Compare commits

..

32 Commits

Author SHA1 Message Date
bf33aed853 fix convert oox group shape to vml group shape 2017-02-06 20:07:58 +03:00
5869c7a02e RtfFormatWriter - fix table cell width (auto) 2017-02-06 13:55:01 +03:00
bbd429a994 OdfFormat - Reader/Writer - background page (image, pattern, gradient) 2017-02-05 15:57:17 +03:00
f4d636539e Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-02-03 18:34:43 +03:00
92e02257d7 fix bug #33918 2017-02-03 18:33:50 +03:00
d2046d7ccb add missed include 2017-02-03 18:15:57 +03:00
7bc35a157a Implemented case when the size of the masked image doesn't match to the size of the mask. 2017-02-03 18:02:28 +03:00
903245e8a7 fixed converter for iOS 2017-02-03 17:33:48 +03:00
25ee9c3c1c Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t vesion up  2.0.3.435
  PDFReader: text clip
  .
  fix...
  .
  x2t version up
  DocxFormat - fix vml single geom position RtfFormat - read/write background page (solid, pattern, gradient, image)
2017-02-03 16:28:47 +03:00
9ead40d279 up header 2017-02-03 16:28:42 +03:00
e097379c21 x2t vesion up 2.0.3.435 2017-02-03 15:27:12 +03:00
f86579d601 PDFReader: text clip 2017-02-03 13:02:26 +03:00
de7511f243 . 2017-02-03 12:42:06 +03:00
9a68a75f70 fix... 2017-02-02 18:43:38 +03:00
e04388aa32 . 2017-02-02 16:53:20 +03:00
cee61e7a92 x2t version up 2017-02-02 16:31:02 +03:00
48185ed4e9 DocxFormat - fix vml single geom position
RtfFormat - read/write background page (solid, pattern, gradient, image)
2017-02-02 15:44:03 +03:00
7bea086784 Fixed bugs with reading pdf files. 2017-02-02 14:53:01 +03:00
774f9c42cb PDF bugs 2017-02-01 19:20:12 +03:00
10964d32e6 ... 2017-02-01 17:10:19 +03:00
da2493ed3b OdfFormatReader - fix math matrix 2017-02-01 16:15:32 +03:00
0a183f3505 fix bug #33886 2017-02-01 15:59:28 +03:00
ac6cc1ec24 pptx file with wrong rels 2017-02-01 15:05:08 +03:00
a1846da0da Merge tag 'v4.2.7' into develop
v4.2.7 v4.2.7
2017-02-01 12:49:34 +03:00
0bd10c28ac Merge branch 'hotfix/v4.2.7' 2017-02-01 12:49:29 +03:00
2367cee329 PptxFormat - fix user file with wrong rels 2017-01-31 19:59:20 +03:00
288d89301a fix bug 33801 2017-01-31 17:16:28 +03:00
4d519e8f26 x2t - version up, .. 2017-01-31 15:02:34 +03:00
1bd2c0b852 Merge branch 'hotfix/v4.2.7' into develop
fix bug 33867
2017-01-31 13:57:55 +03:00
82b0f4bce8 DiagramDrawing losing images 2017-01-31 13:50:16 +03:00
5635239274 fix crash on windows 2017-01-31 13:12:43 +03:00
765ca861fb fix bug 33842 (corrupted xlsx->csv convertion) 2017-01-27 15:22:14 +03:00
130 changed files with 6527 additions and 7691 deletions

View File

@ -232,7 +232,8 @@ namespace DocFileFormat
case sprmOldCIss:
case sprmCIss:
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
if (iter->argumentsSize > 0 && iter->Arguments[0] < 3) //Metaevan.doc
appendValueElement( parent, L"vertAlign", FormatUtils::MapValueToWideString( iter->Arguments[0], &SuperscriptIndex[0][0], 3, 12 ), true );
break;
case sprmCRgLid0_80:

View File

@ -307,13 +307,11 @@ namespace DocFileFormat
if (!FormatUtils::IsControlSymbol(xchBullet))
{
ret.push_back(lvl.xst[0]);
ret.push_back(L'\0');
}
}
else
{
ret.push_back(L'\xF0B7');
ret.push_back(L'\0');
}
}
else

View File

@ -250,10 +250,6 @@ public:
{
pFile->WriteFile((BYTE*)m_pMetaHeader, m_lMetaHeaderSize);
}
if (NULL != m_pMetaFile)
{
pFile->WriteFile((BYTE*)m_pMetaFile, m_lMetaFileSize);
}
}
};

View File

@ -71,26 +71,26 @@ namespace DocFileFormat
{
struct __BITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
_UINT32 biSize;
_INT32 biWidth;
_INT32 biHeight;
_UINT16 biPlanes;
_UINT16 biBitCount;
_UINT32 biCompression;
_UINT32 biSizeImage;
_INT32 biXPelsPerMeter;
_INT32 biYPelsPerMeter;
_UINT32 biClrUsed;
_UINT32 biClrImportant;
};
struct __BITMAPCOREHEADER
{
DWORD bcSize; /* used to get to color table */
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
_UINT32 bcSize; /* used to get to color table */
_UINT16 bcWidth;
_UINT16 bcHeight;
_UINT16 bcPlanes;
_UINT16 bcBitCount;
};
Global::BlipType GetFormatPict(unsigned char* data, int size)
{

View File

@ -37,29 +37,29 @@
namespace ImageHelper
{
struct __BITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
};
struct __BITMAPINFOHEADER
{
_UINT32 biSize;
_INT32 biWidth;
_INT32 biHeight;
_UINT16 biPlanes;
_UINT16 biBitCount;
_UINT32 biCompression;
_UINT32 biSizeImage;
_INT32 biXPelsPerMeter;
_INT32 biYPelsPerMeter;
_UINT32 biClrUsed;
_UINT32 biClrImportant;
};
struct __BITMAPCOREHEADER
{
DWORD bcSize; /* used to get to color table */
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
};
struct __BITMAPCOREHEADER
{
_UINT32 bcSize; /* used to get to color table */
_UINT16 bcWidth;
_UINT16 bcHeight;
_UINT16 bcPlanes;
_UINT16 bcBitCount;
};
inline Global::_BlipType SaveImageToFileFromDIB(unsigned char* data, int size, const std::wstring& file_name)//without ext
{
@ -152,10 +152,10 @@ namespace ImageHelper
NSFile::CFileBinary file;
if (file.CreateFileW(file_name + L".bmp"))
{
WORD vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
DWORD dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
DWORD dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
DWORD dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
_UINT16 vtType = 0x4D42; file.WriteFile((BYTE*)&vtType, 2);
_UINT32 dwLen = biSizeImage; file.WriteFile((BYTE*)&dwLen, 4);
_UINT32 dwRes = 0; file.WriteFile((BYTE*)&dwRes, 4);
_UINT32 dwOffset = 2; file.WriteFile((BYTE*)&dwOffset, 4);
file.WriteFile((BYTE*)data, size);
file.CloseFile();

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../win32/ASCOfficeCriticalSection.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
@ -41,6 +41,7 @@
#include <string>
#include <windows.h>
#include <tchar.h>
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
@ -58,7 +59,6 @@ int _tmain(int argc, _TCHAR* argv[])
std::wstring outputDir = NSDirectory::GetFolderPath(sDstDocx);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
// doc->docx
COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir;
@ -71,7 +71,7 @@ int _tmain(int argc, _TCHAR* argv[])
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1);
}
FileSystem::Directory::DeleteDirectory(dstTempPath);
NSDirectory::DeleteDirectory(dstTempPath);
return hRes;
}

View File

@ -338,6 +338,58 @@
<References>
</References>
<Files>
<Filter
Name="Common"
>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\ChartFromToBinary.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\ChartWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Common\Common.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\CommonWriter.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Reader\CSVReader.cpp"
>
</File>
<File
RelativePath="..\..\XlsxSerializerCom\Writer\CSVWriter.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\DocxSerializer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/bigobj&#x0D;&#x0A;"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
</File>
</Filter>
<File
RelativePath=".\DocFormatTest.cpp"
>
@ -386,6 +438,14 @@
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
</File>
</Files>
<Globals>
</Globals>

View File

@ -378,6 +378,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -414,6 +415,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -2,6 +2,9 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml_wrapper", "..\win32\cpxml.vcproj", "{41BED424-4EAF-4053-8A5F-1E2A387D53D1}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatReaderLib", "..\win32\cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}"
ProjectSection(ProjectDependencies) = postProject
@ -21,7 +24,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormulasConvert", "..\wi
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}"
ProjectSection(ProjectDependencies) = postProject
{41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1}
{50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
@ -30,7 +35,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFil
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}"

View File

@ -31,18 +31,23 @@
*/
// OdfFileTest.cpp
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include <stdio.h>
#include <tchar.h>
#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../src/ConvertOO2OOX.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../src/ConvertOO2OOX.h"
#if defined(_WIN64)
#pragma comment(lib, "../../../build/bin/icu/win_64/icuuc.lib")
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
#elif defined (_WIN32)
#pragma comment(lib, "../../../build/bin/icu/win_32/icuuc.lib")
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
@ -50,12 +55,12 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hr = S_OK;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx"; //xlsx pptx
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx
std::wstring outputDir = FileSystem::Directory::GetFolderPath(dstPath);
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
std::wstring srcTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir);
std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
// распаковываем исходник во временную директорию
COfficeUtils oCOfficeUtils(NULL);
@ -64,14 +69,14 @@ int _tmain(int argc, _TCHAR* argv[])
hr = ConvertOO2OOX(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", false, NULL);
FileSystem::Directory::DeleteDirectory(srcTempPath);
NSDirectory::DeleteDirectory(srcTempPath);
if (hr != S_OK) return hr;
if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), -1))
return hr;
FileSystem::Directory::DeleteDirectory(dstTempPath);
NSDirectory::DeleteDirectory(dstTempPath);
////////////////////////////////////////////////////////////////////////
return 0;

View File

@ -43,11 +43,11 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_UNICODE;UNICODE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="4"
@ -63,7 +63,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdi32.lib"
AdditionalDependencies="gdi32.lib Rpcrt4.lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
@ -369,6 +369,30 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmldom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\DesktopEditor\xml\src\xmllight.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>

View File

@ -531,8 +531,8 @@ mso-position-vertical-relative:text;";
strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;";
strStyle += L"z-index:" + boost::lexical_cast<std::wstring>(0xF000800 - val.id);
CP_XML_ATTR(L"id", L"Rect" + boost::lexical_cast<std::wstring>(val.id));
CP_XML_ATTR(L"o:spid", L"_x0000_s" + boost::lexical_cast<std::wstring>(1024 + val.id));
CP_XML_ATTR(L"id", L"Rect" + std::to_wstring(val.id));
CP_XML_ATTR(L"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id));
CP_XML_ATTR(L"style", strStyle);
CP_XML_ATTR(L"fillcolor", L"#4f81bd [3204]");
CP_XML_ATTR(L"strokecolor", L"#243f60 [1604]");

View File

@ -58,7 +58,7 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot)
std::wstring resultPath = packetRoot + FILE_SEPARATOR_STR + mediaPath;
return NSDirectory::Exists(resultPath) || NSDirectory::Exists(mediaPath);
return NSFile::CFileBinary::Exists(resultPath) || NSDirectory::Exists(mediaPath);
}
mediaitems::item::item( std::wstring const & _href,

View File

@ -66,7 +66,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
{
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",color);
CP_XML_ATTR(L"val", color);
if (opacity)
{
CP_XML_NODE(L"a:alpha")
@ -101,11 +101,56 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(L"a:solidFill")
{
oox_serialize_srgb(CP_XML_STREAM(),val.solid->color,val.opacity);
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
}
}
}
void vml_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.solid)return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:fill")
{
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
CP_XML_ATTR(L"v:fill", val.solid->color);
if (val.opacity)
{
CP_XML_ATTR(L"v:opacity", *val.opacity);
}
}
}
}
void vml_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.bitmap) return;
if (!val.bitmap->isInternal) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:fill")
{
CP_XML_ATTR(L"r:id", val.bitmap->rId );
if (val.opacity)
{
CP_XML_ATTR(L"opacity",(int)(*val.opacity));
}
if (val.bitmap->bTile)
{
CP_XML_ATTR(L"type", L"pattern");
}
else
{
CP_XML_ATTR(L"type", L"frame");
}
CP_XML_ATTR(L"recolor", L"t");
}
}
}
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.bitmap) return;
@ -164,20 +209,69 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE(L"a:fillRect");
}
}
}
}
}
}
void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.gradient) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:fill")
{
if (!val.gradient->colors.empty())
{
CP_XML_ATTR(L"color2", val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
std::wstring colors_value;
for (size_t i = 0; i < val.gradient->colors.size(); i++)
{
colors_value += std::to_wstring(val.gradient->colors[i].pos) + L"% #" +
val.gradient->colors[i].color_ref + L",";
}
if (!colors_value.empty())
{
CP_XML_ATTR(L"colors", colors_value.substr(0, colors_value.length() - 1));
}
}
double angle =/*360 - */val.gradient->angle/* * 180./3.14159265358979323846*/;
CP_XML_ATTR(L"focus", L"100%");
switch(val.gradient->style)
{
case 0:
CP_XML_ATTR(L"type", L"gradient");
CP_XML_ATTR(L"method", L"linear");
CP_XML_ATTR(L"angle", angle);
break;
case 1:
//CP_XML_ATTR(L"type", L"gradientRadial");
//break;
case 2:
//CP_XML_ATTR(L"type", L"gradientCenter");
//break;
case 3:
//CP_XML_ATTR(L"type", L"gradientUnscaled");
//break;
CP_XML_ATTR(L"type", L"gradientRadial");
}
if (val.gradient->style > 0)
{
double focus_x = ((val.gradient->rect[2] - val.gradient->rect[0]) /2. + val.gradient->rect[0]) / 100.;
double focus_y = ((val.gradient->rect[3] - val.gradient->rect[1]) /2. + val.gradient->rect[1]) / 100.;
CP_XML_ATTR(L"focusposition", XmlUtils::DoubleToString(focus_x, L"%.2f") + L"," + XmlUtils::DoubleToString(focus_y, L"%.2f"));
}
}
}
}
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.gradient)
{
return;
}
if (!val.gradient) return;
CP_XML_WRITER(strm)
{
@ -233,6 +327,7 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.hatch)return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:pattFill")
@ -253,7 +348,38 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
}
}
}
void oox_serialize_fill(std::wostream & strm, const _oox_fill & val)
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id)
{
if (val.type == 0) return;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"v:background")
{
CP_XML_ATTR(L"id", L"_x0000_s" + std::to_wstring(1024 + id));
CP_XML_ATTR(L"o:bwmode", L"white");
CP_XML_ATTR(L"fillcolor", L"#" + color);
CP_XML_ATTR(L"o:targetscreensize", L"1024,768");
switch (val.type)
{
case 1:
vml_serialize_solid_fill(CP_XML_STREAM(), val);
break;
case 2:
vml_serialize_bitmap_fill(CP_XML_STREAM(), val);
break;
case 3:
vml_serialize_gradient_fill(CP_XML_STREAM(), val);
break;
case 4:
//vml_serialize_hatch_fill(CP_XML_STREAM(), val);
break;
}
}
}
}
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val)
{
switch (val.type)
{

View File

@ -143,9 +143,10 @@ namespace oox {
}
};
void oox_serialize_fill(std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id);
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
}
}

View File

@ -433,8 +433,6 @@ void pptx_slide_context::end_shape()
void pptx_slide_context::end_table()
{
impl_->objects_.push_back(impl_->object_description_);
default_set();
}
bool pptx_slide_context::empty() const

View File

@ -376,7 +376,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vector<const odf_reader::styl
if (fill.bitmap)
{
bool isMediaInternal = false;
bool isMediaInternal = true;
std::wstring ref;
fill.bitmap->rId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref);
Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage);

View File

@ -109,11 +109,11 @@ void common_draw_fill_attlist::add_attributes( const xml::attributes_wc_ptr & At
}
void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:fill-color", draw_fill_color_);
CP_XML_ATTR_OPT(L"draw:fill", draw_fill_);
CP_XML_ATTR_OPT(L"draw:fill-color", draw_fill_color_);
CP_XML_ATTR_OPT(L"draw:fill", draw_fill_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
CP_XML_ATTR_OPT(L"draw:image-opacity", draw_image_opacity_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
CP_XML_ATTR_OPT(L"draw:image-opacity", draw_image_opacity_);
CP_XML_ATTR_OPT(L"draw:fill-image-name", draw_fill_image_name_);
CP_XML_ATTR_OPT(L"draw:fill-gradient-name", draw_fill_gradient_name_);

View File

@ -216,10 +216,10 @@ int Compute_BorderWidth(const graphic_format_properties & graphicProperties, Bor
switch(borderSide)
{
case sideTop: borderValue = graphicProperties.common_border_attlist_.fo_border_top_; break;
case sideBottom: borderValue = graphicProperties.common_border_attlist_.fo_border_bottom_; break;
case sideLeft: borderValue = graphicProperties.common_border_attlist_.fo_border_left_; break;
case sideRight: borderValue = graphicProperties.common_border_attlist_.fo_border_right_; break;
case sideTop: borderValue = graphicProperties.common_border_attlist_.fo_border_top_; break;
case sideBottom: borderValue = graphicProperties.common_border_attlist_.fo_border_bottom_; break;
case sideLeft: borderValue = graphicProperties.common_border_attlist_.fo_border_left_; break;
case sideRight: borderValue = graphicProperties.common_border_attlist_.fo_border_right_; break;
}
if (!borderValue)
@ -281,14 +281,14 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill->style = 0;
point.pos = 0;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
}break;
@ -297,20 +297,20 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill->style = 0;
point.pos = 0;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 50;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
}break;
@ -319,41 +319,35 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
case gradient_style::square:
case gradient_style::rectangular:
{
if (style == gradient_style::radial || style == gradient_style::ellipsoid) fill->style = 2;
if (style == gradient_style::radial ||
style == gradient_style::ellipsoid) fill->style = 2;
if (style == gradient_style::square ) fill->style = 1;
if (style == gradient_style::rectangular) fill->style = 3;
point.pos = 0;
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
point.pos = 100;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point);
if (image_style->draw_cx_)//хохма - у мс в конвертилке из open-office перепутаны l & r !!!
point.pos = 100;
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point);
fill->rect[0] = fill->rect[1] = 0;
fill->rect[2] = fill->rect[3] = 100;
if (image_style->draw_cx_)
{
fill->rect[0]=image_style->draw_cx_->get_value();
fill->rect[2]=100-image_style->draw_cx_->get_value();
}
else
{
fill->rect[0]=0;
fill->rect[2]=100;
fill->rect[0] = 100 - image_style->draw_cx_->get_value();
fill->rect[2] = image_style->draw_cx_->get_value();
}
if (image_style->draw_cy_)
{
fill->rect[1]=image_style->draw_cy_->get_value();
fill->rect[3]=100-image_style->draw_cy_->get_value();
}
else
{
fill->rect[1]=0;
fill->rect[3]=100;
fill->rect[1] = 100 - image_style->draw_cy_->get_value();
fill->rect[3] = image_style->draw_cy_->get_value();
}
}break;
}
@ -427,8 +421,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
switch(image->style_repeat_->get_type())
{
case style_repeat::Repeat : fill.bitmap->bTile = true; break;
case style_repeat::Stretch : fill.bitmap->bStretch = true; break;
case style_repeat::Repeat :
fill.bitmap->bTile = true;
fill.bitmap->bStretch = false;
break;
case style_repeat::Stretch :
fill.bitmap->bStretch = true;
fill.bitmap->bTile = false; //?? для background точно выключать
break;
}
}
if (image->draw_opacity_)
@ -445,8 +445,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
switch(props.style_repeat_->get_type())
{
case style_repeat::Repeat : fill.bitmap->bTile = true; break;
case style_repeat::Stretch : fill.bitmap->bStretch = true; break;
case style_repeat::Repeat :
fill.bitmap->bTile = true;
fill.bitmap->bStretch = false;
break;
case style_repeat::Stretch :
fill.bitmap->bStretch = true;
fill.bitmap->bTile = false;
break;
}
}
else

View File

@ -893,17 +893,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles() ,drawing->fill, bTxbx);
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.length() < 1))
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
{
std::wstring href = drawing->fill.bitmap->xlink_href_;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
}
////////////////////////////////////////////////////
drawing->additional.push_back(odf_reader::_property(L"border_width_left", Compute_BorderWidth(graphicProperties, sideLeft)));
drawing->additional.push_back(odf_reader::_property(L"border_width_left", Compute_BorderWidth(graphicProperties, sideLeft)));
drawing->additional.push_back(odf_reader::_property(L"border_width_top", Compute_BorderWidth(graphicProperties, sideTop)));
drawing->additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
drawing->additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
drawing->additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
drawing->additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
if (graphicProperties.common_border_attlist_.fo_border_)
{

View File

@ -71,14 +71,9 @@ namespace odf_reader {
void draw_g::pptx_convert(oox::pptx_conversion_context & Context)
{
int i=0;
int size = content_.size();
while(true)
{
if (i>=size)break;
office_element_ptr const & elm = content_[i];
elm->pptx_convert(Context);
i++;
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
}
void draw_frame::pptx_convert_placeHolder(oox::pptx_conversion_context & Context)

View File

@ -178,10 +178,10 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
////////////////////////////////////////////////////////////////////
properties.apply_to(Context.get_drawing_context().get_properties());
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right",Compute_BorderWidth(properties, sideRight)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
if (properties.fo_clip_)
{

View File

@ -94,10 +94,10 @@ void math_mtr::oox_convert(oox::math_context & Context)
strm << L"<m:mr>";
for (int i = 0; i < content_.size(); i++)
{
strm << L"<m:e>";
//strm << L"<m:e>"; // EqArray записался в числитель вместо знаменателя.docx - дублирование
office_math_element* math_element = dynamic_cast<office_math_element*>(content_[i].get());
math_element->oox_convert(Context);
strm << L"</m:e>";
//strm << L"</m:e>";
}
strm << L"</m:mr>";
}

View File

@ -41,7 +41,9 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>
#include "odfcontext.h"
#include "draw_common.h"
namespace cpdoccore {
@ -111,14 +113,29 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
Context.add_page_properties(L""); //
Context.add_page_properties(L"");
}
//backcolor (for all pages)
//background (for all pages)
if (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
if (style_page_layout_properties * prop = firtsPageLayout->properties())
{
if (prop->docx_back_serialize(Context.output_stream(), Context))
oox::_oox_fill fill;
Compute_GraphicFill(prop->style_page_layout_properties_attlist_.common_draw_fill_attlist_,
prop->style_page_layout_properties_elements_.style_background_image_,
Context.root()->odf_context().drawStyles(), fill);
if (prop->style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
{
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape",true));
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, fill.bitmap->isInternal, href);
}
int id = Context.get_drawing_context().get_current_shape_id();
if (prop->docx_background_serialize(Context.output_stream(), Context, fill, id))
{
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape", true));
}
}
}
}

View File

@ -73,11 +73,11 @@ public:
public:
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
///////////////////////////////
_CP_OPT(odf_types::color) svg_stroke_color_;

View File

@ -98,17 +98,17 @@ private:
virtual void add_text(const std::wstring & Text);
private:
odf_types::length style_position_;
_CP_OPT(odf_types::style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
odf_types::length style_position_;
_CP_OPT(odf_types::style_type) style_type_;
_CP_OPT(wchar_t) style_char_;
_CP_OPT(odf_types::line_type) style_leader_type_;
_CP_OPT(odf_types::line_style) style_leader_style_;
_CP_OPT(odf_types::line_width) style_leader_width_;
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
_CP_OPT(odf_types::line_type) style_leader_type_;
_CP_OPT(odf_types::line_style) style_leader_style_;
_CP_OPT(odf_types::line_width) style_leader_width_;
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
_CP_OPT( std::wstring ) style_leader_text_;
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
_CP_OPT( std::wstring ) style_leader_text_;
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
};

View File

@ -54,7 +54,6 @@
#include "serialize_elements.h"
#include "odfcontext.h"
#include "draw_common.h"
namespace cpdoccore {
@ -904,12 +903,12 @@ void style_page_layout::add_child_element( xml::sax * Reader, const std::wstring
// style-page-layout-properties-attlist
void style_page_layout_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"fo:page-width", fo_page_width_);
CP_APPLY_ATTR(L"fo:page-height", fo_page_height_);
CP_APPLY_ATTR(L"fo:page-width", fo_page_width_);
CP_APPLY_ATTR(L"fo:page-height", fo_page_height_);
common_num_format_attlist_.add_attributes(Attributes);
common_num_format_prefix_suffix_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"style:paper-tray-name", style_paper_tray_name_);
CP_APPLY_ATTR(L"style:print-orientation", style_print_orientation_);
CP_APPLY_ATTR(L"style:paper-tray-name", style_paper_tray_name_);
CP_APPLY_ATTR(L"style:print-orientation", style_print_orientation_);
common_horizontal_margin_attlist_.add_attributes(Attributes);
common_vertical_margin_attlist_.add_attributes(Attributes);
@ -919,7 +918,8 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
common_padding_attlist_.add_attributes(Attributes);
common_shadow_attlist_.add_attributes(Attributes);
common_background_color_attlist_.add_attributes(Attributes);
common_draw_fill_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_APPLY_ATTR(L"style:print", style_print_);
CP_APPLY_ATTR(L"style:print-page-order", style_print_page_order_);
@ -1260,18 +1260,26 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const s
{
style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext());
}
bool style_page_layout_properties::docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{
if (!style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)return false;
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent) return true;
bool style_page_layout_properties::docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id)
{
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ &&
style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent)
return true; //??
//прозрачный фон
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:background")
{
std::wstring color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color",color);
std::wstring color = L"ffffff";
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)
color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color", color);
oox::vml_serialize_background(CP_XML_STREAM(), fill, color, id);
}
}
return true;

