Compare commits

...

62 Commits

Author SHA1 Message Date
ad74a8ea6b fix bug #34747 2017-04-11 17:11:56 +03:00
f50dda7c31 fix bug #34736 2017-04-11 15:28:51 +03:00
f78a805fa3 . 2017-04-11 13:17:58 +03:00
bc177269a9 OdfFormatReader - fix solid background in documents 2017-04-11 10:52:19 +03:00
84cab29276 fix build 2017-04-11 10:32:09 +03:00
d7c7584b4d OdfFormatWriter - slides size, ... 2017-04-11 10:24:53 +03:00
1346072ab2 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t binary - dont write unsupported graphicData (sle:slicer)
  fix bugs after refactoring
  xmlsec
  OdfFormat ...
2017-04-10 16:26:59 +03:00
3b6b463b1b fix build converter ios 2017-04-10 16:26:50 +03:00
a75daf9d90 x2t binary - dont write unsupported graphicData (sle:slicer) 2017-04-10 11:10:22 +03:00
dc81f97bac fix bugs after refactoring 2017-04-09 20:55:53 +03:00
d194249ffb xmlsec 2017-04-08 14:26:26 +03:00
4ec04c31c5 OdfFormat ... 2017-04-07 18:36:47 +03:00
8774035be9 OdfFormatReader - presentation table extended graphics properties 2017-04-06 19:30:44 +03:00
8cec4ce82e OdfFormatWriter presentation layouts, layers
OdfFormat - nation style-name
2017-04-06 17:40:26 +03:00
17e46a2c99 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatWriter - presentation tables styled
  OdfFormatWriter - presentation tables
2017-04-06 15:26:59 +03:00
c5ffcd4b44 open documents with password (ios) 2017-04-06 15:26:54 +03:00
38813fd105 OdfFormatWriter - presentation tables styled 2017-04-05 18:48:51 +03:00
19960fa3b5 OdfFormatWriter - presentation tables 2017-04-04 20:07:27 +03:00
32121d6d3b Merge tag 'v4.3.0' into develop
v4.3.0
2017-04-03 12:57:47 +03:00
2dcef22681 Merge branch 'release/v4.3.0' 2017-04-03 12:57:28 +03:00
ee5a56183e fix linux build 2017-04-03 12:20:12 +03:00
b90e3a3cd1 . 2017-04-03 11:49:20 +03:00
f074d1252b OdfFormatWriter - odp 2017-04-03 11:15:30 +03:00
30f07d3aa4 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-31 17:58:20 +03:00
d27b7b2f56 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop
* 'develop' of https://github.com/ONLYOFFICE/core:
  x2t version up
  for bug 34597
  fix bug 34603
  for bug 34498
2017-03-31 17:57:44 +03:00
1dbf3e83ad ios collaboration 2017-03-31 17:57:35 +03:00
a5f70c9740 x2t - change projects 2017-03-31 16:29:15 +03:00
ab72c8973d OdfFormatWriter - presentation hyperlink, backgrounds slides & masters 2017-03-31 16:06:31 +03:00
a204c576ad Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-31 11:29:41 +03:00
4a7d40d3fb x2t version up 2017-03-31 08:17:46 +03:00
4f5fb86f87 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-30 17:33:49 +03:00
f7f2629e9d for bug 34597 2017-03-30 16:51:08 +03:00
048c2fd034 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-30 16:04:22 +03:00
3299c47858 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-30 16:03:47 +03:00
8977e2c792 fix bug 34603 2017-03-30 16:02:23 +03:00
089e7d3230 Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-30 11:00:56 +03:00
bd5863a02d for bug 34498 2017-03-29 20:12:04 +03:00
e0296d5a9a OdfFormatWriter - odp master page 2017-03-29 16:09:39 +03:00
e26cf3bf39 OdfFormatWriter - convert pptx->odp 2017-03-29 13:06:41 +03:00
8525a1e9f0 . 2017-03-29 13:04:40 +03:00
2e8c83a668 RtfFormat, TxtFormat - chage convert from ooxml drawing 2017-03-29 13:04:07 +03:00
e857496565 .. 2017-03-29 13:02:24 +03:00
143f65ae5a BinaryFormat - refactoring drawing objects, convert embedded objects, ole objects 2017-03-29 13:01:22 +03:00
f89d75ae92 PptxFormat refactoring and extending drawing objects 2017-03-29 12:57:07 +03:00
403507206d . 2017-03-29 12:52:52 +03:00
7f6431700c DocxFormat - refactoring, move common drawing in pptx format, ... 2017-03-29 12:52:17 +03:00
7977bcf069 . 2017-03-29 12:47:58 +03:00
32ad6b46e2 ooxml files encrypting 2017-03-29 12:35:09 +03:00
bf6bfce051 fix bug 34509 2017-03-24 20:02:11 +03:00
805c24ff1a fix bug 27498 2017-03-24 18:35:08 +03:00
2c4bb7c808 for bug 34498. ULong 2017-03-23 20:24:52 +03:00
15a711396f x2t xlsx outline level save/read in binary 2017-03-22 17:53:09 +03:00
3d8403346b fix added bug 34297 2017-03-20 17:42:00 +03:00
5700503efe fix build converter ios 2017-03-16 12:56:04 +03:00
d01b1e7d41 fix bug 33781 2017-03-15 13:28:49 +03:00
584cc6ab80 fix bug 34297 2017-03-11 18:47:30 +03:00
4b727edde8 . 2017-03-09 16:05:45 +03:00
9d10c4ddce Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop 2017-03-07 12:19:08 +03:00
d5026d014d . 2017-03-06 17:24:29 +03:00
ac0b7e4e22 fix bug 34019 2017-03-06 15:45:43 +03:00
623fe25415 fix 34229 2017-03-06 15:30:54 +03:00
c4c9d50aae fix bug 34222 2017-03-06 14:29:15 +03:00
1469 changed files with 314657 additions and 34327 deletions

View File

@ -50,8 +50,8 @@ namespace DocFileFormat
EncryptionHeader( FileInformationBlock* fib, POLE::Stream* tableStream );
private:
CRYPT::CryptRC4Data crypt_data_rc4;
CRYPT::ECMADecryptor::_cryptData crypt_data_aes;
bool bStandard;
CRYPT::_rc4CryptData crypt_data_rc4;
CRYPT::_ecmaCryptData crypt_data_aes;
bool bStandard;
};
}

View File

@ -385,6 +385,10 @@
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
@ -434,6 +438,10 @@
RelativePath="..\..\Common\FileDownloader\FileDownloader_win.cpp"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>

View File

@ -38,72 +38,63 @@ namespace Writers
{
class ChartWriter
{
class ChartElem
struct _chartElem
{
public:
std::wstring content;
std::wstring filename;
int index;
std::wstring content;
std::wstring filename;
int index;
};
std::vector<ChartElem*> m_aCharts;
ContentTypesWriter& m_oContentTypesWriter;
int nChartCount;
std::vector<_chartElem> m_aCharts;
int nChartCount;
public:
std::wstring m_sDir;
public:
ChartWriter(std::wstring sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
ChartWriter(std::wstring sDir) : m_sDir(sDir)
{
nChartCount = 0;
}
~ChartWriter()
{
for(size_t i = 0, length = m_aCharts.size(); i < length; ++i)
{
delete m_aCharts[i];
}
}
bool IsEmpty()
{
return 0 == m_aCharts.size();
}
void Write()
bool Write()
{
if(false == IsEmpty())
if(IsEmpty()) return false;
OOX::CPath pathChartDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("charts");
for(size_t i = 0; i < m_aCharts.size(); ++i)
{
OOX::CPath pathChartDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("charts");
NSDirectory::CreateDirectory(pathChartDir.GetPath());
_chartElem & elem = m_aCharts[i];
for(size_t i = 0, length = m_aCharts.size(); i < length; ++i)
{
ChartElem* elem = m_aCharts[i];
OOX::CPath filePath = pathChartDir + FILE_SEPARATOR_STR + elem.filename;
OOX::CPath filePath = pathChartDir + FILE_SEPARATOR_STR + elem->filename;
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
oFile.WriteStringUTF8(elem->content);
oFile.CloseFile();
//Content_Types
std::wstring sRelPath = L"/word/charts/" + elem->filename;
m_oContentTypesWriter.AddOverride(sRelPath, L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml");
}
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n");
oFile.WriteStringUTF8(elem.content);
oFile.CloseFile();
}
return true;
}
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int& index)
{
ChartElem* pChartElem = new ChartElem();
pChartElem->content = content;
pChartElem->index = nChartCount + 1;
nChartCount++;
pChartElem->filename = L"chart" + std::to_wstring(pChartElem->index) + L".xml";
_chartElem oChartElem;
sRelsName = L"charts/" + pChartElem->filename;
sFileName = pChartElem->filename;
index = pChartElem->index;
oChartElem.content = content;
oChartElem.index = nChartCount + 1;
nChartCount++;
oChartElem.filename = L"chart" + std::to_wstring(oChartElem.index) + L".xml";
sRelsName = L"charts/" + oChartElem.filename;
sFileName = oChartElem.filename;
index = oChartElem.index;
m_aCharts.push_back(pChartElem);
m_aCharts.push_back(oChartElem);
}
int getChartCount()
{

View File

@ -46,20 +46,19 @@ namespace Writers
class CommentsWriter
{
std::wstring m_sDir;
ContentTypesWriter& m_oContentTypesWriter;
public:
std::wstring m_sComment;
std::wstring m_sCommentExt;
std::wstring m_sPeople;
public:
CommentsWriter(std::wstring sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
std::wstring m_sComment;
std::wstring m_sCommentExt;
std::wstring m_sPeople;
CommentsWriter(std::wstring sDir) : m_sDir(sDir)
{
}
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sPeople)
{
m_sComment = sComment;
m_sCommentExt = sCommentExt;
m_sPeople = sPeople;
m_sComment = sComment;
m_sCommentExt = sCommentExt;
m_sPeople = sPeople;
}
void Write()
{
@ -67,42 +66,30 @@ namespace Writers
{
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("comments.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(g_string_comment_Start);
oFile.WriteStringUTF8(m_sComment);
oFile.WriteStringUTF8(g_string_comment_End);
oFile.CloseFile();
//Content_Types
m_oContentTypesWriter.AddOverride(std::wstring(_T("/word/comments.xml")), std::wstring(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml")));
//Rels
//m_oDocumentRelsWriter.AddRels(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"), _T("comments.xml"));
}
if(false == m_sCommentExt.empty())
{
CFile oFile;
oFile.CreateFile(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("commentsExtended.xml"));
NSFile::CFileBinary oFile;
oFile.CreateFileW(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("commentsExtended.xml"));
oFile.WriteStringUTF8(g_string_commentExt_Start);
oFile.WriteStringUTF8(m_sCommentExt);
oFile.WriteStringUTF8(g_string_commentExt_End);
oFile.CloseFile();
//Content_Types
m_oContentTypesWriter.AddOverride(std::wstring(_T("/word/commentsExtended.xml")), std::wstring(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml")));
}
if(false == m_sPeople.empty())
{
CFile oFile;
oFile.CreateFile(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("people.xml"));
NSFile::CFileBinary oFile;
oFile.CreateFileW(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("people.xml"));
oFile.WriteStringUTF8(g_string_people_Start);
oFile.WriteStringUTF8(m_sPeople);
oFile.WriteStringUTF8(g_string_people_End);
oFile.CloseFile();
//Content_Types
m_oContentTypesWriter.AddOverride(std::wstring(_T("/word/people.xml")), std::wstring(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml")));
}
}
};

View File

@ -1,80 +0,0 @@
/*
* (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 CONTENT_TYPES_WRITER
#define CONTENT_TYPES_WRITER
#include "../../XlsxSerializerCom/Common/Common.h"
namespace Writers
{
static std::wstring g_string_ct_Start = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">";
static std::wstring g_string_ct_Ext = L"<Default Extension=\"bin\" ContentType=\"application/vnd.openxmlformats-officedocument.oleObject\"/><Default Extension=\"bmp\" ContentType=\"image/bmp\"/><Default Extension=\"jpg\" ContentType=\"image/jpeg\"/><Default Extension=\"jpeg\" ContentType=\"image/jpeg\"/><Default Extension=\"jpe\" ContentType=\"image/jpeg\"/><Default Extension=\"png\" ContentType=\"image/png\"/><Default Extension=\"gif\" ContentType=\"image/gif\"/><Default Extension=\"emf\" ContentType=\"image/x-emf\"/><Default Extension=\"wmf\" ContentType=\"image/x-wmf\"/><Default Extension=\"rels\" ContentType=\"application/vnd.openxmlformats-package.relationships+xml\"/><Default Extension=\"xml\" ContentType=\"application/xml\"/><Default Extension=\"xlsx\" ContentType=\"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"/>";
static std::wstring g_string_ct_Override = L"<Override PartName=\"/word/document.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml\"/><Override PartName=\"/word/styles.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml\"/><Override PartName=\"/word/settings.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml\"/><Override PartName=\"/word/webSettings.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml\"/><Override PartName=\"/word/fontTable.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml\"/><Override PartName=\"/word/theme/theme1.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.theme+xml\"/><Override PartName=\"/docProps/core.xml\" ContentType=\"application/vnd.openxmlformats-package.core-properties+xml\"/><Override PartName=\"/docProps/app.xml\" ContentType=\"application/vnd.openxmlformats-officedocument.extended-properties+xml\"/>";
static std::wstring g_string_ct_End = L"</Types>";
class ContentTypesWriter
{
XmlUtils::CStringWriter m_oWriter;
std::wstring m_sDir;
XmlUtils::CStringWriter m_oAdditional;
public:
ContentTypesWriter(std::wstring sDir) : m_sDir(sDir)
{
}
void Write()
{
m_oWriter.WriteString(g_string_ct_Start);
m_oWriter.WriteString(g_string_ct_Ext);
m_oWriter.WriteString(g_string_ct_Override);
m_oWriter.Write(m_oAdditional);
m_oWriter.WriteString(g_string_ct_End);
OOX::CPath filePath = m_sDir + L"/[Content_Types].xml";
CFile oFile;
oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile();
}
void AddOverride(const std::wstring& PartName, const std::wstring& ContentType)
{
std::wstring sOverride = L"<Override PartName=\"" + PartName+ L"\" ContentType=\"" + ContentType + L"\"/>";
m_oAdditional.WriteString(sOverride);
}
void AddOverrideRaw(const std::wstring& sXml)
{
m_oAdditional.WriteString(sXml);
}
};
}
#endif // #ifndef CONTENT_TYPES_WRITER

View File

@ -39,15 +39,16 @@ namespace Writers
class DefaultThemeWriter
{
public:
DefaultThemeWriter()
std::wstring m_sContent;
DefaultThemeWriter( )
{
}
void Write(std::wstring sThemeFilePath)
{
std::wstring s_Common;
s_Common = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?> \
<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"Office Theme\"> \
if (m_sContent.empty())
{
m_sContent = _T("<a:theme xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" name=\"Office Theme\">\
<a:themeElements> \
<a:clrScheme name=\"Office\"> \
<a:dk1> \
@ -87,7 +88,7 @@ namespace Writers
<a:srgbClr val=\"800080\"/> \
</a:folHlink> \
</a:clrScheme> ");
s_Common +=
m_sContent +=
_T("<a:fontScheme name=\"Office\"> \
<a:majorFont> \
<a:latin typeface=\"Cambria\"/> \
@ -158,7 +159,7 @@ s_Common +=
<a:font script=\"Uigh\" typeface=\"Microsoft Uighur\"/> \
</a:minorFont> \
</a:fontScheme>");
s_Common +=
m_sContent +=
_T("<a:fmtScheme name=\"Office\"> \
<a:fillStyleLst> \
<a:solidFill> \
@ -329,13 +330,14 @@ s_Common +=
<a:objectDefaults/> \
<a:extraClrSchemeLst/> \
</a:theme>");
}
OOX::CPath fileName = sThemeFilePath;
CFile oFile;
oFile.CreateFile(fileName.GetPath());
oFile.WriteStringUTF8(s_Common);
NSFile::CFileBinary oFile;
oFile.CreateFileW(fileName.GetPath());
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
oFile.WriteStringUTF8(m_sContent);
oFile.CloseFile();
}
};

View File

@ -56,8 +56,8 @@ namespace Writers
OOX::CPath fileName = m_sDir + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + _T(".rels");
CFile oFile;
oFile.CreateFile(fileName.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(fileName.GetPath());
oFile.WriteStringUTF8(s_Common);
oFile.CloseFile();
}

View File

@ -51,8 +51,8 @@ namespace Writers
{
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") +FILE_SEPARATOR_STR + _T("document.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8( std::wstring(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>")));
oFile.WriteStringUTF8( std::wstring(_T("<w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">")));

View File

@ -31,6 +31,7 @@
*/
#ifndef FILE_WRITER
#define FILE_WRITER
#include "../../DesktopEditor/common/Path.h"
#include "NumberingWriter.h"
#include "fontTableWriter.h"
@ -45,19 +46,21 @@
#include "webSettingsWriter.h"
#include "DefaultThemeWriter.h"
namespace BinDocxRW {
namespace BinDocxRW
{
class CComments;
}
namespace NSBinPptxRW
{
class CDrawingConverter;
}
namespace Writers
{
class FileWriter
{
public:
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
std::wstring m_sThemePath;
bool m_bSaveChartAsImg;
ContentTypesWriter m_oContentTypesWriter;
public:
FontTableWriter m_oFontTableWriter;
DocumentWriter m_oDocumentWriter;
MediaWriter m_oMediaWriter;
@ -71,35 +74,57 @@ namespace Writers
ChartWriter m_oChartWriter;
DocumentRelsWriter m_oDocumentRelsWriter;
WebSettingsWriter m_oWebSettingsWriter;
DefaultThemeWriter m_oDefaultTheme;
int m_nDocPrIndex;
BinDocxRW::CComments* m_pComments;
public:
FileWriter(std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath):
m_pDrawingConverter(pDrawingConverter),m_sThemePath(sThemePath),m_bSaveChartAsImg(bSaveChartAsImg),
m_oContentTypesWriter(sDirOutput), m_oFontTableWriter(sDirOutput, sFontDir, bNoFontDir),
m_oHeaderFooterWriter(sDirOutput, m_oContentTypesWriter),
m_oFootnotesWriter(sDirOutput, m_oContentTypesWriter),
m_oEndnotesWriter(sDirOutput, m_oContentTypesWriter),
m_oMediaWriter(sDirOutput),
m_oStylesWriter(sDirOutput, nVersion),
m_oNumberingWriter(sDirOutput, m_oContentTypesWriter),
m_oDocumentWriter(sDirOutput, m_oHeaderFooterWriter),
m_oSettingWriter(sDirOutput, m_oHeaderFooterWriter),
m_oCommentsWriter(sDirOutput, m_oContentTypesWriter),
m_oChartWriter(sDirOutput, m_oContentTypesWriter),
m_oDocumentRelsWriter(sDirOutput),
m_oWebSettingsWriter(sDirOutput),
DefaultThemeWriter m_oTheme;
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
bool m_bSaveChartAsImg;
std::wstring m_sThemePath;
int m_nDocPrIndex;
BinDocxRW::CComments* m_pComments;
FileWriter (std::wstring sDirOutput,std::wstring sFontDir, bool bNoFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, std::wstring sThemePath)
: m_pDrawingConverter(pDrawingConverter), m_sThemePath(sThemePath), m_bSaveChartAsImg(bSaveChartAsImg),
m_oFontTableWriter (sDirOutput, sFontDir, bNoFontDir),
m_oHeaderFooterWriter (sDirOutput),
m_oFootnotesWriter (sDirOutput),
m_oEndnotesWriter (sDirOutput),
m_oMediaWriter (sDirOutput),
m_oStylesWriter (sDirOutput, nVersion),
m_oNumberingWriter (sDirOutput),
m_oDocumentWriter (sDirOutput, m_oHeaderFooterWriter),
m_oSettingWriter (sDirOutput, m_oHeaderFooterWriter),
m_oCommentsWriter (sDirOutput),
m_oChartWriter (sDirOutput),
m_oDocumentRelsWriter (sDirOutput),
m_oWebSettingsWriter (sDirOutput),
m_nDocPrIndex(0),
m_pComments(NULL)
{
}
public: int getNextDocPr()
{
m_nDocPrIndex++;
return m_nDocPrIndex;
}
int getNextDocPr()
{
m_nDocPrIndex++;
return m_nDocPrIndex;
}
void Write()
{
m_oCommentsWriter.Write();
m_oChartWriter.Write();
m_oStylesWriter.Write();
m_oNumberingWriter.Write();
m_oFontTableWriter.Write();
m_oHeaderFooterWriter.Write();
m_oFootnotesWriter.Write();
m_oEndnotesWriter.Write();
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
m_oSettingWriter.Write();
m_oWebSettingsWriter.Write();
//Document пишем после HeaderFooter, чтобы заполнить sectPr
m_oDocumentWriter.Write();
//Rels и ContentTypes пишем в конце
m_oDocumentRelsWriter.Write();
}
};
}
#endif // #ifndef FILE_WRITER

View File

@ -33,6 +33,7 @@
#define HEADER_FOOTER_WRITER
#include "../../XlsxSerializerCom/Common/Common.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
namespace Writers
{
@ -54,10 +55,10 @@ namespace Writers
{
return m_sFilename.empty();
}
std::wstring m_sFilename;
ContentWriter Header;
std::wstring rId;
SimpleTypes::EHdrFtr eType;
std::wstring m_sFilename;
ContentWriter Header;
std::wstring rId;
SimpleTypes::EHdrFtr eType;
};
static std::wstring g_string_hdr_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
static std::wstring g_string_hdr_End = _T("</w:hdr>");
@ -74,12 +75,11 @@ namespace Writers
class HeaderFooterWriter
{
std::wstring m_sDir;
ContentTypesWriter& m_oContentTypesWriter;
public:
std::vector<HdrFtrItem*> m_aHeaders;
std::vector<HdrFtrItem*> m_aFooters;
public:
HeaderFooterWriter( std::wstring sDir, ContentTypesWriter& oContentTypesWriter) : m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
HeaderFooterWriter( std::wstring sDir) : m_sDir(sDir)
{
}
~HeaderFooterWriter()
@ -109,8 +109,8 @@ namespace Writers
{
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
CFile oFile;
oFile.CreateFile(filePath.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
if(bHeader)
oFile.WriteStringUTF8(g_string_hdr_Start);
@ -122,43 +122,33 @@ namespace Writers
else
oFile.WriteStringUTF8(g_string_ftr_End);
oFile.CloseFile();
//Content_Types
m_oContentTypesWriter.AddOverride(L"/word/" + sFilename, L"application/vnd.openxmlformats-officedocument.wordprocessingml." + sHeader + L"+xml");
//Rels
//return m_oDocumentRelsWriter.AddRels(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/") + sHeader, sFilename);
}
};
class FootnotesWriter
{
std::wstring m_sDir;
ContentTypesWriter& m_oContentTypesWriter;
public:
ContentWriter m_oNotesWriter;
FootnotesWriter( std::wstring sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
FootnotesWriter( std::wstring sDir ):m_sDir(sDir)
{
}
void Write()
{
if(!IsEmpty())
{
std::wstring sFilename = getFilename();
if(IsEmpty()) return;
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
std::wstring sFilename = getFilename();
CFile oFile;
oFile.CreateFile(filePath);
oFile.WriteStringUTF8(g_string_footnotes_Start);
oFile.WriteStringUTF8(m_oNotesWriter.m_oContent.GetData());
oFile.WriteStringUTF8(g_string_footnotes_End);
oFile.CloseFile();
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + sFilename;
//ContentType
m_oContentTypesWriter.AddOverride(L"/word/" + sFilename, L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml");
}
NSFile::CFileBinary oFile;
oFile.CreateFileW (filePath);
oFile.WriteStringUTF8 (g_string_footnotes_Start);
oFile.WriteStringUTF8 (m_oNotesWriter.m_oContent.GetData());
oFile.WriteStringUTF8 (g_string_footnotes_End);
oFile.CloseFile();
}
std::wstring getFilename()
std::wstring getFilename()
{
return _T("footnotes.xml");
}
@ -169,33 +159,29 @@ namespace Writers
};
class EndnotesWriter
{
std::wstring m_sDir;
ContentTypesWriter& m_oContentTypesWriter;
std::wstring m_sDir;
public:
ContentWriter m_oNotesWriter;
EndnotesWriter( std::wstring sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
EndnotesWriter( std::wstring sDir ) : m_sDir(sDir)
{
}
void Write()
{
if(!IsEmpty())
{
std::wstring sFilename = getFilename();
if(IsEmpty()) return;
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
std::wstring sFilename = getFilename();
CFile oFile;
oFile.CreateFile(filePath);
oFile.WriteStringUTF8(g_string_endnotes_Start);
oFile.WriteStringUTF8(m_oNotesWriter.m_oContent.GetData());
oFile.WriteStringUTF8(g_string_endnotes_End);
oFile.CloseFile();
std::wstring filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
//ContentType
m_oContentTypesWriter.AddOverride(_T("/word/") + sFilename, _T("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"));
}
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath);
oFile.WriteStringUTF8(g_string_endnotes_Start);
oFile.WriteStringUTF8(m_oNotesWriter.m_oContent.GetData());
oFile.WriteStringUTF8(g_string_endnotes_End);
oFile.CloseFile();
}
std::wstring getFilename()
std::wstring getFilename()
{
return _T("endnotes.xml");
}

View File

@ -32,7 +32,6 @@
#ifndef NUMBERING_WRITER
#define NUMBERING_WRITER
#include "ContentTypesWriter.h"
#include "DocumentRelsWriter.h"
namespace Writers
@ -43,13 +42,12 @@ namespace Writers
class NumberingWriter
{
XmlUtils::CStringWriter m_oWriter;
std::wstring m_sDir;
ContentTypesWriter& m_oContentTypesWriter;
std::wstring m_sDir;
public:
XmlUtils::CStringWriter m_oANum;
XmlUtils::CStringWriter m_oNumList;
public:
NumberingWriter( std::wstring sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
NumberingWriter( std::wstring sDir) : m_sDir(sDir)
{
}
bool IsEmpty()
@ -58,26 +56,20 @@ namespace Writers
}
void Write()
{
if(false == IsEmpty())
{
m_oWriter.WriteString(g_string_n_Start);
m_oWriter.Write(m_oANum);
m_oWriter.Write(m_oNumList);
m_oWriter.WriteString(g_string_n_End);
if(IsEmpty()) return;
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("numbering.xml");
m_oWriter.WriteString(g_string_n_Start);
m_oWriter.Write(m_oANum);
m_oWriter.Write(m_oNumList);
m_oWriter.WriteString(g_string_n_End);
CFile oFile;
oFile.CreateFile(filePath.GetPath());
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("numbering.xml");
oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
//ContentType
m_oContentTypesWriter.AddOverride( std::wstring(_T("/word/numbering.xml")), std::wstring(_T("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml")));
//Rels
//m_oDocumentRelsWriter.AddRels(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"), _T("numbering.xml"));
}
oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile();
}
};
}

View File

@ -34,6 +34,8 @@
#include "../../Common/DocxFormat/Source/XML/Utils.h"
#include <boost/algorithm/string.hpp>
namespace BinDocxRW {
class SectPr
@ -1881,7 +1883,12 @@ public:
class CDrawingProperty
{
public:
long DataPos;
bool bObject;
std::wstring sObjectProgram;
long nObjectId;
BYTE nObjectType;
long DataPos;
long DataLength;
BYTE Type;
bool BehindDoc;
@ -1914,8 +1921,8 @@ public:
int m_nDocPr;
std::wstring sGraphicFramePr;
std::wstring sDocPr;
CDrawingPropertyWrap DrawingPropertyWrap;
CDrawingPropertyWrap DrawingPropertyWrap;
bool bDataPos;
bool bDataLength;
@ -1949,6 +1956,10 @@ public:
CDrawingProperty(int nDocPr)
{
m_nDocPr = nDocPr;
bObject = false;
nObjectType = 0;
nObjectId = 0;
bDataPos = false;
bDataLength = false;
bType = false;
@ -2062,7 +2073,7 @@ distT=\"0\" distB=\"0\" distL=\"0\" distR=\"0\"><wp:extent cx=\"" + std::to_wstr
int nSimplePos = 0;
if(bBSimplePos && BSimplePos)
nSimplePos = 1;
int nRelativeHeight = 0;
unsigned long nRelativeHeight = 0;
if(bRelativeHeight)
nRelativeHeight = RelativeHeight;
int nBehindDoc = 0;

View File

@ -0,0 +1,113 @@
/*
* (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
*
*/
#include "Readers.h"
namespace BinDocxRW {
Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter),m_pComments(pComments)
{
}
int Binary_HdrFtrTableReader::Read()
{
return ReadTable(&Binary_HdrFtrTableReader::ReadHdrFtrContent, this);
}
int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerHdrFtrTypes::Header == type || c_oSerHdrFtrTypes::Footer == type )
{
nCurType = type;
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrFEO, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int Binary_HdrFtrTableReader::ReadHdrFtrFEO(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerHdrFtrTypes::HdrFtr_First == type || c_oSerHdrFtrTypes::HdrFtr_Even == type || c_oSerHdrFtrTypes::HdrFtr_Odd == type )
{
nCurHeaderType = type;
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItem, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerHdrFtrTypes::HdrFtr_Content == type )
{
Writers::HdrFtrItem* poHdrFtrItem = NULL;
switch(nCurHeaderType)
{
case c_oSerHdrFtrTypes::HdrFtr_First:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrFirst);break;
case c_oSerHdrFtrTypes::HdrFtr_Even:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrEven);break;
case c_oSerHdrFtrTypes::HdrFtr_Odd:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrDefault);break;
}
if(NULL != poHdrFtrItem)
{
if(nCurType == c_oSerHdrFtrTypes::Header)
{
m_oHeaderFooterWriter.m_aHeaders.push_back(poHdrFtrItem);
poHdrFtrItem->m_sFilename = L"header" + std::to_wstring((int)m_oHeaderFooterWriter.m_aHeaders.size()) + L".xml";
}
else
{
m_oHeaderFooterWriter.m_aFooters.push_back(poHdrFtrItem);
poHdrFtrItem->m_sFilename = L"footer" + std::to_wstring((int)m_oHeaderFooterWriter.m_aFooters.size()) + L".xml";
}
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
FILE_SEPARATOR_STR + _T("_rels")+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + _T(".rels");
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
}
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int Binary_HdrFtrTableReader::ReadHdrFtrItemContent(BYTE type, long length, void* poResult)
{
Binary_DocumentTableReader* pBinary_DocumentTableReader = static_cast<Binary_DocumentTableReader*>(poResult);
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
}
}

View File

@ -41,6 +41,7 @@
#include "../DocWrapper/XlsxSerializer.h"
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
namespace BinDocxRW {
@ -254,10 +255,11 @@ private:
};
class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableReader>
{
Writers::FileWriter& m_oFileWriter;
int nCurType;
int nCurHeaderType;
CComments* m_pComments;
Writers::FileWriter& m_oFileWriter;
CComments* m_pComments;
int nCurType;
int nCurHeaderType;
public:
Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
public:
@ -581,13 +583,14 @@ class Binary_pPrReader : public Binary_CommonReader<Binary_pPrReader>
private:
Writers::FontTableWriter& m_oFontTableWriter;
public:
Binary_CommonReader2 oBinary_CommonReader2;
Binary_rPrReader oBinary_rPrReader;
Binary_HdrFtrTableReader oBinary_HdrFtrTableReader;
Writers::FileWriter& m_oFileWriter;
bool bDoNotWriteNullProp;
long m_nCurNumId;
long m_nCurLvl;
Binary_CommonReader2 oBinary_CommonReader2;
Binary_rPrReader oBinary_rPrReader;
Binary_HdrFtrTableReader oBinary_HdrFtrTableReader;
Writers::FileWriter& m_oFileWriter;
bool bDoNotWriteNullProp;
long m_nCurNumId;
long m_nCurLvl;
Binary_pPrReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):
m_oFontTableWriter(oFileWriter.m_oFontTableWriter), Binary_CommonReader(poBufferedStream), oBinary_CommonReader2(poBufferedStream), oBinary_rPrReader(poBufferedStream, oFileWriter), oBinary_HdrFtrTableReader(poBufferedStream, oFileWriter, oFileWriter.m_pComments), m_oFileWriter(oFileWriter)
@ -2605,11 +2608,12 @@ public:
};
class BinaryStyleTableReader : public Binary_CommonReader<BinaryStyleTableReader>
{
Binary_pPrReader oBinary_pPrReader;
Binary_rPrReader oBinary_rPrReader;
Binary_tblPrReader oBinary_tblPrReader;
Writers::StylesWriter& m_oStylesWriter;
Writers::FontTableWriter& m_oFontTableWriter;
Binary_pPrReader oBinary_pPrReader;
Binary_rPrReader oBinary_rPrReader;
Binary_tblPrReader oBinary_tblPrReader;
Writers::StylesWriter& m_oStylesWriter;
Writers::FontTableWriter& m_oFontTableWriter;
public:
BinaryStyleTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter) :Binary_CommonReader(poBufferedStream), m_oStylesWriter(oFileWriter.m_oStylesWriter), m_oFontTableWriter(oFileWriter.m_oFontTableWriter), oBinary_pPrReader(poBufferedStream, oFileWriter), oBinary_rPrReader(poBufferedStream, oFileWriter), oBinary_tblPrReader(poBufferedStream, oFileWriter)
{
@ -2895,10 +2899,11 @@ public:
}
else if(c_oSerOtherTableTypes::DocxTheme == type)
{
//переписываем взятую из ресурсов тему.
long nCurPos = m_oBufferedStream.GetPos();
m_oFileWriter.m_pDrawingConverter->SaveThemeXml(nCurPos, length, m_oFileWriter.m_sThemePath);
m_oBufferedStream.Seek(nCurPos + length);
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme();
pTheme->fromPPTY(&m_oBufferedStream);
NSBinPptxRW::CXmlWriter xmlWriter;
pTheme->toXmlWriter(&xmlWriter);
m_oFileWriter.m_oTheme.m_sContent = xmlWriter.GetXmlString();
}
else
res = c_oSerConstants::ReadUnknown;
@ -6304,6 +6309,8 @@ public:
}
int ReadObject(BYTE type, long length, void* poResult)
{
CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr());
int res = c_oSerConstants::ReadOk;
if( c_oSerParType::OMath == type )
{
@ -6313,7 +6320,6 @@ public:
}
else if(c_oSerRunType::pptxDrawing == type)
{
CDrawingProperty oCDrawingProperty(m_oFileWriter.getNextDocPr());
res = Read2(length, &Binary_DocumentTableReader::ReadPptxDrawing, this, &oCDrawingProperty);
if(oCDrawingProperty.bDataPos && oCDrawingProperty.bDataLength)
@ -6573,7 +6579,7 @@ public:
pDrawingProperty->bDataLength = true;
pDrawingProperty->DataPos = m_oBufferedStream.GetPos();
pDrawingProperty->DataLength = length;
//сейчас пропуская, потому что перед чтение этого поля надо собрать остальные данные
//сейчас пропуская, потому что перед чтение этого поля надо собрать остальные данные
res = c_oSerConstants::ReadUnknown;
}
else if ( c_oSerImageType2::Chart2 == type )
@ -6589,20 +6595,18 @@ public:
OOX::CPath pathChartsWorksheetDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("embeddings");
OOX::CSystemUtility::CreateDirectories(pathChartsWorksheetDir.GetPath());
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
int nativeDocumentType = m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType;
std::wstring sThemeDir;
int nIndex = (int)m_oFileWriter.m_sThemePath.rfind(FILE_SEPARATOR_CHAR);
if(-1 != nIndex)
sThemeDir = m_oFileWriter.m_sThemePath.substr(0, nIndex);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType = XMLWRITER_DOC_TYPE_XLSX;
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
BinXlsxRW::SaveParams oSaveParams(sThemeDir);
BinXlsxRW::SaveParams oSaveParams(m_oFileWriter.m_sThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());
BinXlsxRW::BinaryChartReader oBinaryChartReader(m_oBufferedStream, oSaveParams, m_oFileWriter.m_pDrawingConverter);
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace();
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
//save xlsx
//save xlsx
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(m_oFileWriter.m_oChartWriter.getChartCount() + 1) + L".xlsx";
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
@ -6610,7 +6614,7 @@ public:
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rIdXlsx;
std::wstring bstrChartsWorksheetRelType = OOX::Spreadsheet::FileTypes::ChartsWorksheet.RelationType();
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rIdXlsx);
pChartSpace->m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
@ -6620,7 +6624,7 @@ public:
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
pChartSpace->m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
//save chart.xml
//save chart.xml
NSStringUtils::CStringBuilder sw;
pChartSpace->toXML(sw);
@ -6630,16 +6634,19 @@ public:
std::wstring sContent = sw.GetData();
m_oFileWriter.m_oChartWriter.AddChart(sContent, sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oContentTypesWriter.AddOverrideRaw(oSaveParams.sAdditionalContentTypes);
OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + L".rels";
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(pathChartsRels.GetPath());
long rIdChart;
std::wstring bstrChartRelType = OOX::Spreadsheet::FileTypes::Charts.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartRelType, sRelsName, std::wstring(), &rIdChart);
std::wstring bstrChartRelType = OOX::FileTypes::Chart.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrChartRelType, sRelsName, std::wstring(), &rIdChart);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml", L"/word/charts", sFilename);
pDrawingProperty->sChartRels = L"rId" + std::to_wstring( rIdChart);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_nDocumentType = nativeDocumentType;
}
else
res = c_oSerConstants::ReadUnknown;
@ -6652,7 +6659,7 @@ public:
pDrawingProperty->bDataLength = true;
pDrawingProperty->DataPos = m_oBufferedStream.GetPos();
pDrawingProperty->DataLength = length;
//сейчас пропуская, потому что перед чтение этого поля надо собрать остальные данные
//сейчас пропуская, потому что перед чтение этого поля надо собрать остальные данные
}
res = c_oSerConstants::ReadUnknown;
}
@ -6689,7 +6696,7 @@ public:
else if ( c_oSerImageType2::RelativeHeight == type )
{
pDrawingProperty->bRelativeHeight = true;
pDrawingProperty->RelativeHeight = m_oBufferedStream.GetLong();
pDrawingProperty->RelativeHeight = m_oBufferedStream.GetULong();
}
else if ( c_oSerImageType2::BSimplePos == type )
{
@ -6764,56 +6771,118 @@ public:
}
else if ( c_oSerImageType2::GraphicFramePr == type )
{
OOX::Drawing::CGraphicalObjectFrameLocking* pLocking = new OOX::Drawing::CGraphicalObjectFrameLocking();
res = Read2(length, &Binary_DocumentTableReader::ReadNvGraphicFramePr, this, pLocking);
OOX::Drawing::CNonVisualGraphicFrameProperties oGraphicFramePr;
oGraphicFramePr.m_oGraphicFrameLocks.reset(pLocking);
PPTX::Logic::CNvGraphicFramePr oGraphicFramePr(L"wp");
res = Read2(length, &Binary_DocumentTableReader::ReadCNvGraphicFramePr, this, &oGraphicFramePr);
pDrawingProperty->sGraphicFramePr = oGraphicFramePr.toXML();
}
else if ( c_oSerImageType2::DocPr == type )
{
OOX::Drawing::CNonVisualDrawingProps pNonVisualDrawingProps;
pNonVisualDrawingProps.m_eType = OOX::et_wp_docPr;
PPTX::Logic::CNvPr pNonVisualDrawingProps(L"wp");
res = Read1(length, &Binary_DocumentTableReader::ReadDocPr, this, &pNonVisualDrawingProps);
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML();
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML2(L"wp:docPr");
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadNvGraphicFramePr(BYTE type, long length, void* poResult)
int ReadEmbedded(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Drawing::CGraphicalObjectFrameLocking* pLocking = static_cast<OOX::Drawing::CGraphicalObjectFrameLocking*>(poResult);
CDrawingProperty* pDrawingProperty = static_cast<CDrawingProperty*>(poResult);
if ( c_oSerEmbedded::Type == type )
{
pDrawingProperty->nObjectType = m_oBufferedStream.GetUChar();
}
else if ( c_oSerEmbedded::Program == type )
{
pDrawingProperty->sObjectProgram = m_oBufferedStream.GetString2();
}
else if ( c_oSerEmbedded::Data == type )
{
pDrawingProperty->bObject = true;
long pos = m_oBufferedStream.GetPos();
if (pDrawingProperty->nObjectType == 1)
{
}
else if (pDrawingProperty->nObjectType == 2)
{
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
oXlsxSerializer.setDrawingConverter(m_oFileWriter.m_pDrawingConverter);
std::wstring strDstEmbedded = m_oBufferedStream.m_pRels->m_pManager->GetDstMedia();
int nPos = (int)strDstEmbedded.rfind(wchar_t('m'));
if (-1 != nPos)
strDstEmbedded = strDstEmbedded.substr(0, nPos);
strDstEmbedded += L"embeddings";
NSDirectory::CreateDirectory(strDstEmbedded);
std::wstring strDstEmbeddedTemp = strDstEmbedded + FILE_SEPARATOR_STR + L"Temp";
NSDirectory::CreateDirectory(strDstEmbeddedTemp);
int id = m_oFileWriter.m_oChartWriter.getChartCount();
m_oFileWriter.m_oChartWriter.setChartCount(id + 1);
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring( id + 1) + L".xlsx";
BinXlsxRW::SaveParams oSaveParams(m_oFileWriter.m_sThemePath, m_oFileWriter.m_pDrawingConverter->GetContentTypes());//???
OOX::Spreadsheet::CXlsx oXlsx;
BinXlsxRW::BinaryFileReader embeddedReader;
embeddedReader.ReadMainTable(oXlsx, m_oBufferedStream, L"", strDstEmbeddedTemp, oSaveParams, m_oFileWriter.m_pDrawingConverter);
oXlsx.PrepareToWrite();
oXlsx.Write(strDstEmbeddedTemp, *oSaveParams.pContentTypes);
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(strDstEmbeddedTemp, strDstEmbedded + FILE_SEPARATOR_STR + sXlsxFilename, -1);
std::wstring sEmbWorksheetRelsName = L"embeddings/" + sXlsxFilename;
std::wstring bstrEmbWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_oFileWriter.m_pDrawingConverter->WriteRels(bstrEmbWorksheetRelType, sEmbWorksheetRelsName, std::wstring(), &pDrawingProperty->nObjectId);
NSDirectory::DeleteDirectory(strDstEmbeddedTemp);
}
m_oBufferedStream.Seek( pos + length);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
}
int ReadCNvGraphicFramePr(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
PPTX::Logic::CNvGraphicFramePr * pLocking = static_cast<PPTX::Logic::CNvGraphicFramePr*>(poResult);
if ( c_oSerGraphicFramePr::NoChangeAspect == type )
{
pLocking->m_oNoChangeAspect.Init();
pLocking->m_oNoChangeAspect->FromBool(m_oBufferedStream.GetBool());
pLocking->noChangeAspect = m_oBufferedStream.GetBool();
}
else if ( c_oSerGraphicFramePr::NoDrilldown == type )
{
pLocking->m_oNoDrilldown.Init();
pLocking->m_oNoDrilldown->FromBool(m_oBufferedStream.GetBool());
pLocking->noDrilldown = m_oBufferedStream.GetBool();
}
else if ( c_oSerGraphicFramePr::NoGrp == type )
{
pLocking->m_oNoGrp.Init();
pLocking->m_oNoGrp->FromBool(m_oBufferedStream.GetBool());
pLocking->noGrp = m_oBufferedStream.GetBool();
}
else if ( c_oSerGraphicFramePr::NoMove == type )
{
pLocking->m_oNoMove.Init();
pLocking->m_oNoMove->FromBool(m_oBufferedStream.GetBool());
pLocking->noMove = m_oBufferedStream.GetBool();
}
else if ( c_oSerGraphicFramePr::NoResize == type )
{
pLocking->m_oNoResize.Init();
pLocking->m_oNoResize->FromBool(m_oBufferedStream.GetBool());
pLocking->noResize = m_oBufferedStream.GetBool();
}
else if ( c_oSerGraphicFramePr::NoSelect == type )
{
pLocking->m_oNoSelect.Init();
pLocking->m_oNoSelect->FromBool(m_oBufferedStream.GetBool());
pLocking->noSelect = m_oBufferedStream.GetBool();
}
else
res = c_oSerConstants::ReadUnknown;
@ -6822,31 +6891,28 @@ public:
int ReadDocPr(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
OOX::Drawing::CNonVisualDrawingProps* pNonVisualDrawingProps = static_cast<OOX::Drawing::CNonVisualDrawingProps*>(poResult);
PPTX::Logic::CNvPr* pNonVisualDrawingProps = static_cast<PPTX::Logic::CNvPr*>(poResult);
if ( c_oSerDocPr::Id == type )
{
pNonVisualDrawingProps->m_oId.Init();
pNonVisualDrawingProps->m_oId->SetValue(m_oBufferedStream.GetLong());
pNonVisualDrawingProps->id = m_oBufferedStream.GetLong();
}
else if ( c_oSerDocPr::Name == type )
{
pNonVisualDrawingProps->m_sName.Init();
pNonVisualDrawingProps->m_sName->append(m_oBufferedStream.GetString3(length));
pNonVisualDrawingProps->name = m_oBufferedStream.GetString3(length);
}
else if ( c_oSerDocPr::Hidden == type )
{
pNonVisualDrawingProps->m_oHidden.Init();
pNonVisualDrawingProps->m_oHidden->FromBool(m_oBufferedStream.GetBool());
pNonVisualDrawingProps->hidden = m_oBufferedStream.GetBool();
}
else if ( c_oSerDocPr::Title == type )
{
pNonVisualDrawingProps->m_sTitle.Init();
pNonVisualDrawingProps->m_sTitle->append(m_oBufferedStream.GetString3(length));
pNonVisualDrawingProps->title = m_oBufferedStream.GetString3(length);
}
else if ( c_oSerDocPr::Descr == type )
{
pNonVisualDrawingProps->m_sDescr.Init();
pNonVisualDrawingProps->m_sDescr->append(m_oBufferedStream.GetString3(length));
pNonVisualDrawingProps->descr = m_oBufferedStream.GetString3(length);
}
else
res = c_oSerConstants::ReadUnknown;
@ -7083,88 +7149,13 @@ public:
return oBinary_pPrReader.Read_SecPr(type, length, poResult);
}
};
Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter),m_pComments(pComments)
{
}
int Binary_HdrFtrTableReader::Read()
{
return ReadTable(&Binary_HdrFtrTableReader::ReadHdrFtrContent, this);
}
int Binary_HdrFtrTableReader::ReadHdrFtrContent(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerHdrFtrTypes::Header == type || c_oSerHdrFtrTypes::Footer == type )
{
nCurType = type;
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrFEO, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int Binary_HdrFtrTableReader::ReadHdrFtrFEO(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerHdrFtrTypes::HdrFtr_First == type || c_oSerHdrFtrTypes::HdrFtr_Even == type || c_oSerHdrFtrTypes::HdrFtr_Odd == type )
{
nCurHeaderType = type;
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItem, this, poResult);
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poResult)
{
int res = c_oSerConstants::ReadOk;
if ( c_oSerHdrFtrTypes::HdrFtr_Content == type )
{
Writers::HdrFtrItem* poHdrFtrItem = NULL;
switch(nCurHeaderType)
{
case c_oSerHdrFtrTypes::HdrFtr_First:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrFirst);break;
case c_oSerHdrFtrTypes::HdrFtr_Even:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrEven);break;
case c_oSerHdrFtrTypes::HdrFtr_Odd:poHdrFtrItem = new Writers::HdrFtrItem(SimpleTypes::hdrftrDefault);break;
}
if(NULL != poHdrFtrItem)
{
if(nCurType == c_oSerHdrFtrTypes::Header)
{
m_oHeaderFooterWriter.m_aHeaders.push_back(poHdrFtrItem);
poHdrFtrItem->m_sFilename = L"header" + std::to_wstring((int)m_oHeaderFooterWriter.m_aHeaders.size()) + L".xml";
}
else
{
m_oHeaderFooterWriter.m_aFooters.push_back(poHdrFtrItem);
poHdrFtrItem->m_sFilename = L"footer" + std::to_wstring((int)m_oHeaderFooterWriter.m_aFooters.size()) + L".xml";
}
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
FILE_SEPARATOR_STR + _T("_rels")+
FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + _T(".rels");
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
}
}
else
res = c_oSerConstants::ReadUnknown;
return res;
};
int Binary_HdrFtrTableReader::ReadHdrFtrItemContent(BYTE type, long length, void* poResult)
{
Binary_DocumentTableReader* pBinary_DocumentTableReader = static_cast<Binary_DocumentTableReader*>(poResult);
return pBinary_DocumentTableReader->ReadDocumentContent(type, length, NULL);
};
class Binary_NotesTableReader : public Binary_CommonReader<Binary_NotesTableReader>
{
Writers::FileWriter& m_oFileWriter;
CComments* m_pComments;
bool m_bIsFootnote;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
nullable<SimpleTypes::CFtnEdn<> > m_oType;
Writers::FileWriter& m_oFileWriter;
CComments* m_pComments;
bool m_bIsFootnote;
nullable<SimpleTypes::CDecimalNumber<>> m_oId;
nullable<SimpleTypes::CFtnEdn<>> m_oType;
public:
Binary_NotesTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments, bool bIsFootnote):
Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_pComments(pComments),m_bIsFootnote(bIsFootnote)
@ -7271,9 +7262,11 @@ class BinaryFileReader
{
private:
NSBinPptxRW::CBinaryFileReader& m_oBufferedStream;
Writers::FileWriter& m_oFileWriter;
std::wstring m_sFileInDir;
public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReader& oBufferedStream, Writers::FileWriter& oFileWriter):m_sFileInDir(sFileInDir),m_oBufferedStream(oBufferedStream), m_oFileWriter(oFileWriter)
Writers::FileWriter& m_oFileWriter;
std::wstring m_sFileInDir;
public:
BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReader& oBufferedStream, Writers::FileWriter& oFileWriter) :
m_sFileInDir(sFileInDir), m_oBufferedStream(oBufferedStream), m_oFileWriter(oFileWriter)
{
}
int ReadFile()
@ -7282,19 +7275,23 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
}
int ReadMainTable()
{
m_oBufferedStream.m_nDocumentType = XMLWRITER_DOC_TYPE_DOCX;
long res = c_oSerConstants::ReadOk;
//mtLen
res = m_oBufferedStream.Peek(1) == false ? c_oSerConstants::ErrorStream : c_oSerConstants::ReadOk;
if(c_oSerConstants::ReadOk != res)
return res;
long nOtherOffset = -1;
long nStyleOffset = -1;
long nSettingsOffset = -1;
long nDocumentOffset = -1;
long nCommentsOffset = -1;
long nOtherOffset = -1;
long nStyleOffset = -1;
long nSettingsOffset = -1;
long nDocumentOffset = -1;
long nCommentsOffset = -1;
std::vector<BYTE> aTypes;
std::vector<long> aOffBits;
BYTE mtLen = m_oBufferedStream.GetUChar();
for(int i = 0; i < mtLen; ++i)
{
//mtItem
@ -7383,29 +7380,29 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
{
//case c_oSerTableTypes::Signature:break;
//case c_oSerTableTypes::Info:break;
//case c_oSerTableTypes::Style:
// res = BinaryStyleTableReader(m_oBufferedStream, m_oFileWriter).Read();
// break;
//case c_oSerTableTypes::Document:
// res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter).Read();
// break;
case c_oSerTableTypes::HdrFtr:
res = Binary_HdrFtrTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments).Read();
break;
case c_oSerTableTypes::Numbering:
res = Binary_NumberingTableReader(m_oBufferedStream, m_oFileWriter).Read();
break;
case c_oSerTableTypes::Footnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, true).Read();
break;
case c_oSerTableTypes::Endnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read();
break;
//case c_oSerTableTypes::Style:
// res = BinaryStyleTableReader(m_oBufferedStream, m_oFileWriter).Read();
// break;
//case c_oSerTableTypes::Document:
// res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter).Read();
// break;
case c_oSerTableTypes::HdrFtr:
res = Binary_HdrFtrTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments).Read();
break;
case c_oSerTableTypes::Numbering:
res = Binary_NumberingTableReader(m_oBufferedStream, m_oFileWriter).Read();
break;
case c_oSerTableTypes::Footnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, true).Read();
break;
case c_oSerTableTypes::Endnotes:
res = Binary_NotesTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments, false).Read();
break;
//Comments должны читаться раньше чем c_oSerTableTypes::Document
//case c_oSerTableTypes::Comments:
// res = oBinary_CommentsTableReader.Read();
// break;
//Comments должны читаться раньше чем c_oSerTableTypes::Document
//case c_oSerTableTypes::Comments:
// res = oBinary_CommentsTableReader.Read();
// break;
//case c_oSerTableTypes::Other:
// res = Binary_OtherTableReader(m_sFileInDir, m_oBufferedStream, m_oFileWriter).Read();
// break;
@ -7419,25 +7416,37 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
long stamdartRId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles")), std::wstring(_T("styles.xml")), std::wstring(), &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings")), std::wstring(_T("settings.xml")), std::wstring(), &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings")), std::wstring(_T("webSettings.xml")), std::wstring(), &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable")), std::wstring(_T("fontTable.xml")), std::wstring(), &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme")), std::wstring(_T("theme/theme1.xml")), std::wstring(), &stamdartRId);
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", L"styles.xml", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", L"settings.xml", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",L"webSettings.xml", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", L"fontTable.xml", L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", L"theme/theme1.xml",L"", &stamdartRId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", L"/word", L"document.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", L"/word", L"styles.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml", L"/word", L"settings.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml", L"/word", L"webSettings.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml", L"/word", L"fontTable.xml");
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.theme+xml", L"/word/theme", L"theme1.xml");
if(false == m_oFileWriter.m_oNumberingWriter.IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering")), std::wstring(_T("numbering.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml", L"/word", L"numbering.xml");
}
if(false == m_oFileWriter.m_oFootnotesWriter.IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes")), std::wstring(_T("footnotes.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml", L"/word", L"footnotes.xml");
}
if(false == m_oFileWriter.m_oEndnotesWriter.IsEmpty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes")), std::wstring(_T("endnotes.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml", L"/word", L"endnotes.xml");
}
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aHeaders.size(); ++i)
{
@ -7447,6 +7456,8 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header")), pHeader->m_sFilename, std::wstring(), &rId);
pHeader->rId = L"rId" + std::to_wstring( rId );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", L"/word", pHeader->m_sFilename);
}
}
for(size_t i = 0; i < m_oFileWriter.m_oHeaderFooterWriter.m_aFooters.size(); ++i)
@ -7457,6 +7468,8 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer")), pFooter->m_sFilename, std::wstring(), &rId);
pFooter->rId = L"rId" + std::to_wstring( rId );
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml", L"/word", pFooter->m_sFilename);
}
}
res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter, &oBinary_CommentsTableReader.m_oComments).Read();
@ -7465,26 +7478,32 @@ public: BinaryFileReader(std::wstring& sFileInDir, NSBinPptxRW::CBinaryFileReade
+ FILE_SEPARATOR_STR + _T("_rels")
+ FILE_SEPARATOR_STR + _T("document.xml.rels");
CComments& oComments = oBinary_CommentsTableReader.m_oComments;
CComments& oComments= oBinary_CommentsTableReader.m_oComments;
Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter;
std::wstring sContent = oComments.writeContent();
std::wstring sContentEx = oComments.writeContentExt();//важно чтобы writeContentExt вызывался после writeContent
std::wstring sPeople = oComments.writePeople();
std::wstring sContent = oComments.writeContent();
std::wstring sContentEx = oComments.writeContentExt(); //важно чтобы writeContentExt вызывался после writeContent
std::wstring sPeople = oComments.writePeople();
oCommentsWriter.setElements(sContent, sContentEx, sPeople);
if(false == oCommentsWriter.m_sComment.empty())
if(false == oCommentsWriter.m_sComment.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments")), std::wstring(_T("comments.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
}
if(false == oCommentsWriter.m_sCommentExt.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/commentsExtended")), std::wstring(_T("commentsExtended.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
}
if(false == oCommentsWriter.m_sPeople.empty())
{
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.microsoft.com/office/2011/relationships/people")), std::wstring(_T("people.xml")), std::wstring(), &rId);
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
}
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());

View File

@ -42,9 +42,9 @@ namespace Writers
class SettingWriter
{
std::wstring m_sDir;
XmlUtils::CStringWriter m_oSettingWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
std::wstring m_sDir;
XmlUtils::CStringWriter m_oSettingWriter;
HeaderFooterWriter& m_oHeaderFooterWriter;
public:
SettingWriter(std::wstring sDir, HeaderFooterWriter& oHeaderFooterWriter):m_sDir(sDir),m_oHeaderFooterWriter(oHeaderFooterWriter)
{
@ -54,8 +54,8 @@ namespace Writers
Prepare();
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"settings.xml";
CFile oFile;
oFile.CreateFile(filePath.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(g_string_set_Start);
oFile.WriteStringUTF8(m_oSettingWriter.GetData());
oFile.WriteStringUTF8(g_string_set_Default);

View File

@ -58,7 +58,6 @@ namespace Writers
}
void Write()
{
m_oWriter.WriteString(g_string_st_Start);
m_oWriter.WriteString(std::wstring(_T("<w:docDefaults>")));
m_oWriter.WriteString(std::wstring(_T("<w:rPrDefault>")));
@ -81,8 +80,8 @@ namespace Writers
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("styles.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile();

View File

@ -34,6 +34,7 @@
#include "../../XlsxSerializerCom/Common/Common.h"
#include "../../DesktopEditor/fontengine/FontManager.h"
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
namespace Writers
{
@ -48,8 +49,8 @@ namespace Writers
CFontManager* m_pFontManager;
public:
std::map<std::wstring, int> m_mapFonts;
public:
FontTableWriter(std::wstring sDir, std::wstring sFontDir, bool bNoFontDir):m_sDir(sDir)
FontTableWriter(std::wstring sDir, std::wstring sFontDir, bool bNoFontDir):m_sDir(sDir)
{
m_pFontManager = NULL;
if(!bNoFontDir)
@ -102,8 +103,8 @@ namespace Writers
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("fontTable.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath.GetPath());
oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile();

View File

@ -54,8 +54,8 @@ namespace Writers
OOX::CPath fileName = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("webSettings.xml");
CFile oFile;
oFile.CreateFile(fileName.GetPath());
NSFile::CFileBinary oFile;
oFile.CreateFileW(fileName.GetPath());
oFile.WriteStringUTF8(s_Common);
oFile.CloseFile();
}

View File

@ -33,13 +33,11 @@
#define BINEQUATIONWRITER_H
#include "BinReaderWriterDefines.h"
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_OMath.h"
#include "../../Common/DocxFormat/Source/MathEquation/OutputDev.h"
#include <stack>
/*namespace BinDocxRW
{
class BinaryCommonWriter;
}*/
namespace MathEquation
{
class EquationRun

View File

@ -997,6 +997,12 @@ extern int g_nCurFormatVersion;
Title = 3,
Descr = 4
};}
namespace c_oSerEmbedded{enum c_oSerEmbedded
{
Type = 0,
Data = 1,
Program = 2
};}
}
#endif // #ifndef DOCX_BIN_READER_WRITER_DEFINES

View File

@ -35,9 +35,9 @@
namespace BinDocxRW
{
BinaryHeaderFooterTableWriter::BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels, std::map<int, bool>* mapIgnoreComments):
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_poTheme(oParamsWriter.m_poTheme), m_oFontProcessor(*oParamsWriter.m_pFontProcessor), m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter), m_oDocumentRels(oDocumentRels),m_mapIgnoreComments(mapIgnoreComments)
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_poTheme(oParamsWriter.m_poTheme), m_oFontProcessor(*oParamsWriter.m_pFontProcessor), m_oSettings(oParamsWriter.m_oSettings), m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter), m_oDocumentRels(oDocumentRels),m_mapIgnoreComments(mapIgnoreComments)
{
};
}
void BinaryHeaderFooterTableWriter::Write()
{
int nStart = m_oBcw.WriteItemWithLengthStart();
@ -57,7 +57,7 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
m_oBcw.WriteItemWithLengthEnd(nStart);
};
}
void BinaryHeaderFooterTableWriter::WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr)
{
int nCurPos = 0;
@ -69,26 +69,26 @@ namespace BinDocxRW
BYTE byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_Odd;
switch(eType)
{
case SimpleTypes::hdrftrFirst: byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_First;break;
case SimpleTypes::hdrftrEven: byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_Even;break;
default: byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_Odd;break;
case SimpleTypes::hdrftrFirst: byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_First; break;
case SimpleTypes::hdrftrEven: byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_Even; break;
default: byteHdrFtrType = c_oSerHdrFtrTypes::HdrFtr_Odd; break;
}
nCurPos = m_oBcw.WriteItemStart(byteHdrFtrType);
WriteHdrFtrItem(pSectPr, pHdrFtr, bHdr);
m_oBcw.WriteItemEnd(nCurPos);
}
};
}
void BinaryHeaderFooterTableWriter::WriteHdrFtrItem(OOX::Logic::CSectionProperty* pSectPr, OOX::CHdrFtr* pHdrFtr, bool bHdr)
{
int nCurPos = 0;
//Content
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath());
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, pHdrFtr->m_arrShapeTypes);
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
};
{
int nCurPos = 0;
//Content
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath());
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, pHdrFtr->m_arrShapeTypes);
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
m_oBcw.WriteItemEnd(nCurPos);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -43,10 +43,16 @@ int BinDocxRW::g_nCurFormatVersion = 0;
BinDocxRW::CDocxSerializer::CDocxSerializer()
{
m_pParamsWriter = NULL;
m_pCurFileWriter = NULL;
m_bIsNoBase64Save = false;
m_bSaveChartAsImg = false;
m_pParamsWriter = NULL;
m_pCurFileWriter = NULL;
m_bIsNoBase64Save = false;
m_bSaveChartAsImg = false;
}
BinDocxRW::CDocxSerializer::~CDocxSerializer()
{
RELEASEOBJECT(m_pParamsWriter);
RELEASEOBJECT(m_pCurFileWriter);
}
bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions)
{
@ -106,6 +112,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
CFontManager* pFontManager = pFontPicker->get_FontManager();
DocWrapper::FontProcessor fp;
fp.setFontManager(pFontManager);
NSBinPptxRW::CDrawingConverter oDrawingConverter;
oDrawingConverter.SetFontManager(pFontManager);
NSBinPptxRW::CBinaryFileWriter& oBufferedStream = *oDrawingConverter.m_pBinaryWriter;
@ -136,10 +143,13 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const std::wstring& sSrcFileName, co
m_pParamsWriter = new ParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
BinaryFileWriter oBinaryFileWriter(*m_pParamsWriter);
oBinaryFileWriter.intoBindoc(sDstPath);
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
int nBinBufferLen = oBufferedStream.GetPosition();
if (m_bIsNoBase64Save)
{
NSFile::CFileBinary oFile;
@ -207,6 +217,7 @@ bool BinDocxRW::CDocxSerializer::CreateDocxFolders(std::wstring strDirectory, st
bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sThemePath, const std::wstring& sMediaPath, const std::wstring& sEmbedPath)
{
bool bResultOk = false;
RELEASEOBJECT(m_pCurFileWriter);
NSFile::CFileBinary oFile;
if(oFile.OpenFile(sSrcFileName))
@ -263,7 +274,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
if(false != Base64::Base64Decode((const char*)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
{
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
NSBinPptxRW::CBinaryFileReader& oBufferedStream = *oDrawingConverter.m_pReader;
oBufferedStream.Init(pData, 0, nDataSize);
@ -276,24 +288,26 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
{
g_nCurFormatVersion = nVersion = nTempVersion;
}
}
}
oDrawingConverter.SetMainDocument(this);
oDrawingConverter.SetMediaDstPath(sMediaPath);
oDrawingConverter.SetEmbedDstPath(sEmbedPath);
m_pCurFileWriter = new Writers::FileWriter(sDstPath, m_sFontDir, false, nVersion, m_bSaveChartAsImg, &oDrawingConverter, sThemePath);
//папка с картинками
//папка с картинками
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
std::wstring sFileInDir = strFileInDir.c_str();
oDrawingConverter.SetSourceFileDir(sFileInDir);
//default theme
m_pCurFileWriter->m_oDefaultTheme.Write(sThemePath);
BinaryFileReader oBinaryFileReader(sFileInDir, oBufferedStream, *m_pCurFileWriter);
oBinaryFileReader.ReadFile();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
OOX::CContentTypes oContentTypes;
//themes
m_pCurFileWriter->m_oTheme.Write(sThemePath);
OOX::CContentTypes *pContentTypes = oDrawingConverter.GetContentTypes();
//docProps
OOX::CPath pathDocProps = sDstPath + FILE_SEPARATOR_STR + _T("docProps");
NSDirectory::CreateDirectory(pathDocProps.GetPath());
@ -304,14 +318,14 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("3.0000"));
pApp->SetAppVersion(_T("4.3000"));
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, *pContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore();
@ -319,34 +333,15 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, *pContentTypes);
delete pCore;
}
/////////////////////////////////////////////////////////////////////////////////////
m_pCurFileWriter->m_oContentTypesWriter.AddOverrideRaw(oDrawingConverter.GetContentTypes());
m_pCurFileWriter->Write();
pContentTypes->Write(sDstPath);
m_pCurFileWriter->m_oCommentsWriter.Write();
m_pCurFileWriter->m_oChartWriter.Write();
m_pCurFileWriter->m_oStylesWriter.Write();
m_pCurFileWriter->m_oNumberingWriter.Write();
m_pCurFileWriter->m_oFontTableWriter.Write();
m_pCurFileWriter->m_oHeaderFooterWriter.Write();
m_pCurFileWriter->m_oFootnotesWriter.Write();
m_pCurFileWriter->m_oEndnotesWriter.Write();
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
m_pCurFileWriter->m_oSettingWriter.Write();
m_pCurFileWriter->m_oWebSettingsWriter.Write();
//Document пишем после HeaderFooter, чтобы заполнить sectPr
m_pCurFileWriter->m_oDocumentWriter.Write();
//Rels и ContentTypes пишем в конце
m_pCurFileWriter->m_oDocumentRelsWriter.Write();
m_pCurFileWriter->m_oContentTypesWriter.Write();
//CSerializer oSerializer = CSerializer();
//if(false != oSerializer.Write(oBufferedStream, sDirectoryOut))
//{
bResultOk = true;
//}
}
}
RELEASEARRAYOBJECTS(pBase64Data);
@ -371,11 +366,6 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const std::wstring& bsTxConten
XmlUtils::CXmlLiteReader oReader;
// std::wstring bsTxContentTemp = _T("<root xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">");
//
// bsTxContentTemp += bsTxContent;
// bsTxContentTemp + _T("</root>");
std::wstring sBegin(_T("<root xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">"));
std::wstring sEnd(_T("</root>"));
@ -398,6 +388,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const std::wstring& bsTxConten
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems);
oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos);
@ -419,6 +410,7 @@ bool BinDocxRW::CDocxSerializer::getBinaryContentElem(OOX::EElementType eElemTyp
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
if(OOX::et_m_oMathPara == eElemType)
@ -431,6 +423,11 @@ bool BinDocxRW::CDocxSerializer::getBinaryContentElem(OOX::EElementType eElemTyp
OOX::Logic::COMath* pMath = static_cast<OOX::Logic::COMath*>(pElem);
oBinaryDocumentTableWriter.WriteMathArgNodes(pMath->m_arrItems);
}
else if(OOX::et_w_sdtContent == eElemType)
{
OOX::Logic::CSdtContent* pContent = static_cast<OOX::Logic::CSdtContent*>(pElem);
oBinaryDocumentTableWriter.WriteDocumentContent(pContent->m_arrItems);
}
oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos);
oParamsWriter.m_pCBufferedStream = pBufferedStreamOld;

View File

@ -51,14 +51,16 @@ namespace BinDocxRW
class CDocxSerializer
{
public:
std::wstring m_sFontDir;
std::wstring m_sEmbeddedFontsDir;
bool m_bIsNoBase64Save;
bool m_bSaveChartAsImg;
ParamsWriter* m_pParamsWriter;
Writers::FileWriter* m_pCurFileWriter;
public:
std::wstring m_sFontDir;
std::wstring m_sEmbeddedFontsDir;
bool m_bIsNoBase64Save;
bool m_bSaveChartAsImg;
ParamsWriter* m_pParamsWriter;
Writers::FileWriter* m_pCurFileWriter;
CDocxSerializer();
virtual ~CDocxSerializer();
bool ConvertDocxToDoct(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);
bool ConvertDoctToDocx(const std::wstring& sSrcFileName, const std::wstring& sDstFileName, const std::wstring& sTmpDir, const std::wstring& sXMLOptions);

View File

@ -80,24 +80,24 @@ namespace DocWrapper {
return fontName;
}
std::wstring FontProcessor::getFont(const NSCommon::nullable<OOX::Spreadsheet::CFontScheme>& oScheme, const NSCommon::nullable<ComplexTypes::Spreadsheet::String>& oRFont, const NSCommon::nullable<OOX::Spreadsheet::CCharset>& oCharset, const NSCommon::nullable<OOX::Spreadsheet::CFontFamily >& oFamily, OOX::CTheme* pTheme)
std::wstring FontProcessor::getFont(const NSCommon::nullable<OOX::Spreadsheet::CFontScheme>& oScheme, const NSCommon::nullable<ComplexTypes::Spreadsheet::String>& oRFont, const NSCommon::nullable<OOX::Spreadsheet::CCharset>& oCharset, const NSCommon::nullable<OOX::Spreadsheet::CFontFamily >& oFamily, PPTX::Theme* pTheme)
{
CFontSelectFormat oFontSelectFormat;
std::wstring sFontName;
if(NULL != pTheme && oScheme.IsInit() && oScheme->m_oFontScheme.IsInit())
{
//берем шрифт из темы
//берем шрифт из темы
const SimpleTypes::Spreadsheet::EFontScheme eFontScheme = oScheme->m_oFontScheme->GetValue();
if(SimpleTypes::Spreadsheet::fontschemeMajor == eFontScheme)
sFontName = pTheme->GetMajorFont();
sFontName = pTheme->themeElements.fontScheme.majorFont.latin.typeface;
else if(SimpleTypes::Spreadsheet::fontschemeMinor == eFontScheme)
sFontName = pTheme->GetMinorFont();
sFontName = pTheme->themeElements.fontScheme.minorFont.latin.typeface;
}
if(sFontName.empty() && oRFont.IsInit() && oRFont->m_sVal.IsInit())
sFontName = oRFont->ToString2();
if(sFontName.empty())
sFontName = std::wstring(gc_sNoNameFont);
//подбор перенесен в js
//подбор перенесен в js
return sFontName;
oFontSelectFormat.wsName = new std::wstring(sFontName);

View File

@ -30,26 +30,29 @@
*
*/
#pragma once
//#include "../stdafx.h"
#include <map>
#include "../../DesktopEditor/fontengine/ApplicationFonts.h"
//#include "DocWrapper/Base.h"
namespace NSCommon{
template<class Type> class nullable;
}
namespace ComplexTypes{
namespace Spreadsheet{
namespace ComplexTypes
{
namespace Spreadsheet
{
class String;
}
}
namespace PPTX
{
class Theme;
}
namespace OOX
{
class CFont;
class CFontTable;
class CTheme;
namespace Spreadsheet
{
class CFont;
@ -61,9 +64,10 @@ namespace OOX
}
}
namespace DocWrapper {
class FontProcessor {
namespace DocWrapper
{
class FontProcessor
{
CFontManager* m_pFontManager;
std::map<std::wstring, std::wstring> fontMap;
@ -76,7 +80,7 @@ namespace DocWrapper {
void setFontTable(OOX::CFontTable* fontTable);
std::wstring getFont(const std::wstring& name);
std::wstring getFont(const NSCommon::nullable<OOX::Spreadsheet::CFontScheme>& oScheme, const NSCommon::nullable<ComplexTypes::Spreadsheet::String>& oRFont, const NSCommon::nullable<OOX::Spreadsheet::CCharset>& oCharset, const NSCommon::nullable<OOX::Spreadsheet::CFontFamily >& oFamily, OOX::CTheme* pTheme);
std::wstring getFont(const NSCommon::nullable<OOX::Spreadsheet::CFontScheme>& oScheme, const NSCommon::nullable<ComplexTypes::Spreadsheet::String>& oRFont, const NSCommon::nullable<OOX::Spreadsheet::CCharset>& oCharset, const NSCommon::nullable<OOX::Spreadsheet::CFontFamily >& oFamily, PPTX::Theme* pTheme);
private:
void addToFontMap(OOX::CFont& font);
};

View File

@ -85,17 +85,17 @@ namespace BinXlsxRW{
}
bool CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir)
{
NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter;
oOfficeDrawingConverter.SetMediaDstPath(sMediaDir);
oOfficeDrawingConverter.SetEmbedDstPath(sEmbedDir);
NSBinPptxRW::CDrawingConverter oDrawingConverter;
oDrawingConverter.SetMediaDstPath(sMediaDir);
oDrawingConverter.SetEmbedDstPath(sEmbedDir);
//папка с бинарников
std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName);
oOfficeDrawingConverter.SetSourceFileDir(strFileInDir, 2);
oDrawingConverter.SetSourceFileDir(strFileInDir, 2);
BinXlsxRW::BinaryFileReader oBinaryFileReader;
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oOfficeDrawingConverter, sXMLOptions);
oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oDrawingConverter, sXMLOptions);
return true;
}
bool CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions)
@ -139,105 +139,100 @@ namespace BinXlsxRW{
RELEASEOBJECT(pFontPicker);
return true;
}
bool CXlsxSerializer::loadChart(const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize)
bool CXlsxSerializer::loadChart(const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter* pWriter, long& lDataSize)
{
bool bRes = false;
//todo передать нормальный oRootPath
OOX::CPath oRootPath;
OOX::Spreadsheet::CChartSpace oChart(oRootPath, sChartPath);
if(NULL != m_pExternalDrawingConverter)
{
long nStartPos = oBufferedStream.GetPosition();
BinXlsxRW::BinaryCommonWriter oBcw(oBufferedStream);
std::wstring sOldRelsPath = m_pExternalDrawingConverter->GetRelsPath();
m_pExternalDrawingConverter->SetRelsPath(sChartPath);
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(oBufferedStream, m_pExternalDrawingConverter);
oBinaryChartWriter.WriteCT_ChartSpace(oChart);
m_pExternalDrawingConverter->SetRelsPath(sOldRelsPath);
long nEndPos = oBufferedStream.GetPosition();
lDataSize = nEndPos - nStartPos;
bRes = true;
}
return bRes;
}
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, const std::wstring& sFilepath, const std::wstring& sContentTypePath, std::wstring** sContentTypeElement, const long& lChartNumber)
{
bool bRes = false;
*sContentTypeElement = NULL;
if(NULL != m_pExternalDrawingConverter)
{
m_pExternalDrawingConverter->SetDstContentRels();
//получаем sThemePath из bsFilename предполагая что папка theme находится на уровень выше bsFilename
std::wstring sThemePath;
std::wstring sEmbedingPath;
if (NULL == pWriter) return false;
if (NULL == m_pExternalDrawingConverter) return false;
int nIndex = (int)sFilepath.rfind(FILE_SEPARATOR_CHAR);
nIndex = (int)sFilepath.rfind(FILE_SEPARATOR_CHAR, nIndex - 1);
if(-1 != nIndex)
{
std::wstring sFilepathLeft = sFilepath.substr(0, nIndex + 1);
sThemePath = sFilepathLeft + L"theme";
sEmbedingPath = sFilepathLeft + L"embeddings";
}
OOX::CPath oRootPath;
OOX::Spreadsheet::CChartSpace oChart(oRootPath, sChartPath);
long nStartPos = pWriter->GetPosition();
BinXlsxRW::BinaryCommonWriter oBcw(*pWriter);
std::wstring sOldRelsPath = m_pExternalDrawingConverter->GetRelsPath();
m_pExternalDrawingConverter->SetRelsPath(sChartPath);
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(*pWriter, m_pExternalDrawingConverter);
oBinaryChartWriter.WriteCT_ChartSpace(oChart);
m_pExternalDrawingConverter->SetRelsPath(sOldRelsPath);
long nEndPos = pWriter->GetPosition();
lDataSize = nEndPos - nStartPos;
return true;
}
bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilepath, const long& lChartNumber)
{
if (NULL == pReader) return false;
if (NULL == m_pExternalDrawingConverter) return false;
bool bRes = false;
m_pExternalDrawingConverter->SetDstContentRels();
//получаем sThemePath из bsFilename предполагая что папка theme находится на уровень выше bsFilename
std::wstring sThemePath;
std::wstring sEmbedingPath;
std::wstring sContentTypePath;
int nIndex = (int)sFilepath.rfind(FILE_SEPARATOR_CHAR);
nIndex = (int)sFilepath.rfind(FILE_SEPARATOR_CHAR, nIndex - 1);
if(-1 != nIndex)
{
std::wstring sFilepathLeft = sFilepath.substr(0, nIndex + 1);
sThemePath = sFilepathLeft + L"theme";
sEmbedingPath = sFilepathLeft + L"embeddings";
}
if (pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_DOCX) sContentTypePath = L"/word/charts/";
else if (pReader->m_nDocumentType == XMLWRITER_DOC_TYPE_XLSX) sContentTypePath = L"/xl/charts/";
else sContentTypePath = L"/ppt/charts/";
//todo theme path
BinXlsxRW::SaveParams oSaveParams(sThemePath);
OOX::Spreadsheet::CChartSpace oChartSpace;
BinXlsxRW::BinaryChartReader oBinaryChartReader(oBufferedStream, oSaveParams, m_pExternalDrawingConverter);
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace.m_oChartSpace);
BinXlsxRW::SaveParams oSaveParams(sThemePath, m_pExternalDrawingConverter->GetContentTypes());
OOX::Spreadsheet::CChartSpace oChartSpace;
BinXlsxRW::BinaryChartReader oBinaryChartReader(*pReader, oSaveParams, m_pExternalDrawingConverter);
oBinaryChartReader.ReadCT_ChartSpace(lLength, &oChartSpace.m_oChartSpace);
if(oChartSpace.isValid())
if(oChartSpace.isValid())
{
//save xlsx embedded for chart
if(pReader->m_nDocumentType != XMLWRITER_DOC_TYPE_XLSX && !sEmbedingPath.empty())
{
//todo не делать embeddings, если пишем xlsx
//save xlsx
if(!sEmbedingPath.empty())
{
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
writeChartXlsx(sXlsxPath, oChartSpace);
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(lChartNumber) + L".xlsx";
std::wstring sXlsxPath = sEmbedingPath + FILE_SEPARATOR_STR + sXlsxFilename;
writeChartXlsx(sXlsxPath, oChartSpace);
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
std::wstring bstrChartsWorksheetRelType = OOX::Spreadsheet::FileTypes::ChartsWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
std::wstring sChartsWorksheetRelsName = L"../embeddings/" + sXlsxFilename;
long rId;
std::wstring bstrChartsWorksheetRelType = OOX::FileTypes::MicrosoftOfficeExcelWorksheet.RelationType();
m_pExternalDrawingConverter->WriteRels(bstrChartsWorksheetRelType, sChartsWorksheetRelsName, std::wstring(), &rId);
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
std::wstring strFilepath = sFilepath;
std::wstring strDir = NSSystemPath::GetDirectoryName(strFilepath);
std::wstring strFilename = NSSystemPath::GetFileName(strFilepath);
OOX::CPath pathRelsDir = strDir + FILE_SEPARATOR_STR + _T("_rels");
OOX::CSystemUtility::CreateDirectories(pathRelsDir.GetPath());
oChartSpace.write2(sFilepath);
OOX::CPath pathRelsFile = pathRelsDir + FILE_SEPARATOR_STR + strFilename + _T(".rels");
m_pExternalDrawingConverter->SaveDstContentRels(pathRelsFile.GetPath());
std::wstring sContentType(sContentTypePath);
sContentType += strFilename;
std::wstring sContent = L"<Override PartName=\"" + sContentType + L"\" ContentType=\"application/vnd.openxmlformats-officedocument.drawingml.chart+xml\"/>";
sContent += oSaveParams.sAdditionalContentTypes;
(*sContentTypeElement) = new std::wstring(sContent);
bRes = true;
oChartSpace.m_oChartSpace.m_externalData = new OOX::Spreadsheet::CT_ExternalData();
oChartSpace.m_oChartSpace.m_externalData->m_id = new std::wstring();
oChartSpace.m_oChartSpace.m_externalData->m_id->append(L"rId");
oChartSpace.m_oChartSpace.m_externalData->m_id->append(std::to_wstring(rId));
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate = new OOX::Spreadsheet::CT_Boolean();
oChartSpace.m_oChartSpace.m_externalData->m_autoUpdate->m_val = new bool(false);
}
std::wstring strFilepath = sFilepath;
std::wstring strDir = NSSystemPath::GetDirectoryName(strFilepath);
std::wstring strFilename = NSSystemPath::GetFileName(strFilepath);
OOX::CPath pathRelsDir = strDir + FILE_SEPARATOR_STR + _T("_rels");
OOX::CSystemUtility::CreateDirectories(pathRelsDir.GetPath());
oChartSpace.write2(sFilepath);
OOX::CPath pathRelsFile = pathRelsDir + FILE_SEPARATOR_STR + strFilename + _T(".rels");
m_pExternalDrawingConverter->SaveDstContentRels(pathRelsFile.GetPath());
pReader->m_pRels->m_pManager->m_pContentTypes->Registration(L"application/vnd.openxmlformats-officedocument.drawingml.chart+xml", sContentTypePath, strFilename);
bRes = true;
}
return bRes;
}
@ -255,28 +250,28 @@ namespace BinXlsxRW{
}
void CXlsxSerializer::writeChartXlsx(const std::wstring& sDstFile, const OOX::Spreadsheet::CChartSpace& oChart)
{
//анализируем chart
//анализируем chart
BinXlsxRW::ChartWriter helper;
helper.parseChart(oChart.m_oChartSpace.m_chart);
//создаем temp
//создаем temp
std::wstring sTempDir = NSSystemPath::GetDirectoryName(sDstFile) + FILE_SEPARATOR_STR + NSSystemPath::GetFileName(sDstFile) + L"_TEMP";
NSDirectory::CreateDirectory(sTempDir);
OOX::CPath oPath(sTempDir.c_str());
//шиблонные папки
//шиблонные папки
std::wstring sXmlOptions = _T("");
std::wstring sMediaPath;// will be filled by 'CreateXlsxFolders' method
std::wstring sEmbedPath; // will be filled by 'CreateXlsxFolders' method
CreateXlsxFolders (sXmlOptions, sTempDir, sMediaPath, sEmbedPath);
//заполняем Xlsx
//заполняем Xlsx
OOX::Spreadsheet::CXlsx oXlsx;
helper.toXlsx(oXlsx);
//write
std::wstring sAdditionalContentTypes;
oXlsx.Write(oPath, sAdditionalContentTypes);
//write
OOX::CContentTypes oContentTypes;
oXlsx.Write(oPath, oContentTypes);
//zip
COfficeUtils oOfficeUtils(NULL);
oOfficeUtils.CompressFileOrDirectory(sTempDir, sDstFile, true);
//clean
//clean
NSDirectory::DeleteDirectory(sTempDir);
}
};

View File

@ -59,13 +59,13 @@ namespace BinXlsxRW {
CXlsxSerializer();
~CXlsxSerializer();
void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
static void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath);
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions);
bool loadChart (const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize);
bool saveChart (NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, const std::wstring& sFilename, const std::wstring& sContentTypePath, std::wstring** sContentTypeElement, const long& lChartNumber);
bool loadChart (const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter* pWriter, long& lDataSize);
bool saveChart (NSBinPptxRW::CBinaryFileReader* pReader, long lLength, const std::wstring& sFilename, const long& lChartNumber);
void setFontDir (const std::wstring& sFontDir);
void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir);

