Commit 8cdf4911 authored by ElenaSubbotina's avatar ElenaSubbotina

DocxBin - add background document

parent c5c64cb6
......@@ -53,13 +53,22 @@ namespace Writers
CFile oFile;
oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\"><w:body>")));
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>")));
oFile.WriteStringUTF8(CString(_T("</w:body><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">")));
oFile.WriteStringUTF8(m_oBackground.GetData());
oFile.WriteStringUTF8(CString(_T("<w:body>")));
oFile.WriteStringUTF8(m_oContent.GetData());
oFile.WriteStringUTF8(CString(_T("<w:sectPr >")));
oFile.WriteStringUTF8(WriteSectPrHdrFtr());
oFile.WriteStringUTF8(m_oSecPr.GetData());
oFile.WriteStringUTF8(CString(_T("</w:sectPr>")));
oFile.WriteStringUTF8(CString(_T("</w:body></w:document>")));
oFile.WriteStringUTF8(CString(_T("</w:body>")));
oFile.WriteStringUTF8(CString(_T("</w:document>")));
oFile.CloseFile();
}
CString WriteSectPrHdrFtr()
......
......@@ -39,6 +39,7 @@ namespace Writers
class ContentWriter
{
public:
XmlUtils::CStringWriter m_oBackground;
XmlUtils::CStringWriter m_oContent;
XmlUtils::CStringWriter m_oSecPr;
};
......
......@@ -265,6 +265,51 @@ public:
bBeforeAuto = false;
}
};
class Background
{
public:
docRGB Color;
CThemeColor ThemeColor;
CString sObject;
bool bColor;
bool bThemeColor;
Background() : bColor (false), bThemeColor(false) {}
CString Write()
{
CString sBackground = L"<w:background";
if(bColor)
{
sBackground += L" w:color=\"" + Color.ToString() + L"\"";
}
if(bThemeColor && ThemeColor.IsNoEmpty())
{
if(ThemeColor.bColor)
sBackground += L" w:themeColor=\"" + ThemeColor.ToStringColor() + L"\"";
if(ThemeColor.bTint)
sBackground += L" w:themeColorTint=\"" + ThemeColor.ToStringTint() + L"\"";
if(ThemeColor.bShade)
sBackground += L" w:themeColorShade=\"" + ThemeColor.ToStringShade() + L"\"";
}
if (!bColor && !bThemeColor)
{
sBackground += L" w:color=\"ffffff\"";
}
sBackground += L">";
sBackground += sObject;
sBackground += L"</w:background>";
return sBackground;
}
};
class Shd
{
public:
......
This diff is collapsed.
......@@ -152,7 +152,8 @@ extern int g_nCurFormatVersion;
Comments = 8,
Settings = 9,
Footnotes = 10,
Endnotes = 11
Endnotes = 11,
Background
};}
namespace c_oSerSigTypes{enum c_oSerSigTypes
{
......@@ -459,7 +460,8 @@ extern int g_nCurFormatVersion;
Hyperlink = 10,
FldSimple = 11,
Del = 12,
Ins = 13
Ins = 13,
Background = 14
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{
......@@ -506,6 +508,12 @@ extern int g_nCurFormatVersion;
endnoteReference = 27,
arPr = 28
};}
namespace c_oSerBackgroundType{enum c_oSerBackgroundType
{
Color = 0,
ColorTheme = 1,
pptxDrawing = 2
};}
namespace c_oSerImageType{enum c_oSerImageType
{
MediaId = 0,
......
This diff is collapsed.
......@@ -47,6 +47,12 @@
#include "../source/Oox2OdfConverter/Oox2OdfConverter.h"
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
std::wstring DetectTypeDocument(const std::wstring & pathOOX)
{
std::wstring sRes;
......
......@@ -373,6 +373,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
......
......@@ -96,6 +96,8 @@ namespace OOX
if ( _T("w:drawing") == sName )
m_oDrawing = oReader;
else if ( _T("v:background") == sName )
m_oBackground = oReader;
}
}
virtual CString toXML() const
......@@ -136,6 +138,11 @@ namespace OOX
sResult += m_oDrawing->toXML();
sResult += _T("</w:background>");
}
else if (m_oBackground.IsInit())
{//наличие атрибута Color обязательно
sResult += m_oBackground->toXML();
sResult += _T("</w:background>");
}
else
sResult += _T("/>");
......@@ -172,6 +179,7 @@ namespace OOX
// Childs
nullable<OOX::Logic::CDrawing > m_oDrawing;
nullable<OOX::Vml::CBackground> m_oBackground;
};
}
}
......
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