View File

@ -892,54 +892,26 @@ public:
odf_types::common_padding_attlist common_padding_attlist_;
odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.10
odf_types::common_background_color_attlist common_background_color_attlist_;
// 15.2.12
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
// 15.2.13 TODO
_CP_OPT(std::wstring) style_print_;
// 15.2.14
_CP_OPT(odf_types::direction) style_print_page_order_;
// 15.2.15 TODO
_CP_OPT(std::wstring) style_first_page_number_;
// 15.2.16
_CP_OPT(odf_types::percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_;
// 15.2.17
_CP_OPT(odf_types::table_centering) style_table_centering_;
// 15.2.18
_CP_OPT(odf_types::length) style_footnote_max_height_;
// 15.2.19
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
// 15.2.21
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
// 15.2.22
_CP_OPT(odf_types::length) style_layout_grid_base_height_;
// 15.2.23
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
// 15.2.24
_CP_OPT(unsigned int) style_layout_grid_lines_;
// 15.2.25
_CP_OPT(odf_types::color) style_layout_grid_color_;
// 15.2.26
_CP_OPT(bool) style_layout_grid_ruby_below_;
// 15.2.27
_CP_OPT(bool) style_layout_grid_print_;
// 15.2.28
_CP_OPT(bool) style_layout_grid_display_;
odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
_CP_OPT(std::wstring) style_print_;
_CP_OPT(odf_types::direction) style_print_page_order_;
_CP_OPT(std::wstring) style_first_page_number_;
_CP_OPT(odf_types::percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_;
_CP_OPT(odf_types::table_centering) style_table_centering_;
_CP_OPT(odf_types::length) style_footnote_max_height_;
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
_CP_OPT(odf_types::length) style_layout_grid_base_height_;
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
_CP_OPT(unsigned int) style_layout_grid_lines_;
_CP_OPT(odf_types::color) style_layout_grid_color_;
_CP_OPT(bool) style_layout_grid_ruby_below_;
_CP_OPT(bool) style_layout_grid_print_;
_CP_OPT(bool) style_layout_grid_display_;
};
@ -992,7 +964,7 @@ public:
};
// style:page-layout-properties
// style:page-layout-properties
class style_page_layout_properties : public office_element_impl<style_page_layout_properties>
{
public:
@ -1005,7 +977,7 @@ public:
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
bool docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
style_page_layout_properties() { }
@ -1020,7 +992,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(style_page_layout_properties);
// text:notes-configuration
// text:notes-configuration
class text_notes_configuration : public office_element_impl<text_notes_configuration>
{
public:

View File

@ -55,8 +55,7 @@
#include "style_text_properties.h"
#include "style_paragraph_properties.h"
#include "style_graphic_properties.h"
#include "style_page_layout_properties.h"
namespace cpdoccore
{
@ -175,6 +174,7 @@ struct odf_drawing_state
svg_y_ = boost::none;
svg_height_ = boost::none;
svg_width_ = boost::none;
fill_color_ = boost::none;
name_ = L"";
description_ = L"";
@ -208,7 +208,8 @@ struct odf_drawing_state
int z_order_;
bool hidden_;
_CP_OPT(double) rotateAngle;
_CP_OPT(double) rotateAngle;
_CP_OPT(unsigned int) fill_color_;
bool flipH;
bool flipV;
@ -238,8 +239,9 @@ public:
width = height = x = y = 0;
is_header_ = false;
is_footer_ = false;
is_header_ = false;
is_footer_ = false;
is_background_ = false;
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
//в MS Office и в нашем - проблем таких нет.
}
@ -254,6 +256,7 @@ public:
bool is_footer_;
bool is_header_;
bool is_background_;
void create_draw_base(int type);
office_element_ptr create_draw_element(int type);
@ -309,10 +312,18 @@ void odf_drawing_context::set_header_state(bool Val)
{
impl_->is_header_ = Val;
}
void odf_drawing_context::set_background_state(bool Val)
{
impl_->is_background_ = Val;
impl_->current_graphic_properties = new style_graphic_properties();
}
void odf_drawing_context::check_anchor()
{
return;
if ((impl_->is_footer_ || impl_->is_header_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
{
set_anchor(anchor_type::Char);
//подозрительно на подложку страницы
@ -444,7 +455,18 @@ void odf_drawing_context::start_drawing()
}
void odf_drawing_context::end_drawing()
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (impl_->current_drawing_state_.elements_.empty())
{
if (impl_->is_background_ && impl_->current_graphic_properties)
{
style_page_layout_properties * current_layout_properties = impl_->odf_context_->page_layout_context()->last_layout()->get_properties();
current_layout_properties->style_page_layout_properties_attlist_.common_draw_fill_attlist_.apply_from(impl_->current_graphic_properties->content().common_draw_fill_attlist_);
delete impl_->current_graphic_properties;
impl_->current_graphic_properties = NULL;
impl_->current_drawing_state_.clear();
}
return;
}
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
@ -570,12 +592,13 @@ void odf_drawing_context::end_drawing()
{
impl_->tops_elements_.push_back(impl_->current_drawing_state_.elements_[0].elm);
}
///////////////
impl_->current_drawing_state_.clear();
impl_->current_graphic_properties = NULL;
impl_->current_paragraph_properties = NULL;
impl_->current_text_properties = NULL;
}
////////////////////////////////////////////////////////////////////////////
@ -629,7 +652,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
if (draw == NULL)return;
//////////
styles_context_->create_style(L"",style_family::Graphic, true, false, -1);
styles_context_->create_style(L"", style_family::Graphic, true, false, -1);
office_element_ptr & style_shape_elm = styles_context_->last_state()->get_office_element();
std::wstring style_name;
@ -1068,7 +1091,7 @@ void odf_drawing_context::set_no_fill()
switch(impl_->current_drawing_part_)
{
case Area:
if ((impl_->is_footer_ || impl_->is_header_) &&
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
@ -1088,6 +1111,17 @@ void odf_drawing_context::set_type_fill(int type)
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = (draw_fill::type)type;
}
void odf_drawing_context::set_fill_color(unsigned int Color)
{
impl_->current_drawing_state_.fill_color_ = Color;
}
_CP_OPT(unsigned int) odf_drawing_context::get_fill_color()
{
return impl_->current_drawing_state_.fill_color_;
}
void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{
if (!impl_->current_graphic_properties)return;
@ -1097,28 +1131,29 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
if ((impl_->is_footer_ || impl_->is_header_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
}
else
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
break;
case Line:
impl_->current_graphic_properties->content().svg_stroke_color_ = hexColor;
if (!impl_->current_graphic_properties->content().draw_stroke_)
impl_->current_graphic_properties->content().draw_stroke_=line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->content().svg_stroke_width_)
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
break;
case Area:
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
}
else
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
break;
case Line:
impl_->current_graphic_properties->content().svg_stroke_color_ = hexColor;
if (!impl_->current_graphic_properties->content().draw_stroke_)
impl_->current_graphic_properties->content().draw_stroke_=line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->content().svg_stroke_width_)
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
break;
}
}
void odf_drawing_context::set_z_order(int id)
{
if (id < 0)
@ -1243,7 +1278,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
{
if (Val)
{
if (impl_->is_footer_|| impl_->is_header_)
if (impl_->is_footer_|| impl_->is_header_ || impl_->is_background_)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
}
@ -1273,7 +1308,7 @@ void odf_drawing_context::set_margin_bottom (double valPt)
}
void odf_drawing_context::set_anchor(int type)
{
if ((impl_->is_footer_|| impl_->is_header_) && type == anchor_type::Page)
if ((impl_->is_footer_|| impl_->is_header_ || impl_->is_background_) && type == anchor_type::Page)
{
type = anchor_type::Paragraph;
}
@ -1369,7 +1404,7 @@ void odf_drawing_context::set_horizontal_pos(double offset_pt)
}
void odf_drawing_context::set_default_wrap_style()
{
if (impl_->is_header_ || impl_->is_footer_ )
if (impl_->is_header_ || impl_->is_footer_ || impl_->is_background_)
{
impl_->anchor_settings_.style_wrap_ = style_wrap::RunThrough;
}
@ -1879,7 +1914,7 @@ void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(d
//вложенные элементы
void odf_drawing_context::start_image(std::wstring odf_path)
{
if (impl_->is_footer_ || impl_->is_header_)
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
{
start_shape(142/*SimpleTypes::shapetypeRect*/);
start_bitmap_style();
@ -2011,7 +2046,7 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
void odf_drawing_context::end_image()
{
if (impl_->is_footer_ || impl_->is_header_)
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
{
end_bitmap_style();
end_shape();
@ -2179,9 +2214,11 @@ void odf_drawing_context::start_gradient_style()
gradient->draw_start_color_ = impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_;
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
gradient->draw_border_ = 0;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
}
void odf_drawing_context::set_gradient_type(gradient_style::type style)
{
@ -2198,7 +2235,7 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
gradient->draw_start_color_ = hexColor;
gradient->draw_start_color_ = hexColor;
gradient->draw_start_intensity_ = 100.;
}
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
@ -2209,15 +2246,15 @@ void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(doub
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
gradient->draw_end_color_ = hexColor;
gradient->draw_end_intensity_ = 100.;
gradient->draw_end_color_ = hexColor;
gradient->draw_end_intensity_ = 100.;
}
void odf_drawing_context::set_gradient_angle(double angle)
{
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return;
gradient->draw_angle_ = (270-angle)*10;//(int)((360 - angle)/180. * 3.14159265358979323846);
gradient->draw_angle_ = (270- angle) * 10;//(int)((360 - angle)/180. * 3.14159265358979323846);
}
void odf_drawing_context::set_gradient_rect(double l, double t, double r,double b)
{
@ -2721,7 +2758,7 @@ void odf_drawing_context::set_image_client_rect_inch(double l, double t, double
void odf_drawing_context::set_bitmap_link(std::wstring file_path)
{
std::wstring odf_ref_name ;
impl_->odf_context_->mediaitems()->add_or_find(file_path,_mediaitems::typeImage,odf_ref_name);
impl_->odf_context_->mediaitems()->add_or_find(file_path, _mediaitems::typeImage, odf_ref_name);
if (impl_->current_drawing_state_.oox_shape_preset == 3000)
{

View File

@ -64,8 +64,10 @@ public:
void clear ();
void set_styles_context (odf_style_context* styles_context);//для embedded
void set_header_state (bool Val);
void set_footer_state (bool Val);
void set_header_state (bool Val);
void set_footer_state (bool Val);
void set_background_state (bool Val);
void check_anchor ();
void set_margin_left (double valPt);
@ -173,6 +175,7 @@ public:
void set_type_fill (int type);//for area - temp for objects
void set_solid_fill (std::wstring hexColor);
void set_opacity (double percent);
//////////////////////////////////////////////////////////////
void start_area_properties();
void end_area_properties();
@ -187,6 +190,8 @@ public:
std::wstring add_marker_style(int type);
void end_line_properties ();
_CP_OPT(unsigned int) get_fill_color ();
void set_fill_color (unsigned int color);
//void start_shadow_properties();
//void end_shadow_properties();
// пока одной функией ..

View File

@ -170,6 +170,7 @@ private:
bool is_header_;
bool is_footer_;
bool is_background_;
std::vector<odf_drawing_context_ptr> drawing_context_;
std::vector<odf_text_context_ptr> text_context_; //for embedded

View File

@ -122,42 +122,47 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
}
}
CP_XML_ATTR_OPT (L"fo:page-width", fo_page_width_);
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_);
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:paper-tray-name", style_paper_tray_name_);
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
CP_XML_ATTR_OPT (L"fo:page-width", fo_page_width_);
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_);
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
common_vertical_margin_attlist_.serialize(CP_GET_XML_NODE());
common_margin_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize(CP_GET_XML_NODE());
common_padding_attlist_.serialize(CP_GET_XML_NODE());
common_shadow_attlist_.serialize(CP_GET_XML_NODE());
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
common_num_format_attlist_.serialize (CP_GET_XML_NODE());
common_num_format_prefix_suffix_attlist_.serialize (CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_XML_ATTR_OPT (L"style:print", style_print_);
CP_XML_ATTR_OPT (L"style:print-page-order", style_print_page_order_);
CP_XML_ATTR_OPT (L"style:first-page-number", style_first_page_number_);
CP_XML_ATTR_OPT (L"style:scale-to", style_scale_to_);
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_);
CP_XML_ATTR_OPT (L"style:table-centering", style_table_centering_);
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:layout-grid-mode", style_layout_grid_mode_);
CP_XML_ATTR_OPT (L"style:layout-grid-base-height", style_layout_grid_base_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-lines", style_layout_grid_lines_);
CP_XML_ATTR_OPT (L"style:layout-grid-color", style_layout_grid_color_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
CP_XML_ATTR_OPT (L"style:layout-grid-print", style_layout_grid_print_);
CP_XML_ATTR_OPT (L"style:layout-grid-display", style_layout_grid_display_);
CP_XML_ATTR_OPT (L"style:paper-tray-name", style_paper_tray_name_);
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
common_horizontal_margin_attlist_.serialize (CP_GET_XML_NODE());
common_vertical_margin_attlist_.serialize (CP_GET_XML_NODE());
common_margin_attlist_.serialize (CP_GET_XML_NODE());
common_border_attlist_.serialize (CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize (CP_GET_XML_NODE());
common_padding_attlist_.serialize (CP_GET_XML_NODE());
common_shadow_attlist_.serialize (CP_GET_XML_NODE());
common_background_color_attlist_.serialize (CP_GET_XML_NODE());
common_draw_fill_attlist_.serialize (CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
CP_XML_ATTR_OPT (L"style:print", style_print_);
CP_XML_ATTR_OPT (L"style:print-page-order", style_print_page_order_);
CP_XML_ATTR_OPT (L"style:first-page-number", style_first_page_number_);
CP_XML_ATTR_OPT (L"style:scale-to", style_scale_to_);
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_);
CP_XML_ATTR_OPT (L"style:table-centering", style_table_centering_);
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT (L"style:layout-grid-mode", style_layout_grid_mode_);
CP_XML_ATTR_OPT (L"style:layout-grid-base-height", style_layout_grid_base_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
CP_XML_ATTR_OPT (L"style:layout-grid-lines", style_layout_grid_lines_);
CP_XML_ATTR_OPT (L"style:layout-grid-color", style_layout_grid_color_);
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
CP_XML_ATTR_OPT (L"style:layout-grid-print", style_layout_grid_print_);
CP_XML_ATTR_OPT (L"style:layout-grid-display", style_layout_grid_display_);
}
const wchar_t * style_page_layout_properties::ns = L"style";
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
const wchar_t * style_page_layout_properties::ns = L"style";
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
void style_page_layout_properties::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{

View File

@ -62,6 +62,7 @@ public:
_CP_OPT(odf_types::length) fo_page_width_;
_CP_OPT(odf_types::length) fo_page_height_;
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
odf_types::common_num_format_attlist common_num_format_attlist_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;

View File

@ -159,8 +159,8 @@ public:
std::wstring get_style_name(){return draw_name_.get_value_or(L"");}
_CP_OPT(odf_types::color) draw_start_color_;
_CP_OPT(odf_types::color) draw_end_color_;
_CP_OPT(odf_types::color) draw_start_color_;
_CP_OPT(odf_types::color) draw_end_color_;
_CP_OPT(odf_types::percent) draw_end_intensity_;
_CP_OPT(odf_types::percent) draw_start_intensity_;
@ -169,11 +169,11 @@ public:
_CP_OPT(odf_types::percent) draw_cx_;
_CP_OPT(odf_types::percent) draw_border_;
_CP_OPT(int) draw_angle_;
_CP_OPT(odf_types::gradient_style) draw_style_;
_CP_OPT(int) draw_angle_;
_CP_OPT(odf_types::gradient_style) draw_style_;
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_display_name_;
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_display_name_;
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void serialize(std::wostream & strm);

View File

@ -48,8 +48,6 @@
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#define ARGB(a, r, g, b) ((unsigned int)( ( (unsigned char)(a) )| ( ( (unsigned char)(r) ) << 8 ) | ( ( (unsigned char)(g) ) << 16 ) | ( (unsigned char)(b) << 24 ) ) )
using namespace cpdoccore;
namespace Oox2Odf
@ -305,9 +303,80 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path)
}
void OoxConverter::convert(PPTX::Logic::BlipFill *oox_fill)
void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
{
if (!oox_fill) return;
if (oox_bitmap_fill == NULL)return;
odf_context()->drawing_context()->start_bitmap_style();
{
double Width=0, Height = 0;
if (oox_bitmap_fill->blip.IsInit())
{
std::wstring sID, pathImage;
if (oox_bitmap_fill->blip->embed.IsInit())
{
sID = oox_bitmap_fill->blip->embed->get();
pathImage = find_link_by_id(sID,1);
if (!pathImage.empty())
{
odf_context()->drawing_context()->set_bitmap_link(pathImage);
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
}
}
else if (oox_bitmap_fill->blip->link.IsInit())
{
sID = pathImage = oox_bitmap_fill->blip->link->get();
odf_context()->drawing_context()->set_bitmap_link(pathImage);
//...
}
//for (size_t i = 0 ; i < oox_bitmap_fill->blip->m_arrEffects.size(); i++)
//{
// convert(oox_bitmap_fill->blip->m_arrEffects[i]);
//}
}
if (oox_bitmap_fill->srcRect.IsInit() && Width >0 && Height >0)//часть изображения
{
odf_context()->drawing_context()->set_image_client_rect_inch(
(oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI,
(oox_bitmap_fill->srcRect->r.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->r.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->b.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->b.get()) : 0 ) /100. * Height/ currentSystemDPI);
}
if (oox_bitmap_fill->tile.IsInit())
{
odf_context()->drawing_context()->set_image_style_repeat(2);
if (oox_bitmap_fill->tile->algn.IsInit())
odf_context()->drawing_context()->set_bitmap_tile_align(oox_bitmap_fill->tile->algn->GetBYTECode());
if (oox_bitmap_fill->tile->flip.IsInit()) {}
if (oox_bitmap_fill->tile->sx.IsInit() && Width >0)
{
odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100. * Width);
}
if (oox_bitmap_fill->tile->sy.IsInit()&& Height >0)
{
odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100. * Height);
}
if (oox_bitmap_fill->tile->tx.IsInit() && Width >0)
{
odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100. / Width );
}
if (oox_bitmap_fill->tile->ty.IsInit() && Height >0)
{
odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100. / Height );
}
}
if (oox_bitmap_fill->stretch.IsInit())
{
odf_context()->drawing_context()->set_image_style_repeat(1);
if (oox_bitmap_fill->stretch->fillRect.IsInit()){} //заполнение неполного объема
}
}
odf_context()->drawing_context()->end_bitmap_style();
}
void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill)
{

View File

@ -44,6 +44,7 @@
#include "../OdfFormat/style_paragraph_properties.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "VmlShapeTypes2Oox.h"
@ -63,8 +64,7 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
if (odf_context()->drawing_context()->m_mapVmlShapeTypes.find( sId ) ==
odf_context()->drawing_context()->m_mapVmlShapeTypes.end())
{
odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(odf_context()->drawing_context()->m_mapVmlShapeTypes.begin(),
std::pair<std::wstring, OOX::Vml::CShapeType*>(sId, vml_shape_type));
odf_context()->drawing_context()->m_mapVmlShapeTypes.insert(std::make_pair(sId, vml_shape_type));
}
}
@ -80,9 +80,9 @@ void OoxConverter::convert(OOX::Vml::CShapeType *vml_shape_type)
}
//o:spt
//nullable<std::wstring> m_oAdj;
//nullable<SimpleTypes::Vml::CVmlPath> m_oPath;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oMaster;
//nullable<std::wstring> m_oAdj;
//nullable<SimpleTypes::Vml::CVmlPath> m_oPath;
//SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oMaster;
//m_arrItems
//CVmlCommonElements
}
@ -387,6 +387,9 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
void OoxConverter::convert(OOX::Vml::CBackground *vml_background)
{
if (vml_background == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_background);
convert(vml_common);
}
void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
@ -395,6 +398,28 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
odf_context()->drawing_context()->start_area_properties();
std::wstring sImagePath;
_CP_OPT(unsigned int) nRgbColor1, nRgbColor2;
_CP_OPT(std::wstring) sRgbColor1, sRgbColor2;
if (vml_fill->m_oColor.IsInit())
{
nRgbColor1 = ((unsigned int)(((BYTE)(vml_fill->m_oColor->Get_B())
| ((unsigned int)((BYTE)(vml_fill->m_oColor->Get_G()))<<8))
| (((unsigned int)(BYTE)(vml_fill->m_oColor->Get_R()))<<16)));
sRgbColor1 = XmlUtils::IntToString(*nRgbColor1, L"%06X");
}
if (vml_fill->m_oColor2.IsInit())
{
nRgbColor2 = ((unsigned int)(((BYTE)(vml_fill->m_oColor2->Get_B())
| ((unsigned int)((BYTE)(vml_fill->m_oColor2->Get_G()))<<8))
| (((unsigned int)(BYTE)(vml_fill->m_oColor2->Get_R()))<<16)));
sRgbColor2 = XmlUtils::IntToString(*nRgbColor2, L"%06X");
}
if (vml_fill->m_rId.IsInit())
{
//bitmap fill
@ -402,37 +427,37 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
{
double Width=0, Height = 0;
std::wstring sID = vml_fill->m_rId->GetValue();
std::wstring pathImage = find_link_by_id(sID,1);
sImagePath = find_link_by_id(sID, 1);
if (!pathImage.empty())
if (!sImagePath.empty())
{
odf_context()->drawing_context()->set_bitmap_link(pathImage);
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
odf_context()->drawing_context()->set_bitmap_link( sImagePath );
_graphics_utils_::GetResolution( sImagePath.c_str(), Width, Height );
}
odf_context()->drawing_context()->set_image_style_repeat(1);
}
odf_context()->drawing_context()->end_bitmap_style();
}
else
switch (vml_fill->m_oType.GetValue())
{
switch (vml_fill->m_oType.GetValue())
{
case SimpleTypes::filltypeGradient :
case SimpleTypes::filltypeGradientCenter :
case SimpleTypes::filltypeGradientRadial :
case SimpleTypes::filltypeGradientUnscaled:
{
odf_context()->drawing_context()->start_gradient_style();
if (SimpleTypes::filltypeGradient == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::linear);
if (SimpleTypes::filltypeGradientRadial == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::radial);
if (SimpleTypes::filltypeGradientCenter == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::axial);
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square);
if (SimpleTypes::filltypeGradient == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::linear);
if (SimpleTypes::filltypeGradientRadial == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::radial);
if (SimpleTypes::filltypeGradientCenter == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::axial);
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square);
_CP_OPT(double) no_set;
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_gradient_start(vml_fill->m_oColor->ToString(), no_set);
if (vml_fill->m_oColor2.IsInit())
odf_context()->drawing_context()->set_gradient_end(vml_fill->m_oColor2->ToString(), no_set);
if (sRgbColor1)
odf_context()->drawing_context()->set_gradient_start(*sRgbColor1, no_set);
if (sRgbColor2)
odf_context()->drawing_context()->set_gradient_end(*sRgbColor2, no_set);
if (vml_fill->m_oFocusPosition.IsInit())
odf_context()->drawing_context()->set_gradient_center(vml_fill->m_oFocusPosition->GetX(), vml_fill->m_oFocusPosition->GetY());
@ -441,23 +466,35 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
}break;
case SimpleTypes::filltypePattern:
{
if (!sImagePath.empty())
{
odf_context()->drawing_context()->set_image_style_repeat(2);
if (!nRgbColor1)
nRgbColor1 = odf_context()->drawing_context()->get_fill_color();
CBgraFrame bgraFrame;
bgraFrame.ReColorPatternImage(sImagePath, nRgbColor1.get_value_or(0xffffff), nRgbColor2.get_value_or(0x000000));
}
else
{
odf_context()->drawing_context()->start_hatch_style();
if (vml_fill->m_oColor2.IsInit())
odf_context()->drawing_context()->set_hatch_line_color(vml_fill->m_oColor2->ToString());
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_hatch_area_color(vml_fill->m_oColor->ToString());
if (sRgbColor2)
odf_context()->drawing_context()->set_hatch_line_color(*sRgbColor2);
if (sRgbColor1)
odf_context()->drawing_context()->set_hatch_area_color(*sRgbColor1);
else
odf_context()->drawing_context()->set_hatch_area_color(L"#ffffff");
odf_context()->drawing_context()->end_hatch_style();
}
}break;
case SimpleTypes::filltypeSolid:
default:
if (vml_fill->m_oColor.IsInit())
odf_context()->drawing_context()->set_solid_fill(vml_fill->m_oColor->ToString());
if (sImagePath.empty() && sRgbColor1)
odf_context()->drawing_context()->set_solid_fill(*sRgbColor1);
break;
}
}
//--------------------------------------------------------------------------------------------------------------------
if (vml_fill->m_oOpacity.IsInit() && vml_fill->m_oOpacity2.IsInit() )
@ -589,7 +626,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
if (vml_stroke->m_oColor.IsInit())
{
std::wstring hexColor = vml_stroke->m_oColor->ToString();
if (hexColor.length() < 1)hexColor = L"000000";
if (hexColor.empty()) hexColor = L"000000";
odf_context()->drawing_context()->set_solid_fill(hexColor);
}
@ -819,9 +856,16 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
if (oRgbColor)
{
odf_context()->drawing_context()->start_area_properties();
unsigned int nRgbColor = ((unsigned int)(((BYTE)( oRgbColor->Get_B())
| ((unsigned int)((BYTE)( oRgbColor->Get_G()))<<8))
| (((unsigned int)(BYTE)( oRgbColor->Get_R()))<<16)));
odf_context()->drawing_context()->set_fill_color(nRgbColor);
odf_context()->drawing_context()->start_area_properties();
odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().substr(2));//.Right(6));
odf_context()->drawing_context()->end_area_properties();
delete oRgbColor;
}
}

View File

@ -215,11 +215,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Vml::CTextbox *vml = static_cast<OOX::Vml::CTextbox*>(oox_unknown);
convert(vml);
}break;
//case OOX::et_v_background:
//{
// OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
// convert(vml);
//}break;
case OOX::et_v_background:
{
OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
convert(vml);
}break;
case OOX::et_v_path:
{
OOX::Vml::CPath *vml = static_cast<OOX::Vml::CPath*>(oox_unknown);

View File

@ -1676,21 +1676,28 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
{
if (oox_background == NULL) return;
_CP_OPT(odf_types::color) color;
convert ( oox_background->m_oColor.GetPointer(),
oox_background->m_oThemeColor.GetPointer(),
oox_background->m_oThemeTint.GetPointer(),
oox_background->m_oThemeShade.GetPointer(), color);
odt_context->set_background(color, type);
odt_context->start_drawings();
odt_context->drawing_context()->set_background_state(true);
odt_context->drawing_context()->start_drawing();
if (oox_background->m_oDrawing.IsInit())
{
//подложка
convert(oox_background->m_oDrawing.GetPointer());
}
else
else if (oox_background->m_oBackground.IsInit())
{
//цветовая подложка
_CP_OPT(odf_types::color) color;
convert ( oox_background->m_oColor.GetPointer(),
oox_background->m_oThemeColor.GetPointer(),
oox_background->m_oThemeTint.GetPointer(),
oox_background->m_oThemeShade.GetPointer(), color);
odt_context->set_background(color, type);
convert(oox_background->m_oBackground.GetPointer());
}
odt_context->drawing_context()->end_drawing();
odt_context->end_drawings();
}
void DocxConverter::convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf_writer::style_paragraph_properties * paragraph_properties)

View File

@ -1735,15 +1735,21 @@ void CDrawingConverter::doc_LoadDiagram(PPTX::Logic::SpTreeElem *result, XmlUtil
OOX::CPath pathDiagramDrawing = pathDiagramData.GetDirectory() + FILE_SEPARATOR_STR + L"drawing" + strId + L".xml";
oFileDrawing = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(new OOX::CDiagramDrawing(pathDiagramDrawing)));
if (oFileDrawing.IsInit())
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
if (NSFile::CFileBinary::Exists(pathDiagramDrawing.GetPath()))
{
oFileDrawing = smart_ptr<OOX::File>(dynamic_cast<OOX::File*>(new OOX::CDiagramDrawing(pathDiagramDrawing)));
if (oFileDrawing.IsInit())
pDiagramDrawing = dynamic_cast<OOX::CDiagramDrawing*>(oFileDrawing.operator->());
}
}
}
if (pDiagramDrawing)
if ((pDiagramDrawing) && (pDiagramDrawing->m_oShapeTree.IsInit()))
{
result->InitElem(new PPTX::Logic::SpTree(*pDiagramDrawing->m_oShapeTree));
//to correct write blipFill rId to binary
m_strCurrentRelsPath = pDiagramDrawing->GetReadPath().GetPath();
SetCurrentRelsPath();
}
else
{//BG-FSC1.docx

View File

@ -257,54 +257,74 @@ namespace PPTX2EditorAdvanced
tablestyles->toPPTY(&oBinaryWriter);
}
// Presentation
// Presentation
oBinaryWriter.StartMainRecord(NSMainTables::Presentation);
presentation->toPPTY(&oBinaryWriter);
// themes
// themes
oBinaryWriter.StartMainRecord(NSMainTables::Themes);
ULONG nCountThemes = (ULONG)_themes.size();
ULONG nCountThemes = 0;
for (size_t i = 0; i < _themes.size(); ++i)
{
if (_themes[i].IsInit()) nCountThemes++;
}
oBinaryWriter.WriteULONG(nCountThemes);
for (ULONG i = 0; i < nCountThemes; ++i)
for (size_t i = 0; i < _themes.size(); ++i)
{
if (_themes[i].IsInit() == false) continue;
_themes[i]->toPPTY(&oBinaryWriter);
}
// slidemasters
// slidemasters
oBinaryWriter.StartMainRecord(NSMainTables::SlideMasters);
ULONG nCountSM = (ULONG)_slideMasters.size();
ULONG nCountSM = 0;
for (size_t i = 0; i < _slideMasters.size(); ++i)
{
if (_slideMasters[i].IsInit()) nCountSM++;
}
oBinaryWriter.WriteULONG(nCountSM);
for (ULONG i = 0; i < nCountSM; ++i)
for (size_t i = 0; i < _slideMasters.size(); ++i)
{
if (_slideMasters[i].IsInit() == false) continue;
_slideMasters[i]->toPPTY(&oBinaryWriter);
}
// slidelayouts
// slidelayouts
oBinaryWriter.StartMainRecord(NSMainTables::SlideLayouts);
ULONG nCountL = 0;
for (ULONG i = 0; i < _layouts.size(); ++i)
ULONG nCountL = 0;
for (size_t i = 0; i < _layouts.size(); ++i)
{
if (_layouts[i].IsInit())nCountL++;
if (_layouts[i].IsInit())nCountL++;
}
oBinaryWriter.WriteULONG(nCountL);
for (ULONG i = 0; i < _layouts.size(); ++i)
for (size_t i = 0; i < _layouts.size(); ++i)
{
if (_layouts[i].IsInit() == false)
{
continue;
//непонятки с 42 шаблоном в FY10_September_Partner_Call.pptx
}
if (_layouts[i].IsInit() == false) continue; //непонятки с 42 шаблоном в FY10_September_Partner_Call.pptx
_layouts[i]->toPPTY(&oBinaryWriter);
}
// slides
// slides
oBinaryWriter.StartMainRecord(NSMainTables::Slides);
ULONG nCountS = (ULONG)_slides.size();
ULONG nCountS = 0;
for (size_t i = 0; i < _slides.size(); ++i)
{
if (_slides[i].IsInit()) nCountS++;
}
oBinaryWriter.WriteULONG(nCountS);
for (ULONG i = 0; i < nCountS; ++i)
for (size_t i = 0; i < _slides.size(); ++i)
{
if (_slides[i].IsInit() == false ) continue;
_slides[i]->toPPTY(&oBinaryWriter);
}
@ -312,7 +332,7 @@ namespace PPTX2EditorAdvanced
{
// ПОКА нету NOTES
// notes
// notes
oBinaryWriter.StartMainRecord(NSMainTables::NotesSlides);
ULONG nCountN = (ULONG)_notes.size();
oBinaryWriter.WriteULONG(nCountN);
@ -321,7 +341,7 @@ namespace PPTX2EditorAdvanced
_notes[i]->toPPTY(&oBinaryWriter);
}
// notesmasters
// notesmasters
oBinaryWriter.StartMainRecord(NSMainTables::NotesMasters);
ULONG nCountNM = (ULONG)_notesMasters.size();
oBinaryWriter.WriteULONG(nCountNM);

View File

@ -395,7 +395,6 @@ public:
SetPen (root);
SetBrush (root);
//return m_pShape->LoadFromXML(xml);
return ((CPPTShape*)m_pShape)->LoadFromXML(root);
}
#endif
@ -439,20 +438,20 @@ public:
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("stroke"), oNodeTemplate))
{
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor"));
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor"));
//if (strColor != _T(""))
// m_oPen.Color.FromString(strColor);
//std::wstring strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
//std::wstring strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
//if (strSize != _T(""))
// m_oPen.Size = XmlUtils::GetDouble(strSize);
//std::wstring strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
//std::wstring strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
//if (strStroke != _T(""))
// m_oPen.Alpha = 0;
}
if (oNodePict.GetNode(_T("v:stroke"), oNodeTemplate))
{
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle"));
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle"));
//if (strColor != _T(""))
// m_oPen.DashStyle = XmlUtils::GetInteger(strColor);
}
@ -463,7 +462,7 @@ public:
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("fillcolor"), oNodeTemplate))
{
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("val"));
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("val"));
//if (strColor != _T(""))
// m_oBrush.Color1.FromString(strColor);
}
@ -476,19 +475,19 @@ public:
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("coordsize"), oNodeTemplate))
{
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("val"));
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("val"));
if (strCoordSize != _T(""))
{
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
m_dWidthLogic = XmlUtils::GetInteger(oArray[0]);
m_dWidthLogic = XmlUtils::GetInteger(oArray[0]);
m_dHeightLogic = XmlUtils::GetInteger(oArray[1]);
}
}
else
{
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
if (id != _T(""))
{
m_dWidthLogic = 21600;
@ -499,11 +498,11 @@ public:
XmlUtils::CXmlNode oNodeTemplate;
if (oNodePict.GetNode(_T("template"), oNodeTemplate))
{
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("coordsize"));
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("coordsize"));
if (strCoordSize != _T(""))
{
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
std::vector<std::wstring> oArray;
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
m_dWidthLogic = XmlUtils::GetInteger(oArray[0]);
m_dHeightLogic = XmlUtils::GetInteger(oArray[1]);

View File

@ -42,11 +42,49 @@
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
#include "../../DesktopEditor/common/Directory.h"
#include <map>
namespace PPTX
{
static std::wstring arDefDirectories [9][2] = //in ppt Directory
{
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide", L"slides"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout", L"slideLayouts"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster", L"slideMasters"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide", L"notesSlides"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster", L"notesMasters"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster", L"handoutMasters"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments"},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors", L""},
{L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", L"theme"},
};
static std::wstring FindFileInDirectory(std::wstring directory, std::wstring filename)
{
if (directory.empty()) return L"";
if (directory[directory.length() - 1] == FILE_SEPARATOR_CHAR)
directory = directory.substr(0, directory.length() - 1);
int pos_ppt = directory.rfind(L"ppt");
if (pos_ppt >= 0)
{
directory = directory.substr(0, pos_ppt - 1); //root directory
}
CArray<std::wstring> arrFiles = NSDirectory::GetFiles(directory, true);
for (int i = 0 ; i < arrFiles.GetCount(); i++)
{
if (std::wstring::npos != arrFiles[i].find(filename))
{
return arrFiles[i];
}
}
return L"";
}
void FileContainer::read(const OOX::CPath& filename)
{
//not implement FileContainer.read
@ -70,6 +108,39 @@ namespace PPTX
read(rels, path, map, Event);
}
OOX::CPath FileContainer::CorrectPathRels(const OOX::CPath& path, OOX::Rels::CRelationShip* relation )
{
OOX::CPath filename = path / relation->Target();
if ( NSFile::CFileBinary::Exists(filename.GetPath()) == true ) return filename;
//file_1_ (1).pptx
std::wstring strDefDirectory;
for (int i = 0; i < 9; i++)
{
if (relation->Type() == arDefDirectories[i][0])
{
strDefDirectory = arDefDirectories[i][1];
break;
}
}
OOX::CPath new_filename = strDefDirectory + FILE_SEPARATOR_STR + relation->Filename().GetFilename();
filename = path / new_filename;
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
{
filename = FindFileInDirectory(path.GetPath(), relation->Filename().GetFilename()); // find true path by filename
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
return filename;
}
*relation = OOX::Rels::CRelationShip( relation->rId(), relation->Type(), filename);
return filename;
}
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event)
{
bool bIsSlide = false;
@ -81,13 +152,15 @@ namespace PPTX
for (size_t i = 0; i < nCount; ++i)
{
const OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
OOX::CPath normPath = path / pRelation->Target();
OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.find(normPath);
OOX::CPath normPath = CorrectPathRels(path, pRelation);
if (bIsSlide && (pRelation->Type() == OOX::Presentation::FileTypes::Slide))
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.find(normPath);
if (bIsSlide && (pRelation->Type() == OOX::FileTypes::HyperLink))
{// + external audio, video ...
normPath = pRelation->Target();
long percent = Event->GetPercent();
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
@ -112,7 +185,10 @@ namespace PPTX
{
long percent = Event->GetPercent();
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(path, *pRelation, map);
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(normPath, *pRelation, map);
if (file.IsInit() == false)
continue;
map.add(normPath, file);
Add(pRelation->rId(), file);
@ -223,9 +299,11 @@ namespace PPTX
size_t nCount = rels.m_arrRelations.size();
for (size_t i = 0; i < nCount; ++i)
{
const OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
OOX::Rels::CRelationShip* pRelation = rels.m_arrRelations[i];
smart_ptr<OOX::File> _file = PPTX::FileFactory::CreateFilePPTX_OnlyMedia(path, *pRelation);
OOX::CPath normPath = CorrectPathRels(path, pRelation);
smart_ptr<OOX::File> _file = PPTX::FileFactory::CreateFilePPTX_OnlyMedia(normPath, *pRelation);
Add(pRelation->rId(), _file);
}
}

View File

@ -64,6 +64,7 @@ namespace PPTX
void write(OOX::CRels& rels, const OOX::CPath& current, const OOX::CPath& directory, OOX::CContentTypes& content) const;
void WrittenSetFalse();
OOX::CPath CorrectPathRels(const OOX::CPath& path, OOX::Rels::CRelationShip* relation );
long m_lPercent;
bool m_bCancelled;

View File

@ -30,13 +30,13 @@
*
*/
#include "FileFactory.h"
#include "../../Common/DocxFormat/Source/DocxFormat/File.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Rels.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
#include "FileTypes.h"
#include "FileFactory.h"
#include "App.h"
#include "Core.h"
#include "Theme.h"
@ -69,11 +69,15 @@
#include "FileMap.h"
namespace PPTX
{
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX(const OOX::CPath& path, const OOX::Rels::CRelationShip& relation, FileMap& map)
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX(const OOX::CPath& filename, OOX::Rels::CRelationShip& relation, FileMap& map)
{
OOX::CPath filename = path / relation.Filename();
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
{
return smart_ptr<OOX::File>(NULL);
}
if (relation.Type() == OOX::Presentation::FileTypes::App)
return smart_ptr<OOX::File>(new PPTX::App(filename, map));
@ -138,7 +142,7 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
}
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX_OnlyMedia(const OOX::CPath& path, const OOX::Rels::CRelationShip& relation)
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX_OnlyMedia(const OOX::CPath& norm_filename, OOX::Rels::CRelationShip& relation)
{
bool bIsDownload = false;
std::wstring strFile = relation.Filename().GetPath();
@ -152,7 +156,7 @@ namespace PPTX
if (0 == n1 || 0 == n2 || 0 == n3 || 0 == n4)
bIsDownload = true;
OOX::CPath filename = path / relation.Filename();
OOX::CPath filename = norm_filename;
if (bIsDownload)
filename = relation.Filename();

View File

@ -30,9 +30,6 @@
*
*/
#pragma once
#ifndef PPTX_FILE_FACTORY_INCLUDE_H_
#define PPTX_FILE_FACTORY_INCLUDE_H_
#include "../../Common/DocxFormat/Source/DocxFormat/File.h"
namespace OOX {namespace Rels {class CRelationShip;}}
@ -44,9 +41,7 @@ namespace PPTX
class FileFactory
{
public:
static const smart_ptr<OOX::File> CreateFilePPTX(const OOX::CPath& path, const OOX::Rels::CRelationShip& relation, FileMap& map);
static const smart_ptr<OOX::File> CreateFilePPTX_OnlyMedia(const OOX::CPath& path, const OOX::Rels::CRelationShip& relation);
static const smart_ptr<OOX::File> CreateFilePPTX(const OOX::CPath& path, OOX::Rels::CRelationShip& relation, FileMap& map);
static const smart_ptr<OOX::File> CreateFilePPTX_OnlyMedia(const OOX::CPath& path, OOX::Rels::CRelationShip& relation);
};
} // namespace PPTX
#endif // PPTX_FILE_FACTORY_INCLUDE_H_

View File

@ -33,7 +33,7 @@
#ifndef PPTXOOX_FILE_TYPES_INCLUDE_H_
#define PPTXOOX_FILE_TYPES_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/DocxFormat/FileType.h"
#include "../../Common/DocxFormat/Source/DocxFormat/FileType.h"
namespace OOX
{

View File

@ -60,11 +60,13 @@ namespace PPTX
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
private:
virtual void fromXML2(XmlUtils::CXmlNode& node, bool bClear)
{
RunElems.clear();
if (bClear)
{
RunElems.clear();
}
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
@ -94,19 +96,24 @@ namespace PPTX
//todo better check (a14 can be math, slicer)
if(oNodeChoice.GetAttributeIfExist(L"Requires", sRequires) && L"a14" == sRequires)
{
fromXML(oNodeChoice);
fromXML2(oNodeChoice, false);
}
else if (oNode.GetNode(_T("mc:Fallback"), oNodeFall))
{
fromXML(oNodeFall);
fromXML2(oNodeFall, false);
}
}
}
}
}
FillParentPointersForChilds();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
fromXML2(node, true);
}
virtual std::wstring toXML() const
{
XmlUtils::CNodeValue oValue;

View File

@ -532,13 +532,14 @@ namespace PPTX
return (long) nvPicPr.cNvPr.id;
}
void Pic::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap)
void Pic::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, bool in_group)
{
smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>();
smart_ptr<PPTX::Logic::ClrMap> oClrMap = oTheme.smart_dynamic_cast<PPTX::Logic::ClrMap>();
bool bOle = oleObject.IsInit() && oleObject->isValid();
std::wstring sOleNodeName;
if (XMLWRITER_DOC_TYPE_XLSX != pWriter->m_lDocType)
{
if(bOle && oleObject->m_oDxaOrig.IsInit() && oleObject->m_oDyaOrig.IsInit())
@ -546,8 +547,8 @@ namespace PPTX
sOleNodeName = L"w:object";
pWriter->StartNode(sOleNodeName);
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("w:dxaOrig"), oleObject->m_oDxaOrig);
pWriter->WriteAttribute(_T("w:dyaOrig"), oleObject->m_oDyaOrig);
pWriter->WriteAttribute(L"w:dxaOrig", oleObject->m_oDxaOrig);
pWriter->WriteAttribute(L"w:dyaOrig", oleObject->m_oDyaOrig);
pWriter->EndAttributes();
}
else
@ -559,38 +560,40 @@ namespace PPTX
}
}
int dL = 0;
int dT = 0;
int dW = 0;
int dH = 0;
int nShapeId = pWriter->m_lObjectIdVML;
std::wstring strId = L"_x0000_i" + std::to_wstring(nShapeId);
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
std::wstring strObjectid = L"_152504" + std::to_wstring(pWriter->m_lObjectIdVML);
std::wstring strId = L"_x0000_i" + std::to_wstring(nShapeId);
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
std::wstring strObjectid = L"_152504" + std::to_wstring(pWriter->m_lObjectIdVML);
pWriter->m_lObjectIdVML++;
int dL = 0, dT = 0, dW = 0, dH = 0;
if (spPr.xfrm.is_init())
{
if (spPr.xfrm->offX.is_init()) dL = *spPr.xfrm->offX;
if (spPr.xfrm->offY.is_init()) dT = *spPr.xfrm->offY;
if (spPr.xfrm->extX.is_init()) dW = *spPr.xfrm->extX;
if (spPr.xfrm->extY.is_init()) dH = *spPr.xfrm->extY;
}
NSBinPptxRW::CXmlWriter oStylesWriter;
if(pWriter->m_strStyleMain.empty())
{
if (spPr.xfrm.is_init())
oStylesWriter.WriteAttributeCSS (L"position", L"absolute");
if (in_group)
{
if (spPr.xfrm->offX.is_init())
dL = (*spPr.xfrm->offX) / 12700.;
if (spPr.xfrm->offY.is_init())
dT = (*spPr.xfrm->offY) / 12700.;
if (spPr.xfrm->extX.is_init())
dW = (*spPr.xfrm->extX) / 12700.;
if (spPr.xfrm->extY.is_init())
dH = (*spPr.xfrm->extY) / 12700.;
oStylesWriter.WriteAttributeCSS_int(L"left", dL / 100);
oStylesWriter.WriteAttributeCSS_int(L"top", dT / 100);
oStylesWriter.WriteAttributeCSS_int(L"width", dW / 100);
oStylesWriter.WriteAttributeCSS_int(L"height", dH / 100);
}
else
{
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL / 12700);
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT / 12700);
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW / 12700);
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH / 12700);
}
oStylesWriter.WriteAttributeCSS (_T("position"), _T("absolute"));
oStylesWriter.WriteAttributeCSS_int_pt (_T("left"), dL);
oStylesWriter.WriteAttributeCSS_int_pt (_T("top"), dT);
oStylesWriter.WriteAttributeCSS_int_pt (_T("width"), dW);
oStylesWriter.WriteAttributeCSS_int_pt (_T("height"), dH);
}
if (spPr.xfrm.is_init())
@ -598,21 +601,21 @@ namespace PPTX
if (spPr.xfrm->rot.is_init())
{
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
oStylesWriter.WriteAttributeCSS_int(_T("rotation"), nRot);
oStylesWriter.WriteAttributeCSS_int(L"rotation", nRot);
}
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
if (bIsFH && bIsFV)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("xy"));
oStylesWriter.WriteAttributeCSS(L"flip", L"xy");
}
else if (bIsFH)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("x"));
oStylesWriter.WriteAttributeCSS(L"flip", L"x");
}
else if (bIsFV)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("y"));
oStylesWriter.WriteAttributeCSS(L"flip", L"y");
}
}
@ -631,32 +634,38 @@ namespace PPTX
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
pWriter->StartNode(_T("v:shape"));
pWriter->StartNode(L"v:shape");
if (XMLWRITER_DOC_TYPE_XLSX == pWriter->m_lDocType)
{
pWriter->WriteAttribute(_T("id"), strSpid);
pWriter->WriteAttribute(L"id", strSpid);
}
else
{
pWriter->WriteAttribute(_T("id"), strId);
pWriter->WriteAttribute(_T("o:spid"), strSpid);
pWriter->WriteAttribute(L"id", strId);
pWriter->WriteAttribute(L"o:spid", strSpid);
}
pWriter->StartAttributes();
if (oStylesWriter.GetSize() == 0)
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain);
}
else
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
}
if(!bOle)
{
pWriter->WriteAttribute(_T("coordsize"), (std::wstring)_T("100000,100000"));
pWriter->WriteAttribute(_T("path"), strPath);
oStylesWriter.ClearNoAttack();
oStylesWriter.m_oWriter.AddSize(30);
oStylesWriter.m_oWriter.AddIntNoCheck(dW / 100);
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100);
pWriter->WriteAttribute(L"coordsize", oStylesWriter.GetXmlString());
pWriter->WriteAttribute(L"path", strPath);
}
if (!pWriter->m_strAttributesMain.empty())
@ -666,12 +675,12 @@ namespace PPTX
}
if(bOle)
{
pWriter->WriteAttribute(_T("filled"), (std::wstring)L"f");
pWriter->WriteAttribute(L"filled", L"f");
}
std::wstring strNodeVal = _T("");
std::wstring strNodeVal;
if (!spPr.ln.is_init())
{
pWriter->WriteAttribute(_T("stroked"), (std::wstring)_T("false"));
pWriter->WriteAttribute(L"stroked", L"false");
}
else
{
@ -683,76 +692,76 @@ namespace PPTX
pWriter->EndAttributes();
pWriter->StartNode(_T("v:path"));
pWriter->StartNode(L"v:path");
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("textboxrect"), strTextRect);
pWriter->WriteAttribute(L"textboxrect", strTextRect);
pWriter->EndAttributes();
pWriter->EndNode(_T("v:path"));
pWriter->EndNode(L"v:path");
if (blipFill.blip.is_init() && blipFill.blip->embed.is_init())
{
pWriter->StartNode(_T("v:imagedata"));
pWriter->StartNode(L"v:imagedata");
pWriter->StartAttributes();
if (XMLWRITER_DOC_TYPE_XLSX == pWriter->m_lDocType)
{
pWriter->WriteAttribute(_T("o:relid"), blipFill.blip->embed->ToString());
pWriter->WriteAttribute(L"o:relid", blipFill.blip->embed->ToString());
}
else
{
pWriter->WriteAttribute(_T("r:id"), blipFill.blip->embed->ToString());
pWriter->WriteAttribute(L"r:id", blipFill.blip->embed->ToString());
}
pWriter->WriteAttribute(_T("o:title"), std::wstring(_T("")));
pWriter->WriteAttribute(L"o:title", L"");
pWriter->EndAttributes();
pWriter->EndNode(_T("v:imagedata"));
pWriter->EndNode(L"v:imagedata");
}
pWriter->EndNode(_T("v:shape"));
pWriter->EndNode(L"v:shape");
}
else
{
pWriter->StartNode(_T("v:rect"));
pWriter->StartNode(L"v:rect");
pWriter->StartAttributes();
if (XMLWRITER_DOC_TYPE_XLSX == pWriter->m_lDocType)
{
pWriter->WriteAttribute(_T("id"), strSpid);
pWriter->WriteAttribute(L"id", strSpid);
}
else
{
pWriter->WriteAttribute(_T("id"), strId);
pWriter->WriteAttribute(_T("o:spid"), strSpid);
pWriter->WriteAttribute(L"id", strId);
pWriter->WriteAttribute(L"o:spid", strSpid);
}
if (oStylesWriter.GetSize() == 0)
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain);
}
else
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
}
if(bOle)
{
pWriter->WriteAttribute(_T("filled"), L"f");
pWriter->WriteAttribute(_T("stroked"), L"f");
pWriter->WriteAttribute(L"filled", L"f");
pWriter->WriteAttribute(L"stroked", L"f");
}
pWriter->EndAttributes();
if (blipFill.blip.is_init() && blipFill.blip->embed.is_init())
{
pWriter->StartNode(_T("v:imagedata"));
pWriter->StartNode(L"v:imagedata");
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("r:id"), blipFill.blip->embed->ToString());
pWriter->WriteAttribute(_T("o:title"), std::wstring(_T("")));
pWriter->WriteAttribute(L"r:id", blipFill.blip->embed->ToString());
pWriter->WriteAttribute(L"o:title", L"");
pWriter->EndAttributes();
pWriter->EndNode(_T("v:imagedata"));
pWriter->EndNode(L"v:imagedata");
}
pWriter->EndNode(_T("v:rect"));
pWriter->EndNode(L"v:rect");
}
pWriter->m_strStyleMain = _T("");
pWriter->m_strStyleMain.clear();
if(bOle)
{
@ -783,12 +792,12 @@ namespace PPTX
int imgW = node.GetAttributeInt(std::wstring(L"imgW"), 0);
if(imgW > 0)
{
oleObject->m_oDxaOrig = Emu_To_Twips(imgW);
oleObject->m_oDxaOrig = (int)Emu_To_Twips(imgW);
}
int imgH = node.GetAttributeInt(std::wstring(L"imgH"), 0);
if(imgH > 0)
{
oleObject->m_oDyaOrig = Emu_To_Twips(imgH);
oleObject->m_oDyaOrig = (int)Emu_To_Twips(imgH);
}
if(oleObject->m_oId.IsInit())
{

View File

@ -399,7 +399,7 @@ namespace PPTX
pReader->Seek(_end_rec);
}
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
void fromXMLOle(XmlUtils::CXmlNode& node);
public:

View File

@ -569,24 +569,38 @@ namespace PPTX
}
}
void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap)
void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group)
{
std::wstring strPath = _T("");
std::wstring strTextRect = _T("");
std::wstring strPath, strTextRect;
bool bOle = false;
OOX::Vml::SptType vmlPrst = OOX::Vml::sptNotPrimitive;
LONG lW = 43200, lH = 43200;
int dL = 0, dT = 0, dW = 0, dH = 0;
if (spPr.Geometry.is<PrstGeom>())
{
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
vmlPrst = Spt2ShapeType( ooxPrst.GetValue());
}
LONG lW = 43200;
LONG lH = 43200;
if (spPr.xfrm.is_init())
{
if (spPr.xfrm->offX.is_init()) dL = *spPr.xfrm->offX;
if (spPr.xfrm->offY.is_init()) dT = *spPr.xfrm->offY;
if (spPr.xfrm->extX.is_init()) dW = *spPr.xfrm->extX;
if (spPr.xfrm->extY.is_init()) dH = *spPr.xfrm->extY;
lW = spPr.xfrm->extX.get_value_or(43200);
lH = spPr.xfrm->extY.get_value_or(43200);
}
bool bOle = false;
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
std::wstring strId = L"shape " + std::to_wstring(pWriter->m_lObjectIdVML);
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
std::wstring strId = L"shape " + std::to_wstring(pWriter->m_lObjectIdVML);
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
pWriter->m_lObjectIdVML++;
std::wstring strFillAttr;
@ -594,266 +608,143 @@ namespace PPTX
std::wstring strFillNode;
std::wstring strStrokeNode;;
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, bOle);
if (!pWriter->m_strStyleMain.empty())
pWriter->StartNode(L"v:shape");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"id", strId);
pWriter->WriteAttribute(L"o:spid", strSpid);
if (vmlPrst != OOX::Vml::sptNotPrimitive)
pWriter->WriteAttribute(L"o:spt", (int)vmlPrst);
NSBinPptxRW::CXmlWriter oStylesWriter;
if (pWriter->m_strStyleMain.empty())
{
pWriter->StartNode(L"v:shape");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"id", strId);
pWriter->WriteAttribute(L"o:spid", strSpid);
if (spPr.Geometry.is<PrstGeom>())
oStylesWriter.WriteAttributeCSS(L"position", L"absolute");
if (in_group)
{
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
OOX::Vml::SptType vmlPrst = Spt2ShapeType( ooxPrst.GetValue());
if (vmlPrst != OOX::Vml::sptNotPrimitive)
pWriter->WriteAttribute(L"o:spt", (int)vmlPrst);
}
NSBinPptxRW::CXmlWriter oStylesWriter;
if (spPr.xfrm.is_init())
{
if (spPr.xfrm->rot.is_init())
{
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
oStylesWriter.WriteAttributeCSS_int(_T("rotation"), nRot);
}
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
if (bIsFH && bIsFV)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("xy"));
}
else if (bIsFH)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("x"));
}
else if (bIsFV)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("y"));
}
}
if (txBody.is_init())
{
if (txBody->bodyPr.anchor.is_init())
{
std::wstring _strAnchor = txBody->bodyPr.anchor->get();
if (_strAnchor == _T("t"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
else if (_strAnchor == _T("b"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
else if (_strAnchor == _T("ctr"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
}
}
else if (TextBoxBodyPr.is_init())
{
if (TextBoxBodyPr->anchor.is_init())
{
std::wstring _strAnchor = TextBoxBodyPr->anchor->get();
if (_strAnchor == _T("t"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
else if (_strAnchor == _T("b"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
else if (_strAnchor == _T("ctr"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
}
}
if (oStylesWriter.GetSize() == 0)
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
oStylesWriter.WriteAttributeCSS_int(L"left", dL / 100);
oStylesWriter.WriteAttributeCSS_int(L"top", dT / 100);
oStylesWriter.WriteAttributeCSS_int(L"width", dW / 100);
oStylesWriter.WriteAttributeCSS_int(L"height", dH / 100);
}
else
{
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL / 12700);
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT / 12700);
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW / 12700);
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH / 12700);
}
if(!bOle)
{
pWriter->WriteAttribute(_T("coordsize"), (std::wstring)_T("100000,100000"));
pWriter->WriteAttribute(_T("path"), strPath);
}
if (!pWriter->m_strAttributesMain.empty())
{
pWriter->WriteString(pWriter->m_strAttributesMain);
pWriter->m_strAttributesMain.clear();
}
pWriter->WriteString(strFillAttr);
pWriter->WriteString(strStrokeAttr);
pWriter->EndAttributes();
pWriter->StartNode(_T("v:path"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("textboxrect"), strTextRect);
pWriter->EndAttributes();
pWriter->EndNode(_T("v:path"));
pWriter->WriteString(strFillNode);
pWriter->WriteString(strStrokeNode);
pWriter->WriteString(pWriter->m_strNodes);
pWriter->m_strNodes = _T("");
if (TextBoxShape.is_init())
{
pWriter->StartNode(_T("v:textbox"));
pWriter->EndAttributes();
pWriter->WriteString(*TextBoxShape);
pWriter->EndNode(_T("v:textbox"));
}
pWriter->EndNode(_T("v:shape"));
pWriter->m_strStyleMain = _T("");
}
else
if (spPr.xfrm.is_init())
{
int dL = 0;
int dT = 0;
int dW = 0;
int dH = 0;
NSBinPptxRW::CXmlWriter oStylesWriter;
if (spPr.xfrm.is_init())
if (spPr.xfrm->rot.is_init())
{
if (spPr.xfrm->offX.is_init())
dL = (*spPr.xfrm->offX) / 12700.;
if (spPr.xfrm->offY.is_init())
dT = (*spPr.xfrm->offY) / 12700.;
if (spPr.xfrm->extX.is_init())
dW = (*spPr.xfrm->extX) / 12700.;
if (spPr.xfrm->extY.is_init())
dH = (*spPr.xfrm->extY / 12700.);
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
oStylesWriter.WriteAttributeCSS_int(L"rotation", nRot);
}
oStylesWriter.WriteAttributeCSS(L"position", L"absolute");
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL);
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT);
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW);
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH);
if (spPr.xfrm.is_init())
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
if (bIsFH && bIsFV)
{
if (spPr.xfrm->rot.is_init())
{
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
oStylesWriter.WriteAttributeCSS_int(_T("rotation"), nRot);
}
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
if (bIsFH && bIsFV)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("xy"));
}
else if (bIsFH)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("x"));
}
else if (bIsFV)
{
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("y"));
}
oStylesWriter.WriteAttributeCSS(L"flip", L"xy");
}
if (txBody.is_init())
else if (bIsFH)
{
if (txBody->bodyPr.anchor.is_init())
{
std::wstring _strAnchor = txBody->bodyPr.anchor->get();
if (_strAnchor == _T("t"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
else if (_strAnchor == _T("b"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
else if (_strAnchor == _T("ctr"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
}
oStylesWriter.WriteAttributeCSS(L"flip", L"x");
}
else if (TextBoxBodyPr.is_init())
else if (bIsFV)
{
if (TextBoxBodyPr->anchor.is_init())
{
std::wstring _strAnchor = TextBoxBodyPr->anchor->get();
if (_strAnchor == _T("t"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
else if (_strAnchor == _T("b"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
else if (_strAnchor == _T("ctr"))
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
}
oStylesWriter.WriteAttributeCSS(L"flip", L"y");
}
pWriter->StartNode(_T("v:shape"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("id"), strId);
pWriter->WriteAttribute(_T("o:spid"), strSpid);
if (spPr.Geometry.is<PrstGeom>())
{
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
OOX::Vml::SptType vmlPrst = Spt2ShapeType( ooxPrst.GetValue());
if (vmlPrst != OOX::Vml::sptNotPrimitive)
pWriter->WriteAttribute(L"o:spt", (int)vmlPrst);
}
pWriter->WriteAttribute(_T("style"), oStylesWriter.GetXmlString());
if(!bOle)
{
pWriter->WriteAttribute(_T("coordsize"), (std::wstring)_T("100000,100000"));
pWriter->WriteAttribute(_T("path"), strPath);
}
if (!pWriter->m_strAttributesMain.empty())
{
pWriter->WriteString(pWriter->m_strAttributesMain);
pWriter->m_strAttributesMain.clear();
}
pWriter->WriteString(strFillAttr);
pWriter->WriteString(strStrokeAttr);
pWriter->EndAttributes();
pWriter->StartNode(_T("v:path"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("textboxrect"), strTextRect);
pWriter->EndAttributes();
pWriter->EndNode(_T("v:path"));
pWriter->WriteString(strFillNode);
pWriter->WriteString(strStrokeNode);
if (TextBoxShape.is_init())
{
pWriter->StartNode(_T("v:textbox"));
pWriter->EndAttributes();
pWriter->WriteString(*TextBoxShape);
pWriter->EndNode(_T("v:textbox"));
}
pWriter->EndNode(_T("v:shape"));
}
if (txBody.is_init())
{
if (txBody->bodyPr.anchor.is_init())
{
std::wstring _strAnchor = txBody->bodyPr.anchor->get();
if (_strAnchor == L"t")
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"top");
else if (_strAnchor == L"b")
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"bottom");
else if (_strAnchor == L"ctr")
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"middle");
}
}
else if (TextBoxBodyPr.is_init())
{
if (TextBoxBodyPr->anchor.is_init())
{
std::wstring _strAnchor = TextBoxBodyPr->anchor->get();
if (_strAnchor == L"t")
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"top");
else if (_strAnchor == L"b")
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"bottom");
else if (_strAnchor == _T("ctr"))
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"middle");
}
}
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
if(!bOle)
{
oStylesWriter.ClearNoAttack();
oStylesWriter.m_oWriter.AddSize(30);
oStylesWriter.m_oWriter.AddIntNoCheck(dW / 100);
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100);
pWriter->WriteAttribute(L"coordsize", oStylesWriter.GetXmlString());
pWriter->WriteAttribute(L"path", strPath);
}
if (!pWriter->m_strAttributesMain.empty())
{
pWriter->WriteString(pWriter->m_strAttributesMain);
pWriter->m_strAttributesMain.clear();
}
pWriter->WriteString(strFillAttr);
pWriter->WriteString(strStrokeAttr);
pWriter->EndAttributes();
pWriter->StartNode(L"v:path");
pWriter->StartAttributes();
pWriter->WriteAttribute(L"textboxrect", strTextRect);
pWriter->EndAttributes();
pWriter->EndNode(L"v:path");
pWriter->WriteString(strFillNode);
pWriter->WriteString(strStrokeNode);
pWriter->WriteString(pWriter->m_strNodes);
pWriter->m_strNodes.clear();
if (TextBoxShape.is_init())
{
pWriter->StartNode(L"v:textbox");
pWriter->EndAttributes();
pWriter->WriteString(*TextBoxShape);
pWriter->EndNode(L"v:textbox");
}
pWriter->EndNode(L"v:shape");
pWriter->m_strStyleMain.clear();
}
void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap)
{
std::wstring strFillAttr = _T("");
std::wstring strFillNode = _T("");
std::wstring strFillAttr, strFillNode;
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
pWriter->StartNode(_T("v:background"));
pWriter->StartNode(L"v:background");
pWriter->StartAttributes();
@ -871,7 +762,7 @@ namespace PPTX
pWriter->WriteString(strFillNode);
pWriter->EndNode(_T("v:background"));
pWriter->EndNode(L"v:background");
}
} // namespace Logic
} // namespace PPTX

View File

@ -136,7 +136,7 @@ namespace PPTX
pWriter->EndRecord();
}
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
void toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const

View File

@ -119,7 +119,8 @@ namespace PPTX
if ((pDiagramDrawing) && (pDiagramDrawing->m_oShapeTree.IsInit()))
{
m_diag = pDiagramDrawing->m_oShapeTree;
m_oCommonRels = smart_ptr<PPTX::CCommonRels>(dynamic_cast<PPTX::CCommonRels*>(pDiagramDrawing));
m_oCommonRels = smart_ptr<PPTX::CCommonRels>( new PPTX::CCommonRels());
m_oCommonRels->_read(pDiagramDrawing->m_oReadPath);
}
else
{

View File

@ -41,7 +41,7 @@ namespace PPTX
{
namespace Logic
{
void SpTree::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap)
void SpTree::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, bool in_group)
{
smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>();
smart_ptr<PPTX::Logic::ClrMap> oClrMap = oTheme.smart_dynamic_cast<PPTX::Logic::ClrMap>();
@ -95,28 +95,31 @@ namespace PPTX
}
else
{
int dL = 0;
int dT = 0;
int dW = 0;
int dH = 0;
int dL = 0, dT = 0, dW = 0, dH = 0;
if (grpSpPr.xfrm.is_init())
{
if (grpSpPr.xfrm->offX.is_init())
dL = (*grpSpPr.xfrm->offX) / 12700.;
if (grpSpPr.xfrm->offY.is_init())
dT = (*grpSpPr.xfrm->offY) / 12700.;
if (grpSpPr.xfrm->extX.is_init())
dW = (*grpSpPr.xfrm->extX) / 12700.;
if (grpSpPr.xfrm->extY.is_init())
dH = (*grpSpPr.xfrm->extY) / 12700.;
if (grpSpPr.xfrm->offX.is_init()) dL = *grpSpPr.xfrm->offX;
if (grpSpPr.xfrm->offY.is_init()) dT = *grpSpPr.xfrm->offY;
if (grpSpPr.xfrm->extX.is_init()) dW = *grpSpPr.xfrm->extX;
if (grpSpPr.xfrm->extY.is_init()) dH = *grpSpPr.xfrm->extY;
}
oStylesWriter.ClearNoAttack();
oStylesWriter.WriteAttributeCSS(L"position", L"absolute");
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL);
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT);
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW);
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH);
if (in_group)
{
oStylesWriter.WriteAttributeCSS_int(L"left", dL / 100.);
oStylesWriter.WriteAttributeCSS_int(L"top", dT / 100.);
oStylesWriter.WriteAttributeCSS_int(L"width", dW / 100.);
oStylesWriter.WriteAttributeCSS_int(L"height", dH / 100.);
}
else
{
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL / 12700.);
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT / 12700.);
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW / 12700.);
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH / 12700.);
}
if (grpSpPr.xfrm.is_init())
{
@ -150,33 +153,27 @@ namespace PPTX
pWriter->m_strAttributesMain.clear();
}
int dL = 0;
int dT = 0;
int dW = 0;
int dH = 0;
int dL = 0, dT = 0, dW = 0, dH = 0;
if (grpSpPr.xfrm.is_init())
{
if (grpSpPr.xfrm->chOffX.is_init())
dL = (*grpSpPr.xfrm->chOffX) / 12700.;
if (grpSpPr.xfrm->chOffY.is_init())
dT = (*grpSpPr.xfrm->chOffY) / 12700.;
if (grpSpPr.xfrm->chExtX.is_init())
dW = (*grpSpPr.xfrm->chExtX) / 12700.;
if (grpSpPr.xfrm->chExtY.is_init())
dH = (*grpSpPr.xfrm->chExtY) / 12700.;
if (grpSpPr.xfrm->chOffX.is_init()) dL = *grpSpPr.xfrm->chOffX;
if (grpSpPr.xfrm->chOffY.is_init()) dT = *grpSpPr.xfrm->chOffY;
if (grpSpPr.xfrm->chExtX.is_init()) dW = *grpSpPr.xfrm->chExtX;
if (grpSpPr.xfrm->chExtY.is_init()) dH = *grpSpPr.xfrm->chExtY;
}
oStylesWriter.ClearNoAttack();
oStylesWriter.m_oWriter.AddSize(30);
oStylesWriter.m_oWriter.AddIntNoCheck(dL);
oStylesWriter.m_oWriter.AddIntNoCheck(dL / 100.);
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
oStylesWriter.m_oWriter.AddIntNoCheck(dT);
oStylesWriter.m_oWriter.AddIntNoCheck(dT / 100.);
pWriter->WriteAttribute(_T("coordorigin"), oStylesWriter.GetXmlString());
oStylesWriter.ClearNoAttack();
oStylesWriter.m_oWriter.AddSize(30);
oStylesWriter.m_oWriter.AddIntNoCheck(dW);
oStylesWriter.m_oWriter.AddIntNoCheck(dW / 100.);
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
oStylesWriter.m_oWriter.AddIntNoCheck(dH);
oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100.);
pWriter->WriteAttribute(_T("coordsize"), oStylesWriter.GetXmlString());
pWriter->EndAttributes();
@ -186,15 +183,15 @@ namespace PPTX
{
if (SpTreeElems[i].is<PPTX::Logic::Shape>())
{
SpTreeElems[i].as<PPTX::Logic::Shape>().toXmlWriterVML(pWriter, _oTheme, _oClrMap);
SpTreeElems[i].as<PPTX::Logic::Shape>().toXmlWriterVML(pWriter, _oTheme, _oClrMap, true);
}
else if (SpTreeElems[i].is<PPTX::Logic::Pic>())
{
SpTreeElems[i].as<PPTX::Logic::Pic>().toXmlWriterVML(pWriter, _oTheme, _oClrMap);
SpTreeElems[i].as<PPTX::Logic::Pic>().toXmlWriterVML(pWriter, _oTheme, _oClrMap, true);
}
else if (SpTreeElems[i].is<PPTX::Logic::SpTree>())
{
SpTreeElems[i].as<PPTX::Logic::SpTree>().toXmlWriterVML(pWriter, _oTheme, _oClrMap);
SpTreeElems[i].as<PPTX::Logic::SpTree>().toXmlWriterVML(pWriter, _oTheme, _oClrMap, true);
}
}

View File

@ -121,7 +121,7 @@ namespace PPTX
return XmlUtils::CreateNode(m_name, oValue);
}
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{

View File

@ -121,9 +121,11 @@ namespace PPTX
theme_= (FileContainer::Get(OOX::Presentation::FileTypes::ThemePPTX)).smart_dynamic_cast<PPTX::Theme>();
if (theme_.IsInit())
{
theme_->SetColorMap(clrMap);
tableStyles_ = (theme_->presentation->Get(OOX::Presentation::FileTypes::TableStyles)).smart_dynamic_cast<PPTX::TableStyles>();
tableStyles_ = (theme_->presentation->Get(OOX::Presentation::FileTypes::TableStyles)).smart_dynamic_cast<PPTX::TableStyles>();
}
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const

View File

@ -407,14 +407,20 @@ namespace PPTX
Layout = FileContainer::Get(OOX::Presentation::FileTypes::SlideLayout).smart_dynamic_cast<PPTX::SlideLayout>();//boost::shared_dynamic_cast<PPTX::SlideLayout, PPTX::File>(FileContainer::get(OOX::Presentation::FileTypes::SlideLayout));
Note = FileContainer::Get(OOX::Presentation::FileTypes::NotesSlide).smart_dynamic_cast<PPTX::NotesSlide>();
comments = FileContainer::Get(OOX::Presentation::FileTypes::SlideComments).smart_dynamic_cast<PPTX::Comments>();
Master = Layout->Master;
theme = Layout->theme;
tableStyles_= theme->presentation->Get(OOX::Presentation::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();//boost::shared_dynamic_cast<PPTX::TableStyles, PPTX::File>(Theme->Presentation->get(OOX::Presentation::FileTypes::TableStyles));
if (IsExist(OOX::Presentation::FileTypes::VmlDrawing))
if (Layout.IsInit())
{
Vml = FileContainer::Get(OOX::Presentation::FileTypes::VmlDrawing).smart_dynamic_cast<OOX::CVmlDrawing>();//boost::shared_dynamic_cast<PPTX::VmlDrawing, PPTX::File>(FileContainer::get(OOX::Presentation::FileTypes::VmlDrawing));
Master = Layout->Master;
theme = Layout->theme;
if (theme.IsInit())
{
tableStyles_= theme->presentation->Get(OOX::Presentation::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();//boost::shared_dynamic_cast<PPTX::TableStyles, PPTX::File>(Theme->Presentation->get(OOX::Presentation::FileTypes::TableStyles));
}
if (IsExist(OOX::Presentation::FileTypes::VmlDrawing))
{
Vml = FileContainer::Get(OOX::Presentation::FileTypes::VmlDrawing).smart_dynamic_cast<OOX::CVmlDrawing>();//boost::shared_dynamic_cast<PPTX::VmlDrawing, PPTX::File>(FileContainer::get(OOX::Presentation::FileTypes::VmlDrawing));
}
}
}

View File

@ -478,11 +478,13 @@ namespace PPTX
Master = pFile.smart_dynamic_cast<PPTX::SlideMaster>();
if (Master.IsInit())
{
theme = Master->theme;
if (theme.IsInit())
{
tableStyles = theme->presentation->Get(OOX::Presentation::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();
if (theme.IsInit())
{
tableStyles = theme->presentation->Get(OOX::Presentation::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();
}
}
if (IsExist(OOX::Presentation::FileTypes::VmlDrawing))
{

View File

@ -76,7 +76,7 @@ namespace PPTX
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
//FileContainer::read(filename, map);
//FileContainer::read(filename, map);
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(filename.m_strFilename);
@ -516,9 +516,11 @@ namespace PPTX
theme = (FileContainer::Get(OOX::Presentation::FileTypes::ThemePPTX)).smart_dynamic_cast<PPTX::Theme>();
if (theme.IsInit())
{
theme->SetColorMap(clrMap);
//Theme->Master.reset((PPTX::WrapperFile*)this);
tableStyles = (theme->presentation->Get(OOX::Presentation::FileTypes::TableStyles)).smart_dynamic_cast<PPTX::TableStyles>();
//Theme->Master.reset((PPTX::WrapperFile*)this);
tableStyles = (theme->presentation->Get(OOX::Presentation::FileTypes::TableStyles)).smart_dynamic_cast<PPTX::TableStyles>();
}
if (IsExist(OOX::Presentation::FileTypes::VmlDrawing))
{

View File

@ -2288,6 +2288,7 @@
DONT_WRITE_EMBEDDED_FONTS,
CXIMAGE_DONT_DECLARE_TCHAR,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -2329,6 +2330,7 @@
DONT_WRITE_EMBEDDED_FONTS,
CXIMAGE_DONT_DECLARE_TCHAR,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -35,10 +35,6 @@ INCLUDEPATH += \
../../../DesktopEditor/xml/libxml2/include
core_mac {
DEFINES += \
_ASC_USE_UNICODE_CONVERTER_ \
UNICODECONVERTER_USE_DYNAMIC_LIBRARY
LIBS += $$DESTDIR -lUnicodeConverter
}

View File

@ -546,6 +546,7 @@
USE_LITE_READER,
PPT_DEF,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
@ -577,6 +578,7 @@
USE_LITE_READER,
PPT_DEF,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",

View File

@ -38,6 +38,8 @@ class OOXReader;
class RtfWriter;
class RtfReader;
namespace OOX { namespace Vml { class CShapeType; } }
class RtfConvertationManager
{
public:
@ -58,6 +60,7 @@ public:
void OnCompleteItemRtf();
void OnCompleteItemOOX();
private:
OOXWriter* m_poOOXWriter;
OOXReader* m_poOOXReader;

View File

@ -155,7 +155,7 @@ bool RtfDocumentCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
oReader.m_oCurSectionProp.m_bSwitchMargin = 1;
}
}
else if ( "gutter" == sCommand )
else if ( "gutter" == sCommand )
{
if ( hasParameter )
{
@ -163,12 +163,12 @@ bool RtfDocumentCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
oReader.m_oCurSectionProp.m_nGutterMarginWidth = parameter;
}
}
else if ( "ogutter" == sCommand )
else if ( "ogutter" == sCommand )
{
if ( hasParameter )
oDocument.m_oProperty.m_nGutterWidthOutside = parameter;
}
else if ( "margmirror" == sCommand )
else if ( "margmirror" == sCommand )
{
if ( hasParameter && 0 == parameter )
{
@ -194,7 +194,7 @@ bool RtfDocumentCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oRead
COMMAND_RTF_BOOL( "useltbaln", oDocument.m_oProperty.m_bUseTabAlignment, sCommand, hasParameter, parameter )
//Footnotes and Endnotes
COMMAND_RTF_INT ( "endnotes", oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndSection )
COMMAND_RTF_INT ( "enddoc", oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndDocument )
COMMAND_RTF_INT ( "enddoc", oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndDocument )
COMMAND_RTF_INT ( "ftntj", oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_BeneathText )
COMMAND_RTF_INT ( "ftnbj", oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_BottomPage )
@ -309,6 +309,15 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
RtfInfoReader oInfoReader;
return StartSubReader( oInfoReader, oDocument, oReader );
}
else if ( "background" == sCommand )
{
oDocument.m_pBackground = RtfShapePtr( new RtfShape() );
oDocument.m_pBackground->m_bBackground = true;
RtfBackgroundReader oBackgroundReader( *oDocument.m_pBackground );
return StartSubReader( oBackgroundReader, oDocument, oReader );
}
//else if ( "colorschememapping" == sCommand )
//{
// RtfColorSchemeReader oSchemeReader;
@ -1131,7 +1140,7 @@ bool RtfTableCellPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
}
}
COMMAND_RTF_INT ( "clwWidth", cellProps->m_nWidth, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( "clhidemark",cellProps->m_bHideMark, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( "clhidemark", cellProps->m_bHideMark, sCommand, hasParameter, parameter )
COMMAND_RTF_INT ( "clvertalt", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Top )
COMMAND_RTF_INT ( "clvertalc", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Center )
COMMAND_RTF_INT ( "clvertalb", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Bottom )
@ -1921,13 +1930,13 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
else if ( L"fLine" == m_sPropName ) m_oShape.m_bLine = ( 0 == nValue ? false : true );
else if ( L"lineStartArrowhead" == m_sPropName ) m_oShape.m_nLineStartArrow = nValue;
else if ( L"lineColor" == m_sPropName ) m_oShape.m_nLineColor = nValue;
else if ( L"lineStartArrowWidth" == m_sPropName ) m_oShape.m_nLineStartArrowWidth= nValue;
else if ( L"lineStartArrowWidth" == m_sPropName ) m_oShape.m_nLineStartArrowWidth = nValue;
else if ( L"lineStartArrowLength" == m_sPropName ) m_oShape.m_nLineStartArrowLength = nValue;
else if ( L"lineEndArrowhead" == m_sPropName ) m_oShape.m_nLineEndArrow = nValue;
else if ( L"lineEndArrowhead" == m_sPropName ) m_oShape.m_nLineEndArrow = nValue;
else if ( L"lineEndArrowWidth" == m_sPropName ) m_oShape.m_nLineEndArrowWidth = nValue;
else if ( L"lineEndArrowLength" == m_sPropName ) m_oShape.m_nLineEndArrowLength = nValue;
else if ( L"lineWidth" == m_sPropName ) m_oShape.m_nLineWidth = nValue;
else if ( L"lineDashing" == m_sPropName ) m_oShape.m_nLineDashing = nValue;
else if ( L"lineDashing" == m_sPropName ) m_oShape.m_nLineDashing = nValue;
else if (L"cxstyle" == m_sPropName ) m_oShape.m_nConnectorStyle = nValue;
else if (L"cxk" == m_sPropName ) m_oShape.m_nConnectionType = nValue;
else

View File

@ -509,9 +509,9 @@ public:
else if( "author" == sCommand ) m_eInternalState = is_author;
else if( "manager" == sCommand ) m_eInternalState = is_manager;
else if( "company" == sCommand ) m_eInternalState = is_company;
else if( "operator" == sCommand ) m_eInternalState = is_operator;
else if( "category" == sCommand ) m_eInternalState = is_category;
else if( "keywords" == sCommand ) m_eInternalState = is_keywords;
else if( "operator" == sCommand ) m_eInternalState = is_operator;
else if( "category" == sCommand ) m_eInternalState = is_category;
else if( "keywords" == sCommand ) m_eInternalState = is_keywords;
else if( "comment" == sCommand ) m_eInternalState = is_comment;
else if( "doccomm" == sCommand ) m_eInternalState = is_doccomm;
else if( "hlinkbase" == sCommand ) m_eInternalState = is_hlinkbase;
@ -720,12 +720,12 @@ class RtfPictureReader : public RtfAbstractReader
};
private:
RtfShape& m_oShape;
std::wstring m_sFile;
std::wstring m_sData;
bool m_bBin;
BYTE* m_pbBin;
int m_nBinLength;
RtfShape& m_oShape;
std::wstring m_sFile;
std::wstring m_sData;
bool m_bBin;
BYTE* m_pbBin;
int m_nBinLength;
public:
RtfPictureReader( RtfReader& oReader, RtfShape& oShape ) : m_oShape(oShape)
@ -983,7 +983,31 @@ public:
return true;
}
};
class RtfBackgroundReader : public RtfShapeReader
{
public:
RtfShape& m_oShape;
RtfBackgroundReader( RtfShape& oShape ) : RtfShapeReader(oShape), m_oShape(oShape)
{
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, std::string sCommand, bool hasParameter, int parameter)
{
if( "background" == sCommand )
{
return true;
}
else if( "shp" == sCommand )
{
RtfShapeReader oShapeReader( m_oShape );
StartSubReader( oShapeReader, oDocument, oReader );
}
else
return RtfShapeReader::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter);
return true;
}
};
class RtfOldShapeReader : public RtfAbstractReader
{
private:

View File

@ -31,7 +31,9 @@
*/
#pragma once
#include "OOXShapeReader.h"
#include "OOXTextItemReader.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Document.h"
class OOXDocumentReader
@ -58,6 +60,13 @@ public:
m_poReader = oParam.oReader;
m_poDocument = oParam.oRtf;
if ( m_ooxDocument->m_oBackground.IsInit())
{
m_poDocument->m_pBackground = RtfShapePtr(new RtfShape());
OOXBackgroundReader oBackgroundReader(m_ooxDocument->m_oBackground.GetPointer());
oBackgroundReader.Parse( oParam, m_poDocument->m_pBackground);
}
int last_section_start = 0;

View File

@ -34,6 +34,7 @@
#include "OOXDrawingGraphicReader.h"
#include "../../../../ASCOfficePPTXFile/ASCOfficeDrawingConverter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput)
{
@ -89,6 +90,16 @@ OOX::Logic::CPicture * OOXDrawingGraphicReader::Parse( ReaderParameter oParam ,
{
NSBinPptxRW::CDrawingConverter drawingConverter;
OOX::CTheme *pTheme = oParam.oDocx->GetTheme();
if (pTheme)
{
NSCommon::smart_ptr<PPTX::Theme> theme(new PPTX::Theme());
PPTX::FileMap map;
theme->read(pTheme->m_oReadPath, map);
(*drawingConverter.m_pTheme) = theme.smart_dynamic_cast<PPTX::WrapperFile>();
}
drawingConverter.SetRelsPath(oParam.oDocx->m_pDocument->m_oReadPath.GetPath());
std::wstring sVmlXml = drawingConverter.ConvertObjectToVml(m_sXml);

View File

@ -745,17 +745,24 @@ bool OOXRunReader::Parse( ReaderParameter oParam , RtfParagraph& oOutputParagrap
RtfShapePtr pNewShape ( new RtfShape() );
pNewShape->m_oCharProperty = oNewProperty;
OOXShapeReader *pShapeReader = NULL;
if (ooxPicture->m_oShape.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShape.GetPointer());
else if (ooxPicture->m_oShapeType.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeType.GetPointer());
else if (ooxPicture->m_oShapeArc.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeArc.GetPointer());
OOXShapeReader* pShapeReader = NULL;
if (ooxPicture->m_oShapeType.IsInit())
{
pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeType.GetPointer());
if(pShapeReader)
{
pShapeReader->Parse( oParam, pNewShape );
delete pShapeReader; pShapeReader = NULL;
}
}
if (ooxPicture->m_oShapeArc.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeArc.GetPointer());
else if (ooxPicture->m_oShapeRect.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeRect.GetPointer());
else if (ooxPicture->m_oShapeRoundRect.IsInit())pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeRoundRect.GetPointer());
else if (ooxPicture->m_oShapeOval.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeOval.GetPointer());
else if (ooxPicture->m_oShapeLine.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeLine.GetPointer());
else if (ooxPicture->m_oShapePolyLine.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapePolyLine.GetPointer());
else if (ooxPicture->m_oShapeCurve.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShapeCurve.GetPointer());
else if (ooxPicture->m_oShape.IsInit()) pShapeReader = new OOXShapeReader(ooxPicture->m_oShape.GetPointer());
if (pShapeReader)
{

View File

@ -41,7 +41,7 @@ class OOXReader
public:
RtfConvertationManager* m_convertationManager;
std::wstring m_sPath;
std::wstring m_sPath;
int m_nCurItap; //для определение вложенности таблицы

View File

@ -36,6 +36,9 @@
#include <boost/algorithm/string.hpp>
#ifndef RGB
#define RGB(r,g,b) ((_UINT32)(((BYTE)(r)|((_UINT16)((BYTE)(g))<<8))|(((_UINT32)(BYTE)(b))<<16)))
#endif
bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop)
{
if (pShape == NULL) return false;
@ -249,7 +252,7 @@ bool ParseStyle(RtfShape* pShape, SimpleTypes::Vml::CCssProperty* prop)
}
OOXShapeReader::OOXShapeReader(OOX::WritingElementWithChilds<OOX::WritingElement> * elem)
OOXShapeReader::OOXShapeReader(OOX::WritingElementWithChilds<OOX::WritingElement> * elem)
{
m_arrElement = elem;
@ -328,7 +331,7 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
case SimpleTypes::filltypeFrame : oOutput->m_nFillType = 3; break;
case SimpleTypes::filltypeGradient: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypeGradientCenter: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypeGradientRadial: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypeGradientRadial: oOutput->m_nFillType = 6; break;
case SimpleTypes::filltypeGradientUnscaled: oOutput->m_nFillType = 4; break;
case SimpleTypes::filltypePattern: oOutput->m_nFillType = 1; break;
case SimpleTypes::filltypeTile: oOutput->m_nFillType = 2; break;
@ -346,6 +349,21 @@ bool OOXShapeReader::Parse2( ReaderParameter oParam , RtfShapePtr& oOutput)
{
oOutput->m_nFillFocus = fill->m_oFocus->GetValue();
}
if (fill->m_oFocusPosition.IsInit())
{
if (fill->m_oFocusPosition->GetY() > 0.99 || fill->m_oFocusPosition->GetX() > 0.99)
oOutput->m_nFillType = 5;
int toBottom = (1. - fill->m_oFocusPosition->GetY()) * 65535;
int toTop = (fill->m_oFocusPosition->GetY()) * 65535;
int toRight = (1. - fill->m_oFocusPosition->GetX()) * 65535;
int toLeft = (fill->m_oFocusPosition->GetX()) * 65535;
if (toBottom > 0) oOutput->m_nFillToBottom = toBottom;
if (toTop > 0) oOutput->m_nFillToTop = toTop;
if (toRight > 0) oOutput->m_nFillToRight = toRight;
if (toLeft > 0) oOutput->m_nFillToLeft = toLeft;
}
}break;
case OOX::et_v_stroke:
{
@ -825,3 +843,58 @@ void OOXShapeReader::ParseAdjustment(RtfShape& oShape, std::wstring sAdjustment)
}
}
}
bool OOXBackgroundReader::Parse( ReaderParameter oParam , RtfShapePtr& oOutput)
{
if (!m_ooxBackground) return false;
oOutput->m_nShapeType = 1;
oOutput->m_bBackground = true;
oOutput->m_bFilled = true;
if (m_ooxBackground->m_oColor.IsInit() && m_ooxBackground->m_oColor->GetValue() == SimpleTypes::hexcolorRGB)
{
unsigned char ucR = m_ooxBackground->m_oColor->Get_R();
unsigned char ucB = m_ooxBackground->m_oColor->Get_B();
unsigned char ucG = m_ooxBackground->m_oColor->Get_G();
unsigned char ucA = m_ooxBackground->m_oColor->Get_A();
oOutput->m_nFillColor = RGB(ucR, ucG , ucB);
if (ucA != 0xff)
oOutput->m_nFillOpacity = ucA / 255. * 100;
}
else if (m_ooxBackground->m_oThemeColor.IsInit())
{
//nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeShade;
//nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeTint;
}
if (m_ooxBackground->m_oBackground.IsInit())
{
OOXShapeReader sub_reader(m_ooxBackground->m_oBackground.GetPointer());
sub_reader.Parse(oParam, oOutput);
}
else if (m_ooxBackground->m_oDrawing.IsInit())
{
OOXDrawingReader oDrawingReader(m_ooxBackground->m_oDrawing.GetPointer());
if( false == oDrawingReader.Parse( oParam, *oOutput ) )
{
if (!m_ooxBackground->m_oDrawing->m_sXml.IsInit())
{
OOXDrawingGraphicReader oGraphiceReader(*m_ooxBackground->m_oDrawing->m_sXml);
OOX::Logic::CPicture *ooxPicture = oGraphiceReader.Parse( oParam, *oOutput );
if (ooxPicture)
{
OOXShapeReader sub_reader(ooxPicture);
sub_reader.Parse(oParam, oOutput);
delete ooxPicture;
}
}
}
}
return true;
}

View File

@ -69,7 +69,6 @@ private:
}
};
class OOXShapeGroupReader
{
private:
@ -91,3 +90,16 @@ public:
bool Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOutput);
};
class OOXBackgroundReader
{
private:
OOX::Logic::CBackground *m_ooxBackground;
public:
OOXBackgroundReader(OOX::Logic::CBackground *oox_background)
{
m_ooxBackground = oox_background;
}
bool Parse( ReaderParameter oParam , RtfShapePtr& oOutput);
};

View File

@ -164,7 +164,9 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
for( int i = 0; i < m_ooxTable->m_oTblGrid->m_arrGridCol.size(); i++ )
{
if (m_ooxTable->m_oTblGrid->m_arrGridCol[i] && m_ooxTable->m_oTblGrid->m_arrGridCol[i]->m_oW.IsInit())
oOutputTable.m_aTableGrid.push_back( m_ooxTable->m_oTblGrid->m_arrGridCol[i]->m_oW->ToTwips() );
{
oOutputTable.m_aTableGrid.push_back( m_ooxTable->m_oTblGrid->m_arrGridCol[i]->m_oW->ToTwips() );
}
}
}

View File

@ -114,8 +114,19 @@ public:
if( m_ooxTableCellProps->m_oTcW.IsInit() && m_ooxTableCellProps->m_oTcW->m_oW.IsInit())
{
oOutputProperty.m_nWidth = m_ooxTableCellProps->m_oTcW->m_oW->GetValue();
oOutputProperty.m_eWidthUnits = m_ooxTableCellProps->m_oTcW->m_oW->IsPercent() ? mu_Percent : mu_Twips;
bool auto_ = false;
if (m_ooxTableCellProps->m_oTcW->m_oType.IsInit() && m_ooxTableCellProps->m_oTcW->m_oType->GetValue() == SimpleTypes::tblwidthAuto)
auto_ = true;
if (auto_)
{
oOutputProperty.m_eWidthUnits = mu_Auto;
}
else
{
oOutputProperty.m_nWidth = m_ooxTableCellProps->m_oTcW->m_oW->GetValue();
oOutputProperty.m_eWidthUnits = m_ooxTableCellProps->m_oTcW->m_oW->IsPercent() ? mu_Percent : mu_Twips;
}
}
if( m_ooxTableCellProps->m_oHideMark.IsInit())
oOutputProperty.m_bHideMark = m_ooxTableCellProps->m_oHideMark->m_oVal.ToBool() ? 1 : 0;

View File

@ -125,20 +125,20 @@ std::wstring RtfChar::renderTextToXML( std::wstring sParam, bool bDelete )
if (bDelete == false)
{
sResult += L"<w:t xml:space= \"preserve\">";
sResult += XmlUtils::EncodeXmlString( m_sChars );
sResult += XmlUtils::EncodeXmlString( m_sChars, true );
sResult += L"</w:t>";
}
else
{
sResult += L"<w:delText>";
sResult += XmlUtils::EncodeXmlString( m_sChars );
sResult += XmlUtils::EncodeXmlString( m_sChars, true );
sResult += L"</w:delText>";
}
}
else if( L"Math" == sParam && !m_sChars.empty())
{
sResult += L"<m:t>";
sResult += XmlUtils::EncodeXmlString( m_sChars );
sResult += XmlUtils::EncodeXmlString( m_sChars, true );
sResult += L"</m:t>";
}
return sResult;
@ -210,7 +210,7 @@ std::wstring RtfChar::renderRtfText( std::wstring& sText, void* poDocument, int
while (sTextBack.length() < sText.length())
sTextBack += L"-";
for( int i = 0; i < sText.length() ; i++ )
for( size_t i = 0; i < sText.length() ; i++ )
{
bool bWriteUnicode = true;
@ -222,7 +222,7 @@ std::wstring RtfChar::renderRtfText( std::wstring& sText, void* poDocument, int
// -> sTempAnsiChars
std::string sTempAnsiChars = RtfUtility::convert_string(unicodeStr.begin()+i, unicodeStr.begin() + i + 1, nCodePage);
for( int k = 0; k < sTempAnsiChars.length(); k++ )
for( size_t k = 0; k < sTempAnsiChars.length(); k++ )
{
unsigned char nCharCode = sTempAnsiChars[k];
bWriteUnicode = false;

View File

@ -35,6 +35,7 @@
#include "RtfGlobalTables.h"
#include "RtfSection.h"
#include "RtfMath.h"
#include "RtfShape.h"
struct _section
{
@ -56,6 +57,7 @@ public:
RtfStyleTable m_oStyleTable;
RtfRevisionTable m_oRevisionTable;
RtfInformation m_oInformation;
RtfShapePtr m_pBackground;
RtfListTable m_oListTable;
RtfListOverrideTable m_oListOverrideTable;
@ -80,8 +82,10 @@ public:
void SetShapeId( int nShapeId )
{
for( int i = 0; i < (int)m_aShapeId.size(); i++ )
{
if( nShapeId == m_aShapeId[i] )
return;
}
m_aShapeId.push_back( nShapeId );
}
int GetShapeId( int& nShapeId )

View File

@ -237,7 +237,7 @@ std::wstring RtfField::RenderToOOX(RenderParameter oRenderParameter)
if (m_pInsert->m_pTextItems)
{
sResult += XmlUtils::EncodeXmlString( m_pInsert->m_pTextItems->RenderToOOX(oNewParametr) );
sResult += XmlUtils::EncodeXmlString( m_pInsert->m_pTextItems->RenderToOOX(oNewParametr), true );
}
sResult += L"</w:instrText></w:r>";

View File

@ -95,7 +95,7 @@ std::wstring RtfOldList::RenderToOOX(RenderParameter oRenderParameter)
{
if( PROP_DEF != m_nLs && PROP_DEF != m_nIlvl )
sResult += L"<w:numPr><w:ilvl w:val=\"" + std::to_wstring(m_nLs) +
L"\"/><w:numId w:val=\"%" + std::to_wstring(m_nLs) + L"\"/></w:numPr>";
L"\"/><w:numId w:val=\"" + std::to_wstring(m_nLs) + L"\"/></w:numPr>";
}
}
return sResult;

View File

@ -2090,7 +2090,7 @@ std::wstring RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
case tbw_txbxtwno: sResult += L"<w:textboxTightWrap w:val=\"none\"/>"; break;
case tbw_txbxtwalways: sResult += L"<w:textboxTightWrap w:val=\"allLines\"/>"; break;
case tbw_txbxtwfirstlast: sResult += L"<w:textboxTightWrap w:val=\"firstAndLastLine\"/>"; break;
case tbw_txbxtwfirst: sResult += L"<w:textboxTightWrap w:val=\"firstLineOnly\"/>"; break;
case tbw_txbxtwfirst: sResult += L"<w:textboxTightWrap w:val=\"firstLineOnly\"/>"; break;
case tbw_txbxtwlast: sResult += L"<w:textboxTightWrap w:val=\"lastLineOnly\"/>"; break;
}
if( PROP_DEF != m_nListId && PROP_DEF != m_nListLevel )

View File

@ -146,6 +146,10 @@ void RtfShape::SetDefault()
DEFAULT_PROPERTY( m_nFillOpacity )
DEFAULT_PROPERTY( m_nFillFocus )
DEFAULT_PROPERTY( m_nFillAngle )
DEFAULT_PROPERTY( m_nFillToBottom )
DEFAULT_PROPERTY( m_nFillToTop )
DEFAULT_PROPERTY( m_nFillToRight )
DEFAULT_PROPERTY( m_nFillToLeft )
//Line
DEFAULT_PROPERTY_DEF( m_bLine, true )
DEFAULT_PROPERTY( m_nLineColor )
@ -168,7 +172,7 @@ void RtfShape::SetDefault()
m_aTextItems = TextItemContainerPtr();
m_oPicture = RtfPicturePtr();
m_bBackground = false;
m_bIsOle = false;
m_bInGroup = false;
@ -234,6 +238,9 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
}
else
{
if (m_bBackground)
sResult += L"{\\*\\background";
sResult += L"{\\shp";
sResult += L"{\\*\\shpinst";
@ -281,7 +288,7 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
sResult += L"{\\sp{\\sn fLockRotation}{\\sv 1}}";
//picture
if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 9)
if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 3 || m_nFillType == 9)
{
sResult += L"{\\sp{\\sn fillBlip}{\\sv ";
sResult += m_oPicture->RenderToRtf( oRenderParameter );
@ -296,6 +303,9 @@ std::wstring RtfShape::RenderToRtf(RenderParameter oRenderParameter)
}
sResult += L"}";
sResult += L"}";
if (m_bBackground)
sResult += L"}";
}
}
else // anchor
@ -400,14 +410,14 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP(L"fAllowOverlap", sResult, m_bAllowOverlap);
//Position relative
RENDER_RTF_SHAPE_PROP(L"pctHorizPos", sResult, m_nPositionHPct);
RENDER_RTF_SHAPE_PROP(L"pctVertPos", sResult, m_nPositionVPct);
RENDER_RTF_SHAPE_PROP(L"pctHoriz", sResult, m_nPctWidth);
RENDER_RTF_SHAPE_PROP(L"pctVert", sResult, m_nPctHeight);
RENDER_RTF_SHAPE_PROP(L"sizerelh", sResult, m_nPctWidthRelative);
RENDER_RTF_SHAPE_PROP(L"sizerelv", sResult, m_nPctHeightRelative);
RENDER_RTF_SHAPE_PROP(L"colStart", sResult, m_nColStart);
RENDER_RTF_SHAPE_PROP(L"colSpan", sResult, m_nColSpan);
RENDER_RTF_SHAPE_PROP(L"pctHorizPos", sResult, m_nPositionHPct);
RENDER_RTF_SHAPE_PROP(L"pctVertPos", sResult, m_nPositionVPct);
RENDER_RTF_SHAPE_PROP(L"pctHoriz", sResult, m_nPctWidth);
RENDER_RTF_SHAPE_PROP(L"pctVert", sResult, m_nPctHeight);
RENDER_RTF_SHAPE_PROP(L"sizerelh", sResult, m_nPctWidthRelative);
RENDER_RTF_SHAPE_PROP(L"sizerelv", sResult, m_nPctHeightRelative);
RENDER_RTF_SHAPE_PROP(L"colStart", sResult, m_nColStart);
RENDER_RTF_SHAPE_PROP(L"colSpan", sResult, m_nColSpan);
//Rehydration
//RENDER_RTF_SHAPE_PROP(L"metroBlob", sResult, m_sMetroBlob);
@ -419,6 +429,7 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP(L"shapeType", sResult, m_nShapeType);
RENDER_RTF_SHAPE_PROP(L"fBehindDocument",sResult, m_nZOrderRelative);
RENDER_RTF_SHAPE_PROP(L"fHidden", sResult, m_bHidden);
RENDER_RTF_SHAPE_PROP(L"fBackground", sResult, m_bBackground);
//Text
//sResult += L"{\\sp{\\sn fLockText}{\\sv 0}}";
@ -430,10 +441,10 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
RENDER_RTF_SHAPE_PROP(L"anchorText", sResult, m_nAnchorText);
//else
{
RENDER_RTF_SHAPE_PROP(L"dxWrapDistLeft", sResult, RtfUtility::Twips2Emu( m_nWrapDistLeft ));
RENDER_RTF_SHAPE_PROP(L"dyWrapDistTop", sResult, RtfUtility::Twips2Emu( m_nWrapDistTop ));
RENDER_RTF_SHAPE_PROP(L"dxWrapDistRight", sResult, RtfUtility::Twips2Emu( m_nWrapDistRight ));
RENDER_RTF_SHAPE_PROP(L"dyWrapDistBottom", sResult, RtfUtility::Twips2Emu( m_nWrapDistBottom ));
RENDER_RTF_SHAPE_PROP(L"dxWrapDistLeft", sResult, RtfUtility::Twips2Emu( m_nWrapDistLeft ));
RENDER_RTF_SHAPE_PROP(L"dyWrapDistTop", sResult, RtfUtility::Twips2Emu( m_nWrapDistTop ));
RENDER_RTF_SHAPE_PROP(L"dxWrapDistRight", sResult, RtfUtility::Twips2Emu( m_nWrapDistRight ));
RENDER_RTF_SHAPE_PROP(L"dyWrapDistBottom", sResult, RtfUtility::Twips2Emu( m_nWrapDistBottom ));
}
RENDER_RTF_SHAPE_PROP(L"fFitShapeToText", sResult, m_bFitShapeToText);
RENDER_RTF_SHAPE_PROP(L"fFitTextToShape", sResult, m_bFitTextToShape);
@ -503,11 +514,16 @@ std::wstring RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter
if (PROP_DEF != m_nFillOpacity)
RENDER_RTF_SHAPE_PROP(L"fillOpacity", sResult, ( m_nFillOpacity * 65536 /100 ) );
RENDER_RTF_SHAPE_PROP(L"fillFocus", sResult, m_nFillFocus );
RENDER_RTF_SHAPE_PROP(L"fillFocus", sResult, m_nFillFocus );
if (PROP_DEF != m_nFillAngle)
RENDER_RTF_SHAPE_PROP(L"fillAngle", sResult, m_nFillAngle * 65536 );
//Line
RENDER_RTF_SHAPE_PROP(L"fillToBottom", sResult, m_nFillToBottom )
RENDER_RTF_SHAPE_PROP(L"fillToTop", sResult, m_nFillToTop )
RENDER_RTF_SHAPE_PROP(L"fillToRight", sResult, m_nFillToRight )
RENDER_RTF_SHAPE_PROP(L"fillToLeft", sResult, m_nFillToLeft )
//Line
if( 0 == m_bLine )
sResult += L"{\\sp{\\sn fLine}{\\sv 0}}";
RENDER_RTF_SHAPE_PROP(L"lineColor", sResult, m_nLineColor );
@ -642,9 +658,11 @@ std::wstring RtfShape::RenderToOOX(RenderParameter oRenderParameter)
return sResult;
}
std::wstring RtfShape::GetShapeNodeName(int type)
std::wstring RtfShape::GetShapeNodeName()
{
switch(type)
if (m_bBackground) return L"v:background";
switch(m_nShapeType)
{
case NSOfficeDrawing::sptRectangle: return L"v:rect";
case NSOfficeDrawing::sptEllipse: return L"v:oval";
@ -707,7 +725,9 @@ std::wstring RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
if (oRenderParameter.sValue.empty())
oRenderParameter.sValue = GetShapeNodeName(m_nShapeType);
{
oRenderParameter.sValue = GetShapeNodeName();
}
sResult += L"<" + oRenderParameter.sValue;
@ -1285,7 +1305,9 @@ std::wstring RtfShape::RenderToOOXEnd(RenderParameter oRenderParameter)
std::wstring sResult;
if (oRenderParameter.sValue.empty())
oRenderParameter.sValue = GetShapeNodeName(m_nShapeType);
{
oRenderParameter.sValue = GetShapeNodeName();
}
sResult += L"</" + oRenderParameter.sValue + L">";

View File

@ -39,6 +39,7 @@ private:
bool m_bDelete;
public:
bool m_bBackground;
bool m_bIsOle;
bool m_bInGroup; //local anchor
@ -166,6 +167,10 @@ public:
int m_nFillOpacity;
int m_nFillFocus;
int m_nFillAngle;
int m_nFillToBottom;
int m_nFillToTop;
int m_nFillToRight;
int m_nFillToLeft;
//int m_bFillShape; //есть копия заливки картинкой
//Line
int m_bLine; //fLine Has a line
@ -251,7 +256,7 @@ public:
}
}
std::wstring RenderToRtfShapeProperty(RenderParameter oRenderParameter);
std::wstring GetShapeNodeName(int type);
std::wstring GetShapeNodeName();
};

View File

@ -274,28 +274,37 @@ int RtfWriter::GetCount()
std::wstring RtfWriter::CreateRtfStart()
{
RenderParameter oRenderParameter;
oRenderParameter.poDocument = &m_oDocument;
oRenderParameter.poWriter = this;
oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
oRenderParameter.poWriter = this;
oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
std::wstring sResult;
sResult += L"{\\rtf1\\ulc1";
sResult += m_oDocument.m_oProperty.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter );
//---------- test
std::wstring sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
if( false == sDefCharProp.empty() )
if( false == sDefCharProp.empty() )
sResult += L"{\\*\\defchp " + sDefCharProp + L"}";
std::wstring sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
if( false == sDefParProp.empty() )
if( false == sDefParProp.empty() )
sResult += L"{\\*\\defpap " + sDefParProp+ L"}";
sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter );
//---------- test
sResult += m_oDocument.m_oListTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oListOverrideTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oRevisionTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oInformation.RenderToRtf ( oRenderParameter );
if (m_oDocument.m_pBackground)
{
sResult += m_oDocument.m_pBackground->RenderToRtf ( oRenderParameter );
}
sResult += L"\\fet2";//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes
std::wstring sFootnote;
@ -323,7 +332,6 @@ std::wstring RtfWriter::CreateRtfStart()
if( !sFootnote.empty() )
sResult += L"{\\*\\aftnsepc " + sFootnote + L"}";
}
sResult += L"\n\n";
return sResult;
}

View File

@ -36,9 +36,7 @@
#include "../../../Common/FileWriter.h"
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
#ifdef _ASC_USE_UNICODE_CONVERTER_
#include "../../../UnicodeConverter/UnicodeConverter.h"
#endif
#include "../../../UnicodeConverter/UnicodeConverter.h"
#include "UniversalConverterUtils.h"
@ -695,7 +693,7 @@ public:
return 1252;//ANSI
}
#ifdef _ASC_USE_UNICODE_CONVERTER_
static std::wstring convert_string(std::string::const_iterator start, std::string::const_iterator end, int nCodepage = 0)
{
std::string sCodePage;
@ -737,100 +735,6 @@ public:
return oConverter.fromUnicode(inptr, insize, sCodePage.c_str());
}
#else
static std::wstring convert_string(std::string::const_iterator start, std::string::const_iterator end, int nCodepage = 0)
{
std::wstring w_out;
bool ansi = true;
size_t insize = end - start;
char *inptr = (char*)start.operator ->();
if (nCodepage > 0)
{
#if defined (_WIN32) || defined (_WIN64)
int insize = MultiByteToWideChar(nCodepage, 0, inptr, -1, NULL, NULL);
wchar_t *out = new wchar_t[insize];
if (out && MultiByteToWideChar(nCodepage, 0, inptr, -1, out, insize) > 0)
{
w_out = std::wstring(out);
ansi = false;
}
if (out) delete []out;
#else
std::string sCodepage = "CP" + std::to_string(nCodepage);
iconv_t ic= iconv_open("WCHAR_T", sCodepage.c_str());
if (ic != (iconv_t) -1)
{
size_t nconv = 0, avail = (insize) * sizeof(wchar_t);
wchar_t *out = new wchar_t[insize];
nconv = iconv (ic, &inptr, &insize, (char**)&out, &avail);
if (nconv == 0)
{
w_out = std::wstring(out);
ansi = false;
}
if (out) delete []out;
iconv_close(ic);
}
#endif
}
if (ansi)
w_out = std::wstring(start, end);
return w_out;
}
static std::string convert_string(std::wstring::const_iterator start, std::wstring::const_iterator end, int nCodepage = 0)
{
std::string out;
bool ansi = true;
size_t insize = end - start;
char *inptr = (char*)start.operator ->();
char* outptr = (char*)out.c_str();
if (nCodepage > 0)
{
#if defined (_WIN32) || defined (_WIN64)
insize = WideCharToMultiByte(nCodepage, 0, (LPCWSTR)inptr, -1, NULL, 0, NULL, NULL);
out.reserve(insize);
if (WideCharToMultiByte(nCodepage, 0, (LPCWSTR)inptr, -1, outptr, (int)insize, NULL, NULL) > 0)
{
out.resize(insize);
ansi = false;
}
#else
out.reserve(insize);
std::string sCodepage = "CP" + std::to_string(nCodepage);
iconv_t ic= iconv_open(sCodepage.c_str(), "WCHAR_T");
if (ic != (iconv_t) -1)
{
size_t nconv = 0, avail = insize * sizeof(wchar_t);
nconv = iconv (ic, &inptr, &insize, &outptr, &avail);
if (nconv == 0)
{
out.resize(insize);
ansi = false;
}
iconv_close(ic);
}
#endif
}
if (ansi)
out = std::string(start, end);
return out;
}
#endif
static int CodepageToCharset( int nCodepage )
{
#if defined (_WIN32) || defined(_WIN64)

View File

@ -30,7 +30,6 @@
*
*/
#include "OOXDocumentWriter.h"
//#include "OOXContentTypesWriter.h"
#include "OOXRelsWriter.h"
#include "OOXDocumentWriter.h"
#include "OOXNumberingWriter.h"
@ -41,33 +40,42 @@
#include "OOXFootnoteWriter.h"
#include "OOXStylesWriter.h"
//#include "../../../../ASCOfficeDocxFile2/BinReader/ContentTypesWriter.h"
std::wstring OOXDocumentWriter::CreateXmlStart()
{
//пишем Footnotes
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
//пишем document.xml
std::wstring sResult = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n");
sResult += _T("<w:document");
sResult += _T(" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"");
sResult += _T(" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"");
sResult += _T(" xmlns:v=\"urn:schemas-microsoft-com:vml\"");
sResult += _T(" xmlns:o=\"urn:schemas-microsoft-com:office:office\"");
sResult += _T(" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"");
sResult += _T(" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"");
sResult += _T(" xmlns:w10=\"urn:schemas-microsoft-com:office:word\"");
sResult += _T(" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"");
sResult += _T(">");
std::wstring sResult = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n";
sResult += L"<w:document";
sResult += L" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"";
sResult += L" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"";
sResult += L" xmlns:v=\"urn:schemas-microsoft-com:vml\"";
sResult += L" xmlns:o=\"urn:schemas-microsoft-com:office:office\"";
sResult += L" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"";
sResult += L" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"";
sResult += L" xmlns:w10=\"urn:schemas-microsoft-com:office:word\"";
sResult += L" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
sResult += L">";
sResult += _T("<w:body>");
if (m_oDocument.m_pBackground)
{
RtfColor color(m_oDocument.m_pBackground->m_nFillColor);
sResult += L"<w:background w:color=\"" + color.ToHexColor() + L"\">";
{
oNewParam.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
sResult += m_oDocument.m_pBackground->RenderToOOX(oNewParam);
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
}
sResult += L"</w:background>";
}
sResult += L"<w:body>";
return sResult;
}
std::wstring OOXDocumentWriter::CreateXmlEnd( )
@ -88,25 +96,25 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( )
{
oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poFootnoteWriter->AddFootnoteBegin( _T("continuationSeparator"), 1, m_oDocument.m_oFootnoteCon->RenderToOOX( oNewParam ) );
poFootnoteWriter->AddFootnoteBegin( L"continuationSeparator", 1, m_oDocument.m_oFootnoteCon->RenderToOOX( oNewParam ) );
}
if( NULL != m_oDocument.m_oFootnoteSep )
{
oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poFootnoteWriter->AddFootnoteBegin( _T("separator"), 0, m_oDocument.m_oFootnoteSep->RenderToOOX(oNewParam) );
poFootnoteWriter->AddFootnoteBegin( L"separator", 0, m_oDocument.m_oFootnoteSep->RenderToOOX(oNewParam) );
}
if( NULL != m_oDocument.m_oEndnoteCon )
{
oNewParam.poRels = poEndnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poEndnoteWriter->AddEndnoteBegin( _T("continuationSeparator"), 1, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) );
poEndnoteWriter->AddEndnoteBegin( L"continuationSeparator", 1, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) );
}
if( NULL != m_oDocument.m_oEndnoteSep )
{
oNewParam.poRels = poEndnoteWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poEndnoteWriter->AddEndnoteBegin( _T("separator"), 0, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) );
poEndnoteWriter->AddEndnoteBegin( L"separator", 0, m_oDocument.m_oEndnoteSep->RenderToOOX(oNewParam) );
}
//fontTable.xml
@ -142,20 +150,20 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( )
if( false == sTempParaDef.empty() || false == sTempCharDef.empty() )
{
sStyles += _T("<w:docDefaults>");
sStyles += L"<w:docDefaults>";
if( false == sTempCharDef.empty() )
{
sStyles += _T("<w:rPrDefault><w:rPr>");
sStyles += L"<w:rPrDefault><w:rPr>";
sStyles += sTempCharDef ;
sStyles += _T("</w:rPr></w:rPrDefault>");
sStyles += L"</w:rPr></w:rPrDefault>";
}
if( false == sTempParaDef.empty() )
{
sStyles += _T("<w:pPrDefault><w:pPr>");
sStyles += L"<w:pPrDefault><w:pPr>";
sStyles += sTempParaDef;
sStyles += _T("</w:pPr></w:pPrDefault>");
sStyles += L"</w:pPr></w:pPrDefault>";
}
sStyles += _T("</w:docDefaults>");
sStyles += L"</w:docDefaults>";
}
sStyles += m_oDocument.m_oStyleTable.RenderToOOX(oNewParam);
@ -182,28 +190,28 @@ std::wstring OOXDocumentWriter::CreateXmlEnd( )
sResult += m_oDocument[0].props->m_oProperty.RenderToOOX(oNewParam);
sResult += _T("</w:body>");
sResult += _T("</w:document>");
sResult += L"</w:body>";
sResult += L"</w:document>";
return sResult;
}
bool OOXDocumentWriter::SaveByItemStart( std::wstring sFolder )
{
std::wstring pathWord = sFolder + FILE_SEPARATOR_STR + _T("word");
std::wstring pathWord = sFolder + FILE_SEPARATOR_STR + L"word";
NSDirectory::CreateDirectory(pathWord) ;
try
{
std::wstring sFilename = pathWord + FILE_SEPARATOR_STR + _T("document.xml");
std::wstring sFilename = pathWord + FILE_SEPARATOR_STR + L"document.xml";
m_oFileWriter = new NFileWriter::CBufferedFileWriter( sFilename );
}
catch(...)
{
return false;
}
m_oWriter.m_oRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"), _T("word/document.xml") );
m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), _T("/word/document.xml") );
m_oWriter.m_oRels.AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"word/document.xml" );
m_oWriter.m_oContentTypes.AddContent( L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word/document.xml" );
std::wstring sXml = CreateXmlStart( );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml);
@ -261,7 +269,7 @@ bool OOXDocumentWriter::SaveByItem()
else
{
//генерация ???
sXml = _T("<w:p><w:pPr>") + sectPr + _T("</w:pPr></w:p>");
sXml = L"<w:p><w:pPr>" + sectPr + L"</w:pPr></w:p>";
}
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml);

View File

@ -38,10 +38,10 @@
class OOXDocumentWriter
{
private:
OOXWriter& m_oWriter;
RtfDocument& m_oDocument;
NFileWriter::CBufferedFileWriter* m_oFileWriter;
bool m_bFirst; //один параграф пишем другой храним в памяти
OOXWriter& m_oWriter;
RtfDocument& m_oDocument;
NFileWriter::CBufferedFileWriter* m_oFileWriter;
bool m_bFirst; //один параграф пишем другой храним в памяти
public:
OOXDocumentWriter( OOXWriter& oWriter,RtfDocument& oDocument ): m_oWriter(oWriter), m_oDocument(oDocument)
{
@ -64,7 +64,9 @@ public:
{
int nCount = 0;
for( int i = 0; i < m_oDocument.GetCount(); i++ )
{
nCount += m_oDocument[i].props->GetCount();
}
return nCount;
}
};

View File

@ -3,7 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtfFormatLib", "..\RtfFormatLib\Win32\RtfFormatLib.vcproj", "{AF2D00A7-A351-4700-AE88-C1D9ADE29345}"
ProjectSection(ProjectDependencies) = postProject
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}
EndProjectSection
EndProject
@ -14,21 +13,21 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DocxFormat", "..\..\Common\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "raster", "..\..\DesktopEditor\raster\raster_vs2005.vcproj", "{9CAA294E-58C3-4CEB-ABA0-CB9786CA5540}"
ProjectSection(ProjectDependencies) = postProject
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cximage", "..\..\DesktopEditor\cximage\CxImage\cximage_vs2005.vcproj", "{BC52A07C-A797-423D-8C4F-8678805BBB36}"
ProjectSection(ProjectDependencies) = postProject
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{818753F2-DBB9-4D3B-898A-A604309BE470} = {818753F2-DBB9-4D3B-898A-A604309BE470}
{FFDA5DA1-BB65-4695-B678-BE59B4A1355D} = {FFDA5DA1-BB65-4695-B678-BE59B4A1355D}
{EE1B576A-07C5-4ACC-920F-81C41DD0C8C1} = {EE1B576A-07C5-4ACC-920F-81C41DD0C8C1}
{9A037A69-D1DF-4505-AB2A-6CB3641C476E} = {9A037A69-D1DF-4505-AB2A-6CB3641C476E}
{40A69F40-063E-43FD-8543-455495D8733E} = {40A69F40-063E-43FD-8543-455495D8733E}
{0588563C-F05C-428C-B21A-DD74756628B3} = {0588563C-F05C-428C-B21A-DD74756628B3}
{DF861D33-9BC1-418C-82B1-581F590FE169} = {DF861D33-9BC1-418C-82B1-581F590FE169}
{764C3A2D-FB0F-428E-B1C7-62D1DD2CE239} = {764C3A2D-FB0F-428E-B1C7-62D1DD2CE239}
{43A0E60E-5C4A-4C09-A29B-7683F503BBD7} = {43A0E60E-5C4A-4C09-A29B-7683F503BBD7}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jasper", "..\..\DesktopEditor\cximage\jasper\jasper_vs2005.vcproj", "{FFDA5DA1-BB65-4695-B678-BE59B4A1355D}"
@ -53,15 +52,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OfficeUtilsLib", "..\..\Off
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RtfFormatTest", "RtfFormatTest.vcproj", "{0F49D5D1-A8D3-4F97-8BC1-E2F65BB00C10}"
ProjectSection(ProjectDependencies) = postProject
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{AF2D00A7-A351-4700-AE88-C1D9ADE29345} = {AF2D00A7-A351-4700-AE88-C1D9ADE29345}
{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}
{AF2D00A7-A351-4700-AE88-C1D9ADE29345} = {AF2D00A7-A351-4700-AE88-C1D9ADE29345}
{36636678-AE25-4BE6-9A34-2561D1BCF302} = {36636678-AE25-4BE6-9A34-2561D1BCF302}
{617F9069-5E37-4B80-9A3A-E77AFC4CC7AD} = {617F9069-5E37-4B80-9A3A-E77AFC4CC7AD}
{A100103A-353E-45E8-A9B8-90B87CC5C0B0} = {A100103A-353E-45E8-A9B8-90B87CC5C0B0}
{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}
{C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56}
{F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363}
{21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPTXFormat", "..\..\ASCOfficePPTXFile\PPTXLib\PPTXFormat.vcproj", "{36636678-AE25-4BE6-9A34-2561D1BCF302}"

View File

@ -295,6 +295,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
@ -325,6 +326,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
HEADER_SEARCH_PATHS = (
"$(inherited)",

View File

@ -31,14 +31,6 @@
*/
#include "HelpFunc.h"
#ifndef _ASC_USE_UNICODE_CONVERTER_
#if defined (_WIN32) || defined (_WIN64)
#include "shlwapi.h"
#else
#include <iconv.h>
#endif
#endif
#include "../../../../UnicodeConverter/UnicodeConverter.h"
#include <Logic/Biff_structures/CellRangeRef.h>
@ -454,7 +446,6 @@ const size_t hex_str2int(const std::wstring::const_iterator& it_begin, const std
return numeric;
}
#ifdef _ASC_USE_UNICODE_CONVERTER_
const std::wstring toStdWString(std::string ansi_string, const unsigned int code_page)
{
std::string sCodePage;
@ -506,131 +497,6 @@ const std::string toStdString(std::wstring wide_string, const unsigned int code_
NSUnicodeConverter::CUnicodeConverter oConverter;
return oConverter.fromUnicode(wide_string, sCodePage.c_str());
}
#else
const std::string toStdString(std::wstring wide_string, const unsigned int code_page)
{
#if defined (_WIN32) || defined (_WIN64)
const int nSize = WideCharToMultiByte(code_page, 0, wide_string.c_str(), wide_string.length(), NULL, 0, NULL, NULL);
char *sTemp = new char[nSize];
if (!sTemp)
return std::string();
int size = WideCharToMultiByte(code_page, 0, wide_string.c_str(), wide_string.length(), sTemp, nSize, NULL, NULL);
std::string sResult(sTemp, size);
delete []sTemp;
return sResult;
#else
std::string out;
bool ansi = true;
size_t insize = wide_string.length();
out.reserve(insize);
char *inptr = (char*)wide_string.c_str();
char* outptr = (char*)out.c_str();
if (code_page >= 0)
{
std::string sCodepage = "CP" + std::to_string(code_page);
iconv_t ic= iconv_open(sCodepage.c_str(), "WCHAR_T");
if (ic != (iconv_t) -1)
{
size_t nconv = 0, avail = insize * sizeof(wchar_t);
nconv = iconv (ic, &inptr, &insize, &outptr, &avail);
if (nconv == 0) ansi = false;
iconv_close(ic);
}
}
if (ansi)
out = std::string(wide_string.begin(), wide_string.end());
return out;
#endif
}
const std::wstring toStdWString(char* ansi, int size, const unsigned int code_page)
{
std::string sCodePage;
for (int i = 0; i < UNICODE_CONVERTER_ENCODINGS_COUNT; ++i)
{
if (code_page == NSUnicodeConverter::Encodings[i].WindowsCodePage)
{
sCodePage = NSUnicodeConverter::Encodings[i].Name;
break;
}
}
if (!sCodePage.empty())
{
NSUnicodeConverter::CUnicodeConverter oConverter;
return oConverter.toUnicode(ansi, size, sCodePage.c_str());
}
#if defined (_WIN32) || defined (_WIN64)
const int nSize = MultiByteToWideChar(code_page, 0, ansi, size, NULL, 0);
wchar_t *sTemp = new wchar_t[nSize];
if (!sTemp)
return std::wstring();
int size_out = MultiByteToWideChar(code_page, 0, ansi, size, sTemp, nSize);
std::wstring sResult(sTemp, size_out);
delete []sTemp;
return sResult;
#else
bool bAnsi = true;
size_t insize = size;
std::wstring w_out;
char *inptr = ansi;
if (code_page >= 0)
{
std::string sCodepage = "CP" + std::to_string(code_page);
iconv_t ic= iconv_open("WCHAR_T", sCodepage.c_str());
if (ic != (iconv_t) -1)
{
size_t nconv = 0, avail = (insize + 1) * sizeof(wchar_t);
char* out_str = new char[avail];
char* outptr = out_str;
nconv = iconv (ic, &inptr, &insize, &outptr, &avail);
if (nconv == 0)
{
insize = size;
((wchar_t*)out_str)[insize] = 0;
w_out = std::wstring((wchar_t*)out_str, insize);
bAnsi = false;
}
iconv_close(ic);
delete []out_str;
}
}
if (bAnsi)
{
std::string ansi_string(ansi, size);
w_out = std::wstring(ansi_string.begin(), ansi_string.end());
}
return w_out;
#endif
}
const std::wstring toStdWString(std::string ansi_string, const unsigned int code_page)
{
return toStdWString((char*)ansi_string.c_str(), (int)ansi_string.length(), code_page);
}
#endif
} // namespace STR
@ -639,7 +505,6 @@ namespace XMLSTUFF
{;
const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>& sheets_names)
{
if(tabid >= 0 && static_cast<unsigned short>(tabid) < sheets_names.size())

View File

@ -32,6 +32,7 @@
#pragma once
#include <map>
#include <string>
namespace XLS
{

View File

@ -2417,44 +2417,12 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
std::wstring image_path = context_.get_mediaitems().media_path() + drawing_state->fill.texture_target.substr(6);
int rgbColor1 = STR::hex_str2int(sRgbColor1);
int rgbColor2 = STR::hex_str2int(sRgbColor2);
size_t rgbColor1 = STR::hex_str2int(sRgbColor1);
size_t rgbColor2 = STR::hex_str2int(sRgbColor2);
CBgraFrame bgraFrame;
if (bgraFrame.OpenFile(image_path))
{
int smpl = abs(bgraFrame.get_Stride() / bgraFrame.get_Width());
BYTE * rgb = bgraFrame.get_Data();
BYTE R1 = (BYTE)(rgbColor1);
BYTE G1 = (BYTE)(rgbColor1 >> 8);
BYTE B1 = (BYTE)(rgbColor1 >> 16);
BYTE R2 = (BYTE)(rgbColor2);
BYTE G2 = (BYTE)(rgbColor2 >> 8);
BYTE B2 = (BYTE)(rgbColor2 >> 16);
for (int i = 0 ; i < bgraFrame.get_Width() * bgraFrame.get_Height(); i++)
{
if (rgb[i * smpl + 0 ] == 0x00 && rgb[i * smpl + 1 ] == 0x00 && rgb[i * smpl + 2 ] == 0x00)
{
rgb[i * smpl + 0 ] = R1;
rgb[i * smpl + 1 ] = G1;
rgb[i * smpl + 2 ] = B1;
}
else
{
rgb[i * smpl + 0 ] = R2;
rgb[i * smpl + 1 ] = G2;
rgb[i * smpl + 2 ] = B2;
}
}
bgraFrame.SaveFile(image_path, 1);
return true;
}
return false;
return bgraFrame.ReColorPatternImage(image_path, rgbColor1, rgbColor2);
}
void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)

View File

@ -29,10 +29,6 @@ DEFINES += _DEBUG
}
core_mac {
DEFINES += \
_ASC_USE_UNICODE_CONVERTER_ \
UNICODECONVERTER_USE_DYNAMIC_LIBRARY
LIBS += $$DESTDIR -lUnicodeConverter
}

View File

@ -1317,6 +1317,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (
@ -1356,6 +1357,7 @@
MAC,
unix,
_IOS,
DONT_WRITE_EMBEDDED_FONTS,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
HEADER_SEARCH_PATHS = (

View File

@ -112,21 +112,21 @@ namespace SimpleTypes
virtual ECalendarType FromString(std::wstring &sValue)
{
if ( _T("gregorian") == sValue ) this->m_eValue = calendartypeGregorian;
else if ( _T("gregorianArabic") == sValue ) this->m_eValue = calendartypeGregorianArabic;
else if ( _T("gregorianMeFrench") == sValue ) this->m_eValue = calendartypeGregorianMeFrench;
else if ( _T("gregorianUs") == sValue ) this->m_eValue = calendartypeGregorianUs;
else if ( _T("gregorianXlitEnglish") == sValue ) this->m_eValue = calendartypeGregorianXlitEnglish;
else if ( _T("gregorianXlitFrench") == sValue ) this->m_eValue = calendartypeGregorianXlitFrench;
else if ( _T("hebrew") == sValue ) this->m_eValue = calendartypeHebrew;
else if ( _T("hijri") == sValue ) this->m_eValue = calendartypeHijri;
else if ( _T("japan") == sValue ) this->m_eValue = calendartypeJapan;
else if ( _T("korea") == sValue ) this->m_eValue = calendartypeKorea;
else if ( _T("none") == sValue ) this->m_eValue = calendartypeNone;
else if ( _T("saka") == sValue ) this->m_eValue = calendartypeSaka;
else if ( _T("taiwan") == sValue ) this->m_eValue = calendartypeTaiwan;
else if ( _T("thai") == sValue ) this->m_eValue = calendartypeThai;
else this->m_eValue = eDefValue;
if ( L"gregorian" == sValue ) this->m_eValue = calendartypeGregorian;
else if ( L"gregorianArabic" == sValue ) this->m_eValue = calendartypeGregorianArabic;
else if ( L"gregorianMeFrench" == sValue ) this->m_eValue = calendartypeGregorianMeFrench;
else if ( L"gregorianUs" == sValue ) this->m_eValue = calendartypeGregorianUs;
else if ( L"gregorianXlitEnglish" == sValue ) this->m_eValue = calendartypeGregorianXlitEnglish;
else if ( L"gregorianXlitFrench" == sValue ) this->m_eValue = calendartypeGregorianXlitFrench;
else if ( L"hebrew" == sValue ) this->m_eValue = calendartypeHebrew;
else if ( L"hijri" == sValue ) this->m_eValue = calendartypeHijri;
else if ( L"japan" == sValue ) this->m_eValue = calendartypeJapan;
else if ( L"korea" == sValue ) this->m_eValue = calendartypeKorea;
else if ( L"none" == sValue ) this->m_eValue = calendartypeNone;
else if ( L"saka" == sValue ) this->m_eValue = calendartypeSaka;
else if ( L"taiwan" == sValue ) this->m_eValue = calendartypeTaiwan;
else if ( L"thai" == sValue ) this->m_eValue = calendartypeThai;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
@ -135,21 +135,21 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case calendartypeGregorian : return _T("gregorian");
case calendartypeGregorianArabic : return _T("gregorianArabic");
case calendartypeGregorianMeFrench : return _T("gregorianMeFrench");
case calendartypeGregorianUs : return _T("gregorianUs");
case calendartypeGregorianXlitEnglish : return _T("gregorianXlitEnglish");
case calendartypeGregorianXlitFrench : return _T("gregorianXlitFrench");
case calendartypeHebrew : return _T("hebrew");
case calendartypeHijri : return _T("hijri");
case calendartypeJapan : return _T("japan");
case calendartypeKorea : return _T("korea");
case calendartypeNone : return _T("none");
case calendartypeSaka : return _T("saka");
case calendartypeTaiwan : return _T("taiwan");
case calendartypeThai : return _T("thai");
default : return _T("none");
case calendartypeGregorian : return L"gregorian";
case calendartypeGregorianArabic : return L"gregorianArabic";
case calendartypeGregorianMeFrench : return L"gregorianMeFrench";
case calendartypeGregorianUs : return L"gregorianUs";
case calendartypeGregorianXlitEnglish : return L"gregorianXlitEnglish";
case calendartypeGregorianXlitFrench : return L"gregorianXlitFrench";
case calendartypeHebrew : return L"hebrew";
case calendartypeHijri : return L"hijri";
case calendartypeJapan : return L"japan";
case calendartypeKorea : return L"korea";
case calendartypeNone : return L"none";
case calendartypeSaka : return L"saka";
case calendartypeTaiwan : return L"taiwan";
case calendartypeThai : return L"thai";
default : return L"none";
}
}
@ -174,9 +174,9 @@ namespace SimpleTypes
virtual EConformanceClass FromString(std::wstring &sValue)
{
if ( _T("strict") == sValue ) this->m_eValue = conformanceclassStrict;
else if ( _T("transitional") == sValue ) this->m_eValue = conformanceclassTransitional;
else this->m_eValue = eDefValue;
if ( L"strict" == sValue ) this->m_eValue = conformanceclassStrict;
else if ( L"transitional" == sValue ) this->m_eValue = conformanceclassTransitional;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
@ -185,9 +185,9 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case conformanceclassStrict : return _T("strict");
case conformanceclassTransitional : return _T("transitional");
default : return _T("strict");
case conformanceclassStrict : return L"strict";
case conformanceclassTransitional : return L"transitional";
default : return L"strict";
}
}
@ -514,16 +514,16 @@ namespace SimpleTypes
virtual EOnOff FromString(std::wstring &sValue)
{
if ( _T("true") == sValue ) this->m_eValue = onoffTrue;
else if ( _T("True") == sValue ) this->m_eValue = onoffTrue;
else if ( _T("1") == sValue ) this->m_eValue = onoffTrue;
else if ( _T("t") == sValue ) this->m_eValue = onoffTrue;
else if ( _T("on") == sValue ) this->m_eValue = onoffTrue;
else if ( _T("f") == sValue ) this->m_eValue = onoffFalse;
else if ( _T("0") == sValue ) this->m_eValue = onoffFalse;
else if ( _T("false") == sValue ) this->m_eValue = onoffFalse;
else if ( _T("False") == sValue ) this->m_eValue = onoffFalse;
else if ( _T("off") == sValue ) this->m_eValue = onoffFalse;
if ( L"true" == sValue ) this->m_eValue = onoffTrue;
else if ( L"True" == sValue ) this->m_eValue = onoffTrue;
else if ( L"1" == sValue ) this->m_eValue = onoffTrue;
else if ( L"t" == sValue ) this->m_eValue = onoffTrue;
else if ( L"on" == sValue ) this->m_eValue = onoffTrue;
else if ( L"f" == sValue ) this->m_eValue = onoffFalse;
else if ( L"0" == sValue ) this->m_eValue = onoffFalse;
else if ( L"false" == sValue ) this->m_eValue = onoffFalse;
else if ( L"False" == sValue ) this->m_eValue = onoffFalse;
else if ( L"off" == sValue ) this->m_eValue = onoffFalse;
else this->m_eValue = eDefValue;
return this->m_eValue;
@ -533,9 +533,9 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case onoffFalse : return _T("false");
case onoffTrue : return _T("true");
default : return _T("false");
case onoffFalse : return L"false";
case onoffTrue : return L"true";
default : return L"false";
}
}
std::wstring ToString2(EOnOffToString eType) const
@ -544,39 +544,39 @@ namespace SimpleTypes
{
switch (this->m_eValue)
{
case onoffFalse: return _T("false");
case onoffTrue: return _T("true");
default: return _T("false");
case onoffFalse: return L"false";
case onoffTrue: return L"true";
default: return L"false";
}
}
else if (onofftostring1 == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("0");
case onoffTrue: return _T("1");
default: return _T("0");
case onoffFalse: return L"0";
case onoffTrue: return L"1";
default: return L"0";
}
}
else if (onofftostringOn == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("off");
case onoffTrue: return _T("on");
default: return _T("off");
case onoffFalse: return L"off";
case onoffTrue: return L"on";
default: return L"off";
}
}
else if (onofftostringT == eType)
{
switch (this->m_eValue)
{
case onoffFalse: return _T("f");
case onoffTrue: return _T("t");
default: return _T("f");
case onoffFalse: return L"f";
case onoffTrue: return L"t";
default: return L"f";
}
}
return _T("false");
return L"false";
}
std::wstring ToString3(EOnOffToString eType) const
{
@ -584,39 +584,39 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case onoffFalse : return _T("false");
case onoffTrue : return _T("true");
default : return _T("false");
case onoffFalse : return L"false";
case onoffTrue : return L"true";
default : return L"false";
}
}
else if(onofftostring1 == eType)
{
switch(this->m_eValue)
{
case onoffFalse : return _T("0");
case onoffTrue : return _T("1");
default : return _T("0");
case onoffFalse : return L"0";
case onoffTrue : return L"1";
default : return L"0";
}
}
else if(onofftostringOn == eType)
{
switch(this->m_eValue)
{
case onoffFalse : return _T("off");
case onoffTrue : return _T("on");
default : return _T("off");
case onoffFalse : return L"off";
case onoffTrue : return L"on";
default : return L"off";
}
}
else if(onofftostringT == eType)
{
switch(this->m_eValue)
{
case onoffFalse : return _T("f");
case onoffTrue : return _T("t");
default : return _T("f");
case onoffFalse : return L"f";
case onoffTrue : return L"t";
default : return L"f";
}
}
return _T("false");
return L"false";
}
bool ToBool()
{
@ -658,7 +658,7 @@ namespace SimpleTypes
m_sValue = sValue;
for ( size_t nIndex = 0; nIndex < 20 - sValue.length(); nIndex++ )
{
m_sValue += _T("0");
m_sValue += L"0";
}
}
else if ( 20 == sValue.length() )
@ -826,9 +826,9 @@ namespace SimpleTypes
virtual EVerticalAlignRun FromString(std::wstring &sValue)
{
if ( _T("baseline") == sValue ) this->m_eValue = verticalalignrunBaseline;
else if ( _T("subscript") == sValue ) this->m_eValue = verticalalignrunSubscript;
else if ( _T("superscript") == sValue ) this->m_eValue = verticalalignrunSuperscript;
if ( L"baseline" == sValue ) this->m_eValue = verticalalignrunBaseline;
else if ( L"subscript" == sValue ) this->m_eValue = verticalalignrunSubscript;
else if ( L"superscript" == sValue ) this->m_eValue = verticalalignrunSuperscript;
else this->m_eValue = eDefValue;
return this->m_eValue;
@ -838,10 +838,10 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case verticalalignrunBaseline : return _T("baseline");
case verticalalignrunSubscript : return _T("subscript");
case verticalalignrunSuperscript : return _T("superscript");
default : return _T("baseline");
case verticalalignrunBaseline : return L"baseline";
case verticalalignrunSubscript : return L"subscript";
case verticalalignrunSuperscript : return L"superscript";
default : return L"baseline";
}
}
@ -871,12 +871,12 @@ namespace SimpleTypes
virtual EXAlign FromString(std::wstring &sValue)
{
if ( _T("center") == sValue ) this->m_eValue = xalignCenter;
else if ( _T("inside") == sValue ) this->m_eValue = xalignInside;
else if ( _T("left") == sValue ) this->m_eValue = xalignLeft;
else if ( _T("outside") == sValue ) this->m_eValue = xalignOutside;
else if ( _T("right") == sValue ) this->m_eValue = xalignRight;
else this->m_eValue = eDefValue;
if ( L"center" == sValue ) this->m_eValue = xalignCenter;
else if ( L"inside" == sValue ) this->m_eValue = xalignInside;
else if ( L"left" == sValue ) this->m_eValue = xalignLeft;
else if ( L"outside" == sValue ) this->m_eValue = xalignOutside;
else if ( L"right" == sValue ) this->m_eValue = xalignRight;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
@ -885,12 +885,12 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case xalignCenter : return _T("center");
case xalignInside : return _T("inside");
case xalignLeft : return _T("left");
case xalignOutside : return _T("outside");
case xalignRight : return _T("right");
default : return _T("left");
case xalignCenter : return L"center";
case xalignInside : return L"inside";
case xalignLeft : return L"left";
case xalignOutside : return L"outside";
case xalignRight : return L"right";
default : return L"left";
}
}
@ -923,14 +923,14 @@ namespace SimpleTypes
virtual EYAlign FromString(std::wstring &sValue)
{
if ( _T("bottom") == sValue ) this->m_eValue = yalignBottom;
else if ( _T("bot") == sValue ) this->m_eValue = yalignBottom;
else if ( _T("center") == sValue ) this->m_eValue = yalignCenter;
else if ( _T("inline") == sValue ) this->m_eValue = yalignInline;
else if ( _T("inside") == sValue ) this->m_eValue = yalignInside;
else if ( _T("outside") == sValue ) this->m_eValue = yalignOutside;
else if ( _T("top") == sValue ) this->m_eValue = yalignTop;
else this->m_eValue = eDefValue;
if ( L"bottom" == sValue ) this->m_eValue = yalignBottom;
else if ( L"bot" == sValue ) this->m_eValue = yalignBottom;
else if ( L"center" == sValue ) this->m_eValue = yalignCenter;
else if ( L"inline" == sValue ) this->m_eValue = yalignInline;
else if ( L"inside" == sValue ) this->m_eValue = yalignInside;
else if ( L"outside" == sValue ) this->m_eValue = yalignOutside;
else if ( L"top" == sValue ) this->m_eValue = yalignTop;
else this->m_eValue = eDefValue;
return this->m_eValue;
}
@ -939,13 +939,13 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case yalignBottom : return _T("bottom");
case yalignCenter : return _T("center");
case yalignInline : return _T("inline");
case yalignInside : return _T("inside");
case yalignOutside : return _T("outside");
case yalignTop : return _T("top");
default : return _T("top");
case yalignBottom : return L"bottom";
case yalignCenter : return L"center";
case yalignInline : return L"inline";
case yalignInside : return L"inside";
case yalignOutside : return L"outside";
case yalignTop : return L"top";
default : return L"top";
}
}
@ -1180,22 +1180,22 @@ namespace SimpleTypes
}
void ByColorName(std::wstring& sValue)
{
if (sValue.find(_T("aqua")) >= 0)this->m_eValue = colortypeAqua;
else if (sValue.find(_T("black")) >= 0)this->m_eValue = colortypeBlack;
else if (sValue.find(_T("blue")) >= 0)this->m_eValue = colortypeBlue;
else if (sValue.find(_T("fuchsia")) >= 0)this->m_eValue = colortypeFuchsia;
else if (sValue.find(_T("gray")) >= 0)this->m_eValue = colortypeGray;
else if (sValue.find(_T("green")) >= 0)this->m_eValue = colortypeGreen;
else if (sValue.find(_T("lime")) >= 0)this->m_eValue = colortypeLime;
else if (sValue.find(_T("maroon")) >= 0)this->m_eValue = colortypeMaroon;
else if (sValue.find(_T("navy")) >= 0)this->m_eValue = colortypeNavy;
else if (sValue.find(_T("olive")) >= 0)this->m_eValue = colortypeOlive;
else if (sValue.find(_T("purple")) >= 0)this->m_eValue = colortypePurple;
else if (sValue.find(_T("red")) >= 0)this->m_eValue = colortypeRed;
else if (sValue.find(_T("silver")) >= 0)this->m_eValue = colortypeSilver;
else if (sValue.find(_T("teal")) >= 0)this->m_eValue = colortypeTeal;
else if (sValue.find(_T("white")) >= 0)this->m_eValue = colortypeWhite;
else if (sValue.find(_T("yellow")) >= 0)this->m_eValue = colortypeYellow;
if (std::wstring::npos != sValue.find(L"aqua")) this->m_eValue = colortypeAqua;
else if (std::wstring::npos != sValue.find(L"black")) this->m_eValue = colortypeBlack;
else if (std::wstring::npos != sValue.find(L"blue")) this->m_eValue = colortypeBlue;
else if (std::wstring::npos != sValue.find(L"fuchsia")) this->m_eValue = colortypeFuchsia;
else if (std::wstring::npos != sValue.find(L"gray")) this->m_eValue = colortypeGray;
else if (std::wstring::npos != sValue.find(L"green")) this->m_eValue = colortypeGreen;
else if (std::wstring::npos != sValue.find(L"lime")) this->m_eValue = colortypeLime;
else if (std::wstring::npos != sValue.find(L"maroon")) this->m_eValue = colortypeMaroon;
else if (std::wstring::npos != sValue.find(L"navy")) this->m_eValue = colortypeNavy;
else if (std::wstring::npos != sValue.find(L"olive")) this->m_eValue = colortypeOlive;
else if (std::wstring::npos != sValue.find(L"purple")) this->m_eValue = colortypePurple;
else if (std::wstring::npos != sValue.find(L"red")) this->m_eValue = colortypeRed;
else if (std::wstring::npos != sValue.find(L"silver")) this->m_eValue = colortypeSilver;
else if (std::wstring::npos != sValue.find(L"teal")) this->m_eValue = colortypeTeal;
else if (std::wstring::npos != sValue.find(L"white")) this->m_eValue = colortypeWhite;
else if (std::wstring::npos != sValue.find(L"yellow")) this->m_eValue = colortypeYellow;
else this->m_eValue = colortypeNone;
SetRGB();
@ -1227,14 +1227,14 @@ namespace SimpleTypes
virtual ETrueFalse FromString(std::wstring &sValue)
{
if ( _T("t") == sValue ) this->m_eValue = booleanTrue;
else if ( _T("true") == sValue ) this->m_eValue = booleanTrue;
else if ( _T("True") == sValue ) this->m_eValue = booleanTrue;
else if ( _T("") == sValue ) this->m_eValue = booleanFalse;
else if ( _T("f") == sValue ) this->m_eValue = booleanFalse;
else if ( _T("false") == sValue ) this->m_eValue = booleanFalse;
else if ( _T("False") == sValue ) this->m_eValue = booleanFalse;
else this->m_eValue = booleanFalse;
if ( L"t" == sValue ) this->m_eValue = booleanTrue;
else if ( L"true" == sValue ) this->m_eValue = booleanTrue;
else if ( L"True" == sValue ) this->m_eValue = booleanTrue;
else if ( L"" == sValue ) this->m_eValue = booleanFalse;
else if ( L"f" == sValue ) this->m_eValue = booleanFalse;
else if ( L"false" == sValue ) this->m_eValue = booleanFalse;
else if ( L"False" == sValue ) this->m_eValue = booleanFalse;
else this->m_eValue = booleanFalse;
return this->m_eValue;
}
@ -1243,9 +1243,9 @@ namespace SimpleTypes
{
switch(this->m_eValue)
{
case booleanFalse : return _T("f");
case booleanTrue : return _T("t");
default : return _T("f");
case booleanFalse : return L"f";
case booleanTrue : return L"t";
default : return L"f";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -213,6 +213,7 @@ namespace OOX
}
virtual void read(const CPath& oRootPath, const CPath& oFilePath)
{
m_oReadPath = oFilePath;
IFileContainer::Read( oRootPath, oFilePath );
//#ifdef USE_LITE_READER
@ -259,7 +260,12 @@ namespace OOX
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
CPath m_oReadPath;
NSCommon::nullable<PPTX::Logic::SpTree> m_oShapeTree;
};

View File

@ -643,7 +643,7 @@ namespace OOX
nullable<OOX::Logic::CBackground > m_oBackground;
std::vector<WritingElement *> m_arrItems;
std::vector<std::wstring> m_arrShapeTypes;
std::vector<std::wstring> m_arrShapeTypes;
};

View File

@ -53,7 +53,8 @@ namespace OOX
FileType(const WCHAR* defaultDirectory, const WCHAR* defaultFileName,
const std::wstring& overrideType,
const std::wstring& relationType, bool bEnumerated = false, bool bEnumeratedGlobal = false ) : m_defaultDirectory(defaultDirectory),
const std::wstring& relationType, bool bEnumerated = false, bool bEnumeratedGlobal = false )
: m_defaultDirectory(defaultDirectory),
m_defaultFileName(defaultFileName),
m_overrideType(overrideType),
m_relationType(relationType),

View File