View File

@ -42,15 +42,15 @@ SOURCES += \
../../XlsxSerializerCom/Reader/CommonWriter.cpp \
../../XlsxSerializerCom/Reader/CSVReader.cpp \
../../XlsxSerializerCom/Writer/CSVWriter.cpp \
../../OfficeCryptReader/source/ECMACryptReader.cpp \
../../OfficeCryptReader/source/CryptTransform.cpp
../../OfficeCryptReader/source/ECMACryptFile.cpp \
../../OfficeCryptReader/source/CryptTransform.cpp \
../BinReader/Readers.cpp
HEADERS += ../DocWrapper/DocxSerializer.h \
../DocWrapper/FontProcessor.h \
../DocWrapper/XlsxSerializer.h \
../BinReader/ChartWriter.h \
../BinReader/CommentsWriter.h \
../BinReader/ContentTypesWriter.h \
../BinReader/DocumentRelsWriter.h \
../BinReader/DocumentWriter.h \
../BinReader/FileWriter.h \
@ -78,5 +78,5 @@ HEADERS += ../DocWrapper/DocxSerializer.h \
../../Common/FileDownloader/FileDownloader.h \
../BinReader/DefaultThemeWriter.h \
../DocWrapper/ChartWriter.h \
../../OfficeCryptReader/source/ECMACryptReader.h \
../../OfficeCryptReader/source/ECMACryptFile.h \
../../OfficeCryptReader/source/CryptTransform.h

View File

@ -34,7 +34,6 @@
17C1FEB11ACC42C4006B99B3 /* Common.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17F1F1AC4549B00BEA2EA /* Common.h */; };
17C1FEB21ACC42C4006B99B3 /* XlsxSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17F131AC4546100BEA2EA /* XlsxSerializer.h */; };
17C1FEB31ACC42C4006B99B3 /* CSVReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17F271AC4549B00BEA2EA /* CSVReader.h */; };
17C1FEB41ACC42C4006B99B3 /* ContentTypesWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17EED1AC4544900BEA2EA /* ContentTypesWriter.h */; };
17C1FEB51ACC42C4006B99B3 /* HeaderFooterWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17EF41AC4544900BEA2EA /* HeaderFooterWriter.h */; };
17C1FEB61ACC42C4006B99B3 /* webSettingsWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17EFB1AC4544900BEA2EA /* webSettingsWriter.h */; };
17C1FEB71ACC42C4006B99B3 /* SettingWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17EF91AC4544900BEA2EA /* SettingWriter.h */; };
@ -43,6 +42,7 @@
17C1FEBC1ACC42C4006B99B3 /* DocxSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17F0F1AC4546100BEA2EA /* DocxSerializer.h */; };
17C1FEBD1ACC42C4006B99B3 /* FileWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17EF21AC4544900BEA2EA /* FileWriter.h */; };
17C1FEBE1ACC42C4006B99B3 /* CSVWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 17E17F301AC4549B00BEA2EA /* CSVWriter.h */; };
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 690FE0841E9BBD68004B26D0 /* Readers.cpp */; };
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 69414A2E1CB51666003E771B /* ChartWriter.cpp */; };
69414A311CB51666003E771B /* ChartWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 69414A2F1CB51666003E771B /* ChartWriter.h */; };
6967917C1D9E8AEE002CA4BA /* BinEquationWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 696791781D9E8AEE002CA4BA /* BinEquationWriter.h */; };
@ -58,7 +58,6 @@
17C1FEC21ACC42C4006B99B3 /* libASCOfficeDocxFile2Lib_ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libASCOfficeDocxFile2Lib_ios.a; sourceTree = BUILT_PRODUCTS_DIR; };
17E17EEB1AC4544900BEA2EA /* ChartWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartWriter.h; sourceTree = "<group>"; };
17E17EEC1AC4544900BEA2EA /* CommentsWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentsWriter.h; sourceTree = "<group>"; };
17E17EED1AC4544900BEA2EA /* ContentTypesWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentTypesWriter.h; sourceTree = "<group>"; };
17E17EF01AC4544900BEA2EA /* DocumentRelsWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentRelsWriter.h; sourceTree = "<group>"; };
17E17EF11AC4544900BEA2EA /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; };
17E17EF21AC4544900BEA2EA /* FileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileWriter.h; sourceTree = "<group>"; };
@ -91,6 +90,7 @@
17E17F2E1AC4549B00BEA2EA /* BinaryReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinaryReader.h; sourceTree = "<group>"; };
17E17F2F1AC4549B00BEA2EA /* CSVWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSVWriter.cpp; sourceTree = "<group>"; };
17E17F301AC4549B00BEA2EA /* CSVWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSVWriter.h; sourceTree = "<group>"; };
690FE0841E9BBD68004B26D0 /* Readers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Readers.cpp; sourceTree = "<group>"; };
69414A2E1CB51666003E771B /* ChartWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChartWriter.cpp; sourceTree = "<group>"; };
69414A2F1CB51666003E771B /* ChartWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartWriter.h; sourceTree = "<group>"; };
696791781D9E8AEE002CA4BA /* BinEquationWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BinEquationWriter.h; path = ../../BinWriter/BinEquationWriter.h; sourceTree = "<group>"; };
@ -145,7 +145,6 @@
children = (
17E17EEB1AC4544900BEA2EA /* ChartWriter.h */,
17E17EEC1AC4544900BEA2EA /* CommentsWriter.h */,
17E17EED1AC4544900BEA2EA /* ContentTypesWriter.h */,
17A765271B0F3DC30046BC0B /* DefaultThemeWriter.h */,
17E17EF01AC4544900BEA2EA /* DocumentRelsWriter.h */,
17E17EF11AC4544900BEA2EA /* DocumentWriter.h */,
@ -159,6 +158,7 @@
17E17EF91AC4544900BEA2EA /* SettingWriter.h */,
17E17EFA1AC4544900BEA2EA /* StylesWriter.h */,
17E17EFB1AC4544900BEA2EA /* webSettingsWriter.h */,
690FE0841E9BBD68004B26D0 /* Readers.cpp */,
);
name = BinReader;
path = ../../BinReader;
@ -277,7 +277,6 @@
17C1FEB31ACC42C4006B99B3 /* CSVReader.h in Headers */,
6967917D1D9E8AEE002CA4BA /* BinReaderWriterDefines.h in Headers */,
69414A311CB51666003E771B /* ChartWriter.h in Headers */,
17C1FEB41ACC42C4006B99B3 /* ContentTypesWriter.h in Headers */,
17C1FEB51ACC42C4006B99B3 /* HeaderFooterWriter.h in Headers */,
17C1FEB61ACC42C4006B99B3 /* webSettingsWriter.h in Headers */,
17C1FEB71ACC42C4006B99B3 /* SettingWriter.h in Headers */,
@ -350,6 +349,7 @@
69414A301CB51666003E771B /* ChartWriter.cpp in Sources */,
6967917E1D9E8AEE002CA4BA /* BinWriters.cpp in Sources */,
17C1FE9C1ACC42C4006B99B3 /* XlsxSerializer.cpp in Sources */,
690FE0851E9BBD68004B26D0 /* Readers.cpp in Sources */,
17C1FE9D1ACC42C4006B99B3 /* FontProcessor.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -54,7 +54,7 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hr = S_OK;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.xlsx"; //xlsx pptx docx
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.pptx"; //xlsx pptx docx
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);

View File

@ -331,22 +331,10 @@
</References>
<Files>
<Filter
Name="Source Files"
Name="Common"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="OdfFileTest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
@ -396,6 +384,18 @@
</FileConfiguration>
</File>
</Filter>
<File
RelativePath="OdfFileTest.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>

View File

@ -46,7 +46,6 @@
#include "../odf/style_text_properties.h"
#include "../odf/style_table_properties.h"
#include "../odf/style_graphic_properties.h"
#include "../odf/datatypes/style_ref.h"
#include "docx_package.h"
#include "oox_rels.h"
@ -1196,7 +1195,7 @@ void docx_conversion_context::process_headers_footers()
// проходим по всем page layout
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
{
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( odf_types::style_ref(L"") ).style_name();
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( L"" );
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
add_page_properties(masterPageNameLayout);

View File

@ -53,7 +53,6 @@ namespace cpdoccore {
namespace odf_types
{
class style_ref;
class length_or_percent;
}
namespace odf_reader

View File

@ -166,8 +166,7 @@ std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref)
{
bool isMediaInternal = is_internal(href, odf_packet_);
bool isMediaInternal = true;
std::wstring sub_path = L"media/";
std::wstring inputFileName;
@ -175,10 +174,13 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{
sub_path = L"charts/";
}
if ( type == typeMsObject || type == typeOleObject)
else if ( type == typeMsObject || type == typeOleObject)
{
sub_path = L"embeddings/";
}
else
isMediaInternal = is_internal(href, odf_packet_);
int number=0;
if ( type == typeChart) number = count_charts + 1;

View File

@ -108,16 +108,16 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
}
void vml_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{
if (!val.solid)return;
if (!val.solid) return;
if (!val.opacity) 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);
CP_XML_ATTR(L"opacity", (int)(*val.opacity));
}
}

View File

@ -118,21 +118,22 @@ void pptx_conversion_context::process_layouts()
{
for (size_t i = 0; i < master->content_.size(); i++)
{
odf_reader::office_element_ptr elm = master->content_[i];
if (elm->get_type() == odf_reader::typeDrawFrame)
odf_reader::draw_frame* frame = dynamic_cast<odf_reader::draw_frame*>(master->content_[i].get());
if (frame)
{
odf_reader::draw_frame* frame = dynamic_cast<odf_reader::draw_frame *>(elm.get());
if ((frame) && (frame->common_presentation_attlist_.presentation_class_))
odf_types::common_presentation_attlist &common_presentation_attlist_= frame->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
if (common_presentation_attlist_.presentation_class_)
{
odf_types::presentation_class::type type = frame->common_presentation_attlist_.presentation_class_->get_type();
odf_types::presentation_class::type type = common_presentation_attlist_.presentation_class_->get_type();
if (type==odf_types::presentation_class::footer ||
type==odf_types::presentation_class::date_time ||
type==odf_types::presentation_class::header ||
type==odf_types::presentation_class::page_number)
if (type == odf_types::presentation_class::footer ||
type == odf_types::presentation_class::date_time ||
type == odf_types::presentation_class::header ||
type == odf_types::presentation_class::page_number)
{
if (frame->idx_in_owner <0)frame->idx_in_owner = last_idx_placeHolder++;
if (frame->idx_in_owner <0)
frame->idx_in_owner = last_idx_placeHolder++;
frame->pptx_convert_placeHolder(*this);
}
@ -271,9 +272,9 @@ void pptx_conversion_context::end_document()
odf_reader::odf_read_context & context = root()->odf_context();
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
if ((pageLayouts.master_pages().size()>0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
{
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_->style_name();
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_.get();
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName);
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);

View File

@ -91,7 +91,7 @@ public:
int pos =target.find(L".");
if (pos < 0)
{
target = target + std::wstring(L".A1");
target = L"\"" + target + std::wstring(L"\".A1");
}
r.location = converter_.convert_ref(std::wstring(target.begin() + 1, target.end()));
r.type = L"Internal" ;

View File

@ -86,8 +86,8 @@ class calcext_date_is_attr
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(odf_types::style_ref) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
_CP_OPT(std::wstring) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
};
//////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -79,24 +79,24 @@ text_format_properties_content calc_text_properties_content(const std::vector<co
}
//////////////
graphic_format_properties calc_graphic_properties_content(const std::vector<const style_graphic_properties*> & graphicProps)
graphic_format_properties calc_graphic_properties_content(const std::vector<const graphic_format_properties*> & graphicProps)
{
graphic_format_properties result;
BOOST_FOREACH(const style_graphic_properties* v, graphicProps)
BOOST_FOREACH(const graphic_format_properties* v, graphicProps)
{
if (v)
result.apply_from(v->content());
result.apply_from(v);
}
return result;
}
graphic_format_properties calc_graphic_properties_content(const style_instance * styleInstance)
{
std::vector<const style_graphic_properties*> graphicProps;
std::vector<const graphic_format_properties*> graphicProps;
while (styleInstance)
{
if (const style_content * content = styleInstance->content())
if (const style_graphic_properties * graphicProp = content->get_style_graphic_properties())
if (const graphic_format_properties * graphicProp = content->get_graphic_properties())
graphicProps.push_back(graphicProp);
styleInstance = styleInstance->parent();
@ -110,7 +110,8 @@ graphic_format_properties calc_graphic_properties_content(const std::vector<cons
graphic_format_properties result;
BOOST_FOREACH(const style_instance * inst, styleInstances)
{
result.apply_from(calc_graphic_properties_content(inst));
graphic_format_properties f = calc_graphic_properties_content(inst);
result.apply_from(&f);
}
return result;
}

View File

@ -39,6 +39,13 @@
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
{
// 5ms = 5 milliseconds
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
return _Wostream;
}
static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
{
try
@ -115,7 +122,6 @@ clockvalue clockvalue::parse(const std::wstring & Str)
{
int v=0;
int ms=0;
double h=0,m=0,s =0;
bool res = parseTime(Str,h,m,s,ms);

View File

@ -57,6 +57,8 @@ private:
int value_;//in ms
};
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::clockvalue);

View File

@ -624,9 +624,6 @@ void common_horizontal_pos_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:x", svg_x_);
}
// common_num_format_attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_num_format_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:num-format", style_num_format_);
@ -643,9 +640,6 @@ void common_num_format_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"style:num-letter-sync", style_num_letter_sync_);
}
// common_num_format_prefix_suffix_attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_num_format_prefix_suffix_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:num-prefix", style_num_prefix_);
@ -661,205 +655,83 @@ void common_num_format_prefix_suffix_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"style:num-prefix", style_num_prefix_);
CP_XML_ATTR_OPT(L"style:num-suffix", style_num_suffix_);
}
/// common-draw-style-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_style_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
void common_shape_table_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"draw:class-names", draw_class_names_);
CP_APPLY_ATTR(L"presentation:style-name", presentation_style_name_);
CP_APPLY_ATTR(L"presentation:class-names", presentation_class_names_);
CP_APPLY_ATTR(L"table:end-cell-address", table_end_cell_address_);
CP_APPLY_ATTR(L"table:end-x", table_end_x_);
CP_APPLY_ATTR(L"table:end-y", table_end_y_);
CP_APPLY_ATTR(L"table:table-background", table_table_background_);
}
void common_draw_style_name_attlist::apply_from(const common_draw_style_name_attlist & Other)
{
_CP_APPLY_PROP2(draw_style_name_);
_CP_APPLY_PROP2(draw_class_names_);
_CP_APPLY_PROP2(presentation_style_name_);
_CP_APPLY_PROP2(presentation_class_names_);
}
void common_draw_style_name_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:style-name", draw_style_name_);
CP_XML_ATTR_OPT(L"draw:class-names", draw_class_names_);
CP_XML_ATTR_OPT(L"presentation:style-name", presentation_style_name_);
CP_XML_ATTR_OPT(L"presentation:class-names", presentation_class_names_);
}
/// common-draw-z-index-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_z_index_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:z-index", draw_z_index_);
}
void common_draw_z_index_attlist::apply_from(const common_draw_z_index_attlist & Other)
{
_CP_APPLY_PROP2(draw_z_index_);
}
void common_draw_z_index_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:z-index", draw_z_index_);
}
/// common-draw-id-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_id_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:id", draw_id_);
}
void common_draw_id_attlist::apply_from(const common_draw_id_attlist & Other)
{
_CP_APPLY_PROP2(draw_id_);
}
void common_draw_id_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:id", draw_id_);
}
// common-draw-layer-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_layer_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:layer", draw_layer_);
}
void common_draw_layer_name_attlist::apply_from(const common_draw_layer_name_attlist & Other)
{
_CP_APPLY_PROP2(draw_layer_);
}
void common_draw_layer_name_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:layer", draw_layer_);
}
// common-draw-transform-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_transform_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:transform", draw_transform_);
}
void common_draw_transform_attlist::apply_from(const common_draw_transform_attlist & Other)
{
_CP_APPLY_PROP2(draw_transform_);
}
void common_draw_transform_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
}
// common-draw-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:name", draw_name_);
}
void common_draw_name_attlist::apply_from(const common_draw_name_attlist & Other)
{
_CP_APPLY_PROP2(draw_name_);
}
void common_draw_name_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
}
/// common-text-spreadsheet-shape-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_text_spreadsheet_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"table:end-cell-address", table_end_cell_address_);
CP_APPLY_ATTR(L"table:end-x", table_end_x_);
CP_APPLY_ATTR(L"table:end-y", table_end_y_);
CP_APPLY_ATTR(L"table:table-background", table_table_background_);
common_text_anchor_attlist_.add_attributes(Attributes);
}
void common_text_spreadsheet_shape_attlist::apply_from(const common_text_spreadsheet_shape_attlist & Other)
void common_shape_table_attlist::apply_from(const common_shape_table_attlist & Other)
{
_CP_APPLY_PROP2(table_end_cell_address_);
_CP_APPLY_PROP2(table_end_x_);
_CP_APPLY_PROP2(table_end_y_);
_CP_APPLY_PROP2(table_table_background_);
common_text_anchor_attlist_.apply_from(Other.common_text_anchor_attlist_);
}
void common_text_spreadsheet_shape_attlist::serialize(CP_ATTR_NODE)
void common_shape_table_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"table:end-cell-address", table_end_cell_address_);
CP_XML_ATTR_OPT(L"table:end-x", table_end_x_);
CP_XML_ATTR_OPT(L"table:end-y", table_end_y_);
CP_XML_ATTR_OPT(L"table:table-background", table_table_background_);
common_text_anchor_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"table:end-cell-address", table_end_cell_address_);
CP_XML_ATTR_OPT(L"table:end-x", table_end_x_);
CP_XML_ATTR_OPT(L"table:end-y", table_end_y_);
CP_XML_ATTR_OPT(L"table:table-background", table_table_background_);
}
/// common-draw-shape-with-styles-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_shape_with_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_draw_z_index_attlist_.add_attributes(Attributes);
common_draw_id_attlist_.add_attributes(Attributes);
common_draw_layer_name_attlist_.add_attributes(Attributes);
common_draw_style_name_attlist_.add_attributes(Attributes);
common_draw_transform_attlist_.add_attributes(Attributes);
common_draw_name_attlist_.add_attributes(Attributes);
common_text_spreadsheet_shape_attlist_.add_attributes(Attributes);
}
void common_draw_shape_with_styles_attlist::apply_from(const common_draw_shape_with_styles_attlist & Other)
{
common_draw_z_index_attlist_.apply_from( Other.common_draw_z_index_attlist_);
common_draw_id_attlist_.apply_from( Other.common_draw_id_attlist_);
common_draw_layer_name_attlist_.apply_from( Other.common_draw_layer_name_attlist_);
common_draw_style_name_attlist_.apply_from( Other.common_draw_style_name_attlist_);
common_draw_transform_attlist_.apply_from( Other.common_draw_transform_attlist_);
common_draw_name_attlist_.apply_from( Other.common_draw_name_attlist_);
common_text_spreadsheet_shape_attlist_.apply_from( Other.common_text_spreadsheet_shape_attlist_);
}
void common_draw_shape_with_styles_attlist::serialize(CP_ATTR_NODE)
{
common_draw_z_index_attlist_.serialize(CP_GET_XML_NODE());
common_draw_id_attlist_.serialize(CP_GET_XML_NODE());
common_draw_layer_name_attlist_.serialize(CP_GET_XML_NODE());
common_draw_style_name_attlist_.serialize(CP_GET_XML_NODE());
common_draw_transform_attlist_.serialize(CP_GET_XML_NODE());
common_draw_name_attlist_.serialize(CP_GET_XML_NODE());
common_text_spreadsheet_shape_attlist_.serialize(CP_GET_XML_NODE());
}
/// common-draw-text-style-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_text_style_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
void common_shape_draw_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"draw:class-names", draw_class_names_);
CP_APPLY_ATTR(L"draw:z-index", draw_z_index_);
CP_APPLY_ATTR(L"draw:id", draw_id_);
CP_APPLY_ATTR(L"draw:layer", draw_layer_);
CP_APPLY_ATTR(L"draw:transform", draw_transform_);
CP_APPLY_ATTR(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:text-style-name", draw_text_style_name_);
}
void common_draw_text_style_name_attlist::apply_from(const common_draw_text_style_name_attlist & Other)
void common_shape_draw_attlist::apply_from(const common_shape_draw_attlist & Other)
{
_CP_APPLY_PROP2(draw_z_index_);
_CP_APPLY_PROP2(draw_id_);
_CP_APPLY_PROP2(draw_style_name_);
_CP_APPLY_PROP2(draw_class_names_);
_CP_APPLY_PROP2(draw_layer_);
_CP_APPLY_PROP2(draw_transform_);
_CP_APPLY_PROP2(draw_name_);
_CP_APPLY_PROP2(draw_text_style_name_);
}
void common_draw_text_style_name_attlist::serialize(CP_ATTR_NODE)
void common_shape_draw_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:style-name", draw_style_name_);
CP_XML_ATTR_OPT(L"draw:class-names", draw_class_names_);
CP_XML_ATTR_OPT(L"draw:id", draw_id_);
CP_XML_ATTR_OPT(L"draw:z-index", draw_z_index_);
CP_XML_ATTR_OPT(L"draw:layer", draw_layer_);
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:text-style-name", draw_text_style_name_);
}
/// common-draw-shape-with-text-and-styles-attlist
void common_draw_shape_with_text_and_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_draw_shape_with_styles_attlist_.add_attributes(Attributes);
common_draw_text_style_name_attlist_.add_attributes(Attributes);
common_shape_draw_attlist_.add_attributes (Attributes);
common_shape_table_attlist_.add_attributes (Attributes);
common_text_anchor_attlist_.add_attributes (Attributes);
common_presentation_attlist_.add_attributes (Attributes);
}
void common_draw_shape_with_text_and_styles_attlist::apply_from(const common_draw_shape_with_text_and_styles_attlist & Other)
{
common_draw_shape_with_styles_attlist_.apply_from(common_draw_shape_with_styles_attlist_);
common_draw_text_style_name_attlist_.apply_from(common_draw_text_style_name_attlist_);
common_shape_draw_attlist_.apply_from (Other.common_shape_draw_attlist_);
common_shape_table_attlist_.apply_from (Other.common_shape_table_attlist_);
common_text_anchor_attlist_.apply_from (Other.common_text_anchor_attlist_);
common_presentation_attlist_.apply_from (Other.common_presentation_attlist_);
}
void common_draw_shape_with_text_and_styles_attlist::serialize(CP_ATTR_NODE)
{
common_draw_shape_with_styles_attlist_.serialize(CP_GET_XML_NODE());
common_draw_text_style_name_attlist_.serialize(CP_GET_XML_NODE());
common_shape_draw_attlist_.serialize(CP_GET_XML_NODE());
common_shape_table_attlist_.serialize(CP_GET_XML_NODE());
common_text_anchor_attlist_.serialize(CP_GET_XML_NODE());
common_presentation_attlist_.serialize(CP_GET_XML_NODE());
}
/// common-draw-position-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_position_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"svg:x", svg_x_);
@ -876,72 +748,57 @@ void common_draw_position_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:y", svg_y_);
}
/// presentation-shape-attlist
void presentation_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"presentation:class", presentation_class_);
CP_APPLY_ATTR(L"presentation:placeholder", presentation_placeholder_);
CP_APPLY_ATTR(L"presentation:user-transformed", presentation_user_transformed_);
}
void presentation_shape_attlist::apply_from(const presentation_shape_attlist & Other)
{
_CP_APPLY_PROP2(presentation_class_);
_CP_APPLY_PROP2(presentation_placeholder_);
_CP_APPLY_PROP2(presentation_user_transformed_);
}
void presentation_shape_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"presentation:class", presentation_class_);
CP_XML_ATTR_OPT(L"presentation:placeholder", presentation_placeholder_);
CP_XML_ATTR_OPT(L"presentation:user-transformed", presentation_user_transformed_);
}
/// common-data-style-attlist
void common_data_style_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:name", style_name_);
CP_APPLY_ATTR(L"number:language", number_language_);
CP_APPLY_ATTR(L"number:country", number_country_);
CP_APPLY_ATTR(L"number:title", number_title_);
CP_APPLY_ATTR(L"number:volatile", number_volatile_);
CP_APPLY_ATTR(L"number:transliteration-format", number_transliteration_format_);
CP_APPLY_ATTR(L"number:transliteration-language", number_transliteration_language_);
CP_APPLY_ATTR(L"number:transliteration-country", number_transliteration_country_);
CP_APPLY_ATTR(L"number:transliteration-style", number_transliteration_style_);
CP_APPLY_ATTR(L"style:name", style_name_);
CP_APPLY_ATTR(L"number:language", number_language_);
CP_APPLY_ATTR(L"number:country", number_country_);
CP_APPLY_ATTR(L"number:title", number_title_);
CP_APPLY_ATTR(L"number:volatile", number_volatile_);
CP_APPLY_ATTR(L"number:transliteration-format", number_transliteration_format_);
CP_APPLY_ATTR(L"number:transliteration-language", number_transliteration_language_);
CP_APPLY_ATTR(L"number:transliteration-country", number_transliteration_country_);
CP_APPLY_ATTR(L"number:transliteration-style", number_transliteration_style_);
}
void common_data_style_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"style:name", style_name_);
CP_XML_ATTR_OPT(L"number:language", number_language_);
CP_XML_ATTR_OPT(L"number:country", number_country_);
CP_XML_ATTR_OPT(L"number:title", number_title_);
CP_XML_ATTR_OPT(L"number:volatile", number_volatile_);
CP_XML_ATTR_OPT(L"number:transliteration-format", number_transliteration_format_);
CP_XML_ATTR_OPT(L"style:name", style_name_);
CP_XML_ATTR_OPT(L"number:language", number_language_);
CP_XML_ATTR_OPT(L"number:country", number_country_);
CP_XML_ATTR_OPT(L"number:title", number_title_);
CP_XML_ATTR_OPT(L"number:volatile", number_volatile_);
CP_XML_ATTR_OPT(L"number:transliteration-format", number_transliteration_format_);
CP_XML_ATTR_OPT(L"number:transliteration-language", number_transliteration_language_);
CP_XML_ATTR_OPT(L"number:transliteration-country", number_transliteration_country_);
CP_XML_ATTR_OPT(L"number:transliteration-style", number_transliteration_style_);
CP_XML_ATTR_OPT(L"number:transliteration-country", number_transliteration_country_);
CP_XML_ATTR_OPT(L"number:transliteration-style", number_transliteration_style_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_presentation_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"presentation:class", presentation_class_);
CP_APPLY_ATTR(L"presentation:style-name", style_name_);
CP_APPLY_ATTR(L"presentation:placeholder", presentation_placeholder_);
CP_APPLY_ATTR(L"presentation:class", presentation_class_);
CP_APPLY_ATTR(L"presentation:class-names", presentation_class_names_);
CP_APPLY_ATTR(L"presentation:style-name", presentation_style_name_);
CP_APPLY_ATTR(L"presentation:placeholder", presentation_placeholder_);
CP_APPLY_ATTR(L"presentation:user-transformed", presentation_user_transformed_);
}
void common_presentation_attlist::apply_from(const common_presentation_attlist & Other)
{
_CP_APPLY_PROP(presentation_class_, Other.presentation_class_);
_CP_APPLY_PROP(style_name_, Other.style_name_);
_CP_APPLY_PROP(presentation_placeholder_, Other.presentation_placeholder_);
_CP_APPLY_PROP(presentation_class_names_, Other.presentation_class_names_);
_CP_APPLY_PROP(presentation_class_, Other.presentation_class_);
_CP_APPLY_PROP(presentation_style_name_, Other.presentation_style_name_);
_CP_APPLY_PROP(presentation_placeholder_, Other.presentation_placeholder_);
_CP_APPLY_PROP(presentation_user_transformed_, Other.presentation_user_transformed_);
}
void common_presentation_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"presentation:class", presentation_class_);
CP_XML_ATTR_OPT(L"presentation:style-name", style_name_);
CP_XML_ATTR_OPT(L"presentation:placeholder", presentation_placeholder_);
CP_XML_ATTR_OPT(L"presentation:class", presentation_class_);
CP_XML_ATTR_OPT(L"presentation:class-names", presentation_class_names_);
CP_XML_ATTR_OPT(L"presentation:style-name", presentation_style_name_);
CP_XML_ATTR_OPT(L"presentation:placeholder", presentation_placeholder_);
CP_XML_ATTR_OPT(L"presentation:user-transformed", presentation_user_transformed_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -51,7 +51,6 @@
#include "stylehorizontalrel.h"
#include "percentorscale.h"
#include "anchortype.h"
#include "style_ref.h"
#include "linewidth.h"
#include "presentationclass.h"
#include "xlink.h"
@ -71,6 +70,10 @@
if (Other.A) \
A = Other.A;
#define _CP_APPLY_PROP3(A) \
if (Other->A) \
A = Other->A;
namespace cpdoccore {
namespace odf_types {
@ -469,123 +472,37 @@ public:
};
// common-draw-style-name-attlist
class common_draw_style_name_attlist
class common_shape_table_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_style_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) draw_style_name_;
_CP_OPT(std::wstring) draw_class_names_;
_CP_OPT(style_ref) presentation_style_name_;
_CP_OPT(std::wstring) presentation_class_names_;
};
/// common-draw-z-index-attlist
class common_draw_z_index_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_z_index_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(int) draw_z_index_;
};
/// common-draw-id-attlist
class common_draw_id_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_id_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_id_;
};
/// common-draw-layer-name-attlist
class common_draw_layer_name_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_layer_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_layer_;
};
/// common-draw-transform-attlist
class common_draw_transform_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_transform_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_transform_;
};
/// common-draw-name-attlist
class common_draw_name_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_name_;
};
/// common-text-spreadsheet-shape-attlist
class common_text_spreadsheet_shape_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_text_spreadsheet_shape_attlist & Other);
void serialize(CP_ATTR_NODE);
void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_shape_table_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(std::wstring) table_end_cell_address_;
_CP_OPT(length) table_end_x_;
_CP_OPT(length) table_end_y_;
_CP_OPT(Bool) table_table_background_;
common_text_anchor_attlist common_text_anchor_attlist_;
};
/// common-draw-shape-with-styles-attlist
class common_draw_shape_with_styles_attlist
class common_shape_draw_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_shape_with_styles_attlist & Other);
void serialize(CP_ATTR_NODE);
common_draw_z_index_attlist common_draw_z_index_attlist_;
common_draw_id_attlist common_draw_id_attlist_;
common_draw_layer_name_attlist common_draw_layer_name_attlist_;
common_draw_style_name_attlist common_draw_style_name_attlist_;
common_draw_transform_attlist common_draw_transform_attlist_;
common_draw_name_attlist common_draw_name_attlist_;
common_text_spreadsheet_shape_attlist common_text_spreadsheet_shape_attlist_;
void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_shape_draw_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) draw_text_style_name_;
_CP_OPT(std::wstring) draw_class_names_;
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_id_;
_CP_OPT(std::wstring) draw_layer_;
_CP_OPT(std::wstring) draw_transform_;
_CP_OPT(int) draw_z_index_;
};
/// common-draw-text-style-name-attlist
class common_draw_text_style_name_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_text_style_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) draw_text_style_name_;
};
/// common-draw-position-attlist
class common_draw_position_attlist
{
public:
@ -598,7 +515,20 @@ public:
};
/// common-draw-shape-with-text-and-styles-attlist
class common_presentation_attlist
{
public:
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_presentation_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_class_names_;
_CP_OPT(std::wstring) presentation_style_name_;
_CP_OPT(Bool) presentation_placeholder_;
_CP_OPT(Bool) presentation_user_transformed_;
};
class common_draw_shape_with_text_and_styles_attlist
{
public:
@ -606,44 +536,31 @@ public:
void apply_from(const common_draw_shape_with_text_and_styles_attlist & Other);
void serialize(CP_ATTR_NODE);
common_draw_shape_with_styles_attlist common_draw_shape_with_styles_attlist_;
common_draw_text_style_name_attlist common_draw_text_style_name_attlist_;
common_shape_draw_attlist common_shape_draw_attlist_;
common_shape_table_attlist common_shape_table_attlist_;
common_text_anchor_attlist common_text_anchor_attlist_;
common_presentation_attlist common_presentation_attlist_;
};
/// presentation-shape-attlist
class presentation_shape_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const presentation_shape_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) presentation_class_;
_CP_OPT(Bool) presentation_placeholder_;
_CP_OPT(Bool) presentation_user_transformed_;
};
/// common-data-style-attlist
class common_data_style_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) style_name_;
_CP_OPT(std::wstring) number_language_;
_CP_OPT(std::wstring) number_country_;
_CP_OPT(std::wstring) number_title_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(std::wstring) number_language_;
_CP_OPT(std::wstring) number_country_;
_CP_OPT(std::wstring) number_title_;
_CP_OPT(Bool) number_volatile_;
_CP_OPT(std::wstring) number_transliteration_format_;
_CP_OPT(std::wstring) number_transliteration_language_;
_CP_OPT(std::wstring) number_transliteration_country_;
_CP_OPT(std::wstring) number_transliteration_style_;
_CP_OPT(std::wstring) number_transliteration_format_;
_CP_OPT(std::wstring) number_transliteration_language_;
_CP_OPT(std::wstring) number_transliteration_country_;
_CP_OPT(std::wstring) number_transliteration_style_;
};
struct union_common_draw_attlists
{
common_draw_shape_with_text_and_styles_attlist shape_with_text_and_styles_;
@ -653,29 +570,12 @@ struct union_common_draw_attlists
void serialize(CP_ATTR_NODE);
};
// common-presentation-attlist
class common_presentation_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_presentation_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(Bool) presentation_placeholder_;
};
// common-anim-smil-attlist
class common_anim_smil_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_anim_smil_attlist & Other);
void serialize(CP_ATTR_NODE){}
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_anim_smil_attlist & Other);
void serialize (CP_ATTR_NODE){}
//_CP_OPT(std::wstring) smil_direction_;
//_CP_OPT(std::wstring) smil_subtype_;

View File

@ -37,6 +37,55 @@
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const smil_transition_type & _Val)
{
switch(_Val.get_type())
{
case smil_transition_type::barWipe : _Wostream << L"barwipe" ; break;
case smil_transition_type::boxWipe : _Wostream << L"boxwipe" ; break;
case smil_transition_type::fourBoxWipe : _Wostream << L"fourboxwipe" ; break;
case smil_transition_type::barnDoorWipe : _Wostream << L"barndoorwipe" ; break;
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalwipe" ; break;
case smil_transition_type::bowTieWipe : _Wostream << L"bowtiewipe" ; break;
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscdiagonalwipe"; break;
case smil_transition_type::veeWipe : _Wostream << L"veewipe" ; break;
case smil_transition_type::barnVeeWipe : _Wostream << L"barnveewipe" ; break;
case smil_transition_type::zigZagWipe : _Wostream << L"zigzagwipe" ; break;
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnzigzagwipe" ; break;
case smil_transition_type::irisWipe : _Wostream << L"iriswipe" ; break;
case smil_transition_type::triangleWipe : _Wostream << L"trianglewipe" ; break;
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowheadwipe" ; break;
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonwipe" ; break;
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonwipe" ; break;
case smil_transition_type::ellipseWipe : _Wostream << L"ellipsewipe" ; break;
case smil_transition_type::eyeWipe : _Wostream << L"eyewipe" ; break;
case smil_transition_type::roundRectWipe : _Wostream << L"roundrectwipe" ; break;
case smil_transition_type::starWipe : _Wostream << L"starwipe" ; break;
case smil_transition_type::miscShapeWipe : _Wostream << L"miscshapewipe" ; break;
case smil_transition_type::clockWipe : _Wostream << L"clockwipe" ; break;
case smil_transition_type::pinWheelWipe : _Wostream << L"pinwheelwipe" ; break;
case smil_transition_type::singleSweepWipe : _Wostream << L"singlesweepwipe" ; break;
case smil_transition_type::fanWipe : _Wostream << L"fanwipe" ; break;
case smil_transition_type::doubleFanWipe : _Wostream << L"doublefanwipe" ; break;
case smil_transition_type::doubleSweepWipe : _Wostream << L"doublesweepwipe" ; break;
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloondoorwipe" ; break;
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldwipe" ; break;
case smil_transition_type::snakeWipe : _Wostream << L"snakewipe" ; break;
case smil_transition_type::spiralWipe : _Wostream << L"spiralwipe" ; break;
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelsnakeswipe"; break;
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxsnakeswipe" ; break;
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallwipe" ; break;
case smil_transition_type::pushWipe : _Wostream << L"pushwipe" ; break;
case smil_transition_type::slideWipe : _Wostream << L"slidewipe" ; break;
case smil_transition_type::fade : _Wostream << L"fade" ; break;
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardwipe"; break;
case smil_transition_type::blindsWipe : _Wostream << L"blindswipe" ; break;
case smil_transition_type::dissolve : _Wostream << L"dissolve" ; break;
case smil_transition_type::randomBarWipe : _Wostream << L"randombarwipe" ; break;
}
return _Wostream;
}
smil_transition_type smil_transition_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;

View File

@ -68,7 +68,8 @@ public:
PageLayout,
MasterPage,
HandoutMaster,
LayerSet
LayerSet,
PresentationPageLayout
};
style_family() : type_(Default) {}

View File

@ -554,8 +554,8 @@ void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
CP_APPLY_ATTR(L"office:name" , office_name_ , std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name" , office_target_frame_name_);
CP_APPLY_ATTR(L"text:style-name" , text_style_name_ , style_ref(L""));
CP_APPLY_ATTR(L"text:visited-style-name" , text_visited_style_name_ , style_ref(L""));
CP_APPLY_ATTR(L"text:style-name" , text_style_name_ , std::wstring(L""));
CP_APPLY_ATTR(L"text:visited-style-name" , text_visited_style_name_ , std::wstring(L""));
}

View File

@ -106,8 +106,8 @@ private:
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
odf_types::style_ref text_style_name_;
odf_types::style_ref text_visited_style_name_;
std::wstring text_style_name_;
std::wstring text_visited_style_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_a);

View File

@ -166,14 +166,10 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
idx_in_owner = -1;
common_presentation_attlist_.add_attributes(Attributes);
common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
common_draw_attlists_.position_.add_attributes(Attributes);
common_draw_attlists_.rel_size_.add_attributes(Attributes);
presentation_shape_attlist_.add_attributes(Attributes);
draw_frame_attlist_.add_attributes(Attributes);
}

View File

@ -150,7 +150,7 @@ public:
static const ElementType type = typeDrawFrame;
CPDOCCORE_DEFINE_VISITABLE();
draw_frame() : oox_drawing_(NULL) {}
draw_frame() : oox_drawing_(NULL), idx_in_owner(-1) {}
virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
@ -161,10 +161,8 @@ public:
int idx_in_owner ;
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_;
odf_types::presentation_shape_attlist presentation_shape_attlist_;
draw_frame_attlist draw_frame_attlist_;
// draw-text-box, draw-image, draw-object, draw-object-ole, draw-applet, draw-floating-frame, draw-plugin

View File

@ -180,11 +180,7 @@ int ComputeMarginX(const style_page_layout_properties * pagePropertiesNode,
const std::vector<odf_reader::_property> & additional)
{
const _CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_text_spreadsheet_shape_attlist_.
common_text_anchor_attlist_.
type_;
const _CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
_CP_OPT(horizontal_rel) styleHorizontalRel = graphicProperties.common_horizontal_rel_attlist_.style_horizontal_rel_;
_CP_OPT(horizontal_pos) styleHorizontalPos = graphicProperties.common_horizontal_pos_attlist_.style_horizontal_pos_;
@ -575,16 +571,12 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
// TODO : recursive result!!!
const _CP_OPT(anchor_type) anchor =
attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_text_spreadsheet_shape_attlist_.
common_text_anchor_attlist_.
type_;
//todooo пока не ясно как привязать к определеной странице в документе ...
//const _CP_OPT(unsigned int) anchor_page_number =
// attlists_.shape_with_text_and_styles_.
// common_draw_shape_with_styles_attlist_.
// common_text_spreadsheet_shape_attlist_.
// common_text_anchor_attlist_.
// page_number_;
@ -765,10 +757,8 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
void common_draw_docx_convert(oox::docx_conversion_context & Context, const union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing)
{
const _CP_OPT(style_ref) & styleRef = attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_;
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
const std::wstring styleName = attlists_.shape_with_text_and_styles_.
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
@ -813,12 +803,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing->styleVerticalPos = graphicProperties.common_vertical_pos_attlist_.style_vertical_pos_;
drawing->styleVerticalRel = graphicProperties.common_vertical_rel_attlist_.style_vertical_rel_;
_CP_OPT(anchor_type) anchor =
attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_text_spreadsheet_shape_attlist_.
common_text_anchor_attlist_.
type_;
_CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
int level_drawing = Context.get_drawing_context().get_current_level();
@ -826,9 +811,9 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
{
drawing->isInline = true;
}
if (attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_transform_attlist_.draw_transform_)
if (attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_)
{
std::wstring transformStr = attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_transform_attlist_.draw_transform_.get();
std::wstring transformStr = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_.get();
oox_convert_transforms(transformStr, drawing->additional);
}
if (!drawing->isInline)
@ -839,7 +824,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing->relativeHeight = L"2";
drawing->behindDoc = L"0";
_CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_z_index_attlist_.draw_z_index_;
_CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_;
if (zIndex)//порядок отрисовки объектов
{
@ -1138,26 +1123,22 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal,href);
drawing->fill.bitmap->bStretch = true;
const _CP_OPT(style_ref) & styleRef = frame->common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_draw_style_name_attlist_.
draw_style_name_;
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
odf_reader::style_graphic_properties *properties = NULL;
if (styleInst) properties = styleInst->content()->get_style_graphic_properties();
odf_reader::graphic_format_properties *properties = NULL;
if (styleInst) properties = styleInst->content()->get_graphic_properties();
////////////////
if (properties)
{
if (properties->content().fo_clip_ && drawing->fill.bitmap)
if (properties->fo_clip_ && drawing->fill.bitmap)
{
std::wstring strRectClip = properties->content().fo_clip_.get();
strRectClip = strRectClip.substr(5,strRectClip.length()-6);
std::wstring strRectClip = properties->fo_clip_.get();
strRectClip = strRectClip.substr(5, strRectClip.length() - 6);
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR+ href;
std::wstring fileName = Context.root()->get_folder() + FILE_SEPARATOR_STR + href;
drawing->fill.bitmap->bCrop = parse_clipping(strRectClip, fileName, drawing->fill.bitmap->cropRect, NULL/*Context.applicationFonts_*/);
}
@ -1279,8 +1260,7 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
const _CP_OPT(std::wstring) name =
common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_draw_name_attlist_.draw_name_;
common_shape_draw_attlist_.draw_name_;
Context.get_drawing_context().add_name_object(name.get_value_or(L"Group"));
@ -1380,8 +1360,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
const _CP_OPT(std::wstring) name =
common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_draw_name_attlist_.draw_name_;
common_shape_draw_attlist_.draw_name_;
Context.get_drawing_context().add_name_object(name.get_value_or(L"Object"));

View File

