Commit 150ff1fa authored by Oleg Korshul's avatar Oleg Korshul

.

parent dd1b9ca9
This diff is collapsed.
This diff is collapsed.
#pragma once
#ifndef DOCX_RENDERER_ELEMENT_IMAGE_H
#define DOCX_RENDERER_ELEMENT_IMAGE_H
#include "Common.h"
namespace NSDocxRenderer
{
static _bstr_t g_bstr_image_1 = L"<w:r><w:pict><v:shape id=\"\" type=\"\" style=\"position:absolute;";
static _bstr_t g_bstr_image_2 = L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page\" filled=\"f\">";
static _bstr_t g_bstr_image_3 = L"</v:shape></w:pict></w:r>";
static CString g_string_image_position = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;");
static CString g_string_image_position_rotate = _T("margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;rotation:%d;");
static CString g_string_image_rid = _T("<v:imagedata r:id=\"rId%d\" o:title=\"\"/>");
class CImage : public CBaseItem
class CImage : public CBaseItem
{
public:
CString m_strPath;
LONG m_lID;
std::wstring m_strPath;
int m_lID;
double m_dLeft;
double m_dTop;
......@@ -28,18 +22,18 @@ namespace NSDocxRenderer
CImage()
{
m_eType = etImage;
m_strPath = _T("");
m_strPath = L"";
m_lID = -1;
}
CImage(const CImage& oSrc)
{
*this = oSrc;
}
CImage(const CImageInfo& oInfo, const CString& strDstMedia)
CImage(const CImageInfo& oInfo, const std::wstring& strDstMedia)
{
m_eType = etImage;
m_strPath = strDstMedia;
m_lID = oInfo.m_lID;
m_lID = oInfo.m_nId;
}
CImage& operator=(const CImage& oSrc)
{
......@@ -57,31 +51,36 @@ namespace NSDocxRenderer
return *this;
}
virtual void ToXml(NSDocxRenderer::CStringWriter& oWriter)
virtual void ToXml(NSStringUtils::CStringBuilder& oWriter)
{
oWriter.WriteString(g_bstr_image_1);
oWriter.WriteString(L"<w:r><w:pict><v:shape id=\"\" type=\"\" style=\"position:absolute;");
if (0.0 == m_dRotate)
{
CString strPosition = _T("");
strPosition.Format(g_string_image_position, m_dLeft, m_dTop, m_dWidth, m_dHeight);
oWriter.WriteString(strPosition);
}
else
oWriter.WriteString(L"margin-left:");
oWriter.AddDouble(m_dLeft, 2);
oWriter.WriteString(L"mm;margin-top:");
oWriter.AddDouble(m_dTop, 2);
oWriter.WriteString(L"mm;width:");
oWriter.AddDouble(m_dWidth, 2);
oWriter.WriteString(L"mm;height:");
oWriter.AddDouble(m_dHeight, 2);
oWriter.WriteString(L"mm;");
if (fabs(m_dRotate) > 0.01)
{
CString strPosition = _T("");
strPosition.Format(g_string_image_position_rotate, m_dLeft, m_dTop, m_dWidth, m_dHeight, (int)m_dRotate);
oWriter.WriteString(strPosition);
oWriter.WriteString(L"rotation:");
oWriter.AddInt((int)m_dRotate);
oWriter.AddCharSafe(';');
}
oWriter.WriteString(g_bstr_image_2);
oWriter.WriteString(L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page\" filled=\"f\">");
CString strRid = _T("");
strRid.Format(g_string_image_rid, 10 + m_lID);
oWriter.WriteString(L"<v:imagedata r:id=\"rId");
oWriter.AddInt(10 + m_lID);
oWriter.WriteString(L"\" o:title=\"\"/>");
oWriter.WriteString(strRid);
oWriter.WriteString(g_bstr_image_3);
oWriter.WriteString(L"</v:shape></w:pict></w:r>");
}
};
}
\ No newline at end of file
}
#endif // DOCX_RENDERER_ELEMENT_IMAGE_H
#pragma once
#include "Common.h"
//#include "../../Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h"
#include "FontManager.h"
namespace NSDocxRenderer
......@@ -10,7 +9,7 @@ namespace NSDocxRenderer
// T IsBigger, IsBiggerOrEqual
template<typename T>
void SortElements(CAtlArray<T*>& oArray)
void SortElements(CArray<T*>& oArray)
{
int nSize = (int)oArray.GetCount();
......@@ -111,7 +110,7 @@ namespace NSDocxRenderer
static CString g_string_par_props_mode2 = _T("<w:pPr><w:framePr w:hAnchor=\"page\" w:vAnchor=\"page\" w:x=\"%d\" w:y=\"%d\"/></w:pPr>");
AVSINLINE void DeleteSpaces(CString& strText)
inline void DeleteSpaces(CString& strText)
{
int nLen = strText.GetLength();
int nStart = 0;
......@@ -666,4 +665,4 @@ namespace NSDocxRenderer
oWriter.WriteString(g_bstr_text_par_end);
}
};
}
\ No newline at end of file
}
This diff is collapsed.
#pragma once
#ifndef DOCX_RENDERER_FMB_H
#define DOCX_RENDERER_FMB_H
#include "..\stdafx.h"
#include "StringWriter.h"
#include "..\Graphics\Structures.h"
#include "..\Graphics\Matrix.h"
#include "Common.h"
#include "../DesktopEditor/fontengine/ApplicationFonts.h"
namespace NSFontManager
{
......@@ -28,10 +27,10 @@ namespace NSFontManager
double m_dSpaceWidthMM;
// font params
CString m_strFamilyName;
CString m_strPANOSE;
std::wstring m_strFamilyName;
std::wstring m_strPANOSE;
LONG m_lStyle;
CAtlArray<DWORD> m_arSignature;
CArray<DWORD> m_arSignature;
bool m_bIsFixedWidth;
LONG m_lAvgWidth;
......@@ -49,8 +48,8 @@ namespace NSFontManager
m_dSpaceWidthMM = 0;
m_strFamilyName = _T("");
m_strPANOSE = _T("");
m_strFamilyName = L"";
m_strPANOSE = L"";
m_lStyle = 0;
m_arSignature.RemoveAll();
m_bIsFixedWidth = false;
......@@ -78,7 +77,7 @@ namespace NSFontManager
m_strFamilyName = oSrc.m_strFamilyName;
m_strPANOSE = oSrc.m_strPANOSE;
m_lStyle = oSrc.m_lStyle;
m_arSignature.Copy(oSrc.m_arSignature);
m_arSignature = m_arSignature;
m_bIsFixedWidth = oSrc.m_bIsFixedWidth;
m_lAvgWidth = oSrc.m_lAvgWidth;
......@@ -92,7 +91,7 @@ namespace NSFontManager
CFontAdvanced m_oFont;
BYTE m_lRangeNum;
BYTE m_lRange;
CString m_strPickFont;
std::wstring m_strPickFont;
LONG m_lPickStyle;
public:
......@@ -100,7 +99,7 @@ namespace NSFontManager
{
m_lRangeNum = 0xFF;
m_lRange = 0xFF;
m_strPickFont = _T("");
m_strPickFont = L"";
m_lPickStyle = 0;
}
CFontPickUp(const CFontPickUp& oSrc)
......@@ -129,9 +128,9 @@ namespace NSFontManager
};
protected:
AVSGraphics::IASCWinFonts* m_pWinFonts;
AVSGraphics::IASCFontManager* m_pManager;
CString m_strDefaultFont;
CApplicationFonts* m_pFonts;
CFontManager* m_pManager;
std::wstring m_strDefaultFont;
public:
......@@ -141,8 +140,8 @@ namespace NSFontManager
BYTE m_pRanges[0xFFFF];
BYTE m_pRangesNums[0xFFFF];
CAtlList<CFontPickUp> m_arListPicUps;
CString m_strCurrentPickFont;
std::list<CFontPickUp> m_arListPicUps;
std::wstring m_strCurrentPickFont;
LONG m_lCurrentPictFontStyle;
public:
......@@ -303,7 +302,7 @@ namespace NSFontManager
void LoadFontMetrics()
{
unsigned short iTemp = 0;
m_pManager->GetCellAscent(&iTemp);
m_pManager->GetCellAscent(&iTemp);
m_oFont.m_dAscent = iTemp;
m_pManager->GetCellDescent(&iTemp);
m_oFont.m_dDescent = iTemp;
......@@ -1236,7 +1235,7 @@ namespace NSFontManager
//case 31: sUCRName = "Reserved for process-internal usage"; break;
}
__forceinline bool GetRange(const WCHAR& symbol, BYTE& lRangeNum, BYTE& lRange)
inline bool GetRange(const WCHAR& symbol, BYTE& lRangeNum, BYTE& lRange)
{
lRangeNum = m_pRangesNums[symbol];
lRange = m_pRanges[symbol];
......@@ -1244,10 +1243,10 @@ namespace NSFontManager
return (0xFF != lRangeNum);
}
__forceinline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, CString strText)
inline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, const std::wstring& strText)
{
int lCount = strText.GetLength();
WCHAR* pData = strText.GetBuffer();
int lCount = (int)strText.length();
WCHAR* pData = strText.c_str();
BYTE lRangeNum = 0xFF;
BYTE lRange = 0xFF;
......@@ -1266,7 +1265,7 @@ namespace NSFontManager
}
}
}
__forceinline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, BYTE& lRangeNum, BYTE& lRange)
inline void CheckRanges(DWORD& lRange1, DWORD& lRange2, DWORD& lRange3, DWORD& lRange4, BYTE& lRangeNum, BYTE& lRange)
{
if (0 == lRangeNum)
lRange1 |= 1 << lRange;
......@@ -1371,4 +1370,6 @@ namespace NSFontManager
return true;
}
};
};
\ No newline at end of file
};
#endif // DOCX_RENDERER_FMB_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment