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" #include "Common.h"
namespace NSDocxRenderer namespace NSDocxRenderer
{ {
static _bstr_t g_bstr_image_1 = L"<w:r><w:pict><v:shape id=\"\" type=\"\" style=\"position:absolute;"; class CImage : public CBaseItem
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
{ {
public: public:
CString m_strPath; std::wstring m_strPath;
LONG m_lID; int m_lID;
double m_dLeft; double m_dLeft;
double m_dTop; double m_dTop;
...@@ -28,18 +22,18 @@ namespace NSDocxRenderer ...@@ -28,18 +22,18 @@ namespace NSDocxRenderer
CImage() CImage()
{ {
m_eType = etImage; m_eType = etImage;
m_strPath = _T(""); m_strPath = L"";
m_lID = -1; m_lID = -1;
} }
CImage(const CImage& oSrc) CImage(const CImage& oSrc)
{ {
*this = oSrc; *this = oSrc;
} }
CImage(const CImageInfo& oInfo, const CString& strDstMedia) CImage(const CImageInfo& oInfo, const std::wstring& strDstMedia)
{ {
m_eType = etImage; m_eType = etImage;
m_strPath = strDstMedia; m_strPath = strDstMedia;
m_lID = oInfo.m_lID; m_lID = oInfo.m_nId;
} }
CImage& operator=(const CImage& oSrc) CImage& operator=(const CImage& oSrc)
{ {
...@@ -57,31 +51,36 @@ namespace NSDocxRenderer ...@@ -57,31 +51,36 @@ namespace NSDocxRenderer
return *this; 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) oWriter.WriteString(L"margin-left:");
{ oWriter.AddDouble(m_dLeft, 2);
CString strPosition = _T(""); oWriter.WriteString(L"mm;margin-top:");
strPosition.Format(g_string_image_position, m_dLeft, m_dTop, m_dWidth, m_dHeight); oWriter.AddDouble(m_dTop, 2);
oWriter.WriteString(strPosition); oWriter.WriteString(L"mm;width:");
} oWriter.AddDouble(m_dWidth, 2);
else oWriter.WriteString(L"mm;height:");
oWriter.AddDouble(m_dHeight, 2);
oWriter.WriteString(L"mm;");
if (fabs(m_dRotate) > 0.01)
{ {
CString strPosition = _T(""); oWriter.WriteString(L"rotation:");
strPosition.Format(g_string_image_position_rotate, m_dLeft, m_dTop, m_dWidth, m_dHeight, (int)m_dRotate); oWriter.AddInt((int)m_dRotate);
oWriter.WriteString(strPosition); 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(""); oWriter.WriteString(L"<v:imagedata r:id=\"rId");
strRid.Format(g_string_image_rid, 10 + m_lID); oWriter.AddInt(10 + m_lID);
oWriter.WriteString(L"\" o:title=\"\"/>");
oWriter.WriteString(strRid); oWriter.WriteString(L"</v:shape></w:pict></w:r>");
oWriter.WriteString(g_bstr_image_3);
} }
}; };
} }
\ No newline at end of file
#endif // DOCX_RENDERER_ELEMENT_IMAGE_H
#pragma once #pragma once
#include "Common.h" #include "Common.h"
//#include "../../Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h"
#include "FontManager.h" #include "FontManager.h"
namespace NSDocxRenderer namespace NSDocxRenderer
...@@ -10,7 +9,7 @@ namespace NSDocxRenderer ...@@ -10,7 +9,7 @@ namespace NSDocxRenderer
// T IsBigger, IsBiggerOrEqual // T IsBigger, IsBiggerOrEqual
template<typename T> template<typename T>
void SortElements(CAtlArray<T*>& oArray) void SortElements(CArray<T*>& oArray)
{ {
int nSize = (int)oArray.GetCount(); int nSize = (int)oArray.GetCount();
...@@ -111,7 +110,7 @@ namespace NSDocxRenderer ...@@ -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>"); 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 nLen = strText.GetLength();
int nStart = 0; int nStart = 0;
...@@ -666,4 +665,4 @@ namespace NSDocxRenderer ...@@ -666,4 +665,4 @@ namespace NSDocxRenderer
oWriter.WriteString(g_bstr_text_par_end); 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 "Common.h"
#include "StringWriter.h" #include "../DesktopEditor/fontengine/ApplicationFonts.h"
#include "..\Graphics\Structures.h"
#include "..\Graphics\Matrix.h"
namespace NSFontManager namespace NSFontManager
{ {
...@@ -28,10 +27,10 @@ namespace NSFontManager ...@@ -28,10 +27,10 @@ namespace NSFontManager
double m_dSpaceWidthMM; double m_dSpaceWidthMM;
// font params // font params
CString m_strFamilyName; std::wstring m_strFamilyName;
CString m_strPANOSE; std::wstring m_strPANOSE;
LONG m_lStyle; LONG m_lStyle;
CAtlArray<DWORD> m_arSignature; CArray<DWORD> m_arSignature;
bool m_bIsFixedWidth; bool m_bIsFixedWidth;
LONG m_lAvgWidth; LONG m_lAvgWidth;
...@@ -49,8 +48,8 @@ namespace NSFontManager ...@@ -49,8 +48,8 @@ namespace NSFontManager
m_dSpaceWidthMM = 0; m_dSpaceWidthMM = 0;
m_strFamilyName = _T(""); m_strFamilyName = L"";
m_strPANOSE = _T(""); m_strPANOSE = L"";
m_lStyle = 0; m_lStyle = 0;
m_arSignature.RemoveAll(); m_arSignature.RemoveAll();
m_bIsFixedWidth = false; m_bIsFixedWidth = false;
...@@ -78,7 +77,7 @@ namespace NSFontManager ...@@ -78,7 +77,7 @@ namespace NSFontManager
m_strFamilyName = oSrc.m_strFamilyName; m_strFamilyName = oSrc.m_strFamilyName;
m_strPANOSE = oSrc.m_strPANOSE; m_strPANOSE = oSrc.m_strPANOSE;
m_lStyle = oSrc.m_lStyle; m_lStyle = oSrc.m_lStyle;
m_arSignature.Copy(oSrc.m_arSignature); m_arSignature = m_arSignature;
m_bIsFixedWidth = oSrc.m_bIsFixedWidth; m_bIsFixedWidth = oSrc.m_bIsFixedWidth;
m_lAvgWidth = oSrc.m_lAvgWidth; m_lAvgWidth = oSrc.m_lAvgWidth;
...@@ -92,7 +91,7 @@ namespace NSFontManager ...@@ -92,7 +91,7 @@ namespace NSFontManager
CFontAdvanced m_oFont; CFontAdvanced m_oFont;
BYTE m_lRangeNum; BYTE m_lRangeNum;
BYTE m_lRange; BYTE m_lRange;
CString m_strPickFont; std::wstring m_strPickFont;
LONG m_lPickStyle; LONG m_lPickStyle;
public: public:
...@@ -100,7 +99,7 @@ namespace NSFontManager ...@@ -100,7 +99,7 @@ namespace NSFontManager
{ {
m_lRangeNum = 0xFF; m_lRangeNum = 0xFF;
m_lRange = 0xFF; m_lRange = 0xFF;
m_strPickFont = _T(""); m_strPickFont = L"";
m_lPickStyle = 0; m_lPickStyle = 0;
} }
CFontPickUp(const CFontPickUp& oSrc) CFontPickUp(const CFontPickUp& oSrc)
...@@ -129,9 +128,9 @@ namespace NSFontManager ...@@ -129,9 +128,9 @@ namespace NSFontManager
}; };
protected: protected:
AVSGraphics::IASCWinFonts* m_pWinFonts; CApplicationFonts* m_pFonts;
AVSGraphics::IASCFontManager* m_pManager; CFontManager* m_pManager;
CString m_strDefaultFont; std::wstring m_strDefaultFont;
public: public:
...@@ -141,8 +140,8 @@ namespace NSFontManager ...@@ -141,8 +140,8 @@ namespace NSFontManager
BYTE m_pRanges[0xFFFF]; BYTE m_pRanges[0xFFFF];
BYTE m_pRangesNums[0xFFFF]; BYTE m_pRangesNums[0xFFFF];
CAtlList<CFontPickUp> m_arListPicUps; std::list<CFontPickUp> m_arListPicUps;
CString m_strCurrentPickFont; std::wstring m_strCurrentPickFont;
LONG m_lCurrentPictFontStyle; LONG m_lCurrentPictFontStyle;
public: public:
...@@ -303,7 +302,7 @@ namespace NSFontManager ...@@ -303,7 +302,7 @@ namespace NSFontManager
void LoadFontMetrics() void LoadFontMetrics()
{ {
unsigned short iTemp = 0; unsigned short iTemp = 0;
m_pManager->GetCellAscent(&iTemp); m_pManager->GetCellAscent(&iTemp);
m_oFont.m_dAscent = iTemp; m_oFont.m_dAscent = iTemp;
m_pManager->GetCellDescent(&iTemp); m_pManager->GetCellDescent(&iTemp);
m_oFont.m_dDescent = iTemp; m_oFont.m_dDescent = iTemp;
...@@ -1236,7 +1235,7 @@ namespace NSFontManager ...@@ -1236,7 +1235,7 @@ namespace NSFontManager
//case 31: sUCRName = "Reserved for process-internal usage"; break; //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]; lRangeNum = m_pRangesNums[symbol];
lRange = m_pRanges[symbol]; lRange = m_pRanges[symbol];
...@@ -1244,10 +1243,10 @@ namespace NSFontManager ...@@ -1244,10 +1243,10 @@ namespace NSFontManager
return (0xFF != lRangeNum); 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(); int lCount = (int)strText.length();
WCHAR* pData = strText.GetBuffer(); WCHAR* pData = strText.c_str();
BYTE lRangeNum = 0xFF; BYTE lRangeNum = 0xFF;
BYTE lRange = 0xFF; BYTE lRange = 0xFF;
...@@ -1266,7 +1265,7 @@ namespace NSFontManager ...@@ -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) if (0 == lRangeNum)
lRange1 |= 1 << lRange; lRange1 |= 1 << lRange;
...@@ -1371,4 +1370,6 @@ namespace NSFontManager ...@@ -1371,4 +1370,6 @@ namespace NSFontManager
return true; 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