@ -85,15 +85,12 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().start_frame();
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_;
common_shape_draw_attlist &common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_;
common_presentation_attlist &common_presentation_attlist_= common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.
draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
//////////////////////////////////////////////////////////////////////////
const _CP_OPT(length) svg_widthVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_;
@ -114,26 +111,26 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt);
}
///////////////////////////////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_)
if (common_draw_attlist_.draw_transform_)
{
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get();
std::wstring transformStr = common_draw_attlist_.draw_transform_.get();
pptx_convert_transforms(transformStr,Context);
}
////////////////////////////////////////
std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_)
if (common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_)
{
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Anchor = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt);
}
//////////////////////////////////////////////
std::vector<const odf_reader::style_instance *> instances;
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring grStyleName = common_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring baseStyleName = common_presentation_attlist_.presentation_style_name_.get_value_or(L"");
odf_reader::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_);
@ -141,9 +138,9 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
odf_reader::style_instance* baseStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(baseStyleName, odf_types::style_family::Presentation,Context.process_masters_);
if (baseStyleInst && ((!presentation_shape_attlist_.presentation_user_transformed_) ||
((presentation_shape_attlist_.presentation_user_transformed_) &&
(presentation_shape_attlist_.presentation_user_transformed_->get()== false))))//векторная фигура презентаций
if (baseStyleInst && ((!common_presentation_attlist_.presentation_user_transformed_) ||
((common_presentation_attlist_.presentation_user_transformed_) &&
(common_presentation_attlist_.presentation_user_transformed_->get()== false))))//векторная фигура презентаций
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Presentation);
if (defaultStyle)instances.push_back(defaultStyle);
@ -181,7 +178,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
if (idx_in_owner >=0)
if (idx_in_owner >= 0)
Context.get_slide_context().set_placeHolder_idx(idx_in_owner);
}

View File

@ -69,11 +69,10 @@ namespace odf_reader {
void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
{
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_;
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
//////////////////////////////////////////////////////////////////////////
Context.get_drawing_context().start_group( name);
@ -93,12 +92,12 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
//}
////////////////////////////////////////
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_)
if (common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_)
{
std::wstring Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get();
std::wstring Anchor = common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_x_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt, true);
}
@ -115,17 +114,12 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
{
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_;
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.
draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
//////////////////////////////////////////////////////////////////////////
Context.get_drawing_context().start_drawing( name);
@ -145,19 +139,19 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt);
}
///////////////////////////////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_)
if (common_draw_attlist_.common_shape_draw_attlist_.draw_transform_)
{
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get();
std::wstring transformStr = common_draw_attlist_.common_shape_draw_attlist_.draw_transform_.get();
xlsx_convert_transforms(transformStr,Context);
}
////////////////////////////////////////
std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_)
if (common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_)
{
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get();
Anchor = common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_x_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt);
}

View File

@ -79,7 +79,6 @@ void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
common_draw_attlists_.position_.add_attributes(Attributes);
common_draw_attlists_.rel_size_.add_attributes(Attributes);
common_presentation_attlist_.add_attributes(Attributes);
draw_shape_attlist_.add_attributes(Attributes);

View File

@ -63,7 +63,7 @@ public:
static const ElementType type = typeDrawShape;
static const xml::NodeType xml_type = xml::typeElement;
draw_shape() : bad_shape_(false), word_art_(false) {}
draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1) {}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
@ -75,12 +75,12 @@ public:
void common_xlsx_convert(oox::xlsx_conversion_context & Context);
void common_docx_convert(oox::docx_conversion_context & Context) ;
void common_pptx_convert(oox::pptx_conversion_context & Context) ;
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_;
draw_shape_attlist draw_shape_attlist_;
_CP_OPT(std::wstring) draw_id_;//используется для анимашек
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_id_; //используется для анимашек
office_element_ptr_array content_;
@ -91,8 +91,7 @@ public:
bool word_art_;
int sub_type_;
std::vector<odf_reader::_property> additional_;
int idx_in_owner;
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -67,8 +67,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
const _CP_OPT(std::wstring) name =
common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_draw_name_attlist_.draw_name_;
common_shape_draw_attlist_.draw_name_;
Context.get_drawing_context().add_name_object(name.get_value_or(L"Shape"));

View File

@ -65,14 +65,12 @@ namespace odf_reader {
void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
{
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_;
common_shape_draw_attlist &common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_;
common_presentation_attlist &common_presentation_attlist_= common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
///////////////////////////////////////////
Context.get_slide_context().set_name(name);
@ -91,27 +89,27 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt);
}
////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_)
if (common_draw_attlist_.draw_transform_)
{
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get();
std::wstring transformStr = common_draw_attlist_.draw_transform_.get();
pptx_convert_transforms(transformStr,Context);
//oox_convert_transforms(transformStr, additional_);
}
////////////////////////////////////////
std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_)
if (common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_)
{
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Anchor = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt);
}
/////////////////////////////////////////////////////////////////////////////////
std::vector<const odf_reader::style_instance *> instances;
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring grStyleName = common_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring baseStyleName = common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_style_name_.get_value_or(L"");
odf_reader::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_);
@ -154,6 +152,14 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
Context.root()->odf_context().drawStyles() ,fill);
Context.get_slide_context().set_fill(fill);
if (common_presentation_attlist_.presentation_class_)
{
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
if (idx_in_owner >= 0)
Context.get_slide_context().set_placeHolder_idx(idx_in_owner);
}
////////////////////////////////////////////////////////////////////////////////////
Context.get_text_context().start_object();
BOOST_FOREACH(office_element_ptr const & elm, content_)
@ -244,7 +250,7 @@ void draw_custom_shape::pptx_convert(oox::pptx_conversion_context & Context)
}
void draw_caption::pptx_convert(oox::pptx_conversion_context & Context)
{
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
//const std::wstring style = common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_slide_context().start_shape(sub_type_);//rect с наваротами-атрибутами .. а-ля TextBox

View File

@ -65,16 +65,12 @@ namespace odf_reader {
void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
{
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_;
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
///////////////////////////////////////////
Context.get_drawing_context().start_drawing(name);
@ -93,19 +89,19 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt);
}
////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_)
if (common_draw_attlist_.common_shape_draw_attlist_.draw_transform_)
{
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get();
std::wstring transformStr = common_draw_attlist_.common_shape_draw_attlist_.draw_transform_.get();
xlsx_convert_transforms(transformStr,Context);
//oox_convert_transforms(transformStr, additional_);
}
////////////////////////////////////////
std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_)
if (common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_)
{
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Anchor = common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt);
}
@ -247,7 +243,7 @@ void draw_custom_shape::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void draw_caption::xlsx_convert(oox::xlsx_conversion_context & Context)
{
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
//const std::wstring style = common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_drawing_context().start_shape(1);//rect с наваротами-атрибутами .. а-ля TextBox

View File

@ -54,17 +54,12 @@ namespace odf_reader {
std::wstring number_style_base::get_style_name() const
{
if (common_data_style_attlist_.style_name_)
return common_data_style_attlist_.style_name_->style_name();
else
return L"";
return common_data_style_attlist_.style_name_.get_value_or(L"");
}
void number_style_base::oox_convert_impl(oox::num_format_context & Context)
{
std::wstring style_name = L"";
if (common_data_style_attlist_.style_name_)
style_name = common_data_style_attlist_.style_name_->style_name();
std::wstring style_name = common_data_style_attlist_.style_name_.get_value_or(L"");
Context.start_format(style_name);
@ -103,7 +98,7 @@ void number_style_base::oox_convert(oox::num_format_context & Context)
{
if (const style_map * styleMap = dynamic_cast<const style_map *>(elm.get()))
{
const std::wstring applyStyleName = styleMap->style_apply_style_name_.style_name();
const std::wstring applyStyleName = styleMap->style_apply_style_name_;
const std::wstring condition = styleMap->style_condition_;
if (office_element_ptr num_style = Context.odf_context_.numberStyles().find_by_style_name(applyStyleName))

View File

@ -462,8 +462,8 @@ void odf_document::Impl::parse_styles()
continue;
}
const std::wstring styleName = masterPage->style_master_page_attlist_.style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring pageLayoutName = masterPage->style_master_page_attlist_.style_page_layout_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring styleName = masterPage->style_master_page_attlist_.style_name_.get_value_or(L"");
const std::wstring pageLayoutName = masterPage->style_master_page_attlist_.style_page_layout_name_.get_value_or(L"");
context_->pageLayoutContainer().add_master_page(styleName, pageLayoutName, masterPage);
}

View File

@ -353,7 +353,9 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
}
void page_layout_instance::pptx_convert(oox::pptx_conversion_context & Context)
{
properties()->pptx_convert(Context);
style_page_layout_properties * props = properties();
if (props)
props->pptx_convert(Context);
}
void page_layout_container::add_page_layout(const style_page_layout * StylePageLayout)

View File

@ -203,7 +203,7 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
/// Обрабатываем стиль draw
std::vector<const odf_reader::style_instance *> instances;
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
office_annotation_attr_.draw_style_name_.get_value_or(style_ref(L"")).style_name(), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
@ -215,7 +215,7 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
std::wstring ref = Context.current_cell_address();
Context.get_comments_context().end_comment(ref,Context.current_table_column(), Context.current_table_row());
@ -280,7 +280,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
/// Обрабатываем стиль draw
std::vector<const odf_reader::style_instance *> instances;
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
office_annotation_attr_.draw_style_name_.get_value_or(style_ref(L"")).style_name(), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
@ -292,7 +292,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
Context.get_comments_context().end_comment();
}

View File

@ -37,8 +37,6 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
@ -59,8 +57,8 @@ public:
_CP_OPT(bool) display_;
_CP_OPT(odf_types::style_ref) draw_text_style_name_;
_CP_OPT(odf_types::style_ref) draw_style_name_;
_CP_OPT(std::wstring) draw_text_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
};
// dc:date

View File

@ -98,7 +98,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages();
if (!masterPages.empty())
{
Context.set_master_page_name(masterPages[0]->style_master_page_attlist_.style_name_.get_value_or(style_ref(L"Standard")).style_name() );
Context.set_master_page_name(masterPages[0]->style_master_page_attlist_.style_name_.get_value_or(L"Standard"));
}
const page_layout_instance * layout = Context.root()->odf_context().pageLayoutContainer().page_layout_first();

View File

@ -340,7 +340,7 @@ std::wostream & span::text_to_stream(std::wostream & _Wostream) const
void span::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:style-name", text_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"text:style-name", text_style_name_, std::wstring(L""));
const std::wstring classNames = Attributes->get_val< std::wstring >(L"text:class-names").get_value_or(L"");
std::vector< std::wstring > classNamesArray;
@ -351,7 +351,7 @@ void span::add_attributes( const xml::attributes_wc_ptr & Attributes )
BOOST_FOREACH(const std::wstring & name, classNamesArray)
{
text_class_names_.push_back( style_ref(name) );
text_class_names_.push_back( name );
}
}
}
@ -374,10 +374,10 @@ void span::docx_convert(oox::docx_conversion_context & Context)
std::wostream & _Wostream = Context.output_stream();
if (!text_style_name_.style_name().empty()/* && !drawing*/)
if (!text_style_name_.empty()/* && !drawing*/)
{
if (style_instance * styleInst
= Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_)
= Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,Context.process_headers_footers_)
)
{
if (styleInst->is_automatic())
@ -418,7 +418,7 @@ void span::docx_convert(oox::docx_conversion_context & Context)
void span::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_span(text_style_name_.style_name());
Context.start_span(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->xlsx_convert(Context);
@ -427,10 +427,10 @@ void span::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void span::pptx_convert(oox::pptx_conversion_context & Context)
{
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,false))
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,false))
Context.get_text_context().get_styles_context().start_process_style(styleInst);
Context.get_text_context().start_span(text_style_name_.style_name());
Context.get_text_context().start_span(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->pptx_convert(Context);
@ -456,10 +456,10 @@ void a::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
CP_APPLY_ATTR(L"text:style-name", text_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"text:visited-style-name", text_visited_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
CP_APPLY_ATTR(L"text:style-name", text_style_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:visited-style-name", text_visited_style_name_,std::wstring(L""));
}
void a::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -491,8 +491,8 @@ void a::docx_convert(oox::docx_conversion_context & Context)
style_instance * styleInst = NULL;
if (!text_style_name_.style_name().empty())
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_);
if (!text_style_name_.empty())
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,Context.process_headers_footers_);
else
styleInst = Context.root()->odf_context().styleContainer().hyperlink_style();
@ -540,7 +540,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
void a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_hyperlink(text_style_name_.style_name());
Context.start_hyperlink(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->xlsx_convert(Context);
@ -675,7 +675,7 @@ std::wostream & ruby::text_to_stream(std::wostream & _Wostream) const
void ruby::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") ;
}
void ruby::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)

View File

@ -40,7 +40,6 @@
#include "paragraph_content.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
#include "datatypes/targetframename.h"
#include "datatypes/noteclass.h"
@ -380,8 +379,8 @@ public:
office_element_ptr_array content_;
odf_types::style_ref text_style_name_;
odf_types::style_ref_array text_class_names_;
std::wstring text_style_name_;
std::vector<std::wstring> text_class_names_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
@ -421,10 +420,10 @@ private:
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
odf_types::style_ref text_style_name_;
odf_types::style_ref text_visited_style_name_;
std::wstring text_style_name_;
std::wstring text_visited_style_name_;
office_element_ptr_array content_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(a);
@ -481,9 +480,9 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
odf_types::style_ref text_style_name_;
office_element_ptr text_ruby_base_;
office_element_ptr text_ruby_text_;
std::wstring text_style_name_;
office_element_ptr text_ruby_base_;
office_element_ptr text_ruby_text_;
};

View File

@ -87,7 +87,7 @@ std::wostream & ruby_text::text_to_stream(std::wostream & _Wostream) const
void ruby_text::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = odf_types::style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"");
}
void ruby_text::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)

View File

@ -142,85 +142,104 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
if (fo_wrap_option_)
properties.push_back(_property(L"text-wrap", (int)fo_wrap_option_->get_type()));
}
void graphic_format_properties::apply_from(const graphic_format_properties & Other)
void graphic_format_properties::apply_from(const graphic_format_properties * Other)
{
_CP_APPLY_PROP2(draw_stroke_);
_CP_APPLY_PROP2(draw_stroke_dash_);
_CP_APPLY_PROP2(draw_marker_start_);
_CP_APPLY_PROP2(draw_marker_end_);
_CP_APPLY_PROP2(draw_textarea_horizontal_align_);
_CP_APPLY_PROP2(draw_textarea_vertical_align_);
_CP_APPLY_PROP2(draw_auto_grow_height_);
_CP_APPLY_PROP2(draw_auto_grow_width_);
_CP_APPLY_PROP2(draw_fit_to_size_);
_CP_APPLY_PROP2(draw_fit_to_contour_);
_CP_APPLY_PROP2(svg_stroke_color_);
_CP_APPLY_PROP2(svg_stroke_width_);
_CP_APPLY_PROP2(svg_stroke_opacity_);
_CP_APPLY_PROP2(fo_min_width_);
_CP_APPLY_PROP2(fo_min_height_);
_CP_APPLY_PROP2(fo_max_width_);
_CP_APPLY_PROP2(fo_max_height_);
_CP_APPLY_PROP2(fo_wrap_option_);
if (Other == NULL) return;
_CP_APPLY_PROP2(style_print_content_);
_CP_APPLY_PROP2(style_protect_);
_CP_APPLY_PROP2(style_editable_);
_CP_APPLY_PROP2(style_wrap_);
_CP_APPLY_PROP2(style_wrap_dynamic_treshold_);
_CP_APPLY_PROP2(style_number_wrapped_paragraphs_);
_CP_APPLY_PROP2(style_wrap_contour_);
_CP_APPLY_PROP2(style_wrap_contour_mode_);
_CP_APPLY_PROP2(style_run_through_);
_CP_APPLY_PROP2(style_flow_with_text_);
_CP_APPLY_PROP2(style_overflow_behavior_);
_CP_APPLY_PROP2(style_mirror_);
_CP_APPLY_PROP2(fo_clip_);
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
_CP_APPLY_PROP3(draw_stroke_);
_CP_APPLY_PROP3(draw_stroke_dash_);
_CP_APPLY_PROP3(draw_marker_start_);
_CP_APPLY_PROP3(draw_marker_end_);
_CP_APPLY_PROP3(draw_textarea_horizontal_align_);
_CP_APPLY_PROP3(draw_textarea_vertical_align_);
_CP_APPLY_PROP3(draw_auto_grow_height_);
_CP_APPLY_PROP3(draw_auto_grow_width_);
_CP_APPLY_PROP3(draw_fit_to_size_);
_CP_APPLY_PROP3(draw_fit_to_contour_);
_CP_APPLY_PROP3(svg_stroke_color_);
_CP_APPLY_PROP3(svg_stroke_width_);
_CP_APPLY_PROP3(svg_stroke_opacity_);
_CP_APPLY_PROP3(fo_min_width_);
_CP_APPLY_PROP3(fo_min_height_);
_CP_APPLY_PROP3(fo_max_width_);
_CP_APPLY_PROP3(fo_max_height_);
_CP_APPLY_PROP3(fo_wrap_option_);
common_draw_fill_attlist_.apply_from(Other.common_draw_fill_attlist_);
common_draw_rel_size_attlist_.apply_from(Other.common_draw_rel_size_attlist_);
common_horizontal_margin_attlist_.apply_from(Other.common_horizontal_margin_attlist_);
common_vertical_margin_attlist_.apply_from(Other.common_vertical_margin_attlist_);
common_margin_attlist_.apply_from(Other.common_margin_attlist_);
common_horizontal_pos_attlist_.apply_from(Other.common_horizontal_pos_attlist_);
common_horizontal_rel_attlist_.apply_from(Other.common_horizontal_rel_attlist_);
common_vertical_pos_attlist_.apply_from(Other.common_vertical_pos_attlist_);
common_vertical_rel_attlist_.apply_from(Other.common_vertical_rel_attlist_);
common_text_anchor_attlist_.apply_from(Other.common_text_anchor_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
common_border_line_width_attlist_.apply_from(Other.common_border_line_width_attlist_);
common_padding_attlist_.apply_from(Other.common_padding_attlist_);
common_shadow_attlist_.apply_from(Other.common_shadow_attlist_);
common_background_color_attlist_.apply_from(Other.common_background_color_attlist_);
_CP_APPLY_PROP3(style_print_content_);
_CP_APPLY_PROP3(style_protect_);
_CP_APPLY_PROP3(style_editable_);
_CP_APPLY_PROP3(style_wrap_);
_CP_APPLY_PROP3(style_wrap_dynamic_treshold_);
_CP_APPLY_PROP3(style_number_wrapped_paragraphs_);
_CP_APPLY_PROP3(style_wrap_contour_);
_CP_APPLY_PROP3(style_wrap_contour_mode_);
_CP_APPLY_PROP3(style_run_through_);
_CP_APPLY_PROP3(style_flow_with_text_);
_CP_APPLY_PROP3(style_overflow_behavior_);
_CP_APPLY_PROP3(style_mirror_);
_CP_APPLY_PROP3(fo_clip_);
_CP_APPLY_PROP3(draw_wrap_influence_on_position_);
common_draw_fill_attlist_.apply_from (Other->common_draw_fill_attlist_);
common_draw_rel_size_attlist_.apply_from (Other->common_draw_rel_size_attlist_);
common_horizontal_margin_attlist_.apply_from(Other->common_horizontal_margin_attlist_);
common_vertical_margin_attlist_.apply_from (Other->common_vertical_margin_attlist_);
common_margin_attlist_.apply_from (Other->common_margin_attlist_);
common_horizontal_pos_attlist_.apply_from (Other->common_horizontal_pos_attlist_);
common_horizontal_rel_attlist_.apply_from (Other->common_horizontal_rel_attlist_);
common_vertical_pos_attlist_.apply_from (Other->common_vertical_pos_attlist_);
common_vertical_rel_attlist_.apply_from (Other->common_vertical_rel_attlist_);
common_text_anchor_attlist_.apply_from (Other->common_text_anchor_attlist_);
common_border_attlist_.apply_from (Other->common_border_attlist_);
common_border_line_width_attlist_.apply_from(Other->common_border_line_width_attlist_);
common_padding_attlist_.apply_from (Other->common_padding_attlist_);
common_shadow_attlist_.apply_from (Other->common_shadow_attlist_);
common_background_color_attlist_.apply_from (Other->common_background_color_attlist_);
_CP_APPLY_PROP(style_background_image_, Other.style_background_image_);
_CP_APPLY_PROP(style_background_image_, Other->style_background_image_);
}
// style:graphic-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_graphic_properties::ns = L"style";
const wchar_t * style_graphic_properties::name = L"graphic-properties";
void style_graphic_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
graphic_format_properties_.add_attributes(Attributes);
content_.add_attributes(Attributes);
}
void style_graphic_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if (L"style" == Ns && L"background-image" == Name)
{
CP_CREATE_ELEMENT(graphic_format_properties_.style_background_image_);
CP_CREATE_ELEMENT(content_.style_background_image_);
}
//if (CP_CHECK_NAME(L"text", L"list-style")
// styles_.add_child_element(Reader, Ns, Name, getContext()); он тут и не нужен по сути... описание есть и в другом сместе
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * loext_graphic_properties::ns = L"loext";
const wchar_t * loext_graphic_properties::name = L"graphic-properties";
void loext_graphic_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
content_.add_attributes(Attributes);
}
void loext_graphic_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
if (L"style" == Ns && L"background-image" == Name)
{
CP_CREATE_ELEMENT(content_.style_background_image_);
}
//if (CP_CHECK_NAME(L"text", L"list-style")
// styles_.add_child_element(Reader, Ns, Name, getContext()); он тут и не нужен по сути... описание есть и в другом сместе
}
}
}

View File

@ -68,11 +68,10 @@ class graphic_format_properties
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const graphic_format_properties & Other);
void apply_from(const graphic_format_properties * Other);
void apply_to(std::vector<_property> & properties);
public:
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
@ -138,7 +137,6 @@ public:
};
/// style:graphic-properties
class style_graphic_properties : public office_element_impl<style_graphic_properties>
{
public:
@ -149,20 +147,34 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
const graphic_format_properties & content() const { return graphic_format_properties_; }
graphic_format_properties content_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
graphic_format_properties graphic_format_properties_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_graphic_properties);
class loext_graphic_properties : public office_element_impl<style_graphic_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleGraphicPropertis;
CPDOCCORE_DEFINE_VISITABLE();
graphic_format_properties content_;
private:
virtual void add_attributes ( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element ( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
};
CP_REGISTER_OFFICE_ELEMENT2(loext_graphic_properties);
}
}

View File

@ -52,10 +52,10 @@ const wchar_t * style_map::name = L"map";
void style_map::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:condition", style_condition_, std::wstring(L""));
CP_APPLY_ATTR(L"style:name", style_name_, style_ref(L""));
CP_APPLY_ATTR(L"style:base-cell-address", style_base_cell_address_, std::wstring(L""));
CP_APPLY_ATTR(L"style:apply-style-name", style_apply_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"style:condition", style_condition_, std::wstring(L""));
CP_APPLY_ATTR(L"style:name", style_name_, std::wstring(L""));
CP_APPLY_ATTR(L"style:base-cell-address", style_base_cell_address_, std::wstring(L""));
CP_APPLY_ATTR(L"style:apply-style-name", style_apply_style_name_, std::wstring(L""));
}
void style_map::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)

View File

@ -39,7 +39,6 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
@ -59,10 +58,10 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
std::wstring style_condition_;
odf_types::style_ref style_name_;
std::wstring style_base_cell_address_;
odf_types::style_ref style_apply_style_name_;
std::wstring style_condition_;
std::wstring style_name_;
std::wstring style_base_cell_address_;
std::wstring style_apply_style_name_;
};

View File