@ -60,77 +60,77 @@ namespace OOX
virtual ~CVmlCommonElements(){}
virtual void fromXML(XmlUtils::CXmlNode& oNode){}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlNode& oNode){}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes (oReader);
ReadElements (oReader);
}
virtual std::wstring toXML() const;
virtual EElementType getType() const
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
return et_v_shape_elements;
}
// 1 AG_AllCoreAttributes
// 1.1 AG_CoreAttributes
nullable<std::wstring> m_sId;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<std::wstring> m_sHref;
nullable<std::wstring> m_sTarget;
nullable<std::wstring> m_sClass;
nullable<std::wstring> m_sTitle;
nullable<std::wstring> m_sAlt;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordSize;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordOrigin;
nullable<SimpleTypes::Vml::CVml_Polygon2D> m_oWrapCoords;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oPrint;
// 1.2 AG_OfficeCoreAttributes
nullable<std::wstring> m_sSpId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOned;
nullable<SimpleTypes::CDecimalNumber<>> m_oRegroupId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oDoubleClickNotify;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oButton;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserHidden;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBullet;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHr;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrStd;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrNoShade;
SimpleTypes::CDouble m_oHrPct;
SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn;
nullable<SimpleTypes::CColorType<>> m_oBorderTopColor;
nullable<SimpleTypes::CColorType<>> m_oBorderLeftColor;
nullable<SimpleTypes::CColorType<>> m_oBorderBottomColor;
nullable<SimpleTypes::CColorType<>> m_oBorderRightColor;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayout;
nullable<std::wstring> m_oDgmNodeKind;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayoutMru;
SimpleTypes::CInsetMode<SimpleTypes::insetmodeAuto> m_oInsetMode;
// 2 AG_AllShapeAttributes
// 2.1 AG_ShapeAttributes
nullable<SimpleTypes::CColorType<>> m_oChromaKey;
nullable<SimpleTypes::CTrueFalse<>> m_oFilled;
nullable<SimpleTypes::CColorType<>> m_oFillColor;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oOpacity;
nullable<SimpleTypes::CTrueFalse<>> m_oStroked;
nullable<SimpleTypes::CColorType<>> m_oStrokeColor;
nullable<SimpleTypes::CEmu> m_oStrokeWeight;
nullable<SimpleTypes::CTrueFalse<>> m_oInsetPen;
// 2.2 AG_OfficeShapeAttributes
nullable<SimpleTypes::CDecimalNumber<>> m_oSpt;
nullable<SimpleTypes::CConnectorType<>> m_oConnectorType;
nullable<SimpleTypes::CBWMode<>> m_oBwMode;
nullable<SimpleTypes::CBWMode<>> m_oBwPure;
nullable<SimpleTypes::CBWMode<>> m_oBwNormal;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oForceDash;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOleIcon;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOle;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oPreferRelative;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oClipToWrap;
nullable<SimpleTypes::CTrueFalse<>> m_oClip;
// 1 AG_AllCoreAttributes
// 1.1 AG_CoreAttributes
nullable<std::wstring> m_sId;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<std::wstring> m_sHref;
nullable<std::wstring> m_sTarget;
nullable<std::wstring> m_sClass;
nullable<std::wstring> m_sTitle;
nullable<std::wstring> m_sAlt;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordSize;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordOrigin;
nullable<SimpleTypes::Vml::CVml_Polygon2D> m_oWrapCoords;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oPrint;
// 1.2 AG_OfficeCoreAttributes
nullable<std::wstring> m_sSpId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOned;
nullable<SimpleTypes::CDecimalNumber<>> m_oRegroupId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oDoubleClickNotify;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oButton;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserHidden;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBullet;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHr;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrStd;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrNoShade;
SimpleTypes::CDouble m_oHrPct;
SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn;
nullable<SimpleTypes::CColorType<>> m_oBorderTopColor;
nullable<SimpleTypes::CColorType<>> m_oBorderLeftColor;
nullable<SimpleTypes::CColorType<>> m_oBorderBottomColor;
nullable<SimpleTypes::CColorType<>> m_oBorderRightColor;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayout;
nullable<std::wstring> m_oDgmNodeKind;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayoutMru;
SimpleTypes::CInsetMode<SimpleTypes::insetmodeAuto> m_oInsetMode;
// 2 AG_AllShapeAttributes
// 2.1 AG_ShapeAttributes
nullable<SimpleTypes::CColorType<>> m_oChromaKey;
nullable<SimpleTypes::CTrueFalse<>> m_oFilled;
nullable<SimpleTypes::CColorType<>> m_oFillColor;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oOpacity;
nullable<SimpleTypes::CTrueFalse<>> m_oStroked;
nullable<SimpleTypes::CColorType<>> m_oStrokeColor;
nullable<SimpleTypes::CEmu> m_oStrokeWeight;
nullable<SimpleTypes::CTrueFalse<>> m_oInsetPen;
// 2.2 AG_OfficeShapeAttributes
nullable<SimpleTypes::CDecimalNumber<>> m_oSpt;
nullable<SimpleTypes::CConnectorType<>> m_oConnectorType;
nullable<SimpleTypes::CBWMode<>> m_oBwMode;
nullable<SimpleTypes::CBWMode<>> m_oBwPure;
nullable<SimpleTypes::CBWMode<>> m_oBwNormal;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oForceDash;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOleIcon;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOle;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oPreferRelative;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oClipToWrap;
nullable<SimpleTypes::CTrueFalse<>> m_oClip;
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
void ReadElements(XmlUtils::CXmlLiteReader& oReader) ;
@ -150,18 +150,18 @@ namespace OOX
virtual ~CArc(){}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CArc::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:arc ");
@ -233,17 +233,17 @@ namespace OOX
virtual ~CCurve(){}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CCurve::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:curve ");
@ -404,11 +404,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CFill::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -597,7 +597,7 @@ namespace OOX
// Attributes
nullable<SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue>> m_oAlignShape;
nullable<std::wstring> m_sAltHref;
nullable<std::wstring> m_sAltHref;
nullable<SimpleTypes::CDecimalNumber<>> m_oAngle;
nullable<SimpleTypes::CImageAspect<SimpleTypes::imageaspectIgnore>> m_oAspect;
nullable<SimpleTypes::CColorType<>> m_oColor;
@ -607,9 +607,9 @@ namespace OOX
nullable<SimpleTypes::CFixedPercentage > m_oFocus;
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> m_oFocusPosition;
nullable<SimpleTypes::Vml::CVml_Vector2D_Percentage> m_oFocusSize;
nullable<std::wstring> m_sHref;
nullable<std::wstring> m_sHref;
nullable<SimpleTypes::CRelationshipId> m_rId;
nullable<std::wstring> m_sId;
nullable<std::wstring> m_sId;
nullable<SimpleTypes::CFillMethod<SimpleTypes::fillmethodSigma>> m_oMethod;
nullable<SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue>> m_oOn;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oOpacity;
@ -620,8 +620,8 @@ namespace OOX
nullable<SimpleTypes::CRelationshipId> m_oRelId;
nullable<SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse>> m_oRotate;
nullable<SimpleTypes::Vml::CVml_Vector2D_Units> m_oSize;
nullable<std::wstring> m_sSrc;
nullable<std::wstring> m_sTitle;
nullable<std::wstring> m_sSrc;
nullable<std::wstring> m_sTitle;
SimpleTypes::CFillType<SimpleTypes::filltypeSolid, 0> m_oType;
// Childs
@ -631,7 +631,7 @@ namespace OOX
//--------------------------------------------------------------------------------
// CBackground 14.1.2.2 (Part4)
//--------------------------------------------------------------------------------
class CBackground : public WritingElement
class CBackground : public CVmlCommonElements
{
public:
WritingElement_AdditionConstructors(CBackground)
@ -644,35 +644,24 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CBackground::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
if ( _T("v:fill") == sName )
m_oFill = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:background ");
ComplexTypes_WriteAttribute2( _T("id=\""), m_sId );
if ( SimpleTypes::booleanTrue != m_oFilled.GetValue() )
sResult += _T("filled=\"false\" ");
ComplexTypes_WriteAttribute ( _T("fillcolor=\""), m_oFillColor );
sResult += CVmlCommonElements::WriteAttributes();
ComplexTypes_WriteAttribute ( _T("o:bwmode=\""), m_oBwMode );
ComplexTypes_WriteAttribute ( _T("o:bwpure=\""), m_oBwPure );
ComplexTypes_WriteAttribute ( _T("o:bwnormal=\""), m_oBwNormal );
@ -680,8 +669,7 @@ namespace OOX
sResult += _T(">");
if ( m_oFill.IsInit() )
sResult += m_oFill->toXML();
sResult += CVmlCommonElements::WriteElements();
sResult += _T("</v:background>");
@ -709,15 +697,6 @@ namespace OOX
wchar_t wsChar = wsName[0];
switch ( wsChar )
{
case 'f':
if ( _T("fillcolor") == wsName ) m_oFillColor = oReader.GetText();
else if ( _T("filled") == wsName ) m_oFilled = oReader.GetText();
break;
case 'i':
if ( _T("id") == wsName ) m_sId = oReader.GetText();
break;
case 'o':
if ( _T("o:bwmode") == wsName ) m_oBwMode = oReader.GetText();
else if ( _T("o:bwnormal") == wsName ) m_oBwNormal = oReader.GetText();
@ -739,17 +718,11 @@ namespace OOX
public:
// Attributes
nullable<SimpleTypes::CBWMode<>> m_oBwMode;
nullable<SimpleTypes::CBWMode<>> m_oBwNormal;
nullable<SimpleTypes::CBWMode<>> m_oBwPure;
nullable<SimpleTypes::CColorType<>> m_oFillColor;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oFilled;
nullable<std::wstring> m_sId;
nullable<SimpleTypes::CScreenSize<>> m_oTargetScreenSize;
// Childs
nullable<OOX::Vml::CFill> m_oFill;
// Attributes
nullable<SimpleTypes::CBWMode<>> m_oBwMode;
nullable<SimpleTypes::CBWMode<>> m_oBwNormal;
nullable<SimpleTypes::CBWMode<>> m_oBwPure;
nullable<SimpleTypes::CScreenSize<>> m_oTargetScreenSize;
};
//--------------------------------------------------------------------------------
@ -768,11 +741,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CFormulas::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
@ -788,7 +761,7 @@ namespace OOX
}
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:formulas>");
@ -1029,17 +1002,17 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CImage::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:image ");
@ -1176,18 +1149,18 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CImageData::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:imagedata ");
@ -1343,16 +1316,16 @@ namespace OOX
public:
// Attributes
nullable<std::wstring> m_sAltHref;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBiLevel;
SimpleTypes::CDouble m_oBlackLevel;
nullable<SimpleTypes::CColorType<>> m_oChromaKey;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropLeft;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropTop;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropRight;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropBottom;
nullable<SimpleTypes::CTrueFalse<>> m_oDetectMouseClick;
nullable<SimpleTypes::CColorType<>> m_oEmbossColor;
nullable<std::wstring> m_sAltHref;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBiLevel;
SimpleTypes::CDouble m_oBlackLevel;
nullable<SimpleTypes::CColorType<>> m_oChromaKey;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropLeft;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropTop;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropRight;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropBottom;
nullable<SimpleTypes::CTrueFalse<>> m_oDetectMouseClick;
nullable<SimpleTypes::CColorType<>> m_oEmbossColor;
SimpleTypes::CDouble m_oGain;
SimpleTypes::CDouble m_oGamma;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oGrayscale;
@ -1379,17 +1352,17 @@ namespace OOX
virtual ~CLine(){}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CLine::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:line ");
@ -1465,16 +1438,16 @@ namespace OOX
virtual ~COval(){}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать COval::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:oval ");
@ -1510,18 +1483,18 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CPath::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:path ");
@ -1788,17 +1761,17 @@ namespace OOX
virtual ~CRoundRect(){}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CRoundRect::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:roundrect ");
@ -1872,11 +1845,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CShadow::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -1987,17 +1960,17 @@ namespace OOX
public:
// Attributes
SimpleTypes::CColorType<SimpleTypes::colortypeRGB> m_oColor;
SimpleTypes::CColorType<SimpleTypes::colortypeRGB> m_oColor2;
nullable<std::wstring> m_oId;
nullable<SimpleTypes::Vml::CVml_Matrix> m_oMatrix;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oObscured;
SimpleTypes::Vml::CVml_Vector2D_Units_Or_Percentage m_oOffset;
SimpleTypes::Vml::CVml_Vector2D_Units_Or_Percentage m_oOffset2;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oOn;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oOpacity;
SimpleTypes::Vml::CVml_Vector2D_Percentage m_oOrigin;
SimpleTypes::CShadowType<SimpleTypes::shadowtypeSingle> m_oType;
SimpleTypes::CColorType<SimpleTypes::colortypeRGB> m_oColor;
SimpleTypes::CColorType<SimpleTypes::colortypeRGB> m_oColor2;
nullable<std::wstring> m_oId;
nullable<SimpleTypes::Vml::CVml_Matrix> m_oMatrix;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oObscured;
SimpleTypes::Vml::CVml_Vector2D_Units_Or_Percentage m_oOffset;
SimpleTypes::Vml::CVml_Vector2D_Units_Or_Percentage m_oOffset2;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oOn;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oOpacity;
SimpleTypes::Vml::CVml_Vector2D_Percentage m_oOrigin;
SimpleTypes::CShadowType<SimpleTypes::shadowtypeSingle> m_oType;
};
//--------------------------------------------------------------------------------
// CShape 14.1.2.19 (Part4)
@ -2011,14 +1984,14 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode){}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlNode& oNode){}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const;
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
return OOX::et_v_shape;
@ -2089,14 +2062,14 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode){}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlNode& oNode){}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CVmlCommonElements::ReadAttributes( oReader );
CVmlCommonElements::ReadElements( oReader );
}
virtual std::wstring toXML() const;
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
return OOX::et_v_shapetype;
@ -2161,9 +2134,9 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
return OOX::et_v_ClientData;
@ -2197,13 +2170,13 @@ namespace OOX
public:
// Attributes
nullable<SimpleTypes::Vml::CVmlClientDataObjectType<>> m_oObjectType;
nullable<SimpleTypes::Vml::CVmlClientDataObjectType<>> m_oObjectType;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffTrue>> m_oMoveWithCells;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffTrue>> m_oSizeWithCells;
nullable<std::wstring> m_oAnchor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oRow;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oColumn;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffTrue>> m_oMoveWithCells;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffTrue>> m_oSizeWithCells;
nullable<std::wstring> m_oAnchor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oRow;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oColumn;
};
//--------------------------------------------------------------------------------
// CStroke 14.1.2.21 (Part4)
@ -2221,11 +2194,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CStroke::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -2249,7 +2222,7 @@ namespace OOX
m_oColumn = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:stroke ");
@ -2440,35 +2413,35 @@ namespace OOX
public:
// Attributes
nullable<std::wstring> m_oId;
nullable<std::wstring> m_sAltHref;
nullable<SimpleTypes::CColorType<SimpleTypes::colortypeBlack>> m_oColor;
nullable<SimpleTypes::CColorType<SimpleTypes::colortypeBlack>> m_oColor2;
SimpleTypes::Vml::CVmlDashStyle<SimpleTypes::Vml::vmldashstyleSolid> m_oDahsStyle;
SimpleTypes::CStrokeArrowType<SimpleTypes::strokearrowtypeNone> m_oEndArrow;
SimpleTypes::CStrokeArrowLength<SimpleTypes::strokearrowlengthMedium> m_oEndArrowLength;
SimpleTypes::CStrokeArrowWidth<SimpleTypes::strokearrowwidthMedium> m_oEndArrowWidth;
SimpleTypes::CStrokeEndCap<SimpleTypes::strokeendcapFlat> m_oEndCap;
SimpleTypes::CFillType<SimpleTypes::filltypeSolid, 0> m_oFillType;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oForceDash;
nullable<std::wstring> m_sHref;
nullable<SimpleTypes::CRelationshipId> m_rId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oImageAlignShape;
SimpleTypes::CImageAspect<SimpleTypes::imageaspectIgnore> m_oImageAspect;
nullable<SimpleTypes::Vml::CVml_Vector2D_Units> m_oImageSize;
nullable<SimpleTypes::CTrueFalse<>> m_oInsetPen;
SimpleTypes::CStrokeJoinStyle<SimpleTypes::strokejoinstyleRound> m_oJoinStyle;
nullable<std::wstring> m_oId;
nullable<std::wstring> m_sAltHref;
nullable<SimpleTypes::CColorType<SimpleTypes::colortypeBlack>> m_oColor;
nullable<SimpleTypes::CColorType<SimpleTypes::colortypeBlack>> m_oColor2;
SimpleTypes::Vml::CVmlDashStyle<SimpleTypes::Vml::vmldashstyleSolid> m_oDahsStyle;
SimpleTypes::CStrokeArrowType<SimpleTypes::strokearrowtypeNone> m_oEndArrow;
SimpleTypes::CStrokeArrowLength<SimpleTypes::strokearrowlengthMedium> m_oEndArrowLength;
SimpleTypes::CStrokeArrowWidth<SimpleTypes::strokearrowwidthMedium> m_oEndArrowWidth;
SimpleTypes::CStrokeEndCap<SimpleTypes::strokeendcapFlat> m_oEndCap;
SimpleTypes::CFillType<SimpleTypes::filltypeSolid, 0> m_oFillType;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oForceDash;
nullable<std::wstring> m_sHref;
nullable<SimpleTypes::CRelationshipId> m_rId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oImageAlignShape;
SimpleTypes::CImageAspect<SimpleTypes::imageaspectIgnore> m_oImageAspect;
nullable<SimpleTypes::Vml::CVml_Vector2D_Units> m_oImageSize;
nullable<SimpleTypes::CTrueFalse<>> m_oInsetPen;
SimpleTypes::CStrokeJoinStyle<SimpleTypes::strokejoinstyleRound> m_oJoinStyle;
nullable<SimpleTypes::CStrokeLineStyle<SimpleTypes::strokelinestyleSingle>> m_oLineStyle;
SimpleTypes::CDecimalNumber<8> m_oMiterLimit;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oOn;
nullable<SimpleTypes::CDouble> m_oOpacity;
nullable<SimpleTypes::CRelationshipId> m_oRelId;
nullable<std::wstring> m_sSrc;
SimpleTypes::CStrokeArrowType<SimpleTypes::strokearrowtypeNone> m_oStartArrow;
SimpleTypes::CStrokeArrowLength<SimpleTypes::strokearrowlengthMedium> m_oStartArrowLength;
SimpleTypes::CStrokeArrowWidth<SimpleTypes::strokearrowwidthMedium> m_oStartArrowWidth;
nullable<std::wstring> m_sTitle;
SimpleTypes::CDouble m_oWeight;
SimpleTypes::CDecimalNumber<8> m_oMiterLimit;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oOn;
nullable<SimpleTypes::CDouble> m_oOpacity;
nullable<SimpleTypes::CRelationshipId> m_oRelId;
nullable<std::wstring> m_sSrc;
SimpleTypes::CStrokeArrowType<SimpleTypes::strokearrowtypeNone> m_oStartArrow;
SimpleTypes::CStrokeArrowLength<SimpleTypes::strokearrowlengthMedium> m_oStartArrowLength;
SimpleTypes::CStrokeArrowWidth<SimpleTypes::strokearrowwidthMedium> m_oStartArrowWidth;
nullable<std::wstring> m_sTitle;
SimpleTypes::CDouble m_oWeight;
// Childs
nullable<OOX::VmlOffice::CStrokeChild> m_oLeft;
@ -2494,11 +2467,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CTextbox::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -2612,11 +2585,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CTextPath::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -2625,7 +2598,7 @@ namespace OOX
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<v:textpath ");
@ -2707,16 +2680,16 @@ namespace OOX
public:
// Attributes
nullable<SimpleTypes::CTrueFalse<>> m_oFitPath;
nullable<SimpleTypes::CTrueFalse<>> m_oFitShape;
nullable<std::wstring> m_oId;
nullable<SimpleTypes::CTrueFalse<>> m_oOn;
nullable<std::wstring> m_sString;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<SimpleTypes::CTrueFalse<>> m_oTrim;
nullable<SimpleTypes::CTrueFalse<>> m_oXScale;
nullable<SimpleTypes::CTrueFalse<>> m_oFitPath;
nullable<SimpleTypes::CTrueFalse<>> m_oFitShape;
nullable<std::wstring> m_oId;
nullable<SimpleTypes::CTrueFalse<>> m_oOn;
nullable<std::wstring> m_sString;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<SimpleTypes::CTrueFalse<>> m_oTrim;
nullable<SimpleTypes::CTrueFalse<>> m_oXScale;
nullable<std::wstring> m_sStringOriginal;
nullable<std::wstring> m_sStringOriginal;
};
//--------------------------------------------------------------------------------
// CGroup 14.1.2.7 (Part4)
@ -2731,9 +2704,9 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
virtual EElementType getType() const
{
return OOX::et_v_group;
@ -2865,51 +2838,49 @@ namespace OOX
}
public:
// Attributes
// AG_AllCoreAttributes
nullable<std::wstring> m_sId;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<std::wstring> m_sHref;
nullable<std::wstring> m_sTarget;
nullable<std::wstring> m_sClass;
nullable<std::wstring> m_sTitle;
nullable<std::wstring> m_sAlt;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordSize;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordOrigin;
nullable<SimpleTypes::Vml::CVml_Polygon2D> m_oWrapCoords;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oPrint;
nullable<std::wstring> m_sSpId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOned;
nullable<SimpleTypes::CDecimalNumber<>> m_oRegroupId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oDoubleClickNotify;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oButton;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserHidden;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBullet;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHr;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrStd;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrNoShade;
SimpleTypes::CDouble m_oHrPct;
SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn;
nullable<SimpleTypes::CColorType<>> m_oBorderTopColor;
nullable<SimpleTypes::CColorType<>> m_oBorderLeftColor;
nullable<SimpleTypes::CColorType<>> m_oBorderBottomColor;
nullable<SimpleTypes::CColorType<>> m_oBorderRightColor;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayout;
nullable<std::wstring> m_oDgmNodeKind;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayoutMru;
SimpleTypes::CInsetMode<SimpleTypes::insetmodeCustom> m_oInsetMode;
nullable<std::wstring> m_sId;
nullable<SimpleTypes::Vml::CCssStyle> m_oStyle;
nullable<std::wstring> m_sHref;
nullable<std::wstring> m_sTarget;
nullable<std::wstring> m_sClass;
nullable<std::wstring> m_sTitle;
nullable<std::wstring> m_sAlt;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordSize;
nullable<SimpleTypes::Vml::CVml_Vector2D> m_oCoordOrigin;
nullable<SimpleTypes::Vml::CVml_Polygon2D> m_oWrapCoords;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oPrint;
nullable<std::wstring> m_sSpId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oOned;
nullable<SimpleTypes::CDecimalNumber<>> m_oRegroupId;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oDoubleClickNotify;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oButton;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserHidden;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBullet;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHr;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrStd;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oHrNoShade;
SimpleTypes::CDouble m_oHrPct;
SimpleTypes::CHrAlign<SimpleTypes::hralignLeft> m_oHrAlign;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oAllowInCell;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oAllowOverlap;
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oUserDrawn;
nullable<SimpleTypes::CColorType<>> m_oBorderTopColor;
nullable<SimpleTypes::CColorType<>> m_oBorderLeftColor;
nullable<SimpleTypes::CColorType<>> m_oBorderBottomColor;
nullable<SimpleTypes::CColorType<>> m_oBorderRightColor;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayout;
nullable<std::wstring> m_oDgmNodeKind;
nullable<SimpleTypes::CDiagramLayout<>> m_oDgmLayoutMru;
SimpleTypes::CInsetMode<SimpleTypes::insetmodeCustom> m_oInsetMode;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oFilled;
nullable<SimpleTypes::CColorType<>> m_oFillColor;
nullable<SimpleTypes::CEditAs<>> m_oEditAs;
nullable<SimpleTypes::Vml::CVml_TableLimits> m_oTableLimits;
SimpleTypes::Vml::CVml_TableProperties<0> m_oTableProperties;
SimpleTypes::CTrueFalse<SimpleTypes::booleanTrue> m_oFilled;
nullable<SimpleTypes::CColorType<>> m_oFillColor;
nullable<SimpleTypes::CEditAs<>> m_oEditAs;
nullable<SimpleTypes::Vml::CVml_TableLimits> m_oTableLimits;
SimpleTypes::Vml::CVml_TableProperties<0> m_oTableProperties;
};
} // namespace Vml
} // namespace OOX
@ -2934,11 +2905,11 @@ namespace OOX
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
// TO DO: Реализовать CShapeDefaults::fromXML(XmlUtils::CXmlNode& oNode)
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -2971,7 +2942,7 @@ namespace OOX
m_oColorMenu = oReader;
}
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
std::wstring sResult = _T("<o:shapedefaults ");

View File

@ -1017,7 +1017,7 @@ namespace NSFile
size_t sz = 0;
if ( (0 == _wdupenv_s(&wsTempDir, &sz, L"TEMP")) && (wsFolder == NULL))
{
wsTemp = std::wstring(wsTempDir, sz);
wsTemp = std::wstring(wsTempDir, sz-1);
#else
char *wsTempDirA;
if ((wsTempDirA = getenv("TEMP")) && (wsFolder == NULL))
@ -1041,14 +1041,8 @@ namespace NSFile
for (int nIndex = 0; nIndex < 1000; ++nIndex)
{
wsFileName = wsTemp;
#if defined(_WIN32) || defined (_WIN64)
wchar_t buff[32] ={};
size_t sz = 0;
_itow_s(nTime + nIndex, buff, sz, 10);
wsFileName.append(buff, sz);
#else
wsFileName.append(std::to_wstring(nTime + nIndex));
#endif
if (wsExt)
{
wsFileName.append(wsExt);

View File

@ -0,0 +1,92 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#ifndef _BUILD_IGROBJECT_CROSSPLATFORM_H_
#define _BUILD_IGROBJECT_CROSSPLATFORM_H_
#include "Types.h"
#ifdef __APPLE__
#include <libkern/OSAtomic.h>
#endif
class IGrObject
{
protected:
#ifdef __APPLE__
volatile int32_t m_lRef;
#else
ULONG m_lRef;
#endif
public:
IGrObject()
{
m_lRef = 1;
}
virtual ~IGrObject()
{
}
#ifdef __APPLE__
virtual ULONG AddRef()
{
OSAtomicIncrement32(&m_lRef);
return (ULONG)m_lRef;
}
virtual ULONG Release()
{
int32_t ret = OSAtomicDecrement32(&m_lRef);
if (0 == m_lRef)
delete this;
return (ULONG)ret;
}
#else
virtual ULONG AddRef()
{
++m_lRef;
return m_lRef;
}
virtual ULONG Release()
{
ULONG ret = --m_lRef;
if (0 == m_lRef)
delete this;
return ret;
}
#endif
};
#endif //_BUILD_IGROBJECT_CROSSPLATFORM_H_

View File

@ -29,13 +29,6 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
//
// ImageUtils.h
// UTILS
//
// Created by alexey.musinov on 30.04.15.
// Copyright (c) 2015 Ascensio System SIA. All rights reserved.
//
#ifndef _IMAGE_UTILS_H_
#define _IMAGE_UTILS_H_

Some files were not shown because too many files have changed in this diff Show More