@ -58,7 +58,6 @@
#include "datatypes/linestyle.h"
#include "datatypes/linetype.h"
#include "datatypes/styleleadercolor.h"
#include "datatypes/style_ref.h"
#include "datatypes/dropcaplength.h"
#include "datatypes/fobreak.h"
#include "datatypes/styleposition.h"
@ -108,7 +107,7 @@ private:
_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_style_;
};
@ -143,7 +142,6 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(style_tab_stops);
// style_drop_cap
class style_drop_cap : public office_element_impl<style_drop_cap>
{
public:
@ -157,10 +155,10 @@ public:
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
odf_types::drop_cap_length style_length_;
unsigned int style_lines_;
_CP_OPT(odf_types::length) style_distance_;
_CP_OPT(odf_types::style_ref) style_style_name_;
odf_types::drop_cap_length style_length_;
unsigned int style_lines_;
_CP_OPT(odf_types::length) style_distance_;
_CP_OPT(std::wstring) style_style_name_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
@ -172,7 +170,6 @@ private:
CP_REGISTER_OFFICE_ELEMENT2(style_drop_cap);
/// style:background-image
class style_background_image : public office_element_impl<style_background_image>
{
public:
@ -215,85 +212,32 @@ public:
void xlsx_convert(std::wostream & strm, bool in_draw);
// 15.5.1 fo:line-height
_CP_OPT(odf_types::line_width) fo_line_height_; // +
// 15.5.2 style:line-height-at-least
_CP_OPT(odf_types::length) style_line_height_at_least_; // +
// 15.5.3 style:line-spacing
_CP_OPT(odf_types::length) style_line_height_at_least_; // +
_CP_OPT(odf_types::length) style_line_spacing_; // +
// 15.5.4 style:font-independent-line-spacing
_CP_OPT(bool) style_font_independent_line_spacing_; // ???
// 15.5.5 fo:text-align
_CP_OPT(odf_types::text_align) fo_text_align_; // +
// 15.5.6 fo:text-align-last
_CP_OPT(odf_types::text_align) fo_text_align_last_;
// 15.5.7 style:justify-single-word
_CP_OPT(bool) style_justify_single_word_;
// 15.5.8 fo:keep-together
_CP_OPT(odf_types::keep_together) fo_keep_together_; // +
// 15.5.9 fo:widows
_CP_OPT(unsigned int) fo_widows_; // +
// 15.5.10 fo:orphans
_CP_OPT(unsigned int) fo_orphans_;
// 15.5.11 <style:tab-stops>
office_element_ptr style_tab_stops_; // +
// 15.5.12 style:tab-stop-distance
_CP_OPT(odf_types::length) style_tab_stop_distance_;
// 15.5.13 fo:hyphenation-keep
_CP_OPT(odf_types::hyphenation_keep) fo_hyphenation_keep_;
// 15.5.14 fo:hyphenation-ladder-count
_CP_OPT(odf_types::integer_or_nolimit) fo_hyphenation_ladder_count_;
// 15.5.15 <style:drop-cap>
office_element_ptr style_drop_cap_;
// 15.5.16 style:register-true
_CP_OPT(bool) style_register_true_;
// 15.5.17 fo:margin-left
_CP_OPT(odf_types::length_or_percent) fo_margin_left_; // +
// fo:margin-right
_CP_OPT(odf_types::length_or_percent) fo_margin_right_; // +
// 15.5.18 fo:text-indent
_CP_OPT(odf_types::length_or_percent) fo_text_indent_; // +
// 15.5.19 style:auto-text-indent
_CP_OPT(bool) style_auto_text_indent_; // ???
// 15.5.20 fo:margin-top
_CP_OPT(odf_types::length_or_percent) fo_margin_top_; // +
// fo:margin-bottom
_CP_OPT(odf_types::length_or_percent) fo_margin_bottom_; // +
// 15.5.21 fo:margin
_CP_OPT(odf_types::length_or_percent) fo_margin_;
// 15.5.22 fo:break-before
_CP_OPT(odf_types::fo_break) fo_break_before_; // +
// fo:break-after
_CP_OPT(odf_types::fo_break) fo_break_after_;
// 15.5.23 fo:background-color
_CP_OPT(odf_types::background_color) fo_background_color_;
// 15.5.24 <style:background-image>
office_element_ptr style_background_image_;
_CP_OPT(odf_types::border_style) fo_border_; // +
@ -302,7 +246,6 @@ public:
_CP_OPT(odf_types::border_style) fo_border_left_; // +
_CP_OPT(odf_types::border_style) fo_border_right_; // +
// 15.5.26
_CP_OPT( odf_types::border_widths ) style_border_line_width_; // +
_CP_OPT( odf_types::border_widths ) style_border_line_width_top_; // +
@ -328,14 +271,11 @@ public:
_CP_OPT(bool) style_snap_to_layout_grid_;
_CP_OPT(unsigned int) style_page_number_;
// 15.5.40 style:background-transparency
_CP_OPT(odf_types::percent) style_background_transparency_;
//
_CP_OPT(bool) style_join_border_;
};
// style_paragraph_properties
class style_paragraph_properties : public office_element_impl<style_paragraph_properties>
{
public:

View File

@ -918,10 +918,9 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if (shape->word_art_)
{//взять из графических ствойст цвет текста ..
const _CP_OPT(style_ref) & styleRef = shape->common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_;
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
const std::wstring styleName = shape->common_draw_attlists_.shape_with_text_and_styles_.
common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);

View File

@ -40,7 +40,6 @@
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
#include "datatypes/fontvariant.h"
#include "datatypes/texttransform.h"
#include "datatypes/color.h"
@ -106,7 +105,7 @@ public:
_CP_OPT(odf_types::line_width) style_text_line_through_width_;
_CP_OPT(odf_types::color) style_text_line_through_color_;
_CP_OPT(std::wstring) style_text_line_through_text_;
_CP_OPT(odf_types::style_ref) style_text_line_through_text_style_;
_CP_OPT(std::wstring) style_text_line_through_text_style_;
_CP_OPT(odf_types::text_position) style_text_position_;
_CP_OPT(std::wstring) style_font_name_;
_CP_OPT(std::wstring) style_font_name_asian_;

View File

@ -158,9 +158,15 @@ style_paragraph_properties * style_content::get_style_paragraph_properties() con
return dynamic_cast<style_paragraph_properties *>(style_paragraph_properties_.get());
}
style_graphic_properties * style_content::get_style_graphic_properties() const
graphic_format_properties * style_content::get_graphic_properties() const
{
return dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
style_graphic_properties *style_ = dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
loext_graphic_properties *loext_ = dynamic_cast<loext_graphic_properties *>(style_graphic_properties_.get());
if (style_) return &style_->content_;
if (loext_) return &loext_->content_;
return NULL;
}
style_table_properties * style_content::get_style_table_properties() const
{
@ -264,7 +270,7 @@ void style_content::add_child_element( xml::sax * Reader, const std::wstring & N
{
CP_CREATE_ELEMENT_SIMPLE(style_section_properties_);
}
else if CP_CHECK_NAME(L"style", L"graphic-properties")
else if (CP_CHECK_NAME(L"style", L"graphic-properties") || CP_CHECK_NAME(L"loext", L"graphic-properties"))
{
CP_CREATE_ELEMENT_SIMPLE(style_graphic_properties_);
}
@ -1411,26 +1417,40 @@ int style_master_page::find_placeHolderIndex(presentation_class::type placeHolde
{
int idx = -1;
int i=0;
int size = content_.size();
while(true)
for (size_t i = 0; i < content_.size(); i++)
{
if (i>=size)break;
if (content_[i]->get_type() == odf_reader::typeDrawFrame)
{
draw_frame* frame = dynamic_cast<draw_frame *>(content_[i].get());
if (frame->idx_in_owner<0)frame->idx_in_owner = last_idx++;
if ((frame) && (frame->common_presentation_attlist_.presentation_class_) &&
(frame->common_presentation_attlist_.presentation_class_->get_type()== placeHolder))
if (frame)
{
idx = frame->idx_in_owner;
break;
odf_types::common_presentation_attlist &common_presentation_attlist_ = frame->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
if (frame->idx_in_owner < 0)
frame->idx_in_owner = last_idx++;
if ((common_presentation_attlist_.presentation_class_) &&
(common_presentation_attlist_.presentation_class_->get_type()== placeHolder))
{
idx = frame->idx_in_owner;
break;
}
}
draw_shape* shape = dynamic_cast<draw_shape *>(content_[i].get());
if (shape)
{
odf_types::common_presentation_attlist &common_presentation_attlist_ = shape->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
if (shape->idx_in_owner < 0)
shape->idx_in_owner = last_idx++;
if ((common_presentation_attlist_.presentation_class_) &&
(common_presentation_attlist_.presentation_class_->get_type()== placeHolder))
{
idx = shape->idx_in_owner;
break;
}
}
}
i++;
}
return idx;
}

View File

@ -46,7 +46,6 @@
#include "office_elements_create.h"
#include "datatypes/stylefamily.h"
#include "datatypes/style_ref.h"
#include "datatypes/textalign.h"
#include "datatypes/lengthorpercent.h"
#include "datatypes/styleverticalrel.h"
@ -71,9 +70,10 @@
namespace cpdoccore { namespace odf_reader {
class graphic_format_properties;
class style_text_properties;
class style_paragraph_properties;
class style_graphic_properties;
class style_section_properties;
class style_table_cell_properties;
class style_table_row_properties;
@ -90,15 +90,16 @@ public:
void docx_convert(oox::docx_conversion_context & Context, bool in_styles = false);
void xlsx_convert(oox::xlsx_conversion_context & Context);
style_text_properties * get_style_text_properties() const;
style_paragraph_properties * get_style_paragraph_properties() const;
style_graphic_properties * get_style_graphic_properties() const;
style_table_properties * get_style_table_properties() const;
style_section_properties * get_style_section_properties() const;
style_table_cell_properties * get_style_table_cell_properties() const;
style_table_row_properties * get_style_table_row_properties() const;
graphic_format_properties * get_graphic_properties() const;
style_text_properties * get_style_text_properties() const;
style_paragraph_properties * get_style_paragraph_properties() const;
style_table_properties * get_style_table_properties() const;
style_section_properties * get_style_section_properties() const;
style_table_cell_properties * get_style_table_cell_properties() const;
style_table_row_properties * get_style_table_row_properties() const;
style_table_column_properties * get_style_table_column_properties() const;
style_chart_properties * get_style_chart_properties() const;
style_chart_properties * get_style_chart_properties() const;
style_drawing_page_properties* get_style_drawing_page_properties() const;
private:
@ -411,9 +412,9 @@ public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
office_element_ptr_array style_master_page_; // разметки тем
office_element_ptr_array style_master_page_; // разметки тем
office_element_ptr style_handout_master_; // разметки для принтера - .. второстепенно
office_element_ptr draw_layer_set_; // необязательно .. так как слои все равно не поддерживаются в мс.
office_element_ptr draw_layer_set_; // необязательно .. так как слои все равно не поддерживаются в мс.
// то есть не будут объекты объеденены по признаку слоя
// зы. не путать с обычной группировкой
@ -433,12 +434,12 @@ class style_master_page_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(odf_types::style_ref) style_name_;
_CP_OPT(std::wstring) style_display_name_;
_CP_OPT(odf_types::style_ref) style_page_layout_name_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(std::wstring) style_display_name_;
_CP_OPT(std::wstring) style_page_layout_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(odf_types::style_ref) style_next_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) style_next_style_name_;
};
// style:master-page
@ -895,7 +896,7 @@ public:
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_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_;

View File

@ -43,7 +43,6 @@
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "datatypes/style_ref.h"
namespace cpdoccore { namespace odf_reader {
@ -94,7 +93,7 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
optional<odf_types::style_ref>::Type text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
odf_types::common_num_format_attlist common_num_format_attlist_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
@ -218,10 +217,10 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
_CP_OPT(odf_types::style_ref) text_style_name_;
optional<wchar_t>::Type text_bullet_char_;
_CP_OPT(std::wstring) text_style_name_;
_CP_OPT(wchar_t) text_bullet_char_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
optional<odf_types::percent>::Type text_bullet_relative_size_;
_CP_OPT(odf_types::percent) text_bullet_relative_size_;
friend class text_list_level_style_bullet;

View File

@ -38,8 +38,6 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {

View File

@ -199,13 +199,14 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
if ((inst) && (inst->content()))
{
//table_properties
if (inst->content()->get_style_graphic_properties())
if (inst->content()->get_graphic_properties())
{
const graphic_format_properties & style_graphic = inst->content()->get_style_graphic_properties()->content();
oox::_oox_fill fill;
Compute_GraphicFill(style_graphic.common_draw_fill_attlist_, style_graphic.style_background_image_,
Context.root()->odf_context().drawStyles() ,fill);
graphic_format_properties * graphic_props = inst->content()->get_graphic_properties();
if (graphic_props)
Compute_GraphicFill(graphic_props->common_draw_fill_attlist_, graphic_props->style_background_image_,
Context.root()->odf_context().drawStyles(), fill);
if (fill.bitmap)
{
@ -231,9 +232,9 @@ void table_table::pptx_convert(oox::pptx_conversion_context & Context)
////////////////////////////////////////////////////////////////////////
std::wstring table_content_ = Context.get_table_context().tableData().str();
if (table_content_.length()>0)
if (!table_content_.empty())
{
Context.get_slide_context().set_property(_property(L"table-content",table_content_));
Context.get_slide_context().set_property(_property(L"table-content", table_content_));
}
Context.get_slide_context().end_table();
}

View File

@ -44,7 +44,7 @@ namespace text {
void paragraph_attrs::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") ;
const std::wstring classNames = Attributes->get_val< std::wstring >(L"text:class-names").get_value_or(L"");
if (classNames.size())
@ -54,11 +54,11 @@ void paragraph_attrs::add_attributes( const xml::attributes_wc_ptr & Attributes
for (size_t i = 0; i < classNamesArray.size(); i++)
{
text_class_names_.push_back( style_ref(classNamesArray[i]) );
text_class_names_.push_back( classNamesArray[i] );
}
}
text_cond_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:cond-style-name").get_value_or(L"") );
text_cond_style_name_ = Attributes->get_val< std::wstring >(L"text:cond-style-name").get_value_or(L"");
}

View File

@ -41,7 +41,6 @@
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace xml {
@ -63,9 +62,9 @@ class paragraph_attrs
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
odf_types::style_ref text_style_name_;
odf_types::style_ref_array text_class_names_;
odf_types::style_ref text_cond_style_name_;
std::wstring text_style_name_;
std::vector<std::wstring> text_class_names_;
std::wstring text_cond_style_name_;
_CP_OPT(unsigned int) outline_level_; //from header attr

View File

@ -96,7 +96,7 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con
if (Attr.text_style_name_.empty())return;
style_instance * styleInst
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_.style_name(), style_family::Paragraph,Context.process_headers_footers_);
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph,Context.process_headers_footers_);
if ((!styleInst) || (styleInst->is_automatic() == false))return;
style_content * styleContent = styleInst->content();
@ -147,7 +147,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
if (!Attr.text_style_name_.empty())
{
if (style_instance * styleInst =
Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_.style_name(), style_family::Paragraph, Context.process_headers_footers_)
Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph, Context.process_headers_footers_)
)
{
process_page_break_after(styleInst, Context);
@ -342,7 +342,7 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
span* first_span_in_paragraph = dynamic_cast<span*>(content_[0].get());
if (Context.get_drop_cap_context().FontSize < 1)
{
style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(first_span_in_paragraph->text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_);
style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(first_span_in_paragraph->text_style_name_, style_family::Text,Context.process_headers_footers_);
if ((styleInst) && (styleInst->is_automatic()))
{
style_content * styleContent = styleInst->content();
@ -368,7 +368,7 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
}
void paragraph::docx_convert(oox::docx_conversion_context & Context)
{
const std::wstring & styleName = attrs_.text_style_name_.style_name();
const std::wstring & styleName = attrs_.text_style_name_;
bool in_drawing = false;
@ -408,7 +408,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
// если да — устанавливаем контексту флаг на то что необходимо в конце текущего параграфа
// распечатать свойства секции
//проверить ... не она ли основная - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_.style_name();
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
@ -509,7 +509,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_paragraph(attrs_.text_style_name_.style_name());
Context.start_paragraph(attrs_.text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->xlsx_convert(Context);
@ -518,7 +518,7 @@ void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void paragraph::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_paragraph(attrs_.text_style_name_.style_name());
Context.get_text_context().start_paragraph(attrs_.text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
@ -647,8 +647,8 @@ std::wostream & list::text_to_stream(std::wostream & _Wostream) const
void list::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_continue_numbering_ = Attributes->get_val< bool >(L"text:continue-numbering");
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"");
text_continue_numbering_ = Attributes->get_val< bool >(L"text:continue-numbering");
// TODO
}
@ -672,7 +672,7 @@ void list::add_text(const std::wstring & Text)
void list::docx_convert(oox::docx_conversion_context & Context)
{
bool continue_ = text_continue_numbering_.get_value_or(false);
Context.start_list(text_style_name_.style_name(), continue_);
Context.start_list(text_style_name_, continue_);
if (text_list_header_)
text_list_header_->docx_convert(Context);
@ -687,7 +687,7 @@ void list::docx_convert(oox::docx_conversion_context & Context)
void list::pptx_convert(oox::pptx_conversion_context & Context)
{
bool continue_ = text_continue_numbering_.get_value_or(false);
Context.get_text_context().start_list(text_style_name_.style_name(), continue_);
Context.get_text_context().start_list(text_style_name_, continue_);
if (text_list_header_)
text_list_header_->pptx_convert(Context);
@ -784,12 +784,9 @@ void text_section::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_, text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
{
@ -1000,12 +997,9 @@ void text_illustration_index::docx_convert(oox::docx_conversion_context & Contex
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_,text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
@ -1068,12 +1062,9 @@ void text_alphabetical_index::docx_convert(oox::docx_conversion_context & Contex
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_, text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
@ -1135,12 +1126,9 @@ void text_bibliography::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_, text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);

View File

@ -43,7 +43,6 @@
#include "datatypes/textdisplay.h"
#include "datatypes/common_attlists.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
@ -189,7 +188,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
odf_types::style_ref text_style_name_;
std::wstring text_style_name_;
_CP_OPT(bool) text_continue_numbering_;
office_element_ptr text_list_header_;
@ -225,7 +224,7 @@ class text_section_attr
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
std::wstring text_name_;
_CP_OPT(bool) text_protected_;
_CP_OPT(std::wstring) text_protection_key_;

View File

@ -36,7 +36,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/timer.hpp>
#include <iostream>
#include <string>
@ -109,6 +108,7 @@ std::wstring DetectTypeDocument(const std::wstring & pathOOX)
(res = strContentTypes.find(ppsmFormatLine))>0 || (res = strContentTypes.find(potmFormatLine))>0 ||
(res = strContentTypes.find(ppsxFormatLine)) >0 )
{
sRes = L"presentation";
}
delete []pBuffer;
@ -124,7 +124,6 @@ int _tmain(int argc, _TCHAR* argv[])
if (argc < 3) return 0;
HRESULT hr = S_OK;
boost::timer t1;
//////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1];
std::wstring dstPath = argv[2];
@ -154,7 +153,5 @@ int _tmain(int argc, _TCHAR* argv[])
NSDirectory::DeleteDirectory(dstTempPath);
////////////////////////////////////////////////////////////////////////
std::cout << "\n\nTime : " << t1.elapsed() << "\n";
return 0;
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="windows-1251"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="OdfFileWriterTest"
ProjectGUID="{FBA8446A-150F-4A10-B4DA-1022048D6473}"
RootNamespace="ASCOfficeOdfFileWTest"
@ -65,6 +65,7 @@
Name="VCLinkerTool"
AdditionalDependencies="&#x0D;&#x0A;Rpcrt4.lib"
LinkIncremental="2"
IgnoreDefaultLibraryNames="LIBCMTD.lib"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@ -195,7 +196,7 @@
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;DONT_WRITE_EMBEDDED_FONTS"
RuntimeLibrary="2"
UsePrecompiledHeader="2"
WarningLevel="3"
@ -342,18 +343,6 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\OdfFileWTest.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Common\3dParty\pole\pole.cpp"
>
@ -449,12 +438,32 @@
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\FontProcessor.cpp"
>
</File>
<File
RelativePath="..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\BinReader\Readers.cpp"
>
</File>
<File
RelativePath="..\..\ASCOfficeDocxFile2\DocWrapper\XlsxSerializer.cpp"
>
</File>
</Filter>
</Filter>
<File
RelativePath=".\OdfFileWTest.cpp"
>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Files>
<Globals>
</Globals>

View File

@ -98,16 +98,24 @@ SOURCES += \
../source/OdfFormat/text_elements.cpp \
../source/OdfFormat/odf_settings_context.cpp \
../source/OdfFormat/office_settings.cpp \
../source/OdfFormat/mediaitems_utils.cpp
../source/OdfFormat/mediaitems_utils.cpp \
../source/OdfFormat/anim_elements.cpp \
../source/OdfFormat/draw_page.cpp \
../source/OdfFormat/odp_conversion_context.cpp \
../source/OdfFormat/odp_page_state.cpp \
../source/OdfFormat/odp_slide_context.cpp \
../source/OdfFormat/office_presentation.cpp \
../source/OdfFormat/style_presentation.cpp
}
SOURCES += \
../source/Oox2OdfConverter/ConvertDiagram.cpp \
../source/Oox2OdfConverter/Converter.cpp \
../source/Oox2OdfConverter/ConverterChart.cpp \
../source/Oox2OdfConverter/ConvertVml.cpp \
../source/Oox2OdfConverter/DocxConverter.cpp \
../source/Oox2OdfConverter/XlsxConverter.cpp
../source/Oox2OdfConverter/XlsxConverter.cpp \
../source/Oox2OdfConverter/ConvertDrawing.cpp \
../source/Oox2OdfConverter/PptxConverter.cpp
HEADERS += \
../source/OdfFormat/abstract_xml.h \
@ -189,4 +197,15 @@ HEADERS += \
../source/OdfFormat/Shapes/oox_shapeStars.h \
../source/OdfFormat/Shapes/oox_shapeWordArt.h \
../source/OdfFormat/odf_settings_context.h \
../source/OdfFormat/office_settings.h
../source/OdfFormat/office_settings.h \
../source/OdfFormat/anim_elements.h \
../source/OdfFormat/draw_page.h \
../source/OdfFormat/mediaitems_utils.h \
../source/OdfFormat/odp_conversion_context.h \
../source/OdfFormat/odp_page_state.h \
../source/OdfFormat/odp_slide_context.h \
../source/OdfFormat/office_presentation.h \
../source/OdfFormat/style_presentation.h \
../source/Oox2OdfConverter/PptxConverter.h \
../source/OdfFormat/anim_elements.h \
../source/OdfFormat/style_presentation.h

View File

@ -84,3 +84,10 @@
#include "../source/OdfFormat/odf_settings_context.cpp"
#include "../source/OdfFormat/office_settings.cpp"
#include "../source/OdfFormat/mediaitems_utils.cpp"
#include "../source/OdfFormat/anim_elements.cpp"
#include "../source/OdfFormat/draw_page.cpp"
#include "../source/OdfFormat/odp_conversion_context.cpp"
#include "../source/OdfFormat/odp_page_state.cpp"
#include "../source/OdfFormat/odp_slide_context.cpp"
#include "../source/OdfFormat/office_presentation.cpp"
#include "../source/OdfFormat/style_presentation.cpp"

View File

@ -44,7 +44,7 @@
// shapetypeHeptagon,
// shapetypeNonIsoscelesTrapezoid,
// shapetypePie,
// shapetypePieWedge,
//+ shapetypePieWedge,
//+ shapetypePlaque,
// shapetypePlaqueTabs,
// shapetypeSquareTabs,
@ -324,7 +324,7 @@ public:
}
};
class oox_shape_Gear6 : public oox_shape
class oox_shape_Gear6 : public oox_shape
{
public:
oox_shape_Gear6()
@ -411,7 +411,7 @@ public:
/////////////////////////////////////////////////////////
}
};
class oox_shape_Gear9 : public oox_shape
class oox_shape_Gear9 : public oox_shape
{
public:
oox_shape_Gear9()
@ -758,4 +758,31 @@ public:
/////////////////////////////////////////////////////////
}
};
class oox_shape_PieWedge : public oox_shape
{
public:
oox_shape_PieWedge()
{
odf_type_name =L"ooxml-PieWedge";
enhanced_path = L"M 0 ?f7 G ?f8 ?f9 ?f10 ?f11 L ?f4 ?f7 Z N";
text_areas = L"?f2 ?f3 ?f4 ?f7";
view_box = L"0 0 0 0";
add(L"f0", L"logwidth*cos(pi*(13500000)/10800000)");
add(L"f1", L"logheight*sin(pi*(13500000)/10800000)");
add(L"f2", L"logwidth+?f0 -0");
add(L"f3", L"logheight+?f1 -0");
add(L"f4", L"logwidth");
add(L"f5", L"logheight/2");
add(L"f6", L"logwidth/2");
add(L"f7", L"logheight");
add(L"f8", L"logwidth");
add(L"f9", L"logheight");
add(L"f10", L"(10800000)/60000.0");
add(L"f11", L"(5400000)/60000.0");
/////////////////////////////////////////////////////////
}
};
}

View File

@ -0,0 +1,147 @@
/*
* (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
*
*/
#include "anim_elements.h"
#include <boost/make_shared.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
///////////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * anim_par::ns = L"anim";
const wchar_t * anim_par::name = L"par";
void anim_par::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"anim", L"par")
CP_CREATE_ELEMENT(anim_par_);
else if CP_CHECK_NAME(L"anim", L"seq")
CP_CREATE_ELEMENT(anim_seq_array_);//более 1 элемента- взаимосвязанная анимация (между фигурами)
else
CP_CREATE_ELEMENT(content_);
}
void anim_par::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (type == typeAnimPar)
anim_par_ = child_element;
else if (type == typeAnimSeq)
anim_seq_array_.push_back(child_element);
else
content_.push_back(child_element);
}
void anim_par::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
if (anim_par_)
anim_par_->serialize(CP_XML_STREAM());
for (size_t i = 0; i < anim_seq_array_.size(); i++)
{
anim_seq_array_[i]->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * anim_seq::ns = L"anim";
const wchar_t * anim_seq::name = L"seq";
void anim_seq::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (size_t i = 0; i < anim_par_array_.size(); i++)
{
anim_par_array_[i]->serialize(CP_XML_STREAM());
}
}
}
}
void anim_seq::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"anim", L"par")
CP_CREATE_ELEMENT(anim_par_array_);
}
void anim_seq::add_child_element( const office_element_ptr & child)
{
anim_par_array_.push_back(child);
}
////////////////////////////////////////////////////////////////
void anim_transition_filter_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
CP_XML_ATTR_OPT(L"smil:fadeColor", smil_fadeColor_);
CP_XML_ATTR_OPT(L"smil:mode", smil_mode_);
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
}
const wchar_t * anim_transitionFilter::ns = L"anim";
const wchar_t * anim_transitionFilter::name = L"transitionFilter";
void anim_transitionFilter::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_anim_smil_attlist_.serialize(CP_GET_XML_NODE());
anim_transition_filter_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
////////////////////////////////////////////////////////////////
}
}

View File

@ -0,0 +1,129 @@
/*
* (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
*
*/
#pragma once
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "common_attlists.h"
#include "smil_transitiontype.h"
namespace cpdoccore {
namespace odf_writer {
class anim_par : public office_element_impl<anim_par>//Параллельные анимации
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimPar;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr anim_par_;
office_element_ptr_array anim_seq_array_;
office_element_ptr_array content_;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child);
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(anim_par);
class anim_seq : public office_element_impl<anim_seq>//Последовательные анимации
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimSeq;
CPDOCCORE_DEFINE_VISITABLE();
office_element_ptr_array anim_par_array_;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child);
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:iterate
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------------------------------------/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class anim_transition_filter_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(odf_types::smil_transition_type) smil_type_;
_CP_OPT(std::wstring) smil_mode_;
_CP_OPT(odf_types::color) smil_fadeColor_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
};
class anim_transitionFilter : public office_element_impl<anim_transitionFilter>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimTransitionFilter;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
///////////////////////////////////////////////////////////
odf_types::common_anim_smil_attlist common_anim_smil_attlist_;
anim_transition_filter_attlist anim_transition_filter_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
//anim:audio
//anim:command
}
}

View File

@ -41,7 +41,6 @@
#include "color.h"
#include "style_ref.h"
#include "iconset_type.h"
#include "calcext_type.h"
@ -65,7 +64,7 @@ public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) calcext_base_cell_address_;
_CP_OPT(odf_types::style_ref) calcext_apply_style_name_;
_CP_OPT(std::wstring) calcext_apply_style_name_;
_CP_OPT(std::wstring) calcext_value_;
};
@ -83,7 +82,7 @@ class calcext_date_is_attr
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(odf_types::style_ref) calcext_style_;
_CP_OPT(std::wstring) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
};

View File

@ -78,7 +78,6 @@ void draw_base::serialize(std::wostream & _Wostream)
void draw_base::serialize_attlist(CP_ATTR_NODE)
{
common_draw_attlists_.serialize(CP_GET_XML_NODE());
common_presentation_attlist_.serialize(CP_GET_XML_NODE());
}
}

View File

@ -59,7 +59,6 @@ public:
virtual void serialize(std::wostream & _Wostream);
virtual void serialize_attlist(CP_ATTR_NODE);
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_;
office_element_ptr_array content_;

View File

@ -129,12 +129,12 @@ public:
int idx_in_owner ;
odf_types::presentation_shape_attlist presentation_shape_attlist_;
draw_frame_attlist draw_frame_attlist_;
draw_frame_attlist draw_frame_attlist_;
office_element_ptr office_event_listeners_; // в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
office_element_ptr draw_glue_point_;
office_element_ptr draw_image_map_;
office_element_ptr office_event_listeners_;
// в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
office_element_ptr draw_glue_point_;
office_element_ptr draw_image_map_;
//office_element_ptr draw_chart_map_;
office_element_ptr draw_contour_; // draw-contour-polygon or draw-contour-path

View File

@ -0,0 +1,123 @@
/*
* (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
*
*/
#include "draw_page.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements_create.h"
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
void draw_page_attr::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:id", draw_id_);
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:style-name", draw_style_name_);
CP_XML_ATTR_OPT(L"presentation:presentation-page-layout-name", page_layout_name_);
CP_XML_ATTR_OPT(L"draw:master-page-name", master_page_name_);
CP_XML_ATTR_OPT(L"presentation:use-date-time-name", use_date_time_name_);
CP_XML_ATTR_OPT(L"presentation:use-footer-name", use_footer_name_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_page::ns = L"draw";
const wchar_t * draw_page::name = L"page";
void draw_page::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"anim", L"par")
CP_CREATE_ELEMENT(animation_);
else
CP_CREATE_ELEMENT(content_);
}
void draw_page::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if(type == typeAnimPar)
animation_ = child_element;
else
content_.push_back(child_element);
}
void draw_page::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_page_attr_.serialize(CP_GET_XML_NODE());
for (int i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
if (animation_)
animation_->serialize(CP_XML_STREAM());
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_footer_decl::ns = L"presentation";
const wchar_t * presentation_footer_decl::name = L"footer-decl";
//void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
//{
// CP_XML_ATTR_OPT(L"presentation:name", presentation_name_);
//}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_date_time_decl::ns = L"presentation";
const wchar_t * presentation_date_time_decl::name = L"date-time-decl";
//
//void presentation_date_time_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
//{
// CP_XML_ATTR_OPT(L"presentation:name", presentation_name_);
// CP_XML_ATTR_OPT(L"presentation:source", presentation_source_);
// CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
//}
//
}
}

View File

@ -0,0 +1,132 @@
/*
* (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
*
*/
#pragma once
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "presentationclass.h"
namespace cpdoccore {
namespace odf_writer {
class draw_page_attr
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_id_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) page_layout_name_;
_CP_OPT(std::wstring) master_page_name_;
_CP_OPT(std::wstring) use_footer_name_;
_CP_OPT(std::wstring) use_date_time_name_;
};
class draw_page : public office_element_impl<draw_page>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawPage;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
office_element_ptr animation_;
draw_page_attr draw_page_attr_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_page);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//presentation:footer-decl
class presentation_footer_decl : public office_element_impl<presentation_footer_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationFooterDecl;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream){}
_CP_OPT(std::wstring) presentation_name_;
std::wstring text_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_footer_decl);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//presentation:date-time-decl
class presentation_date_time_decl : public office_element_impl<presentation_date_time_decl>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationDateTimeDecl;
CPDOCCORE_DEFINE_VISITABLE();
_CP_OPT(std::wstring) presentation_name_;
_CP_OPT(std::wstring) presentation_source_;
_CP_OPT(std::wstring) style_data_style_name_;
std::wstring text_;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream){}
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time_decl);
}
}

View File

@ -55,14 +55,11 @@ namespace odf_writer {
std::wstring number_style_base::get_style_name() const
{
if (common_data_style_attlist_.style_name_)
return common_data_style_attlist_.style_name_->style_name();
else
return L"";
return common_data_style_attlist_.style_name_.get_value_or(L"");
}
void number_style_base::set_style_name(std::wstring & name)
{
common_data_style_attlist_.style_name_ = style_ref(name);
common_data_style_attlist_.style_name_ = name;
}
void number_style_base::serialize(std::wostream & strm)

View File

@ -228,8 +228,6 @@ namespace odf_writer
}
}
void object_files::set_content(content_content_ptr & _content)
{
content_.set_content(_content);

View File

@ -109,7 +109,7 @@ namespace odf_writer
struct odf_chart_level_state
{
style_text_properties *text_properties_;
style_graphic_properties *graphic_properties_;
graphic_format_properties *graphic_properties_;
style_paragraph_properties *paragraph_properties_;
style_chart_properties *chart_properties_;
@ -297,8 +297,8 @@ void odf_chart_context::Impl::set_default_series_color()
color col = color(default_MS_series_colors[current_series_count_]);
current_level_.back().graphic_properties_->content().common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->content().svg_stroke_color_ = col;
current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->svg_stroke_color_ = col;
}
////////////////////////////////////////////////////////////////////////////
@ -350,7 +350,7 @@ void odf_chart_context::start_chart(office_element_ptr & root)
if (style_)
{
style_name = style_->style_name_;
level_state.chart_properties_ = style_->style_content_.get_style_chart_properties();
level_state.chart_properties_ = style_->content_.get_style_chart_properties();
chart->chart_chart_attlist_.common_attlist_.chart_style_name_ = style_name;
}
@ -393,25 +393,25 @@ void odf_chart_context::set_chart_bar_type(int type)
switch(type)
{
case 0: // st_shapeCONE = 0,
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::cone); break;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ = chart_solid_type(chart_solid_type::cone); break;
case 1: // st_shapeCONETOMAX = 1,
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::cone); break;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ = chart_solid_type(chart_solid_type::cone); break;
case 2: // st_shapeBOX = 2,
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::cuboid); break;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ = chart_solid_type(chart_solid_type::cuboid); break;
case 3: // st_shapeCYLINDER = 3,
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::cylinder); break;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ = chart_solid_type(chart_solid_type::cylinder); break;
case 4: // st_shapePYRAMID = 4,
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::pyramid); break;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ = chart_solid_type(chart_solid_type::pyramid); break;
case 5: // st_shapePYRAMIDTOMAX = 5
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::pyramid); break;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ = chart_solid_type(chart_solid_type::pyramid); break;
}
if (type == -1)
{
//нужно вытащить свойство с уровня выше.
int sz = impl_->current_level_.size();
if (sz > 1)
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ =
impl_->current_level_[sz-2].chart_properties_->content().chart_solid_type_;
impl_->current_level_.back().chart_properties_->content_.chart_solid_type_ =
impl_->current_level_[sz-2].chart_properties_->content_.chart_solid_type_;
}
}
@ -421,7 +421,7 @@ void odf_chart_context::set_chart_bar_direction(int type)
switch(type)
{
case 0: // st_bardirBAR = 0,
impl_->current_level_.back().chart_properties_->content().chart_vertical_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_vertical_ = true; break;
case 1: // st_bardirCOL = 1
break;
}
@ -439,7 +439,7 @@ void odf_chart_context::set_chart_bar_gap_width(std::wstring val)
percent=true;
}
double dVal = boost::lexical_cast<double>(val);
impl_->current_level_.back().chart_properties_->content().chart_gap_width_ = (int)dVal;
impl_->current_level_.back().chart_properties_->content_.chart_gap_width_ = (int)dVal;
}
void odf_chart_context::set_chart_bar_overlap(std::wstring val)
{
@ -453,14 +453,14 @@ void odf_chart_context::set_chart_bar_overlap(std::wstring val)
percent=true;
}
double dVal = boost::lexical_cast<double>(val);
impl_->current_level_.back().chart_properties_->content().chart_overlap_ = (int)dVal;
impl_->current_level_.back().chart_properties_->content_.chart_overlap_ = (int)dVal;
}
void odf_chart_context::set_chart_stock_candle_stick(bool val)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_japanese_candle_stick_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_japanese_candle_stick_ = val;
}
@ -487,12 +487,12 @@ void odf_chart_context::set_chart_bar_grouping(int type)
switch(type)
{
case 0: // st_groupingPERCENTSTACKED = 0,
impl_->current_level_.back().chart_properties_->content().chart_percentage_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_percentage_ = true; break;
case 1: // st_bargroupingCLUSTERED = 1,
case 2: // st_bargroupingSTANDARD = 2,
break;
case 3: // st_bargroupingSTACKED = 3
impl_->current_level_.back().chart_properties_->content().chart_stacked_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_stacked_ = true; break;
}
}
void odf_chart_context::set_chart_grouping(int type)
@ -502,25 +502,25 @@ void odf_chart_context::set_chart_grouping(int type)
switch(type)
{
case 0: // st_groupingPERCENTSTACKED = 0,
impl_->current_level_.back().chart_properties_->content().chart_percentage_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_percentage_ = true; break;
case 1: // st_groupingSTANDARD = 1,
break;
case 2: // st_groupingSTACKED = 2
impl_->current_level_.back().chart_properties_->content().chart_stacked_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_stacked_ = true; break;
}
}
void odf_chart_context::set_chart_3D(bool val)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_three_dimensional_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_three_dimensional_ = val;
impl_->current_level_.back().chart_properties_->content().chart_treat_empty_cells_ = boost::none;
//impl_->current_level_.back().chart_properties_->content().chart_series_source_ = chart_series_source(chart_series_source::rows);
impl_->current_level_.back().chart_properties_->content_.chart_treat_empty_cells_ = boost::none;
//impl_->current_level_.back().chart_properties_->content_.chart_series_source_ = chart_series_source(chart_series_source::rows);
//impl_->current_level_.back().chart_properties_->content().
//impl_->current_level_.back().chart_properties_->content_.
//chart:treat-empty-cells="leave-gap"
//chart:series-source="rows"
//impl_->current_level_.back().chart_properties_->content().chart_deep_ = true;
//impl_->current_level_.back().chart_properties_->content_.chart_deep_ = true;
//chart_plot_area *plot_area = dynamic_cast<chart_plot_area*>(current_level_.back().elm.get());
//if (!plot_area)return;
@ -529,49 +529,49 @@ void odf_chart_context::set_chart_3D(bool val)
void odf_chart_context::set_chart_colored(bool val)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_three_dimensional_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_three_dimensional_ = val;
}
void odf_chart_context::set_marker_size(int size)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_symbol_width_ = length(size,length::pt);
impl_->current_level_.back().chart_properties_->content().chart_symbol_height_ = length(size,length::pt);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_width_ = length(size,length::pt);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_height_ = length(size,length::pt);
}
void odf_chart_context::set_marker_type(int type)
{
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::namedSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::namedSymbol);
switch(type)
{
case 0://st_markerstyleCIRCLE = 0,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
case 1://st_markerstyleDASH = 1,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::horizontal_barSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::horizontal_barSymbol); break;
case 2://st_markerstyleDIAMOND = 2,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::diamondSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::diamondSymbol); break;
case 3://st_markerstyleDOT = 3,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::circleSymbol); break;
case 4://st_markerstyleNONE = 4,
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol); break;
case 5://st_markerstylePICTURE = 5,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::asteriskSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::asteriskSymbol); break;
case 6://st_markerstylePLUS = 6,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::plusSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::plusSymbol); break;
case 7://st_markerstyleSQUARE = 7,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::squareSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::squareSymbol); break;
case 8://st_markerstyleSTAR = 8,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::starSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::starSymbol); break;
case 9://st_markerstyleTRIANGLE = 9,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::arrow_upSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::arrow_upSymbol); break;
case 10://st_markerstyleX = 10,
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::xSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::xSymbol); break;
case 11://st_markerstyleAUTO = 11
impl_->current_level_.back().chart_properties_->content().chart_symbol_name_ = chart_symbol_name(chart_symbol_name::autoSymbol); break;
impl_->current_level_.back().chart_properties_->content_.chart_symbol_name_ = chart_symbol_name(chart_symbol_name::autoSymbol); break;
default:
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
}
}
@ -584,21 +584,21 @@ void odf_chart_context::set_chart_scatter_type(int type)
case 0://st_scatterstyleNONE
break;
case 1://st_scatterstyleLINE
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
break;
case 2://st_scatterstyleLINEMARKER
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
break;
case 3://st_scatterstyleMARKER
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
break;
case 4://st_scatterstyleSMOOTH
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
impl_->current_level_.back().chart_properties_->content().chart_interpolation_ = chart_interpolation(chart_interpolation::cubicSpline);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::noneSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_interpolation_ = chart_interpolation(chart_interpolation::cubicSpline);
break;
case 5://st_scatterstyleSMOOTHMARKER
impl_->current_level_.back().chart_properties_->content().chart_interpolation_ = chart_interpolation(chart_interpolation::cubicSpline);
impl_->current_level_.back().chart_properties_->content().chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
impl_->current_level_.back().chart_properties_->content_.chart_interpolation_ = chart_interpolation(chart_interpolation::cubicSpline);
impl_->current_level_.back().chart_properties_->content_.chart_symbol_type_ = chart_symbol_type(chart_symbol_type::autoSymbol);
break;
}
}
@ -641,7 +641,7 @@ void odf_chart_context::start_series(std::wstring type)
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
@ -658,7 +658,7 @@ void odf_chart_context::end_series()
void odf_chart_context::set_label_delete(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_display_label_ = !val;
impl_->current_level_.back().chart_properties_->content_.chart_display_label_ = !val;
}
void odf_chart_context::set_label_show_bubble_size(bool val)
{
@ -675,7 +675,7 @@ void odf_chart_context::set_label_show_legend_key(bool val)
void odf_chart_context::set_label_show_percent(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
//impl_->current_level_.back().chart_properties_->content().chart_percentage_ = val;
//impl_->current_level_.back().chart_properties_->content_.chart_percentage_ = val;
}
void odf_chart_context::set_label_show_ser_name(bool val)
{
@ -683,7 +683,7 @@ void odf_chart_context::set_label_show_ser_name(bool val)
void odf_chart_context::set_label_show_values(bool val)
{
if (!impl_->current_level_.back().chart_properties_ || !val)return;
impl_->current_level_.back().chart_properties_->content().chart_data_label_number_=chart_data_label_number(chart_data_label_number::value);
impl_->current_level_.back().chart_properties_->content_.chart_data_label_number_=chart_data_label_number(chart_data_label_number::value);
}
void odf_chart_context::add_axis_group_series(unsigned int id)
{
@ -814,7 +814,7 @@ void odf_chart_context::start_axis()
odf_axis_state axis_state={0,0,L"",elm};
impl_->axis_.push_back(axis_state);
/////////////////////defaults
impl_->current_level_.back().chart_properties_->content().chart_reverse_direction_ = false;
impl_->current_level_.back().chart_properties_->content_.chart_reverse_direction_ = false;
}
void odf_chart_context::start_grid(int type)
{
@ -891,7 +891,7 @@ void odf_chart_context::start_plot_area()
if (!impl_->current_level_.back().chart_properties_) return;
impl_->current_level_.back().chart_properties_->content().chart_treat_empty_cells_ = true;
impl_->current_level_.back().chart_properties_->content_.chart_treat_empty_cells_ = true;
}
void odf_chart_context::end_plot_area()
{
@ -917,8 +917,8 @@ void odf_chart_context::start_text()
style *style_ = dynamic_cast<style*>(impl_->current_chart_state_.elements_.back().style_elm.get());
if (style_)
{
impl_->current_level_.back().paragraph_properties_ = style_->style_content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->style_content_.get_style_text_properties();
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
}
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_level_.back().paragraph_properties_,impl_->current_level_.back().text_properties_);
@ -968,7 +968,7 @@ void odf_chart_context::start_floor()
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
}
}
void odf_chart_context::start_wall()
@ -993,9 +993,9 @@ void odf_chart_context::start_wall()
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
if (impl_->current_level_.back().graphic_properties_)
impl_->current_level_.back().graphic_properties_->content().common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
impl_->current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
}
}
void odf_chart_context::start_legend()
@ -1036,7 +1036,7 @@ void odf_chart_context::start_stock_range_line()
style_name = style_->style_name_;
line->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
@ -1059,7 +1059,7 @@ void odf_chart_context::start_stock_gain_marker()
style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
@ -1082,7 +1082,7 @@ void odf_chart_context::start_stock_loss_marker()
style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
@ -1173,27 +1173,27 @@ void odf_chart_context::set_layout_x(double *val,int mode)//edge, factor
void odf_chart_context::set_display_label(bool Val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_display_label_ = Val;
impl_->current_level_.back().chart_properties_->content_.chart_display_label_ = Val;
}
void odf_chart_context::set_display_label_position(int type)
{
if (!impl_->current_level_.back().chart_properties_)return;
//impl_->current_level_.back().chart_properties_->content().chart:label-arrangement_ = Val;
//impl_->current_level_.back().chart_properties_->content_.chart:label-arrangement_ = Val;
}
void odf_chart_context::set_axis_orientation(int type)
{
if (!impl_->current_level_.back().chart_properties_)return;
if (type == 0) impl_->current_level_.back().chart_properties_->content().chart_reverse_direction_ = true;
if (type == 0) impl_->current_level_.back().chart_properties_->content_.chart_reverse_direction_ = true;
}
void odf_chart_context::set_axis_max(double val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_maximum_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_maximum_ = val;
}
void odf_chart_context::set_axis_min(double val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_minimum_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_minimum_ = val;
}
void odf_chart_context::set_axis_tick_minor(int type)
{
@ -1203,14 +1203,14 @@ void odf_chart_context::set_axis_tick_minor(int type)
{
case 0: break;// st_tickmarkCROSS = 0,
case 1: // st_tickmarkIN = 1,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_inner_ = true;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_outer_ = false; break;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_minor_inner_ = true;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_minor_outer_ = false; break;
case 2: // st_tickmarkNONE = 2,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_outer_ = false; break;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_minor_inner_ = false;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_minor_outer_ = false; break;
case 3: // st_tickmarkOUT = 3
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_outer_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_minor_inner_ = false;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_minor_outer_ = true; break;
}
}
@ -1219,7 +1219,7 @@ void odf_chart_context::set_no_fill(bool Val)
if (Val == false)return;
if (!impl_->current_level_.back().graphic_properties_)return;
impl_->current_level_.back().graphic_properties_->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
impl_->current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
}
void odf_chart_context::set_axis_tick_major(int type)
@ -1229,20 +1229,20 @@ void odf_chart_context::set_axis_tick_major(int type)
{
case 0: break;// st_tickmarkCROSS = 0,
case 1: // st_tickmarkIN = 1,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_inner_ = true;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_outer_ = false; break;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_major_inner_ = true;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_major_outer_ = false; break;
case 2: // st_tickmarkNONE = 2,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_outer_ = false; break;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_major_inner_ = false;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_major_outer_ = false; break;
case 3: // st_tickmarkOUT = 3
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_outer_ = true; break;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_major_inner_ = false;
impl_->current_level_.back().chart_properties_->content_.chart_tick_marks_major_outer_ = true; break;
}
}
void odf_chart_context::set_axis_logarithmic(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_logarithmic_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_logarithmic_ = val;
}
void odf_chart_context::set_axis_id(unsigned int id)
{
@ -1275,9 +1275,9 @@ void odf_chart_context::set_axis_position(int type)
//st_axposR = 2,
//st_axposT = 3
//if (type ==0 || type ==2)
// impl_->current_level_.back().chart_properties_->content().chart_axis_position_ = L"end";
// impl_->current_level_.back().chart_properties_->content_.chart_axis_position_ = L"end";
//if (type ==1 || type ==3)
// impl_->current_level_.back().chart_properties_->content().chart_axis_position_ = L"start";
// impl_->current_level_.back().chart_properties_->content_.chart_axis_position_ = L"start";
//a value of type double the axis line is placed at the given value on the crossing axis.
//If the crossing axis is an axis displaying categories rather than values, a value of 1 indicates that the axis should be placed at the first category, a value of 2 indicates that the axis should be placed at the second category and so forth.
}
@ -1288,9 +1288,9 @@ void odf_chart_context::set_axis_label_position(int type)
//st_ticklblposLOW = 1,
//st_ticklblposNEXTTO = 2,
//st_ticklblposNONE = 3
if (type ==1)impl_->current_level_.back().chart_properties_->content().chart_axis_label_position_ = L"outside-start";
if (type ==0)impl_->current_level_.back().chart_properties_->content().chart_axis_label_position_ = L"outside-end";
if (type ==2)impl_->current_level_.back().chart_properties_->content().chart_axis_label_position_ = L"near-axis";
if (type ==1)impl_->current_level_.back().chart_properties_->content_.chart_axis_label_position_ = L"outside-start";
if (type ==0)impl_->current_level_.back().chart_properties_->content_.chart_axis_label_position_ = L"outside-end";
if (type ==2)impl_->current_level_.back().chart_properties_->content_.chart_axis_label_position_ = L"near-axis";
//near-axis-other-side
//near-axis //default
@ -1355,7 +1355,7 @@ void odf_chart_context::start_element(office_element_ptr & elm, office_element_p
if (style_)
{
style_name = style_->style_name_;
level_state.chart_properties_ = style_->style_content_.get_style_chart_properties();
level_state.chart_properties_ = style_->content_.get_style_chart_properties();
}
impl_->current_level_.push_back(level_state);//стоит ли сюда перенести и current_chart_properties ????
@ -1368,20 +1368,20 @@ void odf_chart_context::end_element()
{
if (impl_->current_level_.back().paragraph_properties_)
{
if (impl_->current_level_.back().paragraph_properties_->content().style_writing_mode_)
if (impl_->current_level_.back().paragraph_properties_->content_.style_writing_mode_)
{
switch(impl_->current_level_.back().paragraph_properties_->content().style_writing_mode_->get_type())
switch(impl_->current_level_.back().paragraph_properties_->content_.style_writing_mode_->get_type())
{
case writing_mode::LrTb:
case writing_mode::RlTb:
case writing_mode::Lr:
impl_->current_level_.back().chart_properties_->content().style_direction_ = direction(direction::Ltr); break;
impl_->current_level_.back().chart_properties_->content_.style_direction_ = direction(direction::Ltr); break;
case writing_mode::TbRl:
case writing_mode::TbLr:
case writing_mode::Tb:
impl_->current_level_.back().chart_properties_->content().style_direction_ = direction(direction::Ttb); break;
impl_->current_level_.back().chart_properties_->content_.style_direction_ = direction(direction::Ttb); break;
}
impl_->current_level_.back().chart_properties_->content().common_rotation_angle_attlist_.style_rotation_angle_ =0;
impl_->current_level_.back().chart_properties_->content_.common_rotation_angle_attlist_.style_rotation_angle_ =0;
}
}
}
@ -1477,7 +1477,7 @@ void odf_chart_context::set_series_pie_explosion(int val)//или точка с
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_pie_offset_ = val;
impl_->current_level_.back().chart_properties_->content_.chart_pie_offset_ = val;
}
//void odf_chart_context::set_cash(std::wstring format, std::vector<double> &data_double)
//{

View File

@ -189,6 +189,11 @@ void odf_conversion_context::start_text()
create_object();
create_element(L"office", L"text", objects_.back().content, this, true);
}
void odf_conversion_context::start_presentation()
{
create_object();
create_element(L"office", L"presentation", objects_.back().content, this, true);
}
void odf_conversion_context::create_object()
{
_object obj;
@ -220,6 +225,10 @@ void odf_conversion_context::end_spreadsheet()
{
end_object();
}
void odf_conversion_context::end_presentation()
{
end_object();
}
void odf_conversion_context::end_object()
{
current_object_ = 0;//main
@ -227,6 +236,11 @@ void odf_conversion_context::end_object()
office_element_ptr & odf_conversion_context::get_current_object_element()
{
if (objects_.empty())
{
create_object();
}
return objects_[current_object_].content;
}

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