mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Compare commits
155 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51ca6f0ef2 | |||
| 5d97b35ba4 | |||
| 2bdc1e4a6d | |||
| 787379808e | |||
| 9a658a2818 | |||
| 079d80adcb | |||
| 8ec5685786 | |||
| 769ab7b238 | |||
| 2a28ba7060 | |||
| eaabba0860 | |||
| f892022232 | |||
| dfa93c344c | |||
| adfc2ef30d | |||
| f8549eaa13 | |||
| fc280b1cd6 | |||
| fc8784c540 | |||
| 17fe15948a | |||
| 38f11a9f4a | |||
| ea43991901 | |||
| a469bad6e3 | |||
| 51781066b6 | |||
| 393baf5265 | |||
| aa6dd092f7 | |||
| 00e47257e1 | |||
| 01911afb0f | |||
| fe3e7357d5 | |||
| 541c90eacf | |||
| 4641c135e7 | |||
| 5c403b39eb | |||
| 1ba6c9b73f | |||
| 2ede1b0d65 | |||
| 3e5c005714 | |||
| 217c5157e1 | |||
| 6783e79c15 | |||
| 7f3a658611 | |||
| 25a10fb642 | |||
| 189cb94892 | |||
| 974b0cc984 | |||
| a202a87a67 | |||
| 7e33da3883 | |||
| 040c6abdef | |||
| 118bd98f4f | |||
| df69792402 | |||
| 6e20801b45 | |||
| 8a2e46cb53 | |||
| 8df2390d9d | |||
| f5789d5059 | |||
| f97a7b1ea3 | |||
| 1a0ecb17a7 | |||
| bc447c4522 | |||
| bebdd90aa2 | |||
| 7d91973ddd | |||
| d98d1859b4 | |||
| 2e34600e01 | |||
| 4e4d69235d | |||
| 29125519d9 | |||
| 46c6efee45 | |||
| 690a614ba5 | |||
| b48e6d508d | |||
| 65a469ef92 | |||
| 41a4eedb63 | |||
| 19bec43364 | |||
| 21f134cf71 | |||
| 80b361fe7d | |||
| 32c752a71f | |||
| 1fe41b8b23 | |||
| b59980bd62 | |||
| 464aa7c8c4 | |||
| 9646ac25ae | |||
| b928936f2b | |||
| 69448ebba0 | |||
| 879715efe9 | |||
| 1bec6aacad | |||
| ac64868d4c | |||
| 23283244e9 | |||
| c4e6dea3a3 | |||
| ffd60188c2 | |||
| 0da5552fdf | |||
| 37acb4cfc2 | |||
| 7651a7e472 | |||
| ad51fa70e4 | |||
| 0a6b3efbbc | |||
| 58865ae153 | |||
| b620e1b6e4 | |||
| 2fb242b9bb | |||
| b763dd2e3c | |||
| b9bc3d0597 | |||
| d321366de7 | |||
| bb657dc536 | |||
| 3b581bf5e3 | |||
| 213b4ddf64 | |||
| 5bd69e0b73 | |||
| 5510223302 | |||
| 78b7fcd7ae | |||
| fd08ef00c3 | |||
| fee2eb653f | |||
| 85d7b5063e | |||
| 8bc77fa710 | |||
| e111568c34 | |||
| 500a32a1dc | |||
| 5387175ed1 | |||
| 63a3da31a9 | |||
| ce06cd0c4c | |||
| 8555b7d5fe | |||
| 18de7c5da1 | |||
| 5e052325ea | |||
| ffebbbe0af | |||
| 03b25199d9 | |||
| e5e30596f0 | |||
| 1569b58dab | |||
| a2614b0020 | |||
| 01d20d1b13 | |||
| f4c6818570 | |||
| 709ac68a97 | |||
| c6a4f83a9d | |||
| d7bd15b4e2 | |||
| 1937f47043 | |||
| f2b19e9701 | |||
| 9cbbca4712 | |||
| 319c9d3522 | |||
| a33cf2fc7f | |||
| 830aee3ae4 | |||
| 9ae72e5a74 | |||
| 92e3d6d3cc | |||
| a6fd52ae70 | |||
| 089f817962 | |||
| 97653a5be7 | |||
| 9c81eb5bd1 | |||
| 543c5a59d9 | |||
| 3517208b92 | |||
| 172308579a | |||
| 9860be4434 | |||
| 8ae061d50b | |||
| 00de58f59d | |||
| 98ad73ce7d | |||
| 7f12d47f7b | |||
| df1bac754b | |||
| be72b15872 | |||
| 700e91629d | |||
| 95e747e400 | |||
| 1ba4412bd4 | |||
| 6d69fc21d5 | |||
| 53a0196dea | |||
| 2e3e75a39c | |||
| 525f318e17 | |||
| a3d083e7bd | |||
| 2267f1bca2 | |||
| 85baa9afc7 | |||
| 8f97f55e67 | |||
| 19070ca5c9 | |||
| 32ac61f890 | |||
| ce2727862d | |||
| b1a044ba14 | |||
| 0af7c8b984 | |||
| e6c7efc0d5 |
@ -55,7 +55,6 @@ namespace DocFileFormat
|
||||
{
|
||||
m_context->_docx->RegisterComments();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:comments", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
@ -148,7 +147,6 @@ namespace DocFileFormat
|
||||
{
|
||||
m_context->_docx->RegisterCommentsExtended();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w15:commentsEx", TRUE );
|
||||
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
|
||||
@ -91,7 +91,6 @@ namespace DocFileFormat
|
||||
doc->listTable->Convert( &numberingMapping );
|
||||
}
|
||||
|
||||
|
||||
//write the footnotes
|
||||
FootnotesMapping footnotesMapping( &context );
|
||||
doc->Convert( &footnotesMapping );
|
||||
|
||||
@ -54,7 +54,6 @@ namespace DocFileFormat
|
||||
|
||||
int id = 0;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:endnotes", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -52,7 +52,6 @@ namespace DocFileFormat
|
||||
|
||||
_ctx->_docx->RegisterFontTable();
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:fonts", TRUE );
|
||||
m_pXmlWriter->WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
m_pXmlWriter->WriteNodeEnd( L"", TRUE, FALSE );
|
||||
|
||||
@ -45,7 +45,6 @@ namespace DocFileFormat
|
||||
m_document = static_cast<WordDocument*>( visited );
|
||||
|
||||
//start the document
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:ftr", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -54,7 +54,6 @@ namespace DocFileFormat
|
||||
|
||||
int id = 0;
|
||||
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:footnotes", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -45,7 +45,6 @@ namespace DocFileFormat
|
||||
m_document = static_cast<WordDocument*>( visited );
|
||||
|
||||
//start the document
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:hdr", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -51,7 +51,6 @@ namespace DocFileFormat
|
||||
m_document = static_cast<WordDocument*>(visited);
|
||||
|
||||
// Header
|
||||
m_pXmlWriter->WriteNodeBegin(L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
m_pXmlWriter->WriteNodeBegin(L"w:document", TRUE );
|
||||
|
||||
// Namespaces
|
||||
|
||||
@ -197,6 +197,9 @@ public:
|
||||
|
||||
virtual int Seek (int offset, int origin = 0/*STREAM_SEEK_SET*/)
|
||||
{
|
||||
if (origin == 2) offset = m_Position + offset;
|
||||
if (origin == 1) offset = m_Size - offset;
|
||||
|
||||
if ( (m_Data != NULL) && (offset >= 0) && ((unsigned int)offset < m_Size) )
|
||||
return m_Position = offset;
|
||||
|
||||
|
||||
@ -63,7 +63,6 @@ namespace DocFileFormat
|
||||
m_xmldocument->RegisterNumbering();
|
||||
|
||||
//start the document
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:numbering", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -108,6 +108,8 @@ namespace DocFileFormat
|
||||
std::wstring pathFileName = outputDir + FILE_SEPARATOR_STR + fileName;
|
||||
if (file.CreateFileW(pathFileName))
|
||||
{
|
||||
std::string root = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
|
||||
file.WriteFile((BYTE*)root.c_str(), root.length());
|
||||
file.WriteStringUTF8(XMLContent);
|
||||
file.CloseFile();
|
||||
}
|
||||
@ -397,7 +399,6 @@ namespace DocFileFormat
|
||||
{
|
||||
XMLTools::CStringXmlWriter writer;
|
||||
|
||||
writer.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
writer.WriteNodeBegin( L"Relationships", TRUE );
|
||||
|
||||
//write namespaces
|
||||
@ -433,7 +434,6 @@ namespace DocFileFormat
|
||||
XMLTools::CStringXmlWriter writer;
|
||||
|
||||
// write content types
|
||||
writer.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?");
|
||||
writer.WriteNodeBegin( L"Types", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -76,7 +76,6 @@ namespace DocFileFormat
|
||||
_ctx->_docx->RegisterSettings();
|
||||
|
||||
//start w:settings
|
||||
m_oXmlWriter.WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_oXmlWriter.WriteNodeBegin( L"w:settings", TRUE );
|
||||
//write namespaces
|
||||
m_oXmlWriter.WriteAttribute( L"xmlns:w", OpenXmlNamespaces::WordprocessingML );
|
||||
|
||||
@ -60,7 +60,6 @@ namespace DocFileFormat
|
||||
this->_ctx->_docx->RegisterStyleSheet();
|
||||
|
||||
//start the document
|
||||
m_pXmlWriter->WriteNodeBegin( L"?xml version=\"1.0\" encoding=\"UTF-8\"?" );
|
||||
m_pXmlWriter->WriteNodeBegin( L"w:styles", TRUE );
|
||||
|
||||
//write namespaces
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
#include "../../Common/OfficeFileErrorDescription.h"
|
||||
#include "../../Common/MS-LCID.h"
|
||||
|
||||
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
|
||||
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.h"
|
||||
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h"
|
||||
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
@ -240,17 +240,20 @@ namespace DocFileFormat
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
POLE::Stream * Summary = NULL;
|
||||
POLE::Stream * DocSummary = NULL;
|
||||
POLE::Stream * Summary = NULL;
|
||||
POLE::Stream * DocSummary = NULL;
|
||||
|
||||
m_pStorage->GetStream (L"SummaryInformation", &Summary);
|
||||
m_pStorage->GetStream (L"DocumentSummaryInformation", &DocSummary);
|
||||
|
||||
OLEPS::PropertySetStream summary_info;
|
||||
|
||||
if ((Summary) && (Summary->size() > 0))
|
||||
{
|
||||
XLS::CFStreamPtr stream = XLS::CFStreamPtr(new XLS::CFStream(Summary));
|
||||
OLEPS::SummaryInformation summary_info(stream);
|
||||
int document_code_page1 = summary_info.GetCodePage(); //from software last open
|
||||
XLS::CFStreamPtr stream = XLS::CFStreamPtr(new XLS::CFStream(Summary));
|
||||
summary_info.read(stream);
|
||||
|
||||
int document_code_page1 = summary_info.GetCodePage();
|
||||
|
||||
if (document_code_page1 > 0)
|
||||
{
|
||||
@ -261,8 +264,9 @@ namespace DocFileFormat
|
||||
if ((DocSummary) && (DocSummary->size() > 0))
|
||||
{
|
||||
XLS::CFStreamPtr stream = XLS::CFStreamPtr(new XLS::CFStream(DocSummary));
|
||||
OLEPS::SummaryInformation doc_summary_info(stream);
|
||||
int document_code_page2 = doc_summary_info.GetCodePage();
|
||||
summary_info.read(stream, true);
|
||||
|
||||
int document_code_page2 = summary_info.GetCodePage();
|
||||
|
||||
if (document_code_page2 > 0)
|
||||
{
|
||||
@ -288,6 +292,8 @@ namespace DocFileFormat
|
||||
nDocumentCodePage = user_codepage;
|
||||
}
|
||||
}
|
||||
m_sXmlApp = summary_info.GetApp();
|
||||
m_sXmlCore = summary_info.GetCore();
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
try
|
||||
{
|
||||
|
||||
@ -88,7 +88,7 @@ namespace DocFileFormat
|
||||
friend class OpenXmlPackage;
|
||||
friend class TextboxMapping;
|
||||
friend class SettingsMapping;
|
||||
|
||||
friend class WordprocessingDocument;
|
||||
public:
|
||||
|
||||
WordDocument (const std::wstring & tempFolder, const int userLCID);
|
||||
@ -153,6 +153,8 @@ namespace DocFileFormat
|
||||
std::wstring m_sTempFolder;
|
||||
std::wstring m_sTempDecryptFileName;
|
||||
int m_nUserLCID;
|
||||
std::wstring m_sXmlApp;
|
||||
std::wstring m_sXmlCore;
|
||||
|
||||
POLE::Stream * WordDocumentStream; // The stream "WordDocument"
|
||||
POLE::Stream * TableStream; // The stream "0Table" or "1Table"
|
||||
|
||||
@ -72,7 +72,6 @@ namespace DocFileFormat
|
||||
|
||||
RegisterDocumentMacros();
|
||||
RegisterVbaProject();
|
||||
//output_document->get_xl_files().add_vba_project();
|
||||
}
|
||||
else bMacros = false;
|
||||
}
|
||||
@ -84,54 +83,66 @@ namespace DocFileFormat
|
||||
RegisterDocument();
|
||||
}
|
||||
OOX::CContentTypes oContentTypes;
|
||||
OOX::CPath pathDocProps = m_strOutputPath + FILE_SEPARATOR_STR + _T("docProps");
|
||||
OOX::CPath pathDocProps = m_strOutputPath + FILE_SEPARATOR_STR + L"docProps";
|
||||
NSDirectory::CreateDirectory(pathDocProps.GetPath());
|
||||
|
||||
OOX::CPath DocProps = std::wstring(_T("docProps"));
|
||||
OOX::CPath DocProps = std::wstring(L"docProps");
|
||||
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
if (docFile->m_sXmlApp.empty())
|
||||
{
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
pApp->SetApplication(sApplication);
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
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);
|
||||
delete pApp;
|
||||
}
|
||||
OOX::CCore* pCore = new OOX::CCore(NULL);
|
||||
if (pCore)
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
pApp->m_sApplication = sApplication;
|
||||
pApp->SetDefaults();
|
||||
|
||||
pApp->write(pathDocProps + FILE_SEPARATOR_STR + L"app.xml", DocProps, oContentTypes);
|
||||
delete pApp;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pCore->SetCreator(_T(""));
|
||||
pCore->SetLastModifiedBy(_T(""));
|
||||
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
|
||||
delete pCore;
|
||||
}
|
||||
SaveToFile(pathDocProps.GetPath(), L"app.xml", docFile->m_sXmlApp);
|
||||
}
|
||||
if (docFile->m_sXmlCore.empty())
|
||||
{
|
||||
OOX::CCore* pCore = new OOX::CCore(NULL);
|
||||
if (pCore)
|
||||
{
|
||||
pCore->SetCreator(L"");
|
||||
pCore->SetLastModifiedBy(L"");
|
||||
pCore->write(pathDocProps + FILE_SEPARATOR_STR + L"core.xml", DocProps, oContentTypes);
|
||||
delete pCore;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SaveToFile(pathDocProps.GetPath(), L"core.xml", docFile->m_sXmlCore);
|
||||
}
|
||||
RegisterDocPr();
|
||||
|
||||
WritePackage();
|
||||
|
||||
//Write main content. (word directory)
|
||||
|
||||
SaveToFile(pathWord, std::wstring( L"document.xml" ), DocumentXML );
|
||||
SaveToFile(pathWord, std::wstring( L"fontTable.xml" ), FontTableXML );
|
||||
SaveToFile(pathWord, std::wstring( L"styles.xml" ), StyleSheetXML );
|
||||
SaveToFile(pathWord, std::wstring( L"footnotes.xml" ), FootnotesXML );
|
||||
SaveToFile(pathWord, std::wstring( L"endnotes.xml" ), EndnotesXML );
|
||||
SaveToFile(pathWord, std::wstring( L"numbering.xml" ), NumberingXML );
|
||||
SaveToFile(pathWord, std::wstring( L"comments.xml" ), CommentsXML );
|
||||
SaveToFile(pathWord, std::wstring( L"commentsExtended.xml"),CommentsExtendedXML );
|
||||
SaveToFile(pathWord, std::wstring( L"settings.xml" ), SettingsXML );
|
||||
SaveToFile(pathWord, std::wstring( L"customizations.xml" ), CommandTableXML );
|
||||
SaveToFile(pathWord, L"document.xml", DocumentXML );
|
||||
SaveToFile(pathWord, L"fontTable.xml", FontTableXML );
|
||||
SaveToFile(pathWord, L"styles.xml", StyleSheetXML );
|
||||
SaveToFile(pathWord, L"footnotes.xml", FootnotesXML );
|
||||
SaveToFile(pathWord, L"endnotes.xml", EndnotesXML );
|
||||
SaveToFile(pathWord, L"numbering.xml", NumberingXML );
|
||||
SaveToFile(pathWord, L"comments.xml", CommentsXML );
|
||||
SaveToFile(pathWord, L"commentsExtended.xml", CommentsExtendedXML );
|
||||
SaveToFile(pathWord, L"settings.xml", SettingsXML );
|
||||
SaveToFile(pathWord, L"customizations.xml", CommandTableXML );
|
||||
|
||||
if (!ImagesList.empty())
|
||||
{
|
||||
@ -173,12 +184,12 @@ namespace DocFileFormat
|
||||
|
||||
for (std::list<std::wstring>::iterator iter = HeaderXMLList.begin(); iter != HeaderXMLList.end(); ++iter)
|
||||
{
|
||||
SaveToFile(pathWord, ( std::wstring( L"header" ) + FormatUtils::IntToWideString(++headersCount) + std::wstring( L".xml" ) ), *iter);
|
||||
SaveToFile(pathWord, ( L"header" + FormatUtils::IntToWideString(++headersCount) + L".xml"), *iter);
|
||||
}
|
||||
|
||||
for (std::list<std::wstring>::iterator iter = FooterXMLList.begin(); iter != FooterXMLList.end(); ++iter)
|
||||
{
|
||||
SaveToFile(pathWord, ( std::wstring( L"footer" ) + FormatUtils::IntToWideString(++footersCount) + std::wstring( L".xml" ) ), *iter);
|
||||
SaveToFile(pathWord, ( L"footer" + FormatUtils::IntToWideString(++footersCount) + L".xml" ), *iter);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
162
ASCOfficeDocxFile2/BinReader/ReaderClasses.cpp
Normal file
162
ASCOfficeDocxFile2/BinReader/ReaderClasses.cpp
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* 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 "ReaderClasses.h"
|
||||
|
||||
namespace BinDocxRW {
|
||||
TrackRevision::TrackRevision()
|
||||
{
|
||||
Id = NULL;
|
||||
vMerge = NULL;
|
||||
vMergeOrigin = NULL;
|
||||
RPr = NULL;
|
||||
PPr = NULL;
|
||||
sectPr = NULL;
|
||||
tblPr = NULL;
|
||||
tblGridChange = NULL;
|
||||
trPr = NULL;
|
||||
tcPr = NULL;
|
||||
content = NULL;
|
||||
contentRun = NULL;
|
||||
}
|
||||
TrackRevision::~TrackRevision()
|
||||
{
|
||||
RELEASEOBJECT(Id);
|
||||
RELEASEOBJECT(vMerge);
|
||||
RELEASEOBJECT(vMergeOrigin);
|
||||
RELEASEOBJECT(RPr);
|
||||
RELEASEOBJECT(PPr);
|
||||
RELEASEOBJECT(sectPr);
|
||||
RELEASEOBJECT(tblPr);
|
||||
RELEASEOBJECT(tblGridChange);
|
||||
RELEASEOBJECT(trPr);
|
||||
RELEASEOBJECT(tcPr);
|
||||
RELEASEOBJECT(content);
|
||||
RELEASEOBJECT(contentRun);
|
||||
}
|
||||
void TrackRevision::Write(NSStringUtils::CStringBuilder* pCStringWriter, std::wstring sName)
|
||||
{
|
||||
if (IsNoEmpty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<");
|
||||
pCStringWriter->WriteString(sName);
|
||||
if (NULL != Id)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:id=\"" + std::to_wstring(*Id) + L"\"");
|
||||
}
|
||||
if (!Author.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:author=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Author);
|
||||
pCStringWriter->WriteString(L"\"");
|
||||
}
|
||||
if (!Date.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:date=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Date);
|
||||
pCStringWriter->WriteString(L"\"");
|
||||
}
|
||||
if (!UserId.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L" oouserid=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(UserId);
|
||||
pCStringWriter->WriteString(L"\"");
|
||||
}
|
||||
if (NULL != vMerge)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:vMerge=\"" + std::to_wstring(*vMerge) + L"\"");
|
||||
}
|
||||
if (NULL != vMergeOrigin)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:vMergeOrig=\"" + std::to_wstring(*vMergeOrigin) + L"\"");
|
||||
}
|
||||
if (NULL != RPr || NULL != PPr || NULL != sectPr || NULL != tblPr || NULL != tblGridChange || NULL != trPr || NULL != tcPr || NULL != content || NULL != contentRun)
|
||||
{
|
||||
pCStringWriter->WriteString(L">");
|
||||
if (NULL != RPr)
|
||||
{
|
||||
pCStringWriter->WriteString(RPr->toXML());
|
||||
}
|
||||
if (NULL != PPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:pPr>");
|
||||
pCStringWriter->Write(*PPr);
|
||||
pCStringWriter->WriteString(L"</w:pPr>");
|
||||
}
|
||||
if (NULL != sectPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:sectPr>");
|
||||
pCStringWriter->WriteString(sectPr->Write());
|
||||
pCStringWriter->WriteString(L"</w:sectPr>");
|
||||
}
|
||||
if (NULL != tblPr)
|
||||
{
|
||||
pCStringWriter->WriteString(tblPr->Write());
|
||||
}
|
||||
if (NULL != tblGridChange)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:tblGrid>");
|
||||
pCStringWriter->Write(*tblGridChange);
|
||||
pCStringWriter->WriteString(L"</w:tblGrid>");
|
||||
}
|
||||
if (NULL != trPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:trPr>");
|
||||
pCStringWriter->Write(*trPr);
|
||||
pCStringWriter->WriteString(L"</w:trPr>");
|
||||
}
|
||||
if (NULL != tcPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:tcPr>");
|
||||
pCStringWriter->Write(*tcPr);
|
||||
pCStringWriter->WriteString(L"</w:tcPr>");
|
||||
}
|
||||
if (NULL != content)
|
||||
{
|
||||
pCStringWriter->Write(*content);
|
||||
}
|
||||
if (NULL != contentRun)
|
||||
{
|
||||
pCStringWriter->Write(*contentRun);
|
||||
}
|
||||
|
||||
pCStringWriter->WriteString(L"</");
|
||||
pCStringWriter->WriteString(sName);
|
||||
pCStringWriter->WriteString(L">");
|
||||
}
|
||||
else
|
||||
{
|
||||
pCStringWriter->WriteString(L"/>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,9 +34,11 @@
|
||||
#include "HeaderFooterWriter.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
#include "../../Common/DocxFormat/Source/Common/SimpleTypes_Word.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Logic/RunProperty.h"
|
||||
#include "../BinWriter/BinReaderWriterDefines.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace BinDocxRW {
|
||||
|
||||
@ -400,449 +402,7 @@ class Tabs
|
||||
public:
|
||||
std::vector<Tab> m_aTabs;
|
||||
};
|
||||
class rPr
|
||||
{
|
||||
private:
|
||||
boost::unordered_map<std::wstring, int>& m_mapFonts;
|
||||
public:
|
||||
bool Bold;
|
||||
bool Italic;
|
||||
bool Underline;
|
||||
bool Strikeout;
|
||||
std::wstring FontAscii;
|
||||
std::wstring FontHAnsi;
|
||||
std::wstring FontAE;
|
||||
std::wstring FontCS;
|
||||
std::wstring FontAsciiTheme;
|
||||
std::wstring FontHAnsiTheme;
|
||||
std::wstring FontAETheme;
|
||||
std::wstring FontCSTheme;
|
||||
long FontSize;
|
||||
docRGB Color;
|
||||
BYTE VertAlign;
|
||||
docRGB HighLight;
|
||||
BYTE nHighLight;
|
||||
std::wstring Shd;
|
||||
std::wstring RStyle;
|
||||
long Spacing;
|
||||
bool DStrikeout;
|
||||
bool Caps;
|
||||
bool SmallCaps;
|
||||
long Position;
|
||||
BYTE FontHint;
|
||||
bool BoldCs;
|
||||
bool ItalicCs;
|
||||
long FontSizeCs;
|
||||
bool Cs;
|
||||
bool Rtl;
|
||||
std::wstring Lang;
|
||||
std::wstring LangBidi;
|
||||
std::wstring LangEA;
|
||||
CThemeColor ThemeColor;
|
||||
bool Vanish;
|
||||
std::wstring Outline;
|
||||
std::wstring Fill;
|
||||
std::wstring Del;
|
||||
std::wstring Ins;
|
||||
std::wstring MoveFrom;
|
||||
std::wstring MoveTo;
|
||||
std::wstring rPrChange;
|
||||
|
||||
bool bBold;
|
||||
bool bItalic;
|
||||
bool bUnderline;
|
||||
bool bStrikeout;
|
||||
bool bFontAscii;
|
||||
bool bFontHAnsi;
|
||||
bool bFontAE;
|
||||
bool bFontCS;
|
||||
bool bFontSize;
|
||||
bool bColor;
|
||||
bool bVertAlign;
|
||||
bool bShd;
|
||||
bool bRStyle;
|
||||
bool bSpacing;
|
||||
bool bDStrikeout;
|
||||
bool bCaps;
|
||||
bool bSmallCaps;
|
||||
bool bPosition;
|
||||
bool bFontHint;
|
||||
bool bBoldCs;
|
||||
bool bItalicCs;
|
||||
bool bFontSizeCs;
|
||||
bool bCs;
|
||||
bool bRtl;
|
||||
bool bLang;
|
||||
bool bLangBidi;
|
||||
bool bLangEA;
|
||||
bool bThemeColor;
|
||||
bool bVanish;
|
||||
bool bSnapToGrid;
|
||||
|
||||
long CompressText;
|
||||
bool bDoNotWriteNullProp;
|
||||
public:
|
||||
rPr(boost::unordered_map<std::wstring, int>& mapFonts) : m_mapFonts(mapFonts)
|
||||
{
|
||||
Reset();
|
||||
|
||||
bDoNotWriteNullProp = false;
|
||||
}
|
||||
void Reset()
|
||||
{
|
||||
Bold = false;
|
||||
Italic = false;
|
||||
Underline = false;
|
||||
Strikeout = false;
|
||||
DStrikeout = false;
|
||||
Caps = false;
|
||||
SmallCaps = false;
|
||||
bBold = false;
|
||||
bItalic = false;
|
||||
bUnderline = false;
|
||||
bStrikeout = false;
|
||||
bFontAscii = false;
|
||||
bFontHAnsi = false;
|
||||
bFontAE = false;
|
||||
bFontCS = false;
|
||||
bFontSize = false;
|
||||
bColor = false;
|
||||
bVertAlign = false;
|
||||
bShd = false;
|
||||
bRStyle = false;
|
||||
bSpacing = false;
|
||||
bDStrikeout = false;
|
||||
bCaps = false;
|
||||
bSmallCaps = false;
|
||||
bPosition = false;
|
||||
bFontHint = false;
|
||||
bBoldCs = false;
|
||||
bItalicCs = false;
|
||||
bFontSizeCs = false;
|
||||
bCs = false;
|
||||
bRtl = false;
|
||||
bLang = false;
|
||||
bLangBidi = false;
|
||||
bLangEA = false;
|
||||
bThemeColor = false;
|
||||
ThemeColor.Reset();
|
||||
bVanish = false;
|
||||
bSnapToGrid = true;
|
||||
|
||||
nHighLight = 0; //not set
|
||||
Outline.clear();
|
||||
Fill.clear();
|
||||
Del.clear();
|
||||
Ins.clear();
|
||||
MoveFrom.clear();
|
||||
MoveTo.clear();
|
||||
rPrChange.clear();
|
||||
|
||||
FontAscii.clear();
|
||||
FontHAnsi.clear();
|
||||
FontAE.clear();
|
||||
FontCS.clear();
|
||||
FontAsciiTheme.clear();
|
||||
FontHAnsiTheme.clear();
|
||||
FontAETheme.clear();
|
||||
FontCSTheme.clear();
|
||||
Shd.clear();
|
||||
RStyle.clear();
|
||||
LangBidi.clear();
|
||||
LangEA.clear();
|
||||
|
||||
CompressText = -1; //not set
|
||||
}
|
||||
bool IsNoEmpty()
|
||||
{
|
||||
return !bSnapToGrid || bBold || bItalic || bUnderline || bStrikeout || bFontAscii || bFontHAnsi || bFontAE || bFontCS || bFontSize || bColor || bVertAlign || nHighLight > 0 || bShd ||
|
||||
bRStyle || bSpacing || bDStrikeout || bCaps || bSmallCaps || bPosition || bFontHint || bBoldCs || bItalicCs || bFontSizeCs || bCs || bRtl || bLang || bLangBidi || bLangEA || bThemeColor || bVanish ||
|
||||
!Outline.empty() || !Fill.empty() || !Del.empty() || !Ins.empty() || !MoveFrom.empty() || !MoveTo.empty() || !rPrChange.empty() || !FontAsciiTheme.empty() || !FontHAnsiTheme.empty() || !FontAETheme.empty() || !FontCSTheme.empty();
|
||||
}
|
||||
void Write(NSStringUtils::CStringBuilder* pCStringWriter)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:rPr>");
|
||||
if(bRStyle)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:rStyle w:val=\"" + RStyle + L"\"/>");
|
||||
}
|
||||
if(bFontAscii || bFontHAnsi || bFontAE || bFontCS || bFontHint || !FontAsciiTheme.empty() || !FontHAnsiTheme.empty() || !FontAETheme.empty() || !FontCSTheme.empty())
|
||||
{
|
||||
std::wstring sFont = _T("<w:rFonts");
|
||||
if(bFontAscii)
|
||||
{
|
||||
sFont += L" w:ascii=\"" + FontAscii + L"\"";
|
||||
m_mapFonts[FontAscii] = 1;
|
||||
}
|
||||
if(bFontHAnsi)
|
||||
{
|
||||
sFont += L" w:hAnsi=\"" + FontHAnsi + L"\"";
|
||||
m_mapFonts[FontHAnsi] = 1;
|
||||
}
|
||||
if(bFontCS)
|
||||
{
|
||||
sFont += L" w:cs=\"" + FontCS + L"\"";
|
||||
m_mapFonts[FontCS] = 1;
|
||||
}
|
||||
if(bFontAE)
|
||||
{
|
||||
sFont += L" w:eastAsia=\"" + FontAE + L"\"";
|
||||
m_mapFonts[FontAE] = 1;
|
||||
}
|
||||
if(!FontAsciiTheme.empty())
|
||||
{
|
||||
sFont += L" w:asciiTheme=\"" + FontAsciiTheme + L"\"";
|
||||
}
|
||||
if(!FontHAnsiTheme.empty())
|
||||
{
|
||||
sFont += L" w:hAnsiTheme=\"" + FontHAnsiTheme + L"\"";
|
||||
}
|
||||
if(!FontAETheme.empty())
|
||||
{
|
||||
sFont += L" w:eastAsiaTheme=\"" + FontAETheme + L"\"";
|
||||
}
|
||||
if(!FontCSTheme.empty())
|
||||
{
|
||||
sFont += L" w:cstheme=\"" + FontCSTheme + L"\"";
|
||||
}
|
||||
if(bFontHint)
|
||||
{
|
||||
switch(FontHint)
|
||||
{
|
||||
case 0: sFont += L" w:hint=\"cs\""; break;
|
||||
case 2: sFont += L" w:hint=\"eastAsia\""; break;
|
||||
default:sFont += L" w:hint=\"default\""; break;
|
||||
}
|
||||
}
|
||||
sFont += _T("/>");
|
||||
pCStringWriter->WriteString(sFont);
|
||||
}
|
||||
if (CompressText >= 0 && CompressText <= 600)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:w w:val=\"" + std::to_wstring(CompressText) + L"\"/>");
|
||||
}
|
||||
if(bBold)
|
||||
{
|
||||
if(Bold)
|
||||
pCStringWriter->WriteString(L"<w:b/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:b w:val=\"0\"/>");
|
||||
}
|
||||
if(bBoldCs)
|
||||
{
|
||||
if(BoldCs)
|
||||
pCStringWriter->WriteString(L"<w:bCs/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:bCs w:val=\"0\"/>");
|
||||
}
|
||||
if(bItalic)
|
||||
{
|
||||
if(Italic)
|
||||
pCStringWriter->WriteString(L"<w:i/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:i w:val=\"0\"/>");
|
||||
}
|
||||
if(bItalicCs)
|
||||
{
|
||||
if(ItalicCs)
|
||||
pCStringWriter->WriteString(L"<w:iCs />");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:iCs w:val=\"0\"/>");
|
||||
}
|
||||
if(bCaps)
|
||||
{
|
||||
if(Caps)
|
||||
pCStringWriter->WriteString(L"<w:caps/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:caps w:val=\"0\"/>");
|
||||
}
|
||||
if(bSmallCaps)
|
||||
{
|
||||
if(SmallCaps)
|
||||
pCStringWriter->WriteString(L"<w:smallCaps/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:smallCaps w:val=\"0\"/>");
|
||||
}
|
||||
if(bStrikeout)
|
||||
{
|
||||
if(Strikeout)
|
||||
pCStringWriter->WriteString(L"<w:strike/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:strike w:val=\"false\"/>");
|
||||
}
|
||||
if(bDStrikeout)
|
||||
{
|
||||
if(DStrikeout)
|
||||
pCStringWriter->WriteString(L"<w:dstrike/>");
|
||||
//else if(false == bDoNotWriteNullProp)
|
||||
// pCStringWriter->WriteString(L"<w:dstrike w:val=\"false\"/>");
|
||||
}
|
||||
if(bVanish)
|
||||
{
|
||||
if(Vanish)
|
||||
pCStringWriter->WriteString(L"<w:vanish/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:vanish w:val=\"false\"/>");
|
||||
}
|
||||
if(bColor || (bThemeColor && ThemeColor.IsNoEmpty()))
|
||||
{
|
||||
std::wstring sColor(L"<w:color");
|
||||
if(bColor)
|
||||
sColor += L" w:val=\"" + Color.ToString() + L"\"";
|
||||
if(bThemeColor && ThemeColor.IsNoEmpty())
|
||||
{
|
||||
if(ThemeColor.Auto && !bColor)
|
||||
sColor += L" w:val=\"auto\"";
|
||||
if(ThemeColor.bColor)
|
||||
sColor += L" w:themeColor=\"" + ThemeColor.ToStringColor() + L"\"";
|
||||
if(ThemeColor.bTint)
|
||||
sColor += L" w:themeTint=\"" + ThemeColor.ToStringTint() + L"\"";
|
||||
if(ThemeColor.bShade)
|
||||
sColor += L" w:themeShade=\"" + ThemeColor.ToStringShade() + L"\"";
|
||||
}
|
||||
sColor += L"/>";
|
||||
pCStringWriter->WriteString(sColor);
|
||||
}
|
||||
if (!bSnapToGrid)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:snapToGrid w:val=\"0\"/>");
|
||||
}
|
||||
if(bSpacing)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:spacing w:val=\"" + std::to_wstring(Spacing) + L"\"/>");
|
||||
}
|
||||
if(bPosition)
|
||||
{
|
||||
std::wstring sPosition = L"<w:position w:val=\"" + std::to_wstring(Position) + L"\"/>";
|
||||
pCStringWriter->WriteString(sPosition);
|
||||
}
|
||||
if(bFontSize)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSize) + L"\"/>");
|
||||
}
|
||||
if(bFontSizeCs)
|
||||
{
|
||||
//if(false == bFontSize) - Sample Doc.docx
|
||||
// pCStringWriter->WriteString(L"<w:sz w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
pCStringWriter->WriteString(L"<w:szCs w:val=\"" + std::to_wstring(FontSizeCs) + L"\"/>");
|
||||
}
|
||||
if(nHighLight > 0)
|
||||
{
|
||||
docRGB& H = HighLight;
|
||||
std::wstring sColor;
|
||||
if (nHighLight == 1)
|
||||
sColor = L"none";
|
||||
else if(0x00 == H.R && 0x00 == H.G && 0x00 == H.B )
|
||||
sColor = _T("black");
|
||||
else if(0x00 == H.R && 0x00 == H.G && 0xFF == H.B )
|
||||
sColor = _T("blue");
|
||||
else if(0x00 == H.R && 0xFF == H.G && 0xFF == H.B )
|
||||
sColor = _T("cyan");
|
||||
else if(0x00 == H.R && 0x00 == H.G && 0x8B == H.B )
|
||||
sColor = _T("darkBlue");
|
||||
else if(0x00 == H.R && 0x8B == H.G && 0x8B == H.B )
|
||||
sColor = _T("darkCyan");
|
||||
else if(0xA9 == H.R && 0xA9 == H.G && 0xA9 == H.B )
|
||||
sColor = _T("darkGray");
|
||||
else if(0x00 == H.R && 0x64 == H.G && 0x00 == H.B )
|
||||
sColor = _T("darkGreen");
|
||||
else if(0x80 == H.R && 0x00 == H.G && 0x80 == H.B )
|
||||
sColor = _T("darkMagenta");
|
||||
else if(0x8B == H.R && 0x00 == H.G && 0x00 == H.B )
|
||||
sColor = _T("darkRed");
|
||||
else if(0x80 == H.R && 0x80 == H.G && 0x00 == H.B )
|
||||
sColor = _T("darkYellow");
|
||||
else if(0x00 == H.R && 0xFF == H.G && 0x00 == H.B )
|
||||
sColor = _T("green");
|
||||
else if(0xD3 == H.R && 0xD3 == H.G && 0xD3 == H.B )
|
||||
sColor = _T("lightGray");
|
||||
else if(0xFF == H.R && 0x00 == H.G && 0xFF == H.B )
|
||||
sColor = _T("magenta");
|
||||
else if(0xFF == H.R && 0x00 == H.G && 0x00 == H.B )
|
||||
sColor = _T("red");
|
||||
else if(0xFF == H.R && 0xFF == H.G && 0xFF == H.B )
|
||||
sColor = _T("white");
|
||||
else if(0xFF == H.R && 0xFF == H.G && 0x00 == H.B )
|
||||
sColor = _T("yellow");
|
||||
if(!sColor.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:highlight w:val=\"" + sColor + L"\"/>");
|
||||
}
|
||||
else if(g_nCurFormatVersion < 5)
|
||||
{
|
||||
//добавляем как shading
|
||||
pCStringWriter->WriteString(L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" + H.ToString() + L"\"/>");
|
||||
}
|
||||
}
|
||||
if(bUnderline)
|
||||
{
|
||||
if(Underline)
|
||||
pCStringWriter->WriteString(L"<w:u w:val=\"single\"/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:u w:val=\"none\"/>");
|
||||
}
|
||||
if(bShd)
|
||||
pCStringWriter->WriteString(Shd);
|
||||
if(bVertAlign)
|
||||
{
|
||||
switch(VertAlign)
|
||||
{
|
||||
case vertalign_Baseline:
|
||||
if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:vertAlign w:val=\"baseline\"/>" );
|
||||
break;
|
||||
case vertalign_SuperScript:pCStringWriter->WriteString(L"<w:vertAlign w:val=\"superscript\"/>" );break;
|
||||
case vertalign_SubScript:pCStringWriter->WriteString(L"<w:vertAlign w:val=\"subscript\"/>" );break;
|
||||
}
|
||||
}
|
||||
if(bRtl)
|
||||
{
|
||||
if(Rtl)
|
||||
pCStringWriter->WriteString(L"<w:rtl/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:rtl w:val=\"false\"/>");
|
||||
}
|
||||
if(bCs)
|
||||
{
|
||||
if(Cs)
|
||||
pCStringWriter->WriteString(L"<w:cs/>");
|
||||
else if(false == bDoNotWriteNullProp)
|
||||
pCStringWriter->WriteString(L"<w:cs w:val=\"false\"/>");
|
||||
}
|
||||
if(bLang || bLangBidi || bLangEA)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:lang");
|
||||
if(bLang)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:val=\"" + Lang + L"\"");
|
||||
}
|
||||
if(bLangBidi)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:bidi=\"" + LangBidi + L"\"");
|
||||
}
|
||||
if(bLangEA)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:eastAsia=\"" + LangEA + L"\"");
|
||||
}
|
||||
pCStringWriter->WriteString(L"/>");
|
||||
}
|
||||
if (!Outline.empty())
|
||||
pCStringWriter->WriteString(Outline);
|
||||
if (!Fill.empty())
|
||||
pCStringWriter->WriteString(Fill);
|
||||
if (!Del.empty())
|
||||
pCStringWriter->WriteString(Del);
|
||||
if (!Ins.empty())
|
||||
pCStringWriter->WriteString(Ins);
|
||||
if (!MoveFrom.empty())
|
||||
pCStringWriter->WriteString(MoveFrom);
|
||||
if (!MoveTo.empty())
|
||||
pCStringWriter->WriteString(MoveTo);
|
||||
if (!rPrChange.empty())
|
||||
pCStringWriter->WriteString(rPrChange);
|
||||
pCStringWriter->WriteString(L"</w:rPr>");
|
||||
}
|
||||
};
|
||||
class docStyle
|
||||
{
|
||||
public:
|
||||
@ -3035,6 +2595,7 @@ public:
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class TrackRevision
|
||||
{
|
||||
public:
|
||||
@ -3045,7 +2606,8 @@ public:
|
||||
long* vMerge;
|
||||
long* vMergeOrigin;
|
||||
|
||||
rPr* RPr;
|
||||
OOX::Logic::CRunProperty* RPr;
|
||||
|
||||
NSStringUtils::CStringBuilder* PPr;
|
||||
SectPr* sectPr;
|
||||
CWiterTblPr* tblPr;
|
||||
@ -3054,36 +2616,8 @@ public:
|
||||
NSStringUtils::CStringBuilder* tcPr;
|
||||
NSStringUtils::CStringBuilder* content;
|
||||
NSStringUtils::CStringBuilder* contentRun;
|
||||
TrackRevision()
|
||||
{
|
||||
Id = NULL;
|
||||
vMerge = NULL;
|
||||
vMergeOrigin = NULL;
|
||||
RPr = NULL;
|
||||
PPr = NULL;
|
||||
sectPr = NULL;
|
||||
tblPr = NULL;
|
||||
tblGridChange = NULL;
|
||||
trPr = NULL;
|
||||
tcPr = NULL;
|
||||
content = NULL;
|
||||
contentRun = NULL;
|
||||
}
|
||||
~TrackRevision()
|
||||
{
|
||||
RELEASEOBJECT(Id);
|
||||
RELEASEOBJECT(vMerge);
|
||||
RELEASEOBJECT(vMergeOrigin);
|
||||
RELEASEOBJECT(RPr);
|
||||
RELEASEOBJECT(PPr);
|
||||
RELEASEOBJECT(sectPr);
|
||||
RELEASEOBJECT(tblPr);
|
||||
RELEASEOBJECT(tblGridChange);
|
||||
RELEASEOBJECT(trPr);
|
||||
RELEASEOBJECT(tcPr);
|
||||
RELEASEOBJECT(content);
|
||||
RELEASEOBJECT(contentRun);
|
||||
}
|
||||
TrackRevision();
|
||||
~TrackRevision();
|
||||
bool IsNoEmpty()
|
||||
{
|
||||
return !Author.empty() || !Date.empty() || NULL != Id;
|
||||
@ -3094,101 +2628,6 @@ public:
|
||||
Write(&writer, sName);
|
||||
return writer.GetData();
|
||||
}
|
||||
void Write(NSStringUtils::CStringBuilder* pCStringWriter, std::wstring sName)
|
||||
{
|
||||
if(IsNoEmpty())
|
||||
{
|
||||
pCStringWriter->WriteString(L"<");
|
||||
pCStringWriter->WriteString(sName);
|
||||
if(NULL != Id)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:id=\"" + std::to_wstring(*Id) + L"\"");
|
||||
}
|
||||
if(!Author.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:author=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Author);
|
||||
pCStringWriter->WriteString(L"\"");
|
||||
}
|
||||
if(!Date.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:date=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(Date);
|
||||
pCStringWriter->WriteString(L"\"");
|
||||
}
|
||||
if(!UserId.empty())
|
||||
{
|
||||
pCStringWriter->WriteString(L" oouserid=\"");
|
||||
pCStringWriter->WriteEncodeXmlString(UserId);
|
||||
pCStringWriter->WriteString(L"\"");
|
||||
}
|
||||
if(NULL != vMerge)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:vMerge=\"" + std::to_wstring(*vMerge) + L"\"");
|
||||
}
|
||||
if(NULL != vMergeOrigin)
|
||||
{
|
||||
pCStringWriter->WriteString(L" w:vMergeOrig=\"" + std::to_wstring(*vMergeOrigin) + L"\"");
|
||||
}
|
||||
if(NULL != RPr || NULL != PPr || NULL != sectPr || NULL != tblPr || NULL != tblGridChange || NULL != trPr || NULL != tcPr || NULL != content|| NULL != contentRun)
|
||||
{
|
||||
pCStringWriter->WriteString(L">");
|
||||
if(NULL != RPr)
|
||||
{
|
||||
RPr->Write(pCStringWriter);
|
||||
}
|
||||
if(NULL != PPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:pPr>");
|
||||
pCStringWriter->Write(*PPr);
|
||||
pCStringWriter->WriteString(L"</w:pPr>");
|
||||
}
|
||||
if(NULL != sectPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:sectPr>");
|
||||
pCStringWriter->WriteString(sectPr->Write());
|
||||
pCStringWriter->WriteString(L"</w:sectPr>");
|
||||
}
|
||||
if(NULL != tblPr)
|
||||
{
|
||||
pCStringWriter->WriteString(tblPr->Write());
|
||||
}
|
||||
if(NULL != tblGridChange)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:tblGrid>");
|
||||
pCStringWriter->Write(*tblGridChange);
|
||||
pCStringWriter->WriteString(L"</w:tblGrid>");
|
||||
}
|
||||
if(NULL != trPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:trPr>");
|
||||
pCStringWriter->Write(*trPr);
|
||||
pCStringWriter->WriteString(L"</w:trPr>");
|
||||
}
|
||||
if(NULL != tcPr)
|
||||
{
|
||||
pCStringWriter->WriteString(L"<w:tcPr>");
|
||||
pCStringWriter->Write(*tcPr);
|
||||
pCStringWriter->WriteString(L"</w:tcPr>");
|
||||
}
|
||||
if(NULL != content)
|
||||
{
|
||||
pCStringWriter->Write(*content);
|
||||
}
|
||||
if(NULL != contentRun)
|
||||
{
|
||||
pCStringWriter->Write(*contentRun);
|
||||
}
|
||||
|
||||
pCStringWriter->WriteString(L"</");
|
||||
pCStringWriter->WriteString(sName);
|
||||
pCStringWriter->WriteString(L" >");
|
||||
}
|
||||
else
|
||||
{
|
||||
pCStringWriter->WriteString(L" />");
|
||||
}
|
||||
}
|
||||
}
|
||||
void Write(NSStringUtils::CStringBuilder* pCStringWriter, std::wstring sName);
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -60,9 +60,11 @@ public:
|
||||
void ReadThemeColor(int length, CThemeColor& oCThemeColor);
|
||||
int ReadThemeColorContent(BYTE type, long length, void* poResult);
|
||||
template<typename T> int ReadTrackRevision(long length, T* poResult);
|
||||
template<typename T> int ReadTrackRevision2(long length, T* poResult);
|
||||
int ReadShdComplexType(BYTE type, long length, void* poResult);
|
||||
private:
|
||||
template<typename T> int ReadTrackRevisionInner(BYTE type, long length, T* poResult);
|
||||
template<typename T> int ReadTrackRevisionInner2(BYTE type, long length, T* poResult);
|
||||
};
|
||||
class Binary_HdrFtrTableReader : public Binary_CommonReader
|
||||
{
|
||||
@ -85,11 +87,12 @@ class Binary_rPrReader : public Binary_CommonReader
|
||||
protected:
|
||||
Binary_CommonReader2 oBinary_CommonReader2;
|
||||
Writers::FileWriter& m_oFileWriter;
|
||||
boost::unordered_map<std::wstring, char>& m_mapFonts;
|
||||
public:
|
||||
Binary_rPrReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter);
|
||||
int Read(long stLen, void* poResult);
|
||||
int ReadContent(BYTE type, long length, void* poResult);
|
||||
int ReadrPrChange(BYTE type, long length, void* poResult);
|
||||
int ReadrPrChange2(BYTE type, long length, void* poResult);
|
||||
};
|
||||
class Binary_pPrReader : public Binary_CommonReader
|
||||
{
|
||||
@ -283,8 +286,8 @@ private:
|
||||
Binary_rPrReader oBinary_rPrReader;
|
||||
Binary_tblPrReader oBinary_tblPrReader;
|
||||
NSStringUtils::CStringBuilder* m_pCurWriter;
|
||||
rPr m_oCur_rPr;
|
||||
rPr m_oMath_rPr;
|
||||
OOX::Logic::CRunProperty m_oCur_rPr;
|
||||
OOX::Logic::CRunProperty m_oMath_rPr;
|
||||
NSStringUtils::CStringBuilder m_oCur_pPr;
|
||||
BYTE m_byteLastElemType;
|
||||
public:
|
||||
|
||||
@ -43,11 +43,11 @@ namespace Writers
|
||||
class FontTableWriter
|
||||
{
|
||||
NSStringUtils::CStringBuilder m_oWriter;
|
||||
std::wstring m_sDir;
|
||||
NSFonts::IApplicationFonts* m_pApplicationFonts;
|
||||
NSFonts::IFontManager* m_pFontManager;
|
||||
std::wstring m_sDir;
|
||||
NSFonts::IApplicationFonts* m_pApplicationFonts;
|
||||
NSFonts::IFontManager* m_pFontManager;
|
||||
public:
|
||||
boost::unordered_map<std::wstring, int> m_mapFonts;
|
||||
boost::unordered_map<std::wstring, char> m_mapFonts;
|
||||
|
||||
FontTableWriter(std::wstring sDir, std::wstring sFontDir, bool bNoFontDir) : m_sDir(sDir)
|
||||
{
|
||||
@ -72,11 +72,11 @@ namespace Writers
|
||||
{
|
||||
m_oWriter.WriteString(g_string_ft_Start);
|
||||
|
||||
//Те шрифты которые всегда пишем в FontTable
|
||||
//Те шрифты которые всегда пишем в FontTable
|
||||
bool bCalibri = false;
|
||||
bool bTimes = false;
|
||||
bool bCambria = false;
|
||||
for (boost::unordered_map<std::wstring, int>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
|
||||
for (boost::unordered_map<std::wstring, char>::const_iterator it = m_mapFonts.begin(); it != m_mapFonts.end(); ++it)
|
||||
{
|
||||
const std::wstring& sFontName = it->first;
|
||||
if(_T("Calibri") == sFontName)
|
||||
|
||||
@ -47,10 +47,6 @@ const int heightrule_AtLeast = 0x00;
|
||||
const int heightrule_Auto = 0x01;
|
||||
const int heightrule_Exact = 0x02;
|
||||
|
||||
const int vertalign_Baseline = 0;
|
||||
const int vertalign_SuperScript = 1;
|
||||
const int vertalign_SubScript = 2;
|
||||
|
||||
const int align_Right = 0;
|
||||
const int align_Left = 1;
|
||||
const int align_Center = 2;
|
||||
@ -419,7 +415,17 @@ extern int g_nCurFormatVersion;
|
||||
FontAETheme = 42,
|
||||
FontCSTheme = 43,
|
||||
CompressText = 44,
|
||||
SnapToGrid = 45
|
||||
SnapToGrid = 45,
|
||||
Ligatures = 46,
|
||||
NumSpacing = 47,
|
||||
NumForm = 48,
|
||||
StylisticSets = 49,
|
||||
CntxtAlts = 50,
|
||||
ShadowExt = 51,
|
||||
Reflection = 52,
|
||||
Glow = 53,
|
||||
Props3d = 54,
|
||||
Scene3d = 55
|
||||
};}
|
||||
namespace c_oSerProp_rowPrType{enum c_oSerProp_rowPrType
|
||||
{
|
||||
@ -1253,7 +1259,8 @@ extern int g_nCurFormatVersion;
|
||||
PictureFormPrShiftX = 64,
|
||||
PictureFormPrShiftY = 65,
|
||||
FormPrBorder = 70,
|
||||
FormPrShd = 71
|
||||
FormPrShd = 71,
|
||||
TextFormPrCombWRule = 72
|
||||
};}
|
||||
namespace c_oSerFFData{enum c_oSerFFData
|
||||
{
|
||||
|
||||
@ -512,7 +512,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Underline);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBOOL(SimpleTypes::underlineNone != oU.m_oVal.get().GetValue());
|
||||
m_oBcw.m_oStream.WriteBYTE(oU.m_oVal.get().GetValue());
|
||||
}
|
||||
}
|
||||
//Strikeout
|
||||
@ -586,12 +586,7 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::VertAlign);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
switch(rPr->m_oVertAlign.get().m_oVal.get().GetValue())
|
||||
{
|
||||
case SimpleTypes::verticalalignrunSuperscript: m_oBcw.m_oStream.WriteBYTE(vertalign_SuperScript);break;
|
||||
case SimpleTypes::verticalalignrunSubscript: m_oBcw.m_oStream.WriteBYTE(vertalign_SubScript);break;
|
||||
default: m_oBcw.m_oStream.WriteBYTE(vertalign_Baseline);break;
|
||||
}
|
||||
m_oBcw.m_oStream.WriteBYTE(rPr->m_oVertAlign.get().m_oVal.get().GetValue());
|
||||
}
|
||||
//HighLight
|
||||
if (false != rPr->m_oHighlight.IsInit() || false != rPr->m_oShd.IsInit())
|
||||
@ -743,13 +738,13 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
|
||||
}
|
||||
}
|
||||
//Vanish
|
||||
if (false != rPr->m_oVanish.IsInit())
|
||||
if (rPr->m_oVanish.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Vanish);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBOOL(rPr->m_oVanish->m_oVal.ToBool());
|
||||
}
|
||||
if (false != rPr->m_oTextOutline.IsInit())
|
||||
if (rPr->m_oTextOutline.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::TextOutline);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
@ -819,6 +814,75 @@ void Binary_rPrWriter::Write_rPr(OOX::Logic::CRunProperty* rPr)
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBOOL(rPr->m_oSnapToGrid->m_oVal.ToBool());
|
||||
}
|
||||
if (rPr->m_oLigatures.IsInit() && rPr->m_oLigatures->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Ligatures);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE((BYTE)rPr->m_oLigatures->m_oVal->GetValue());
|
||||
}
|
||||
if (rPr->m_oNumSpacing.IsInit() && rPr->m_oNumSpacing->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::NumSpacing);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE((BYTE)rPr->m_oNumSpacing->m_oVal->GetValue());
|
||||
}
|
||||
if (rPr->m_oNumForm.IsInit() && rPr->m_oNumForm->m_oVal.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::NumForm);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBYTE((BYTE)rPr->m_oNumForm->m_oVal->GetValue());
|
||||
}
|
||||
if (rPr->m_oCntxtAlts.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::CntxtAlts);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
|
||||
m_oBcw.m_oStream.WriteBOOL(rPr->m_oCntxtAlts->m_oVal.ToBool());
|
||||
}
|
||||
if (rPr->m_oShadowExt.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::ShadowExt);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
m_oBcw.m_oStream.WriteRecord1(0, *rPr->m_oShadowExt);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (rPr->m_oReflection.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Reflection);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
m_oBcw.m_oStream.WriteRecord1(0, *rPr->m_oReflection);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (rPr->m_oGlow.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Glow);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
m_oBcw.m_oStream.WriteRecord1(0, *rPr->m_oGlow);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (rPr->m_oProps3d.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Props3d);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
m_oBcw.m_oStream.WriteRecord1(0, *rPr->m_oProps3d);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
if (rPr->m_oScene3d.IsInit())
|
||||
{
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerProp_rPrType::Scene3d);
|
||||
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Variable);
|
||||
int nCurPos = m_oBcw.WriteItemWithLengthStart();
|
||||
|
||||
m_oBcw.m_oStream.WriteRecord1(0, *rPr->m_oScene3d);
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
void Binary_rPrWriter::Write_rPrChange(const OOX::Logic::CRPrChange& rPrChange)
|
||||
{
|
||||
@ -1517,7 +1581,7 @@ void Binary_pPrWriter::WritePageMargin(OOX::Logic::CSectionProperty* pSectPr)
|
||||
void Binary_pPrWriter::WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr, std::vector<ComplexTypes::Word::CHdrFtrRef*>& aRefs, bool bHdr)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
for(size_t i = 0, length = aRefs.size(); i < length; ++i)
|
||||
for (size_t i = 0, length = aRefs.size(); i < length; ++i)
|
||||
{
|
||||
const ComplexTypes::Word::CHdrFtrRef& oRef = *aRefs[i];
|
||||
if( oRef.m_oType.IsInit() && oRef.m_oId.IsInit())
|
||||
@ -1525,25 +1589,12 @@ void Binary_pPrWriter::WriteHeaderFooter(OOX::Logic::CSectionProperty* pSectPr,
|
||||
int nIndex = 0;
|
||||
OOX::CHdrFtr* pHdrFtr = NULL;
|
||||
|
||||
OOX::CDocxFlat *docx_flat = dynamic_cast<OOX::CDocxFlat*>(m_oBinaryHeaderFooterTableWriter->m_oParamsWriter.m_pMain);
|
||||
smart_ptr<OOX::File> oFile = m_oBinaryHeaderFooterTableWriter->m_oDocumentRelsWriter->Find(oRef.m_oId->GetValue());
|
||||
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
|
||||
{
|
||||
pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
|
||||
}
|
||||
|
||||
if (docx_flat)
|
||||
{
|
||||
std::map<std::wstring, OOX::CHdrFtr*>::iterator pFind = docx_flat->m_mapHeadersFooters.find(oRef.m_oId->GetValue());
|
||||
if (pFind != docx_flat->m_mapHeadersFooters.end())
|
||||
{
|
||||
pHdrFtr = pFind->second;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
smart_ptr<OOX::File> oFile = m_oBinaryHeaderFooterTableWriter->m_oDocumentRelsWriter->Find(oRef.m_oId->GetValue());
|
||||
if (oFile.IsInit() && (OOX::FileTypes::Header == oFile->type() || OOX::FileTypes::Footer == oFile->type()))
|
||||
{
|
||||
pHdrFtr = (OOX::CHdrFtr*)oFile.GetPointer();
|
||||
}
|
||||
}
|
||||
|
||||
if (pHdrFtr)
|
||||
{
|
||||
if(bHdr)
|
||||
@ -7978,6 +8029,12 @@ void BinaryDocumentTableWriter::WriteSdtTextFormPrComb(const ComplexTypes::Word:
|
||||
m_oBcw.m_oStream.WriteStringW3(oComb.m_oFont.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if (oComb.m_oWRule.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerSdt::TextFormPrCombWRule);
|
||||
m_oBcw.m_oStream.WriteBYTE(oComb.m_oWRule->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -9181,7 +9238,7 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
if ((pDocxFlat) && (pDocxFlat->m_pDocument.IsInit()))
|
||||
{
|
||||
pDocument = pDocxFlat->m_pDocument.GetPointer();
|
||||
pComments = &pDocxFlat->m_oComments;
|
||||
pComments = pDocxFlat->m_pComments.GetPointer();
|
||||
|
||||
m_oParamsWriter.m_pSettings = pDocxFlat->m_pSettings.GetPointer();
|
||||
m_oParamsWriter.m_pStyles = pDocxFlat->m_pStyles.GetPointer();
|
||||
@ -9308,7 +9365,7 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
}
|
||||
else if (pDocxFlat)
|
||||
{
|
||||
oBinaryDocumentTableWriter.pBackground = dynamic_cast<OOX::WritingElement*>(pDocxFlat->m_oBgPict.GetPointer());
|
||||
oBinaryDocumentTableWriter.pBackground = dynamic_cast<OOX::WritingElement*>(pDocxFlat->m_pBgPict.GetPointer());
|
||||
}
|
||||
|
||||
// Write content
|
||||
@ -9329,6 +9386,9 @@ void BinaryFileWriter::intoBindoc(const std::wstring& sDir)
|
||||
m_oBcw.m_oStream.EndRecord();
|
||||
|
||||
this->WriteTableEnd(nCurPos);
|
||||
|
||||
|
||||
m_oBcw.WriteItemWithLengthEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +48,8 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/HeaderFooter.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
|
||||
@ -48,6 +48,8 @@
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
|
||||
int BinDocxRW::g_nCurFormatVersion = 0;
|
||||
|
||||
@ -610,3 +612,32 @@ bool BinDocxRW::CDocxSerializer::unpackageFile(const std::wstring& sSrcFileName,
|
||||
|
||||
return file.unpackage(sSrcFileName, sDstPath);
|
||||
}
|
||||
bool BinDocxRW::CDocxSerializer::convertFlat(const std::wstring& sSrcFileName, const std::wstring& sDstPath)
|
||||
{
|
||||
OOX::CDocxFlat docxflat(sSrcFileName);
|
||||
|
||||
if (false == docxflat.m_pDocument.IsInit())
|
||||
return false;
|
||||
|
||||
OOX::CDocx docx;
|
||||
|
||||
if (docxflat.m_pDocument.IsInit())
|
||||
{
|
||||
NSCommon::smart_ptr<OOX::File> file = docxflat.m_pDocument.GetPointer(); file.AddRef();
|
||||
docx.Add(file);
|
||||
docx.m_oMain.document = docxflat.m_pDocument.GetPointer();
|
||||
}
|
||||
if (docxflat.m_pApp.IsInit())
|
||||
{
|
||||
NSCommon::smart_ptr<OOX::File> file(docxflat.m_pApp.GetPointer()); file.AddRef();
|
||||
docx.Add(file);
|
||||
}
|
||||
if (docxflat.m_pCore.IsInit())
|
||||
{
|
||||
NSCommon::smart_ptr<OOX::File> file(docxflat.m_pCore.GetPointer()); file.AddRef();
|
||||
docx.Add(file);
|
||||
}
|
||||
//docxflat.m_oBgPict.GetPointer();
|
||||
|
||||
return docx.Write(sDstPath);
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ namespace BinDocxRW
|
||||
bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sTempPath);
|
||||
|
||||
bool unpackageFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath);
|
||||
bool convertFlat(const std::wstring& sSrcFileName, const std::wstring& sDstPath);
|
||||
|
||||
bool CreateDocxFolders(std::wstring strDirectory, std::wstring& sThemePath, std::wstring& sMediaPath, std::wstring& sEmbedPath);
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ SOURCES += \
|
||||
../../XlsxSerializerCom/Writer/CSVWriter.cpp \
|
||||
../../OfficeCryptReader/source/ECMACryptFile.cpp \
|
||||
../../OfficeCryptReader/source/CryptTransform.cpp \
|
||||
../BinReader/ReaderClasses.cpp \
|
||||
../BinReader/Readers.cpp \
|
||||
../BinReader/CustomXmlWriter.cpp \
|
||||
../BinReader/FileWriter.cpp
|
||||
|
||||
@ -116,6 +116,7 @@ enum ElementType
|
||||
typeDcDescription,
|
||||
typeDcSubject,
|
||||
typeDcTitle,
|
||||
typeDcLanguage,
|
||||
|
||||
typeDrawA,
|
||||
|
||||
@ -449,6 +450,9 @@ enum ElementType
|
||||
typeOfficeMetaKeyword,
|
||||
typeOfficeMetaEditingCycles,
|
||||
typeOfficeMetaEditingDuration,
|
||||
typeOfficeMetaCommon,
|
||||
typeOfficeMetaInitialCreator,
|
||||
typeOfficeMetaTemplate,
|
||||
|
||||
typeDrawBase,
|
||||
typeDrawG,
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
#include "oox_rels.h"
|
||||
#include "../../include/logging.h"
|
||||
|
||||
#include "../../../DesktopEditor/common/SystemUtils.h"
|
||||
#include "../../../DesktopEditor/graphics/pro/Fonts.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
@ -744,7 +745,10 @@ void docx_conversion_context::end_document()
|
||||
get_mediaitems()->dump_rels(notes_context_.endnotesRels(), oox::endnote_place);
|
||||
|
||||
output_document_->get_word_files().set_notes(notes_context_);
|
||||
////////////////////////
|
||||
|
||||
output_document_->get_docProps_files().set_app(package::simple_element::create(L"app.xml", dump_settings_app()));
|
||||
output_document_->get_docProps_files().set_core(package::simple_element::create(L"core.xml", dump_settings_core()));
|
||||
|
||||
for (size_t i = 0; i < charts_.size(); i++)
|
||||
{
|
||||
package::chart_content_ptr content = package::chart_content::create();
|
||||
@ -755,10 +759,7 @@ void docx_conversion_context::end_document()
|
||||
output_document_->get_word_files().add_charts(content);
|
||||
|
||||
}
|
||||
////////////////////////////////
|
||||
output_document_->get_word_files().update_rels(*this);
|
||||
/////////////////////////////////////
|
||||
|
||||
}
|
||||
void docx_conversion_context::dump_bibliography()
|
||||
{
|
||||
@ -814,12 +815,185 @@ void docx_conversion_context::dump_bibliography()
|
||||
const std::wstring sFileRef = std::wstring(L"../customXml/item") + std::to_wstring(id) + L".xml";
|
||||
|
||||
output_document_->get_word_files().add_rels(relationship(sRId, sRel, sFileRef));
|
||||
|
||||
}
|
||||
std::wstring docx_conversion_context::dump_settings_app()
|
||||
{
|
||||
std::wstringstream output;
|
||||
CP_XML_WRITER(output)
|
||||
{
|
||||
CP_XML_NODE(L"Properties")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties");
|
||||
CP_XML_ATTR(L"xmlns:vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
|
||||
|
||||
if (!odf_document_->odf_context().DocProps().template_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"Template")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().template_;
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().revision_)
|
||||
{
|
||||
CP_XML_NODE(L"TotalTime")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().revision_;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
if (!odf_document_->odf_context().DocProps().application_.empty())
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().application_;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
CP_XML_STREAM() << sApplication;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
CP_XML_STREAM() << L"/" << std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().page_count_)
|
||||
{
|
||||
CP_XML_NODE(L"Pages")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().page_count_;
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().word_count_)
|
||||
{
|
||||
CP_XML_NODE(L"Words")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().word_count_;
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().character_count_)
|
||||
{
|
||||
CP_XML_NODE(L"CharactersWithSpaces")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().character_count_;
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().non_whitespace_character_count_)
|
||||
{
|
||||
CP_XML_NODE(L"Characters")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().non_whitespace_character_count_;
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().paragraph_count_)
|
||||
{
|
||||
CP_XML_NODE(L"Paragraphs")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().paragraph_count_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output.str();
|
||||
}
|
||||
std::wstring docx_conversion_context::dump_settings_core()
|
||||
{
|
||||
std::wstringstream output;
|
||||
|
||||
CP_XML_WRITER(output)
|
||||
{
|
||||
CP_XML_NODE(L"cp:coreProperties")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:cp", L"http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
|
||||
CP_XML_ATTR(L"xmlns:xsi", L"http://www.w3.org/2001/XMLSchema-instance");
|
||||
CP_XML_ATTR(L"xmlns:dc", L"http://purl.org/dc/elements/1.1/");
|
||||
CP_XML_ATTR(L"xmlns:dcmitype", L"http://purl.org/dc/dcmitype/");
|
||||
CP_XML_ATTR(L"xmlns:dcterms", L"http://purl.org/dc/terms/");
|
||||
|
||||
if (!odf_document_->odf_context().DocProps().creation_date_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dcterms:created")
|
||||
{
|
||||
CP_XML_ATTR(L"xsi:type", L"dcterms:W3CDTF");
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().creation_date_;
|
||||
}
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().dc_date_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dcterms:modified")
|
||||
{
|
||||
CP_XML_ATTR(L"xsi:type", L"dcterms:W3CDTF");
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().dc_date_;
|
||||
}
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().dc_creator_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:creator")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().dc_creator_;
|
||||
}
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().dc_title_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:title")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().dc_title_;
|
||||
}
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().dc_subject_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:subject")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().dc_subject_;
|
||||
}
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().dc_description_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:description")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().dc_description_;
|
||||
}
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().dc_language_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"dc:language")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().dc_language_;
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"cp:lastModifiedBy")
|
||||
{
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
CP_XML_STREAM() << sApplication;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
CP_XML_STREAM() << L"/" << std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
}
|
||||
if (!odf_document_->odf_context().DocProps().keyword_.empty())
|
||||
{
|
||||
CP_XML_NODE(L"cp:keywords")
|
||||
{
|
||||
CP_XML_STREAM() << odf_document_->odf_context().DocProps().keyword_;
|
||||
}
|
||||
}
|
||||
if (odf_document_->odf_context().DocProps().revision_)
|
||||
{
|
||||
CP_XML_NODE(L"cp:revision")
|
||||
{
|
||||
CP_XML_STREAM() << *odf_document_->odf_context().DocProps().revision_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return output.str();
|
||||
}
|
||||
std::wstring docx_conversion_context::dump_settings_document()
|
||||
{
|
||||
std::wstringstream output(L"");
|
||||
std::wstringstream output;
|
||||
CP_XML_WRITER(output)
|
||||
{
|
||||
CP_XML_NODE(L"w:settings")
|
||||
|
||||
@ -795,7 +795,10 @@ public:
|
||||
_rels_type_place get_type_place();
|
||||
|
||||
void dump_bibliography();
|
||||
|
||||
std::wstring dump_settings_document();
|
||||
std::wstring dump_settings_app();
|
||||
std::wstring dump_settings_core();
|
||||
|
||||
bool next_dump_page_properties_;
|
||||
bool next_dump_section_;
|
||||
@ -998,7 +1001,7 @@ private:
|
||||
std::vector< const odf_reader::style_text_properties*> text_properties_stack_;
|
||||
}state_;
|
||||
std::vector<_context_state> keep_state_;
|
||||
|
||||
//---------------------------------------------------------
|
||||
std::wstringstream document_xml_;
|
||||
std::wstringstream styles_xml_;
|
||||
std::wstringstream fontTable_xml_;
|
||||
@ -1010,7 +1013,7 @@ private:
|
||||
std::wstringstream header_xml_;
|
||||
std::wstringstream settings_xml_;
|
||||
std::wstringstream meta_xml_;
|
||||
|
||||
//--------------------------------------------------------------
|
||||
xlsx_drawing_context_handle_ptr chart_drawing_handle_;
|
||||
|
||||
styles_context styles_context_;
|
||||
|
||||
@ -509,7 +509,7 @@ docx_document::docx_document()
|
||||
relationship(L"rId3", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument", L"word/document.xml" )
|
||||
);
|
||||
|
||||
rels_files_.add_rel_file( relFile );
|
||||
get_rels_files().add_rel_file( relFile );
|
||||
|
||||
}
|
||||
int docx_document::add_customXml(customXml_content_ptr customXml)
|
||||
@ -523,10 +523,10 @@ void docx_document::write(const std::wstring & RootPath)
|
||||
content_type_file_.content()->get_override().push_back( override_content_type(L"/word/numbering.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml") );
|
||||
}
|
||||
customXml_files_.write (RootPath);
|
||||
word_files_.write (RootPath);
|
||||
rels_files_.write (RootPath);
|
||||
docProps_files_.write (RootPath);
|
||||
customXml_files_.write (RootPath);
|
||||
word_files_.write (RootPath);
|
||||
get_rels_files().write (RootPath);
|
||||
get_docProps_files().write (RootPath);
|
||||
content_type_file_.write(RootPath);
|
||||
}
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
void set_fontTable (element_ptr Element);
|
||||
void set_numbering (element_ptr Element);
|
||||
void set_settings (element_ptr Element);
|
||||
bool has_numbering ();
|
||||
bool has_numbering ();
|
||||
void set_media (mediaitems_ptr & mediaitems_);
|
||||
void set_headers_footers(headers_footers & HeadersFooters);
|
||||
void set_notes (notes_context & notesContext);
|
||||
@ -183,8 +183,6 @@ private:
|
||||
docx_content_types_file content_type_file_;
|
||||
word_files word_files_;
|
||||
customXml_files customXml_files_;
|
||||
rels_files rels_files_;
|
||||
docProps_files docProps_files_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -312,8 +312,11 @@ simple_element_ptr simple_element::create(const std::wstring & FileName, const s
|
||||
return boost::make_shared<simple_element>(FileName, Content);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
docProps_files::docProps_files()
|
||||
{
|
||||
|
||||
void core_file::write(const std::wstring & RootPath)
|
||||
}
|
||||
std::wstring docProps_files::create_core()
|
||||
{
|
||||
std::wstringstream resStream;
|
||||
|
||||
@ -321,16 +324,13 @@ void core_file::write(const std::wstring & RootPath)
|
||||
L"xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" "
|
||||
L"xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" >";
|
||||
|
||||
//resStream << L"<dc:creator>ONLYOFFICE</dc:creator>";
|
||||
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
|
||||
resStream << L"<cp:revision>1</cp:revision>";
|
||||
resStream << L"</cp:coreProperties>";
|
||||
|
||||
simple_element elm(L"core.xml", resStream.str());
|
||||
elm.write(RootPath);
|
||||
return resStream.str();
|
||||
}
|
||||
|
||||
void app_file::write(const std::wstring & RootPath)
|
||||
std::wstring docProps_files::create_app()
|
||||
{
|
||||
std::wstringstream resStream;
|
||||
|
||||
@ -348,33 +348,31 @@ void app_file::write(const std::wstring & RootPath)
|
||||
#endif
|
||||
resStream << L"</Application></Properties>";
|
||||
|
||||
simple_element elm(L"app.xml", resStream.str());
|
||||
elm.write(RootPath);
|
||||
return resStream.str();
|
||||
}
|
||||
|
||||
////////////
|
||||
|
||||
docProps_files::docProps_files()
|
||||
void docProps_files::set_app(element_ptr Element)
|
||||
{
|
||||
|
||||
app_ = Element;
|
||||
}
|
||||
void docProps_files::set_core(element_ptr Element)
|
||||
{
|
||||
core_ = Element;
|
||||
}
|
||||
|
||||
void docProps_files::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"docProps";
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
NSDirectory::CreateDirectory(path.c_str());
|
||||
|
||||
core_.write(path);
|
||||
app_.write(path);
|
||||
if (!core_) core_ = simple_element::create(L"core.xml", create_core());
|
||||
if (!app_) app_ = simple_element::create(L"app.xml", create_app());
|
||||
|
||||
core_->write(path);
|
||||
app_->write(path);
|
||||
}
|
||||
|
||||
////////////
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------
|
||||
media::media(mediaitems_ptr & _mediaitems, NSFonts::IApplicationFonts *pAppFonts) : mediaItems_(_mediaitems), appFonts_(pAppFonts)
|
||||
{
|
||||
}
|
||||
|
||||
void media::write(const std::wstring & RootPath)
|
||||
{
|
||||
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
|
||||
|
||||
@ -193,39 +193,35 @@ public:
|
||||
static _CP_PTR(chart_content) create();
|
||||
private:
|
||||
std::wstringstream content_;
|
||||
rels_file_ptr rels_;
|
||||
rels_file_ptr rels_;
|
||||
};
|
||||
//------------------------------------------------------------------------
|
||||
class document : public element
|
||||
{
|
||||
public:
|
||||
virtual content_types_file & get_content_types_file() = 0;
|
||||
};
|
||||
|
||||
class core_file : public element
|
||||
{
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
};
|
||||
|
||||
class app_file : public element
|
||||
{
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
};
|
||||
|
||||
class docProps_files : public element
|
||||
{
|
||||
public:
|
||||
docProps_files();
|
||||
|
||||
public:
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
void set_app(element_ptr Element);
|
||||
void set_core(element_ptr Element);
|
||||
|
||||
virtual void write(const std::wstring & RootPath);
|
||||
|
||||
private:
|
||||
core_file core_;
|
||||
app_file app_;
|
||||
std::wstring create_app();
|
||||
std::wstring create_core();
|
||||
|
||||
element_ptr core_;
|
||||
element_ptr app_;
|
||||
};
|
||||
class document : public element
|
||||
{
|
||||
public:
|
||||
virtual content_types_file & get_content_types_file() = 0;
|
||||
docProps_files & get_docProps_files() { return docProps_files_; }
|
||||
rels_files & get_rels_files() { return rels_files_; }
|
||||
private:
|
||||
docProps_files docProps_files_;
|
||||
rels_files rels_files_;
|
||||
};
|
||||
|
||||
class media : public element
|
||||
|
||||
@ -68,15 +68,15 @@ pptx_document::pptx_document()
|
||||
relFile->get_rels().add(relationship(L"rId2", L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", L"docProps/core.xml"));
|
||||
relFile->get_rels().add(relationship(L"rId3", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", L"docProps/app.xml"));
|
||||
|
||||
rels_files_.add_rel_file( relFile );
|
||||
get_rels_files().add_rel_file( relFile );
|
||||
}
|
||||
|
||||
void pptx_document::write(const std::wstring & RootPath)
|
||||
{
|
||||
ppt_files_.write (RootPath);
|
||||
docProps_files_.write (RootPath);
|
||||
rels_files_.write (RootPath);
|
||||
content_type_file_.write(RootPath);
|
||||
ppt_files_.write (RootPath);
|
||||
get_docProps_files().write (RootPath);
|
||||
get_rels_files().write (RootPath);
|
||||
content_type_file_.write (RootPath);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
@ -259,11 +259,8 @@ public:
|
||||
ppt_files & get_ppt_files() { return ppt_files_; }
|
||||
|
||||
private:
|
||||
pptx_content_types_file content_type_file_;
|
||||
ppt_files ppt_files_;
|
||||
docProps_files docProps_files_;
|
||||
rels_files rels_files_;
|
||||
|
||||
ppt_files ppt_files_;
|
||||
pptx_content_types_file content_type_file_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -73,16 +73,16 @@ xlsx_document::xlsx_document()
|
||||
relFile->get_rels().add(relationship(L"rId2", L"http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties", L"docProps/core.xml"));
|
||||
relFile->get_rels().add(relationship(L"rId3", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", L"docProps/app.xml"));
|
||||
|
||||
rels_files_.add_rel_file( relFile );
|
||||
get_rels_files().add_rel_file( relFile );
|
||||
}
|
||||
|
||||
void xlsx_document::write(const std::wstring & RootPath)
|
||||
{
|
||||
_CP_LOG << L"[info][xlsx] process writing" << std::endl;
|
||||
|
||||
xl_files_.write (RootPath);
|
||||
docProps_files_.write (RootPath);
|
||||
rels_files_.write (RootPath);
|
||||
xl_files_.write (RootPath);
|
||||
get_docProps_files().write (RootPath);
|
||||
get_rels_files().write (RootPath);
|
||||
content_type_file_.write(RootPath);
|
||||
}
|
||||
|
||||
|
||||
@ -337,13 +337,9 @@ public:
|
||||
|
||||
virtual content_types_file & get_content_types_file() { return content_type_file_; }
|
||||
xl_files & get_xl_files() { return xl_files_; }
|
||||
rels_files & get_rels_files() { return rels_files_; }
|
||||
private:
|
||||
xlsx_content_types_file content_type_file_;
|
||||
xl_files xl_files_;
|
||||
docProps_files docProps_files_;
|
||||
rels_files rels_files_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -683,7 +683,6 @@ void odf_document::Impl::parse_settings(office_element *element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void odf_document::Impl::parse_meta(office_element *element)
|
||||
{
|
||||
office_document_base * document = dynamic_cast<office_document_base *>( element );
|
||||
@ -699,8 +698,60 @@ void odf_document::Impl::parse_meta(office_element *element)
|
||||
|
||||
if (user_defined->meta_name_.empty()) continue;
|
||||
|
||||
context_->Settings().add_user_defined(user_defined->meta_name_, user_defined->content_);
|
||||
context_->DocProps().add_user_defined(user_defined->meta_name_, user_defined->content_);
|
||||
}
|
||||
|
||||
dc_creator * dc_creator_ = dynamic_cast<dc_creator*>(meta->dc_creator_.get());
|
||||
if (dc_creator_)
|
||||
context_->DocProps().dc_creator_ = dc_creator_->content_;
|
||||
|
||||
dc_date * dc_date_ = dynamic_cast<dc_date*>(meta->dc_date_.get());
|
||||
if (dc_date_)
|
||||
context_->DocProps().dc_date_ = dc_date_->content_;
|
||||
|
||||
dc_description * dc_description_ = dynamic_cast<dc_description*>(meta->dc_description_.get());
|
||||
if (dc_description_)
|
||||
context_->DocProps().dc_description_ = dc_description_->content_;
|
||||
|
||||
dc_language * dc_language_ = dynamic_cast<dc_language*>(meta->dc_language_.get());
|
||||
if (dc_language_)
|
||||
context_->DocProps().dc_language_ = dc_language_->content_;
|
||||
|
||||
dc_subject * dc_subject_ = dynamic_cast<dc_subject*>(meta->dc_subject_.get());
|
||||
if (dc_subject_)
|
||||
context_->DocProps().dc_subject_ = dc_subject_->content_;
|
||||
|
||||
dc_title * dc_title_ = dynamic_cast<dc_title*>(meta->dc_title_.get());
|
||||
if (dc_title_)
|
||||
context_->DocProps().dc_title_ = dc_title_->content_;
|
||||
|
||||
meta_generator * meta_generator_ = dynamic_cast<meta_generator*>(meta->meta_generator_.get());
|
||||
if (meta_generator_)
|
||||
context_->DocProps().application_ = meta_generator_->content_;
|
||||
|
||||
meta_template * meta_template_ = dynamic_cast<meta_template*>(meta->meta_template_.get());
|
||||
if (meta_template_)
|
||||
context_->DocProps().template_ = meta_generator_->content_;
|
||||
|
||||
meta_creation_date * meta_creation_date_ = dynamic_cast<meta_creation_date*>(meta->meta_creation_date_.get());
|
||||
if (meta_creation_date_)
|
||||
context_->DocProps().creation_date_ = meta_creation_date_->content_;
|
||||
|
||||
meta_keyword * meta_keyword_ = dynamic_cast<meta_keyword*>(meta->meta_keyword_.get());
|
||||
if (meta_keyword_)
|
||||
context_->DocProps().keyword_ = meta_keyword_->content_;
|
||||
meta_document_statistic * meta_document_statistic_ = dynamic_cast<meta_document_statistic*>(meta->meta_document_statistic_.get());
|
||||
if (meta_document_statistic_)
|
||||
{
|
||||
context_->DocProps().character_count_ = meta_document_statistic_->character_count_;
|
||||
context_->DocProps().page_count_ = meta_document_statistic_->page_count_;
|
||||
context_->DocProps().paragraph_count_ = meta_document_statistic_->paragraph_count_;
|
||||
context_->DocProps().word_count_ = meta_document_statistic_->word_count_;
|
||||
context_->DocProps().non_whitespace_character_count_ = meta_document_statistic_->non_whitespace_character_count_;
|
||||
}
|
||||
meta_editing_cycles * meta_editing_cycles_ = dynamic_cast<meta_editing_cycles*>(meta->meta_editing_cycles_.get());
|
||||
if (meta_editing_cycles_)
|
||||
context_->DocProps().revision_ = XmlUtils::GetInteger(meta_editing_cycles_->content_);
|
||||
}
|
||||
|
||||
void odf_document::Impl::parse_styles(office_element *element)
|
||||
|
||||
@ -411,6 +411,7 @@ public:
|
||||
styles_lite_container& drawStyles() { return draw_style_container_; }
|
||||
styles_lite_container& Templates() { return template_container_; }
|
||||
settings_container& Settings() { return settings_container_; }
|
||||
doc_props_container& DocProps() { return doc_props_container_; }
|
||||
|
||||
private:
|
||||
styles_container major_style_container_;
|
||||
@ -424,7 +425,7 @@ private:
|
||||
styles_lite_container template_container_;
|
||||
|
||||
settings_container settings_container_;
|
||||
|
||||
doc_props_container doc_props_container_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
#include "draw_common.h"
|
||||
#include "calcs_styles.h"
|
||||
#include "../docx/xlsx_utils.h"
|
||||
#include "office_meta.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -50,25 +51,6 @@ namespace cpdoccore {
|
||||
|
||||
namespace odf_reader {
|
||||
|
||||
// dc:date
|
||||
/////////////////////////////////////////////
|
||||
const wchar_t * dc_date::ns = L"dc";
|
||||
const wchar_t * dc_date::name = L"date";
|
||||
|
||||
void dc_date::add_text(const std::wstring & Text)
|
||||
{
|
||||
content_ = Text;
|
||||
}
|
||||
|
||||
// dc:creator
|
||||
///////////////////////////////////////////
|
||||
const wchar_t * dc_creator::ns = L"dc";
|
||||
const wchar_t * dc_creator::name = L"creator";
|
||||
|
||||
void dc_creator::add_text(const std::wstring & Text)
|
||||
{
|
||||
content_ = Text;
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
void office_annotation_attr::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
|
||||
@ -56,51 +56,6 @@ public:
|
||||
_CP_OPT(std::wstring) draw_text_style_name_;
|
||||
_CP_OPT(std::wstring) draw_style_name_;
|
||||
};
|
||||
|
||||
// dc:date
|
||||
class dc_date : public office_element_impl<dc_date>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDcDate;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context){}
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
std::wstring 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(dc_date);
|
||||
|
||||
// dc:creator
|
||||
class dc_creator : public office_element_impl<dc_creator>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeDcCreator;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context){}
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context){}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
std::wstring 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(dc_creator);
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
// office:annotation-end
|
||||
class office_annotation_end : public office_element_impl<office_annotation_end>
|
||||
|
||||
@ -62,34 +62,108 @@ void office_meta::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
CP_CREATE_ELEMENT(meta_user_defined_);
|
||||
}
|
||||
else if (Ns == L"meta" && Name == L"creation-date")
|
||||
{
|
||||
CP_CREATE_ELEMENT(meta_creation_date_);
|
||||
}
|
||||
else if (Ns == L"meta" && Name == L"initial-creator")
|
||||
{
|
||||
CP_CREATE_ELEMENT(meta_initial_creator_);
|
||||
}
|
||||
else if (Ns == L"meta" && Name == L"template")
|
||||
{
|
||||
CP_CREATE_ELEMENT(meta_template_);
|
||||
}
|
||||
else if (Ns == L"dc" && Name == L"date")
|
||||
{
|
||||
CP_CREATE_ELEMENT(dc_date_);
|
||||
}
|
||||
else if (Ns == L"dc" && Name == L"creator")
|
||||
{
|
||||
CP_CREATE_ELEMENT(dc_creator_);
|
||||
}
|
||||
else if (Ns == L"dc" && Name == L"description")
|
||||
{
|
||||
CP_CREATE_ELEMENT(dc_description_);
|
||||
}
|
||||
else if (Ns == L"dc" && Name == L"language")
|
||||
{
|
||||
CP_CREATE_ELEMENT(dc_language_);
|
||||
}
|
||||
else if (Ns == L"dc" && Name == L"title")
|
||||
{
|
||||
CP_CREATE_ELEMENT(dc_title_);
|
||||
}
|
||||
else if (Ns == L"dc" && Name == L"subject")
|
||||
{
|
||||
CP_CREATE_ELEMENT(dc_subject_);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * meta_generator::ns = L"meta";
|
||||
const wchar_t * meta_generator::name = L"generator";
|
||||
|
||||
void meta_generator::add_text(const std::wstring & text)
|
||||
//-----------------------------------------------------------------------------------
|
||||
const wchar_t * meta_common::ns = L"meta";
|
||||
const wchar_t * meta_common::name = L"common";
|
||||
void meta_common::add_text(const std::wstring & text)
|
||||
{
|
||||
content_ = text;
|
||||
}
|
||||
const wchar_t * meta_generator::ns = L"meta";
|
||||
const wchar_t * meta_generator::name = L"generator";
|
||||
|
||||
// config_item
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const wchar_t * meta_initial_creator::ns = L"meta";
|
||||
const wchar_t * meta_initial_creator::name = L"initial-creator";
|
||||
|
||||
const wchar_t * meta_creation_date::ns = L"meta";
|
||||
const wchar_t * meta_creation_date::name = L"creation-date";
|
||||
|
||||
const wchar_t * meta_template::ns = L"meta";
|
||||
const wchar_t * meta_template::name = L"template";
|
||||
|
||||
const wchar_t * meta_keyword::ns = L"meta";
|
||||
const wchar_t * meta_keyword::name = L"keyword";
|
||||
|
||||
const wchar_t * meta_editing_cycles::ns = L"meta";
|
||||
const wchar_t * meta_editing_cycles::name = L"editing-cycles";
|
||||
|
||||
const wchar_t * dc_creator::ns = L"dc";
|
||||
const wchar_t * dc_creator::name = L"creator";
|
||||
|
||||
const wchar_t * dc_description::ns = L"dc";
|
||||
const wchar_t * dc_description::name = L"description";
|
||||
|
||||
const wchar_t * dc_language::ns = L"dc";
|
||||
const wchar_t * dc_language::name = L"language";
|
||||
|
||||
const wchar_t * dc_date::ns = L"dc";
|
||||
const wchar_t * dc_date::name = L"date";
|
||||
|
||||
const wchar_t * dc_title::ns = L"dc";
|
||||
const wchar_t * dc_title::name = L"title";
|
||||
|
||||
const wchar_t * dc_subject::ns = L"dc";
|
||||
const wchar_t * dc_subject::name = L"subject";
|
||||
//------------------------------------------------------------------------------------
|
||||
const wchar_t * meta_document_statistic::ns = L"meta";
|
||||
const wchar_t * meta_document_statistic::name = L"document-statistic";
|
||||
|
||||
void meta_document_statistic::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
CP_APPLY_ATTR(L"meta:table-count", meta_table_count_);
|
||||
CP_APPLY_ATTR(L"meta:image-count", meta_image_count_);
|
||||
CP_APPLY_ATTR(L"meta:object-count", meta_object_count_);
|
||||
CP_APPLY_ATTR(L"meta:page-count", meta_page_count_);
|
||||
CP_APPLY_ATTR(L"meta:paragraph-count", meta_paragraph_count_);
|
||||
CP_APPLY_ATTR(L"meta:word-count", meta_word_count_);
|
||||
CP_APPLY_ATTR(L"meta:character-count", meta_character_count_);
|
||||
CP_APPLY_ATTR(L"meta:table-count", table_count_);
|
||||
CP_APPLY_ATTR(L"meta:image-count", image_count_);
|
||||
CP_APPLY_ATTR(L"meta:object-count", object_count_);
|
||||
CP_APPLY_ATTR(L"meta:page-count", page_count_);
|
||||
CP_APPLY_ATTR(L"meta:paragraph-count", paragraph_count_);
|
||||
CP_APPLY_ATTR(L"meta:word-count", word_count_);
|
||||
CP_APPLY_ATTR(L"meta:character-count", character_count_);
|
||||
CP_APPLY_ATTR(L"meta:ole-object-count", ole_object_count_);
|
||||
CP_APPLY_ATTR(L"meta:frame-count", frame_count_);
|
||||
CP_APPLY_ATTR(L"meta:row-count", row_count_);
|
||||
CP_APPLY_ATTR(L"meta:cell-count", cell_count_);
|
||||
CP_APPLY_ATTR(L"meta:non-whitespace-character-count", non_whitespace_character_count_);
|
||||
CP_APPLY_ATTR(L"meta:sentence-count", sentence_count_);
|
||||
CP_APPLY_ATTR(L"meta:syllable-count", syllable_count_);
|
||||
}
|
||||
|
||||
// meta_user_defined
|
||||
|
||||
@ -52,35 +52,156 @@ public:
|
||||
office_element_ptr_array meta_user_defined_;
|
||||
office_element_ptr meta_generator_;
|
||||
office_element_ptr meta_document_statistic_;
|
||||
|
||||
office_element_ptr meta_creation_date_;
|
||||
office_element_ptr meta_template_;
|
||||
office_element_ptr meta_printed_by_;
|
||||
office_element_ptr meta_print_date_;
|
||||
office_element_ptr meta_keyword_;
|
||||
office_element_ptr meta_initial_creator_;
|
||||
office_element_ptr meta_hyperlinkbehaviour_;
|
||||
office_element_ptr meta_editing_duration_;
|
||||
office_element_ptr meta_editing_cycles_;
|
||||
office_element_ptr meta_auto_reloads_;
|
||||
office_element_ptr dc_date_;
|
||||
office_element_ptr dc_description_;
|
||||
office_element_ptr dc_language_;
|
||||
office_element_ptr dc_subject_;
|
||||
office_element_ptr dc_title_;
|
||||
office_element_ptr dc_creator_;
|
||||
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);
|
||||
virtual void add_text(const std::wstring & Text){}
|
||||
};
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(office_meta);
|
||||
|
||||
// meta:generator
|
||||
class meta_generator : public office_element_impl<meta_generator>
|
||||
// base
|
||||
class meta_common : public office_element_impl<meta_common>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeOfficeMetaGenerator;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeOfficeMetaCommon;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
std::wstring 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){}
|
||||
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) {}
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
};
|
||||
// meta:initial-creator
|
||||
class meta_initial_creator : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeOfficeMetaInitialCreator;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_initial_creator);
|
||||
// meta:keyword
|
||||
class meta_keyword : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeOfficeMetaKeyword;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_keyword);
|
||||
// meta:creation-date
|
||||
class meta_creation_date : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeOfficeMetaCreationDate;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_creation_date);
|
||||
// meta:generator
|
||||
class meta_generator : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeOfficeMetaGenerator;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_generator);
|
||||
|
||||
// meta:template
|
||||
class meta_template : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeOfficeMetaTemplate;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_template);
|
||||
// meta:editing-cycles
|
||||
class meta_editing_cycles : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeOfficeMetaEditingCycles;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(meta_editing_cycles);
|
||||
//--------------------------------------------------------------------------
|
||||
// dc:creator
|
||||
class dc_creator : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeDcCreator;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dc_creator);
|
||||
// dc:description
|
||||
class dc_description : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeDcDescription;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dc_description);
|
||||
// dc:language
|
||||
class dc_language : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeDcLanguage;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dc_language);
|
||||
// dc:date
|
||||
class dc_date : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeDcDate;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dc_date);
|
||||
// dc:title
|
||||
class dc_title : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeDcTitle;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dc_title);
|
||||
// dc:subject
|
||||
class dc_subject : public meta_common
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const ElementType type = typeDcSubject;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dc_subject);
|
||||
//-----------------------------------------------------------------------------
|
||||
// meta:document-statistic
|
||||
class meta_document_statistic : public office_element_impl<meta_document_statistic>
|
||||
{
|
||||
@ -91,13 +212,21 @@ public:
|
||||
static const ElementType type = typeOfficeMetaDocumentStatistic;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
_CP_OPT(int) meta_table_count_;
|
||||
_CP_OPT(int) meta_image_count_;
|
||||
_CP_OPT(int) meta_object_count_;
|
||||
_CP_OPT(int) meta_page_count_;
|
||||
_CP_OPT(int) meta_paragraph_count_;
|
||||
_CP_OPT(int) meta_word_count_;
|
||||
_CP_OPT(int) meta_character_count_;
|
||||
_CP_OPT(int) image_count_;
|
||||
_CP_OPT(int) object_count_;
|
||||
_CP_OPT(int) page_count_;
|
||||
_CP_OPT(int) paragraph_count_;
|
||||
_CP_OPT(int) word_count_;
|
||||
_CP_OPT(int) character_count_;
|
||||
_CP_OPT(int) non_whitespace_character_count_;
|
||||
_CP_OPT(int) draw_count_;
|
||||
_CP_OPT(int) ole_object_count_;
|
||||
_CP_OPT(int) frame_count_;
|
||||
_CP_OPT(int) table_count_;
|
||||
_CP_OPT(int) row_count_;
|
||||
_CP_OPT(int) cell_count_;
|
||||
_CP_OPT(int) sentence_count_;
|
||||
_CP_OPT(int) syllable_count_;
|
||||
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){}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include "office_text.h"
|
||||
#include "office_annotation.h"
|
||||
#include "office_meta.h"
|
||||
|
||||
#include "../../include/xml/xmlchar.h"
|
||||
#include "../../include/xml/utils.h"
|
||||
|
||||
@ -1825,7 +1825,7 @@ void text_user_defined::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
odf_reader::odf_read_context & odfContext = Context.root()->odf_context();
|
||||
|
||||
std::wstring value = odfContext.Settings().get_user_defined(*text_name_);
|
||||
std::wstring value = odfContext.DocProps().get_user_defined(*text_name_);
|
||||
if (!value.empty())
|
||||
text_ = text::create(value) ;
|
||||
|
||||
|
||||
@ -82,6 +82,32 @@ office_element_ptr styles_lite_container::find_by_style_name(const std::wstring
|
||||
return office_element_ptr();
|
||||
}
|
||||
}
|
||||
class doc_props_container::Impl
|
||||
{
|
||||
public:
|
||||
Impl() {}
|
||||
|
||||
std::map<std::wstring, std::wstring> map_user_defineds;
|
||||
};
|
||||
|
||||
doc_props_container::doc_props_container() : impl_(new doc_props_container::Impl())
|
||||
{
|
||||
}
|
||||
|
||||
doc_props_container::~doc_props_container()
|
||||
{
|
||||
}
|
||||
void doc_props_container::add_user_defined(const std::wstring & name, const std::wstring & value)
|
||||
{
|
||||
impl_->map_user_defineds.insert(std::make_pair(name, value));
|
||||
}
|
||||
std::wstring doc_props_container::get_user_defined(const std::wstring & name)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::iterator pFind = impl_->map_user_defineds.find(name);
|
||||
|
||||
return pFind != impl_->map_user_defineds.end() ? pFind->second : L"";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
struct settings_value
|
||||
{
|
||||
@ -100,7 +126,7 @@ struct view_elm : settings_elm
|
||||
boost::unordered_map<std::wstring, int> map_tables;
|
||||
std::vector<settings_elm> tables;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
class settings_container::Impl
|
||||
{
|
||||
public:
|
||||
@ -266,16 +292,6 @@ _CP_OPT(std::wstring) settings_container::find_view_by_name(const std::wstring &
|
||||
}
|
||||
return value;
|
||||
}
|
||||
void settings_container::add_user_defined(const std::wstring & name, const std::wstring & value)
|
||||
{
|
||||
impl_->map_user_defineds.insert(std::make_pair(name, value));
|
||||
}
|
||||
std::wstring settings_container::get_user_defined(const std::wstring & name)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::iterator pFind = impl_->map_user_defineds.find(name);
|
||||
|
||||
return pFind != impl_->map_user_defineds.end() ? pFind->second : L"";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +56,36 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class doc_props_container
|
||||
{
|
||||
public:
|
||||
doc_props_container();
|
||||
~doc_props_container();
|
||||
|
||||
void add_user_defined(const std::wstring & name, const std::wstring & value);
|
||||
std::wstring get_user_defined(const std::wstring & name);
|
||||
|
||||
std::wstring dc_creator_;
|
||||
std::wstring dc_date_;
|
||||
std::wstring dc_description_;
|
||||
std::wstring dc_language_;
|
||||
std::wstring dc_subject_;
|
||||
std::wstring dc_title_;
|
||||
std::wstring application_;
|
||||
std::wstring creation_date_;
|
||||
std::wstring keyword_;
|
||||
std::wstring template_;
|
||||
_CP_OPT(int) revision_;
|
||||
|
||||
_CP_OPT(int) page_count_;
|
||||
_CP_OPT(int) paragraph_count_;
|
||||
_CP_OPT(int) word_count_;
|
||||
_CP_OPT(int) character_count_;
|
||||
_CP_OPT(int) non_whitespace_character_count_;
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
};
|
||||
class settings_container
|
||||
{
|
||||
public:
|
||||
@ -80,8 +110,6 @@ public:
|
||||
|
||||
void add_view (const std::wstring & name, const std::wstring & value);
|
||||
|
||||
void add_user_defined(const std::wstring & name, const std::wstring & value);
|
||||
std::wstring get_user_defined(const std::wstring & name);
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/oMathPara.h"
|
||||
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
|
||||
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Docx.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/DocxFlat.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Document.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Endnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Footnote.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/FontTable.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Numbering.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Styles.h"
|
||||
@ -1972,7 +1974,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
}
|
||||
else if (docx_flat_document)
|
||||
{
|
||||
convert(docx_flat_document->m_oBgPict.GetPointer(), 1);
|
||||
convert(docx_flat_document->m_pBgPict.GetPointer(), 1);
|
||||
}
|
||||
//nullable<ComplexTypes::Word::CTextDirection > m_oTextDirection;
|
||||
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oRtlGutter;
|
||||
@ -4176,7 +4178,7 @@ void DocxConverter::convert_comment(int oox_comm_id)
|
||||
}
|
||||
else if (docx_flat_document)
|
||||
{
|
||||
pComments = &docx_flat_document->m_oComments;
|
||||
pComments = docx_flat_document->m_pComments.GetPointer();
|
||||
}
|
||||
|
||||
if (!pComments) return;
|
||||
@ -4221,7 +4223,7 @@ void DocxConverter::convert_footnote(int oox_ref_id)
|
||||
}
|
||||
else if (docx_flat_document)
|
||||
{
|
||||
oox_footnotes = &docx_flat_document->m_oFootnotes;
|
||||
oox_footnotes = docx_flat_document->m_pFootnotes.GetPointer();
|
||||
}
|
||||
if (oox_footnotes == NULL ) return;
|
||||
|
||||
@ -4259,7 +4261,7 @@ void DocxConverter::convert_endnote(int oox_ref_id)
|
||||
}
|
||||
else if (docx_flat_document)
|
||||
{
|
||||
oox_endnotes = &docx_flat_document->m_oEndnotes;
|
||||
oox_endnotes = docx_flat_document->m_pEndnotes.GetPointer();
|
||||
}
|
||||
if (oox_endnotes == NULL ) return;
|
||||
|
||||
@ -4297,11 +4299,7 @@ void DocxConverter::convert_hdr_ftr(std::wstring sId)
|
||||
}
|
||||
else if (docx_flat_document)
|
||||
{
|
||||
std::map<std::wstring, OOX::CHdrFtr*>::iterator pFind = docx_flat_document->m_mapHeadersFooters.find(sId);
|
||||
if (pFind != docx_flat_document->m_mapHeadersFooters.end())
|
||||
{
|
||||
oox_hdr_ftr = pFind->second;
|
||||
}
|
||||
oox_hdr_ftr = docx_flat_document->GetHeaderOrFooter(sId);
|
||||
}
|
||||
if (oox_hdr_ftr == NULL ) return;
|
||||
|
||||
|
||||
@ -1,17 +1,48 @@
|
||||
#include "Converter.h"
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* 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 "../utils.h"
|
||||
#include "Converter.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/DocxFlat.h"
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Math/oMathPara.h"
|
||||
|
||||
|
||||
#include "../OdfFormat/odf_conversion_context.h"
|
||||
#include "../../ASCOfficeOdfFileW/source/OdfFormat/math_layout_elements.h"
|
||||
#include "../../ASCOfficeOdfFileW/source/OdfFormat/math_limit_elements.h"
|
||||
#include "../../ASCOfficeOdfFileW/source/OdfFormat/math_token_elements.h"
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
std::vector<std::vector<std::wstring>>& OoxConverter::brackets()
|
||||
|
||||
@ -96,7 +96,6 @@ _UINT32 COfficePPTFile::OpenFile(const std::wstring & sFileName, const std::wstr
|
||||
}
|
||||
|
||||
//pptReader->ReadEncryptedSummary();
|
||||
//pptReader->ReadDocumentSummary();
|
||||
pptReader->ReadDocument();
|
||||
|
||||
bMacros = pptReader->m_oDocumentInfo.m_bMacros;
|
||||
@ -132,7 +131,9 @@ _UINT32 COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs
|
||||
PPT_FORMAT::CPPTXWriter oPPTXWriter;
|
||||
oPPTXWriter.m_strTempDirectory = sDstPath;
|
||||
|
||||
|
||||
oPPTXWriter.m_xmlApp = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_app_xml;
|
||||
oPPTXWriter.m_xmlCore = ((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_core_xml;
|
||||
|
||||
oPPTXWriter.CreateFile(((CPPTFileReader*)m_pReader)->m_oDocumentInfo.m_arUsers[0]);
|
||||
oPPTXWriter.CloseFile();
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ PPT_FORMAT::CPPTXWriter::~CPPTXWriter()
|
||||
RELEASEOBJECT(m_pShapeWriter);
|
||||
}
|
||||
|
||||
void PPT_FORMAT::CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo )
|
||||
void PPT_FORMAT::CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo)
|
||||
{
|
||||
m_pUserInfo = pUserInfo;
|
||||
|
||||
@ -136,8 +136,9 @@ void PPT_FORMAT::CPPTXWriter::CreateFile(CPPTUserInfo* pUserInfo )
|
||||
|
||||
// core
|
||||
oFile.CreateFileW(m_strTempDirectory + FILE_SEPARATOR_STR + _T("docProps") + FILE_SEPARATOR_STR + _T("core.xml"));
|
||||
strMemory = NSPPTXWriterConst::g_string_core;
|
||||
oFile.WriteStringUTF8(strMemory);
|
||||
if (m_xmlCore.empty())
|
||||
m_xmlCore = NSPPTXWriterConst::g_string_core;
|
||||
oFile.WriteStringUTF8(m_xmlCore);
|
||||
oFile.CloseFile();
|
||||
|
||||
// app
|
||||
@ -299,142 +300,147 @@ void PPT_FORMAT::CPPTXWriter::WriteContentTypes()
|
||||
|
||||
void PPT_FORMAT::CPPTXWriter::WriteApp(NSFile::CFileBinary& oFile)
|
||||
{
|
||||
std::wstringstream strm;
|
||||
if (m_xmlApp.empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"Properties")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties");
|
||||
CP_XML_ATTR(L"xmlns:vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"Properties")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties");
|
||||
CP_XML_ATTR(L"xmlns:vt", L"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
|
||||
|
||||
CP_XML_NODE(L"TotalTime")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"Words")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
CP_XML_NODE(L"TotalTime")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"Words")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
CP_XML_STREAM() << sApplication;
|
||||
}
|
||||
//CP_XML_NODE(L"AppVersion")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"1.0";
|
||||
//}
|
||||
CP_XML_NODE(L"Paragraphs")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"PresentationFormat")
|
||||
{
|
||||
CP_XML_STREAM() << L"On-screen Show (4:3)";
|
||||
}
|
||||
CP_XML_NODE(L"Slides")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
}
|
||||
CP_XML_NODE(L"Notes")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arNotes.size();
|
||||
}
|
||||
CP_XML_NODE(L"HiddenSlides")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"MMClips")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"ScaleCrop")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"HeadingPairs")
|
||||
{
|
||||
CP_XML_NODE(L"vt:vector")
|
||||
{
|
||||
CP_XML_ATTR(L"size", 4);
|
||||
CP_XML_ATTR(L"baseType", L"variant");
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
CP_XML_STREAM() << sApplication;
|
||||
}
|
||||
//CP_XML_NODE(L"AppVersion")
|
||||
//{
|
||||
// CP_XML_STREAM() << L"1.0";
|
||||
//}
|
||||
CP_XML_NODE(L"Paragraphs")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"PresentationFormat")
|
||||
{
|
||||
CP_XML_STREAM() << L"On-screen Show (4:3)";
|
||||
}
|
||||
CP_XML_NODE(L"Slides")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
}
|
||||
CP_XML_NODE(L"Notes")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arNotes.size();
|
||||
}
|
||||
CP_XML_NODE(L"HiddenSlides")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"MMClips")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"ScaleCrop")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"HeadingPairs")
|
||||
{
|
||||
CP_XML_NODE(L"vt:vector")
|
||||
{
|
||||
CP_XML_ATTR(L"size", 4);
|
||||
CP_XML_ATTR(L"baseType", L"variant");
|
||||
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Theme";
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:i4")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arThemes.size();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Slide Titles";
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:i4")
|
||||
CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"TitlesOfParts")
|
||||
{
|
||||
CP_XML_NODE(L"vt:vector")
|
||||
{
|
||||
CP_XML_ATTR(L"size", m_pDocument->m_arSlides.size() + m_pDocument->m_arThemes.size());
|
||||
CP_XML_ATTR(L"baseType", L"lpstr");
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Theme";
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:i4")
|
||||
{
|
||||
CP_XML_STREAM() << m_pDocument->m_arThemes.size();
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Slide Titles";
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_NODE(L"vt:i4")
|
||||
CP_XML_STREAM() << m_pDocument->m_arSlides.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(L"TitlesOfParts")
|
||||
{
|
||||
CP_XML_NODE(L"vt:vector")
|
||||
{
|
||||
CP_XML_ATTR(L"size", m_pDocument->m_arSlides.size() + m_pDocument->m_arThemes.size());
|
||||
CP_XML_ATTR(L"baseType", L"lpstr");
|
||||
|
||||
for (size_t i = 1; i <= m_pDocument->m_arThemes.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Theme " << i;
|
||||
}
|
||||
}
|
||||
for (size_t i = 1; i <= m_pDocument->m_arSlides.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Slide " << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (size_t i = 1; i <= m_pDocument->m_arThemes.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Theme " << i;
|
||||
}
|
||||
}
|
||||
for (size_t i = 1; i <= m_pDocument->m_arSlides.size(); ++i)
|
||||
{
|
||||
CP_XML_NODE(L"vt:lpstr")
|
||||
{
|
||||
CP_XML_STREAM() << L"Slide " << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//CP_XML_NODE(L"Company");
|
||||
CP_XML_NODE(L"LinksUpToDate")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"SharedDoc")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"HyperlinksChanged")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
}
|
||||
}
|
||||
//CP_XML_NODE(L"Company");
|
||||
CP_XML_NODE(L"LinksUpToDate")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"SharedDoc")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
CP_XML_NODE(L"HyperlinksChanged")
|
||||
{
|
||||
CP_XML_STREAM() << L"false";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_xmlApp = strm.str();
|
||||
}
|
||||
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
oFile.WriteStringUTF8(strm.str());
|
||||
oFile.WriteStringUTF8(m_xmlApp);
|
||||
}
|
||||
|
||||
void PPT_FORMAT::CPPTXWriter::WritePresInfo()
|
||||
|
||||
@ -70,6 +70,8 @@ namespace PPT_FORMAT
|
||||
void Write()
|
||||
{
|
||||
}
|
||||
std::wstring m_xmlApp;
|
||||
std::wstring m_xmlCore;
|
||||
|
||||
protected:
|
||||
void WriteApp (NSFile::CFileBinary& oFile);
|
||||
|
||||
@ -43,6 +43,9 @@ public:
|
||||
std::wstring m_strPassword;
|
||||
bool m_bMacros;
|
||||
|
||||
std::wstring m_app_xml;
|
||||
std::wstring m_core_xml;
|
||||
|
||||
CPPTDocumentInfo() : m_oCurrentUser(), m_bMacros(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
#include "PPTFileReader.h"
|
||||
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Crypt/Decryptor.h"
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/PropertySetStream.h"
|
||||
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../Records/Drawing/ArtBlip.h"
|
||||
@ -48,6 +48,7 @@
|
||||
|
||||
#define ENCRYPTED_SUMMARY_STREAM L"EncryptedSummary"
|
||||
#define DOCUMENT_SUMMARY_STREAM L"DocumentSummaryInformation"
|
||||
#define SUMMARY_STREAM L"SummaryInformation"
|
||||
|
||||
CPPTFileReader::CPPTFileReader(POLE::Storage *pStorage, std::wstring strTemp):
|
||||
m_pStorage(pStorage),
|
||||
@ -121,6 +122,8 @@ bool CPPTFileReader::ReadPersists()
|
||||
void CPPTFileReader::ReadDocument()
|
||||
{
|
||||
ReadPictures();
|
||||
ReadDocumentSummary();
|
||||
|
||||
m_oDocumentInfo.LoadDocument(m_strTmpDirectory);
|
||||
}
|
||||
|
||||
@ -183,7 +186,14 @@ CFStreamPtr CPPTFileReader::GetEncryptedSummaryStream()
|
||||
}
|
||||
return m_pEncryptedSummaryStream;
|
||||
}
|
||||
|
||||
CFStreamPtr CPPTFileReader::GetSummaryStream()
|
||||
{
|
||||
if (!m_pDocumentSummaryStream)
|
||||
{
|
||||
m_pDocumentSummaryStream = GetStreamByName(SUMMARY_STREAM);
|
||||
}
|
||||
return m_pDocumentSummaryStream;
|
||||
}
|
||||
CFStreamPtr CPPTFileReader::GetDocumentSummaryStream()
|
||||
{
|
||||
if (!m_pDocumentSummaryStream)
|
||||
@ -210,15 +220,23 @@ void CPPTFileReader::ReadEncryptedSummary()
|
||||
|
||||
void CPPTFileReader::ReadDocumentSummary()
|
||||
{
|
||||
CFStreamPtr pStream = GetDocumentSummaryStream();
|
||||
if (!pStream) return;
|
||||
|
||||
OLEPS::SummaryInformation doc_summary_info(pStream);
|
||||
OLEPS::PropertySetStream summary_info;
|
||||
|
||||
m_nPresentationCodePage = doc_summary_info.GetCodePage();
|
||||
CFStreamPtr pStream = GetSummaryStream();
|
||||
if (pStream)
|
||||
summary_info.read(pStream);
|
||||
|
||||
pStream = GetDocumentSummaryStream();
|
||||
if (pStream)
|
||||
summary_info.read(pStream, true);
|
||||
|
||||
m_nPresentationCodePage = summary_info.GetCodePage();
|
||||
|
||||
if (m_nPresentationCodePage == 0)
|
||||
m_nPresentationCodePage = 1250;
|
||||
|
||||
m_oDocumentInfo.m_app_xml = summary_info.GetApp();
|
||||
m_oDocumentInfo.m_core_xml = summary_info.GetCore();
|
||||
}
|
||||
|
||||
void CPPTFileReader::ReadPictures()
|
||||
|
||||
@ -50,6 +50,7 @@ protected:
|
||||
CFStreamPtr GetPictureStream();
|
||||
CFStreamPtr GetEncryptedSummaryStream();
|
||||
CFStreamPtr GetDocumentSummaryStream();
|
||||
CFStreamPtr GetSummaryStream();
|
||||
|
||||
CFStreamPtr GetStreamByName(const std::wstring & name);
|
||||
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_APP_FILE_INCLUDE_H_
|
||||
#define PPTX_APP_FILE_INCLUDE_H_
|
||||
|
||||
#include "WrapperFile.h"
|
||||
#include "FileTypes.h"
|
||||
@ -366,5 +364,3 @@ namespace PPTX
|
||||
}
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_APP_FILE_INCLUDE_H_
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_CORE_FILE_INCLUDE_H_
|
||||
#define PPTX_CORE_FILE_INCLUDE_H_
|
||||
|
||||
#include "WrapperFile.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/WritingElement.h"
|
||||
@ -270,5 +268,3 @@ namespace PPTX
|
||||
nullable_string version;
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_CORE_FILE_INCLUDE_H_
|
||||
|
||||
@ -126,31 +126,41 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:backdrop");
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + L"backdrop");
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(L"a:anchor");
|
||||
pWriter->StartNode(sNodeNamespace + L"anchor");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"x", anchorX);
|
||||
pWriter->WriteAttribute(L"y", anchorY);
|
||||
pWriter->WriteAttribute(L"z", anchorZ);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"x", anchorX);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"y", anchorY);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"z", anchorZ);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(L"a:anchor");
|
||||
pWriter->StartNode(L"a:norm");
|
||||
pWriter->EndNode(sNodeNamespace + L"anchor");
|
||||
pWriter->StartNode(sNodeNamespace + L"norm");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"dx", normX);
|
||||
pWriter->WriteAttribute(L"dy", normY);
|
||||
pWriter->WriteAttribute(L"dz", normZ);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dx", normX);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dy", normY);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dz", normZ);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(L"a:norm");
|
||||
pWriter->StartNode(L"a:up");
|
||||
pWriter->EndNode(sNodeNamespace + L"norm");
|
||||
pWriter->StartNode(sNodeNamespace + L"up");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"dx", upX);
|
||||
pWriter->WriteAttribute(L"dy", upY);
|
||||
pWriter->WriteAttribute(L"dz", upZ);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dx", upX);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dy", upY);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dz", upZ);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(L"a:up");
|
||||
pWriter->EndNode(L"a:backdrop");
|
||||
pWriter->EndNode(sNodeNamespace + L"up");
|
||||
pWriter->EndNode(sNodeNamespace + L"backdrop");
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
|
||||
@ -46,7 +46,7 @@ namespace PPTX
|
||||
public:
|
||||
WritingElement_AdditionConstructors(Bevel)
|
||||
|
||||
Bevel(const std::wstring name = L"bevel")
|
||||
Bevel(const std::wstring name = L"a:bevel")
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
@ -82,27 +82,45 @@ namespace PPTX
|
||||
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
std::wstring namespace_ = XmlUtils::GetNamespace(m_name);
|
||||
if (namespace_ == L"w14")
|
||||
{
|
||||
namespace_ + L"w14:";
|
||||
}
|
||||
else namespace_.clear();
|
||||
|
||||
XmlUtils::CAttribute oAttr;
|
||||
oAttr.Write(_T("w"), w);
|
||||
oAttr.Write(_T("h"), h);
|
||||
oAttr.WriteLimitNullable(_T("prst"), prst);
|
||||
oAttr.Write(namespace_ + L"w", w);
|
||||
oAttr.Write(namespace_ + L"h", h);
|
||||
oAttr.WriteLimitNullable(namespace_ + L"prst", prst);
|
||||
|
||||
return XmlUtils::CreateNode(L"a:" + m_name, oAttr);
|
||||
return XmlUtils::CreateNode(m_name, oAttr);
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:" + m_name);
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = _T("w14:");
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = _T("a:");
|
||||
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + m_name);
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"w", w);
|
||||
pWriter->WriteAttribute(L"h", h);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"w", w);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"h", h);
|
||||
if (prst.IsInit())
|
||||
{
|
||||
pWriter->WriteAttribute(L"prst", prst->get());
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"prst", prst->get());
|
||||
}
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(L"a:" + m_name);
|
||||
pWriter->EndNode(sNodeNamespace + m_name);
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
|
||||
@ -105,17 +105,27 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("a:camera"));
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + L"camera");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("prst"), prst.get());
|
||||
pWriter->WriteAttribute(_T("fov"), fov);
|
||||
pWriter->WriteAttribute(_T("zoom"), zoom);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"prst", prst.get());
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"fov", fov);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"zoom", zoom);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->Write(rot);
|
||||
|
||||
pWriter->EndNode(_T("a:camera"));
|
||||
pWriter->EndNode(sNodeNamespace + L"camera");
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_EFFECTSTYLE_INCLUDE_H_
|
||||
#define PPTX_LOGIC_EFFECTSTYLE_INCLUDE_H_
|
||||
|
||||
#include "./../WrapperWritingElement.h"
|
||||
#include "EffectProperties.h"
|
||||
@ -88,4 +86,3 @@ namespace PPTX
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_LOGIC_EFFECTSTYLE_INCLUDE_H_
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_GLOW_INCLUDE_H_
|
||||
#define PPTX_LOGIC_GLOW_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../UniColor.h"
|
||||
@ -101,14 +99,24 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:glow");
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + L"glow");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"rad", rad);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"rad", rad);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
Color.toXmlWriter(pWriter);
|
||||
|
||||
pWriter->EndNode(L"a:glow");
|
||||
pWriter->EndNode(sNodeNamespace + L"glow");
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
@ -173,5 +181,3 @@ namespace PPTX
|
||||
};
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_LOGIC_GLOW_INCLUDE_H_
|
||||
|
||||
@ -71,6 +71,8 @@ namespace PPTX
|
||||
}
|
||||
void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
m_name = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
@ -91,7 +93,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("blurRad"), blurRad)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algnt"), algn)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algn"), algn)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kx"), kx)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ky"), ky)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape)
|
||||
@ -123,8 +125,8 @@ namespace PPTX
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
oAttr.Write(_T("blurRad"), blurRad);
|
||||
oAttr.Write(_T("dir"), dir);
|
||||
oAttr.Write(_T("dist"), dist);
|
||||
oAttr.Write(_T("dir"), dir);
|
||||
oAttr.Write(_T("sx"), sx);
|
||||
oAttr.Write(_T("sy"), sy);
|
||||
oAttr.Write(_T("kx"), kx);
|
||||
@ -139,22 +141,32 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:outerShdw");
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + m_name);
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"blurRad", blurRad);
|
||||
pWriter->WriteAttribute(L"dist", dist);
|
||||
pWriter->WriteAttribute(L"dir", dir);
|
||||
pWriter->WriteAttribute(L"kx", kx);
|
||||
pWriter->WriteAttribute(L"ky", ky);
|
||||
pWriter->WriteAttribute(L"sx", sx);
|
||||
pWriter->WriteAttribute(L"sy", sy);
|
||||
pWriter->WriteAttribute(L"rotWithShape", rotWithShape);
|
||||
pWriter->WriteAttribute(L"algn", algn);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"blurRad", blurRad);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dist", dist);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dir", dir);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"sx", sx);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"sy", sy);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"kx", kx);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"ky", ky);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"algn", algn);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"rotWithShape", rotWithShape);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
Color.toXmlWriter(pWriter);
|
||||
|
||||
pWriter->EndNode(L"a:outerShdw");
|
||||
pWriter->EndNode(sNodeNamespace + m_name);
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
@ -232,6 +244,8 @@ namespace PPTX
|
||||
nullable_bool rotWithShape;
|
||||
nullable_int sx;
|
||||
nullable_int sy;
|
||||
|
||||
std::wstring m_name = L"outerShdw";
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -30,8 +30,6 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_REFLECTION_INCLUDE_H_
|
||||
#define PPTX_LOGIC_REFLECTION_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../../Limit/RectAlign.h"
|
||||
@ -84,7 +82,7 @@ namespace PPTX
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("fadeDir"), fadeDir)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algnt"), algn)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algn"), algn)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kx"), kx)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ky"), ky)
|
||||
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape)
|
||||
@ -140,24 +138,34 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:reflection");
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + L"reflection");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"blurRad", blurRad);
|
||||
pWriter->WriteAttribute(L"dist", dist);
|
||||
pWriter->WriteAttribute(L"dir", dir);
|
||||
pWriter->WriteAttribute(L"kx", kx);
|
||||
pWriter->WriteAttribute(L"ky", ky);
|
||||
pWriter->WriteAttribute(L"sx", sx);
|
||||
pWriter->WriteAttribute(L"sy", sy);
|
||||
pWriter->WriteAttribute(L"rotWithShape", rotWithShape);
|
||||
pWriter->WriteAttribute(L"fadeDir", fadeDir);
|
||||
pWriter->WriteAttribute(L"algn", algn);
|
||||
pWriter->WriteAttribute(L"stA", stA);
|
||||
pWriter->WriteAttribute(L"stPos", stPos);
|
||||
pWriter->WriteAttribute(L"endA", endA);
|
||||
pWriter->WriteAttribute(L"endPos", endPos);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"blurRad", blurRad);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"stA", stA);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"stPos", stPos);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"endA", endA);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"endPos", endPos);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dist", dist);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dir", dir);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"fadeDir", fadeDir);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"sx", sx);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"sy", sy);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"kx", kx);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"ky", ky);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"algn", algn);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"rotWithShape", rotWithShape);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(L"a:reflection");
|
||||
pWriter->EndNode(sNodeNamespace + L"reflection");
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
@ -243,8 +251,8 @@ namespace PPTX
|
||||
endPos.normalize_positive();
|
||||
dist.normalize_positive();
|
||||
|
||||
dir.normalize(0, 2100000);
|
||||
fadeDir.normalize(0, 2100000);
|
||||
dir.normalize(0, 21600000);
|
||||
//fadeDir.normalize(0, 27273042316900);
|
||||
|
||||
kx.normalize(-5400000, 5400000);
|
||||
ky.normalize(-5400000, 5400000);
|
||||
@ -252,5 +260,3 @@ namespace PPTX
|
||||
};
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
#endif // PPTX_LOGIC_REFLECTION_INCLUDE_H_
|
||||
|
||||
@ -101,16 +101,26 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("a:lightRig"));
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + L"lightRig");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("rig"), rig.get());
|
||||
pWriter->WriteAttribute(_T("dir"), dir.get());
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"crig", rig.get());
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"dir", dir.get());
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->Write(rot);
|
||||
|
||||
pWriter->EndNode(_T("a:lightRig"));
|
||||
pWriter->EndNode(sNodeNamespace + L"lightRig");
|
||||
}
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
|
||||
@ -32,6 +32,8 @@
|
||||
|
||||
#include "Pic.h"
|
||||
|
||||
#include "../../../ASCOfficeXlsFile2/source/XlsXlsxConverter/ConvertXls2Xlsx.h"
|
||||
#include "../../../ASCOfficeDocFile/DocFormatLib/DocFormatLib.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinWriter/BinEquationWriter.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinWriter/BinWriters.h"
|
||||
#include "../../../ASCOfficeDocxFile2/BinReader/Readers.h"
|
||||
@ -127,16 +129,60 @@ namespace PPTX
|
||||
void COLEObject::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> ole_file = m_OleObjectFile;
|
||||
|
||||
if(m_oId.IsInit() && ole_file.IsInit() == false)
|
||||
|
||||
if (m_oId.IsInit() && ole_file.IsInit() == false)
|
||||
{
|
||||
OOX::IFileContainer* pRels = pWriter->GetRels().GetPointer();
|
||||
|
||||
ole_file = GetOleObject(m_oId.get(), pRels);
|
||||
}
|
||||
}
|
||||
std::wstring sData;
|
||||
std::wstring sProgID = m_sProgId.get_value_or(L"");
|
||||
|
||||
//test xls ole_file for convert to xlsx
|
||||
|
||||
COfficeFileFormatChecker checker;
|
||||
if (ole_file.IsInit() && (checker.isXlsFormatFile(ole_file->filename().GetPath()) ||
|
||||
checker.isDocFormatFile(ole_file->filename().GetPath())))
|
||||
{
|
||||
std::wstring sTemp = ole_file->filename().GetDirectory();
|
||||
|
||||
std::wstring sResultOoxmlDir = sTemp + FILE_SEPARATOR_STR + _T("ooxml_unpacked");
|
||||
NSDirectory::CreateDirectory(sResultOoxmlDir);
|
||||
|
||||
bool bMacro = true;
|
||||
_UINT32 nRes = 0;
|
||||
std::wstring ooxml_file;
|
||||
|
||||
if (checker.nFileType == AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS)
|
||||
{
|
||||
nRes = ConvertXls2Xlsx(ole_file->filename().GetPath(), sResultOoxmlDir, L"", L"", sTemp, 0, bMacro);
|
||||
|
||||
ooxml_file = ole_file->filename().GetPath() + (bMacro ? L".xlsm" : L".xlsx");
|
||||
}
|
||||
else if (checker.nFileType == AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC)
|
||||
{
|
||||
COfficeDocFile docFile;
|
||||
docFile.m_sTempFolder = ole_file->filename().GetDirectory();
|
||||
|
||||
nRes = docFile.LoadFromFile(ole_file->filename().GetPath(), sResultOoxmlDir, L"", bMacro);
|
||||
|
||||
ooxml_file = ole_file->filename().GetPath() + (bMacro ? L".docm" : L".docx");
|
||||
}
|
||||
if (0 == nRes)
|
||||
{
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sResultOoxmlDir, ooxml_file)) ? nRes : S_FALSE;
|
||||
}
|
||||
NSDirectory::DeleteDirectory(sResultOoxmlDir);
|
||||
|
||||
if (0 == nRes && false == ooxml_file.empty())
|
||||
{
|
||||
ole_file->set_MsPackage(true);
|
||||
ole_file->set_filename(ooxml_file, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (ole_file.IsInit() && 0 == sProgID.find(L"asc."))
|
||||
{
|
||||
sData = GetOleData(ole_file->filename().GetPath());
|
||||
@ -149,7 +195,8 @@ namespace PPTX
|
||||
pWriter->WriteInt2 (3, m_oDyaOrig);
|
||||
pWriter->WriteLimit2(4, m_oDrawAspect);
|
||||
pWriter->WriteLimit2(5, m_oType);
|
||||
pWriter->WriteLimit2(6, m_oUpdateMode);
|
||||
pWriter->WriteLimit2(6, m_oUpdateMode);
|
||||
|
||||
if (ole_file.IsInit() && ole_file->isMsPackage() == false)
|
||||
{
|
||||
std::wstring sExt = ole_file->filename().GetExtention(false);
|
||||
|
||||
@ -79,15 +79,25 @@ namespace PPTX
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(L"a:rot");
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = L"a:";
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + L"rot");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"lat", lat);
|
||||
pWriter->WriteAttribute(L"lon", lon);
|
||||
pWriter->WriteAttribute(L"rev", rev);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"lat", lat);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"lon", lon);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"rev", rev);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(L"a:rot");
|
||||
pWriter->EndNode(sNodeNamespace + L"rot");
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
|
||||
@ -47,7 +47,7 @@ namespace PPTX
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(Scene3d)
|
||||
Scene3d() : m_namespace(L"a") {}
|
||||
Scene3d() {}
|
||||
|
||||
virtual OOX::EElementType getType() const
|
||||
{
|
||||
@ -58,7 +58,7 @@ namespace PPTX
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
|
||||
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
@ -90,7 +90,7 @@ namespace PPTX
|
||||
oValue.WriteNullable(lightRig);
|
||||
oValue.WriteNullable(backdrop);
|
||||
|
||||
return XmlUtils::CreateNode(m_namespace + L":scene3d", oValue);
|
||||
return XmlUtils::CreateNode(L"a:scene3d", oValue);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -147,9 +147,17 @@ namespace PPTX
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
std::wstring name_ = m_namespace + L":scene3d";
|
||||
std::wstring sNodeNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
sNodeNamespace = m_namespace + L":";
|
||||
|
||||
pWriter->StartNode(name_);
|
||||
pWriter->StartNode(sNodeNamespace + L"scene3d");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->EndAttributes();
|
||||
@ -158,14 +166,14 @@ namespace PPTX
|
||||
pWriter->Write(lightRig);
|
||||
pWriter->Write(backdrop);
|
||||
|
||||
pWriter->EndNode(name_);
|
||||
pWriter->EndNode(sNodeNamespace + L"scene3d");
|
||||
}
|
||||
|
||||
nullable<Camera> camera;
|
||||
nullable<LightRig> lightRig;
|
||||
nullable<Backdrop> backdrop;
|
||||
|
||||
std::wstring m_namespace;
|
||||
std::wstring m_namespace = L"a";
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
@ -46,7 +46,7 @@ namespace PPTX
|
||||
public:
|
||||
WritingElement_AdditionConstructors(Sp3d)
|
||||
|
||||
Sp3d() : m_namespace(L"a") {}
|
||||
Sp3d() {}
|
||||
Sp3d& operator=(const Sp3d& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
@ -71,7 +71,7 @@ namespace PPTX
|
||||
}
|
||||
void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
|
||||
m_name = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
@ -135,27 +135,39 @@ namespace PPTX
|
||||
}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Start_No_NS(oReader)
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, _T("contourW"), contourW)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("extrusionH"), extrusionH)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("prstMaterial"), prstMaterial)
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("z"), z)
|
||||
WritingElement_ReadAttributes_Read_else_if (oReader, _T("macro"), macro)
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
WritingElement_ReadAttributes_End_No_NS(oReader)
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
std::wstring name_ = m_namespace + L":sp3d";
|
||||
std::wstring sNodeNamespace, sNodeChildNamespace;
|
||||
std::wstring sAttrNamespace;
|
||||
if (XMLWRITER_DOC_TYPE_WORDART == pWriter->m_lDocType)
|
||||
{
|
||||
sNodeNamespace = L"w14:";
|
||||
sNodeChildNamespace = sAttrNamespace = sNodeNamespace;
|
||||
}
|
||||
else
|
||||
{
|
||||
sNodeNamespace = m_namespace + L":";
|
||||
sNodeChildNamespace = L"a:";
|
||||
}
|
||||
|
||||
pWriter->StartNode(name_);
|
||||
|
||||
pWriter->StartNode(sNodeNamespace + m_name);
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("macro"), macro);
|
||||
pWriter->WriteAttribute(_T("contourW"), contourW);
|
||||
pWriter->WriteAttribute(_T("extrusionH"), extrusionH);
|
||||
pWriter->WriteAttribute(_T("prstMaterial"), prstMaterial);
|
||||
pWriter->WriteAttribute(_T("z"), z);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"macro", macro);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"contourW", contourW);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"extrusionH", extrusionH);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"prstMaterial", prstMaterial);
|
||||
pWriter->WriteAttribute(sAttrNamespace + L"z", z);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->Write(bevelT);
|
||||
@ -163,20 +175,20 @@ namespace PPTX
|
||||
|
||||
if (extrusionClr.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("a:extrusionClr"));
|
||||
pWriter->StartNode(sNodeChildNamespace + L"extrusionClr");
|
||||
pWriter->EndAttributes();
|
||||
extrusionClr.toXmlWriter(pWriter);
|
||||
pWriter->EndNode(_T("a:extrusionClr"));
|
||||
pWriter->EndNode(sNodeChildNamespace + L"extrusionClr");
|
||||
}
|
||||
if (contourClr.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("a:contourClr"));
|
||||
pWriter->StartNode(sNodeChildNamespace + L"contourClr");
|
||||
pWriter->EndAttributes();
|
||||
contourClr.toXmlWriter(pWriter);
|
||||
pWriter->EndNode(_T("a:contourClr"));
|
||||
pWriter->EndNode(sNodeChildNamespace + L"contourClr");
|
||||
}
|
||||
|
||||
pWriter->EndNode(name_);
|
||||
pWriter->EndNode(sNodeNamespace + m_name);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
@ -270,7 +282,8 @@ namespace PPTX
|
||||
UniColor extrusionClr;
|
||||
UniColor contourClr;
|
||||
|
||||
std::wstring m_namespace;
|
||||
std::wstring m_name = L"sp3d";
|
||||
std::wstring m_namespace = L"a";
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
|
||||
436
ASCOfficePPTXFile/PPTXFormat/Presentation.cpp
Normal file
436
ASCOfficePPTXFile/PPTXFormat/Presentation.cpp
Normal file
@ -0,0 +1,436 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* 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 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* 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 "Presentation.h"
|
||||
#include "FileContainer.h"
|
||||
#include "FileTypes.h"
|
||||
|
||||
#include "Presentation/EmbeddedFont.h"
|
||||
#include "Presentation/Kinsoku.h"
|
||||
#include "Presentation/NotesSz.h"
|
||||
#include "Presentation/PhotoAlbum.h"
|
||||
#include "Presentation/SldSz.h"
|
||||
#include "CommentAuthors.h"
|
||||
|
||||
#include "Limit/Conformance.h"
|
||||
#include "Logic/TextListStyle.h"
|
||||
#include "Logic/ClrMap.h"
|
||||
#include "Logic/ExtP.h"
|
||||
#include "Theme/ClrScheme.h"
|
||||
#include "Comments.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
|
||||
#include "../../ASCOfficeXlsFile2/source/VbaFormat/VbaReader.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
Presentation::Presentation(OOX::Document *pMain) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
}
|
||||
Presentation::Presentation(OOX::Document *pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
read(filename, map);
|
||||
}
|
||||
Presentation::~Presentation()
|
||||
{
|
||||
}
|
||||
void Presentation::read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNode.FromXmlFile(filename.m_strFilename);
|
||||
|
||||
XmlMacroReadAttributeBase(oNode, L"autoCompressPictures", attrAutoCompressPictures);
|
||||
XmlMacroReadAttributeBase(oNode, L"bookmarkIdSeed", attrBookmarkIdSeed);
|
||||
XmlMacroReadAttributeBase(oNode, L"compatMode", attrCompatMode);
|
||||
XmlMacroReadAttributeBase(oNode, L"conformance", attrConformance);
|
||||
XmlMacroReadAttributeBase(oNode, L"embedTrueTypeFonts", attrEmbedTrueTypeFonts);
|
||||
XmlMacroReadAttributeBase(oNode, L"firstSlideNum", attrFirstSlideNum);
|
||||
XmlMacroReadAttributeBase(oNode, L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave);
|
||||
XmlMacroReadAttributeBase(oNode, L"rtl", attrRtl);
|
||||
XmlMacroReadAttributeBase(oNode, L"saveSubsetFonts", attrSaveSubsetFonts);
|
||||
XmlMacroReadAttributeBase(oNode, L"serverZoom", attrServerZoom);
|
||||
XmlMacroReadAttributeBase(oNode, L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld);
|
||||
XmlMacroReadAttributeBase(oNode, L"strictFirstAndLastChars", attrStrictFirstAndLastChars);
|
||||
|
||||
//custDataLst (Customer Data List)
|
||||
//custShowLst (List of Custom Shows)
|
||||
defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle"));
|
||||
if (defaultTextStyle.is_init())
|
||||
defaultTextStyle->SetParentFilePointer(this);
|
||||
|
||||
embeddedFontLst.clear();
|
||||
XmlUtils::CXmlNode oNodeEmbeddedFonts;
|
||||
if (oNode.GetNode(_T("p:embeddedFontLst"), oNodeEmbeddedFonts))
|
||||
{
|
||||
XmlMacroLoadArray(oNodeEmbeddedFonts, _T("p:embeddedFont"), embeddedFontLst, nsPresentation::EmbeddedFont);
|
||||
|
||||
for (size_t i = 0; i < embeddedFontLst.size(); ++i)
|
||||
embeddedFontLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
handoutMasterIdLst.clear();
|
||||
XmlUtils::CXmlNode oNodeHMList;
|
||||
if (oNode.GetNode(_T("p:handoutMasterIdLst"), oNodeHMList))
|
||||
{
|
||||
XmlMacroLoadArray(oNodeHMList, _T("p:handoutMasterId"), handoutMasterIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < handoutMasterIdLst.size(); ++i)
|
||||
handoutMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
|
||||
kinsoku = oNode.ReadNode(_T("p:kinsoku"));
|
||||
if (kinsoku.is_init())
|
||||
kinsoku->SetParentFilePointer(this);
|
||||
|
||||
//modifyVerifier (Modification Verifier)
|
||||
notesMasterIdLst.clear();
|
||||
XmlUtils::CXmlNode oNodeMIDList;
|
||||
if (oNode.GetNode(_T("p:notesMasterIdLst"), oNodeMIDList))
|
||||
{
|
||||
XmlMacroLoadArray(oNodeMIDList, _T("p:notesMasterId"), notesMasterIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < notesMasterIdLst.size(); ++i)
|
||||
notesMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
notesSz = oNode.ReadNode(_T("p:notesSz"));
|
||||
if (notesSz.is_init())
|
||||
notesSz->SetParentFilePointer(this);
|
||||
|
||||
photoAlbum = oNode.ReadNode(_T("p:photoAlbum"));
|
||||
if (photoAlbum.is_init())
|
||||
photoAlbum->SetParentFilePointer(this);
|
||||
|
||||
sldIdLst.clear();
|
||||
XmlUtils::CXmlNode oNode_sldId;
|
||||
if (oNode.GetNode(_T("p:sldIdLst"), oNode_sldId))
|
||||
{
|
||||
XmlMacroLoadArray(oNode_sldId, _T("p:sldId"), sldIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < sldIdLst.size(); ++i)
|
||||
sldIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
sldMasterIdLst.clear();
|
||||
XmlUtils::CXmlNode oNode_sldM_Id;
|
||||
if (oNode.GetNode(_T("p:sldMasterIdLst"), oNode_sldM_Id))
|
||||
{
|
||||
XmlMacroLoadArray(oNode_sldM_Id, _T("p:sldMasterId"), sldMasterIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < sldMasterIdLst.size(); ++i)
|
||||
sldMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
sldSz = oNode.ReadNode(_T("p:sldSz"));
|
||||
if (sldSz.is_init())
|
||||
sldSz->SetParentFilePointer(this);
|
||||
|
||||
XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst"));
|
||||
if (list.IsValid())
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (list.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
PPTX::Logic::Ext ext;
|
||||
ext.fromXML(oNode);
|
||||
if (ext.sectionLst.IsInit())
|
||||
{
|
||||
sectionLst = ext.sectionLst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//smartTags (Smart Tags)
|
||||
Normalize();
|
||||
}
|
||||
void Presentation::write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
|
||||
{
|
||||
WrapperFile::write(filename, directory, content);
|
||||
FileContainer::write(filename, directory, content);
|
||||
}
|
||||
|
||||
void Presentation::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(NSBinPptxRW::NSMainTables::Presentation);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
pWriter->WriteBool2(0, attrAutoCompressPictures);
|
||||
pWriter->WriteInt2(1, attrBookmarkIdSeed);
|
||||
pWriter->WriteBool2(2, attrCompatMode);
|
||||
pWriter->WriteLimit2(3, attrConformance);
|
||||
pWriter->WriteBool2(4, attrEmbedTrueTypeFonts);
|
||||
pWriter->WriteInt2(5, attrFirstSlideNum);
|
||||
pWriter->WriteBool2(6, attrRemovePersonalInfoOnSave);
|
||||
pWriter->WriteBool2(7, attrRtl);
|
||||
pWriter->WriteBool2(8, attrSaveSubsetFonts);
|
||||
pWriter->WriteString2(9, attrServerZoom);
|
||||
pWriter->WriteBool2(10, attrShowSpecialPlsOnTitleSld);
|
||||
pWriter->WriteBool2(11, attrStrictFirstAndLastChars);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord2(0, defaultTextStyle);
|
||||
pWriter->WriteRecordArray(1, 0, embeddedFontLst);
|
||||
pWriter->WriteRecord2(2, kinsoku);
|
||||
pWriter->WriteRecord2(3, notesSz);
|
||||
pWriter->WriteRecord2(4, photoAlbum);
|
||||
pWriter->WriteRecord2(5, sldSz);
|
||||
|
||||
pWriter->WriteRecord2(6, commentAuthors);
|
||||
pWriter->WriteRecord2(7, sectionLst);
|
||||
|
||||
if (m_pVbaProject.IsInit())
|
||||
{
|
||||
pWriter->StartRecord(8);
|
||||
{
|
||||
m_pVbaProject->toPPTY(pWriter);
|
||||
}
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
pWriter->WriteRecord2(9, m_pJsaProject);
|
||||
pWriter->WriteRecord2(10, comments);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
void Presentation::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
BYTE _type = pReader->GetUChar();
|
||||
LONG _len = pReader->GetULong();
|
||||
LONG _start_pos = pReader->GetPos();
|
||||
LONG _end_pos = _len + _start_pos;
|
||||
|
||||
// attributes
|
||||
BYTE _sa = pReader->GetUChar();
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0: { attrAutoCompressPictures = pReader->GetBool(); break; }
|
||||
case 1: { attrBookmarkIdSeed = pReader->GetLong(); break; }
|
||||
case 2: { attrCompatMode = pReader->GetBool(); break; }
|
||||
case 3: { attrConformance = pReader->GetUChar(); break; }
|
||||
case 4: { attrEmbedTrueTypeFonts = pReader->GetBool(); break; }
|
||||
case 5: { attrFirstSlideNum = pReader->GetLong(); break; }
|
||||
case 6: { attrRemovePersonalInfoOnSave = pReader->GetBool(); break; }
|
||||
case 7: { attrRtl = pReader->GetBool(); break; }
|
||||
case 8: { attrSaveSubsetFonts = pReader->GetBool(); break; }
|
||||
case 9: { attrServerZoom = pReader->GetString2(); break; }
|
||||
case 10: { attrShowSpecialPlsOnTitleSld = pReader->GetBool(); break; }
|
||||
case 11: { attrStrictFirstAndLastChars = pReader->GetBool(); break; }
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (pReader->GetPos() < _end_pos)
|
||||
{
|
||||
_type = pReader->GetUChar();
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
defaultTextStyle = PPTX::Logic::TextListStyle();
|
||||
defaultTextStyle->m_name = _T("p:defaultTextStyle");
|
||||
defaultTextStyle->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
case 1: { pReader->SkipRecord(); break; }
|
||||
case 2: { pReader->SkipRecord(); break; }
|
||||
case 3:
|
||||
{
|
||||
notesSz = new nsPresentation::NotesSz();
|
||||
pReader->Skip(5); // len + start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0: { notesSz->cx = pReader->GetLong(); break; }
|
||||
case 1: { notesSz->cy = pReader->GetLong(); break; }
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: { pReader->SkipRecord(); break; }
|
||||
case 5:
|
||||
{
|
||||
sldSz = new nsPresentation::SldSz();
|
||||
pReader->Skip(5); // len + start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0: { sldSz->cx = pReader->GetLong(); break; }
|
||||
case 1: { sldSz->cy = pReader->GetLong(); break; }
|
||||
case 2: { sldSz->type = pReader->GetUChar(); break; }
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
commentAuthors = new PPTX::Authors(File::m_pMainDocument);
|
||||
commentAuthors->fromPPTY(pReader);
|
||||
}break;
|
||||
case 7:
|
||||
{
|
||||
sectionLst = new nsPresentation::SectionLst();
|
||||
sectionLst->fromPPTY(pReader);
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
if (m_bMacroEnabled)
|
||||
{
|
||||
m_pVbaProject = new OOX::VbaProject(File::m_pMainDocument);
|
||||
m_pVbaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pVbaProject.smart_dynamic_cast<OOX::File>();
|
||||
FileContainer::Add(file);
|
||||
}
|
||||
else
|
||||
pReader->SkipRecord();
|
||||
}break;
|
||||
case 9:
|
||||
{
|
||||
m_pJsaProject = new OOX::JsaProject(File::m_pMainDocument);
|
||||
m_pJsaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pJsaProject.smart_dynamic_cast<OOX::File>();
|
||||
FileContainer::Add(file);
|
||||
}break;
|
||||
case 10:
|
||||
{
|
||||
comments = new PPTX::Comments(OOX::File::m_pMainDocument);
|
||||
comments->fromPPTY(pReader);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_end_pos);
|
||||
}
|
||||
|
||||
void Presentation::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("p:presentation"));
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:m"), PPTX::g_Namespaces.m.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:w"), PPTX::g_Namespaces.w.m_strLink);
|
||||
|
||||
pWriter->WriteAttribute(_T("autoCompressPictures"), attrAutoCompressPictures);
|
||||
pWriter->WriteAttribute(_T("bookmarkIdSeed"), attrBookmarkIdSeed);
|
||||
pWriter->WriteAttribute(_T("compatMode"), attrCompatMode);
|
||||
pWriter->WriteAttribute(_T("conformance"), attrConformance);
|
||||
pWriter->WriteAttribute(_T("embedTrueTypeFonts"), attrEmbedTrueTypeFonts);
|
||||
pWriter->WriteAttribute(_T("firstSlideNum"), attrFirstSlideNum);
|
||||
pWriter->WriteAttribute(_T("removePersonalInfoOnSave"), attrRemovePersonalInfoOnSave);
|
||||
pWriter->WriteAttribute(_T("rtl"), attrRtl);
|
||||
pWriter->WriteAttribute(_T("saveSubsetFonts"), attrSaveSubsetFonts);
|
||||
pWriter->WriteAttribute(_T("serverZoom"), attrServerZoom);
|
||||
pWriter->WriteAttribute(_T("showSpecialPlsOnTitleSld"), attrShowSpecialPlsOnTitleSld);
|
||||
pWriter->WriteAttribute(_T("strictFirstAndLastChars"), attrStrictFirstAndLastChars);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->WriteArray(L"p:sldMasterIdLst", sldMasterIdLst);
|
||||
pWriter->WriteArray(L"p:notesMasterIdLst", notesMasterIdLst);
|
||||
pWriter->WriteArray(L"p:handoutMasterIdLst", handoutMasterIdLst);
|
||||
pWriter->WriteArray(L"p:embeddedFontLst", embeddedFontLst);
|
||||
pWriter->WriteArray(L"p:sldIdLst", sldIdLst);
|
||||
|
||||
pWriter->Write(sldSz);
|
||||
pWriter->Write(notesSz);
|
||||
pWriter->Write(photoAlbum);
|
||||
pWriter->Write(kinsoku);
|
||||
pWriter->Write(defaultTextStyle);
|
||||
|
||||
std::vector<Logic::Ext> extLst;
|
||||
|
||||
if (sectionLst.IsInit())
|
||||
{
|
||||
Logic::Ext exp;
|
||||
exp.sectionLst = sectionLst;
|
||||
extLst.push_back(exp);
|
||||
}
|
||||
pWriter->WriteArray(L"p:extLst", extLst);
|
||||
|
||||
pWriter->EndNode(L"p:presentation");
|
||||
}
|
||||
|
||||
AVSINLINE void Presentation::Normalize()
|
||||
{
|
||||
attrBookmarkIdSeed.normalize(1, 2147483647);
|
||||
attrFirstSlideNum.normalize_positive();
|
||||
}
|
||||
} // namespace PPTX
|
||||
@ -52,384 +52,22 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
|
||||
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
class Presentation : public WrapperFile, public PPTX::FileContainer
|
||||
{
|
||||
public:
|
||||
Presentation(OOX::Document *pMain) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
}
|
||||
Presentation(OOX::Document *pMain, const OOX::CPath& filename, FileMap& map) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
m_bMacroEnabled = false;
|
||||
read(filename, map);
|
||||
}
|
||||
virtual ~Presentation()
|
||||
{
|
||||
}
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNode.FromXmlFile(filename.m_strFilename);
|
||||
Presentation(OOX::Document *pMain);
|
||||
Presentation(OOX::Document *pMain, const OOX::CPath& filename, FileMap& map);
|
||||
virtual ~Presentation();
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map);
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const;
|
||||
|
||||
XmlMacroReadAttributeBase(oNode, L"autoCompressPictures", attrAutoCompressPictures);
|
||||
XmlMacroReadAttributeBase(oNode, L"bookmarkIdSeed", attrBookmarkIdSeed);
|
||||
XmlMacroReadAttributeBase(oNode, L"compatMode", attrCompatMode);
|
||||
XmlMacroReadAttributeBase(oNode, L"conformance", attrConformance);
|
||||
XmlMacroReadAttributeBase(oNode, L"embedTrueTypeFonts", attrEmbedTrueTypeFonts);
|
||||
XmlMacroReadAttributeBase(oNode, L"firstSlideNum", attrFirstSlideNum);
|
||||
XmlMacroReadAttributeBase(oNode, L"removePersonalInfoOnSave", attrRemovePersonalInfoOnSave);
|
||||
XmlMacroReadAttributeBase(oNode, L"rtl", attrRtl);
|
||||
XmlMacroReadAttributeBase(oNode, L"saveSubsetFonts", attrSaveSubsetFonts);
|
||||
XmlMacroReadAttributeBase(oNode, L"serverZoom", attrServerZoom);
|
||||
XmlMacroReadAttributeBase(oNode, L"showSpecialPlsOnTitleSld", attrShowSpecialPlsOnTitleSld);
|
||||
XmlMacroReadAttributeBase(oNode, L"strictFirstAndLastChars", attrStrictFirstAndLastChars);
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
|
||||
|
||||
//custDataLst (Customer Data List)
|
||||
//custShowLst (List of Custom Shows)
|
||||
defaultTextStyle = oNode.ReadNode(_T("p:defaultTextStyle"));
|
||||
if(defaultTextStyle.is_init())
|
||||
defaultTextStyle->SetParentFilePointer(this);
|
||||
|
||||
embeddedFontLst.clear();
|
||||
XmlUtils::CXmlNode oNodeEmbeddedFonts;
|
||||
if (oNode.GetNode(_T("p:embeddedFontLst"), oNodeEmbeddedFonts))
|
||||
{
|
||||
XmlMacroLoadArray(oNodeEmbeddedFonts, _T("p:embeddedFont"), embeddedFontLst, nsPresentation::EmbeddedFont);
|
||||
|
||||
for (size_t i = 0; i < embeddedFontLst.size(); ++i)
|
||||
embeddedFontLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
handoutMasterIdLst.clear();
|
||||
XmlUtils::CXmlNode oNodeHMList;
|
||||
if (oNode.GetNode(_T("p:handoutMasterIdLst"), oNodeHMList))
|
||||
{
|
||||
XmlMacroLoadArray(oNodeHMList, _T("p:handoutMasterId"), handoutMasterIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < handoutMasterIdLst.size(); ++i)
|
||||
handoutMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
|
||||
kinsoku = oNode.ReadNode(_T("p:kinsoku"));
|
||||
if (kinsoku.is_init())
|
||||
kinsoku->SetParentFilePointer(this);
|
||||
|
||||
//modifyVerifier (Modification Verifier)
|
||||
notesMasterIdLst.clear();
|
||||
XmlUtils::CXmlNode oNodeMIDList;
|
||||
if (oNode.GetNode(_T("p:notesMasterIdLst"), oNodeMIDList))
|
||||
{
|
||||
XmlMacroLoadArray(oNodeMIDList, _T("p:notesMasterId"), notesMasterIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < notesMasterIdLst.size(); ++i)
|
||||
notesMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
notesSz = oNode.ReadNode(_T("p:notesSz"));
|
||||
if (notesSz.is_init())
|
||||
notesSz->SetParentFilePointer(this);
|
||||
|
||||
photoAlbum = oNode.ReadNode(_T("p:photoAlbum"));
|
||||
if(photoAlbum.is_init())
|
||||
photoAlbum->SetParentFilePointer(this);
|
||||
|
||||
sldIdLst.clear();
|
||||
XmlUtils::CXmlNode oNode_sldId;
|
||||
if (oNode.GetNode(_T("p:sldIdLst"), oNode_sldId))
|
||||
{
|
||||
XmlMacroLoadArray(oNode_sldId, _T("p:sldId"), sldIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < sldIdLst.size(); ++i)
|
||||
sldIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
sldMasterIdLst.clear();
|
||||
XmlUtils::CXmlNode oNode_sldM_Id;
|
||||
if (oNode.GetNode(_T("p:sldMasterIdLst"), oNode_sldM_Id))
|
||||
{
|
||||
XmlMacroLoadArray(oNode_sldM_Id, _T("p:sldMasterId"), sldMasterIdLst, Logic::XmlId);
|
||||
|
||||
for (size_t i = 0; i < sldMasterIdLst.size(); ++i)
|
||||
sldMasterIdLst[i].SetParentFilePointer(this);
|
||||
}
|
||||
|
||||
sldSz = oNode.ReadNode(_T("p:sldSz"));
|
||||
if (sldSz.is_init())
|
||||
sldSz->SetParentFilePointer(this);
|
||||
|
||||
XmlUtils::CXmlNode list = oNode.ReadNodeNoNS(_T("extLst"));
|
||||
if (list.IsValid())
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (list.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
PPTX::Logic::Ext ext;
|
||||
ext.fromXML(oNode);
|
||||
if (ext.sectionLst.IsInit())
|
||||
{
|
||||
sectionLst = ext.sectionLst;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//smartTags (Smart Tags)
|
||||
Normalize();
|
||||
}
|
||||
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
|
||||
{
|
||||
WrapperFile::write(filename, directory, content);
|
||||
FileContainer::write(filename, directory, content);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(NSBinPptxRW::NSMainTables::Presentation);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
|
||||
pWriter->WriteBool2(0, attrAutoCompressPictures);
|
||||
pWriter->WriteInt2(1, attrBookmarkIdSeed);
|
||||
pWriter->WriteBool2(2, attrCompatMode);
|
||||
pWriter->WriteLimit2(3, attrConformance);
|
||||
pWriter->WriteBool2(4, attrEmbedTrueTypeFonts);
|
||||
pWriter->WriteInt2(5, attrFirstSlideNum);
|
||||
pWriter->WriteBool2(6, attrRemovePersonalInfoOnSave);
|
||||
pWriter->WriteBool2(7, attrRtl);
|
||||
pWriter->WriteBool2(8, attrSaveSubsetFonts);
|
||||
pWriter->WriteString2(9, attrServerZoom);
|
||||
pWriter->WriteBool2(10, attrShowSpecialPlsOnTitleSld);
|
||||
pWriter->WriteBool2(11, attrStrictFirstAndLastChars);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord2(0, defaultTextStyle);
|
||||
pWriter->WriteRecordArray(1, 0, embeddedFontLst);
|
||||
pWriter->WriteRecord2(2, kinsoku);
|
||||
pWriter->WriteRecord2(3, notesSz);
|
||||
pWriter->WriteRecord2(4, photoAlbum);
|
||||
pWriter->WriteRecord2(5, sldSz);
|
||||
|
||||
pWriter->WriteRecord2(6, commentAuthors);
|
||||
pWriter->WriteRecord2(7, sectionLst);
|
||||
|
||||
if (m_pVbaProject.IsInit())
|
||||
{
|
||||
pWriter->StartRecord(8);
|
||||
{
|
||||
m_pVbaProject->toPPTY(pWriter);
|
||||
}
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
pWriter->WriteRecord2(9, m_pJsaProject);
|
||||
pWriter->WriteRecord2(10, comments);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
BYTE _type = pReader->GetUChar();
|
||||
LONG _len = pReader->GetULong();
|
||||
LONG _start_pos = pReader->GetPos();
|
||||
LONG _end_pos = _len + _start_pos;
|
||||
|
||||
// attributes
|
||||
BYTE _sa = pReader->GetUChar();
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0: { attrAutoCompressPictures = pReader->GetBool(); break; }
|
||||
case 1: { attrBookmarkIdSeed = pReader->GetLong(); break; }
|
||||
case 2: { attrCompatMode = pReader->GetBool(); break; }
|
||||
case 3: { attrConformance = pReader->GetUChar(); break; }
|
||||
case 4: { attrEmbedTrueTypeFonts = pReader->GetBool(); break; }
|
||||
case 5: { attrFirstSlideNum = pReader->GetLong(); break; }
|
||||
case 6: { attrRemovePersonalInfoOnSave = pReader->GetBool(); break; }
|
||||
case 7: { attrRtl = pReader->GetBool(); break; }
|
||||
case 8: { attrSaveSubsetFonts = pReader->GetBool(); break; }
|
||||
case 9: { attrServerZoom = pReader->GetString2(); break; }
|
||||
case 10: { attrShowSpecialPlsOnTitleSld = pReader->GetBool(); break; }
|
||||
case 11: { attrStrictFirstAndLastChars = pReader->GetBool(); break; }
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (pReader->GetPos() < _end_pos)
|
||||
{
|
||||
_type = pReader->GetUChar();
|
||||
|
||||
switch (_type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
defaultTextStyle = PPTX::Logic::TextListStyle();
|
||||
defaultTextStyle->m_name = _T("p:defaultTextStyle");
|
||||
defaultTextStyle->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
case 1: { pReader->SkipRecord(); break; }
|
||||
case 2: { pReader->SkipRecord(); break; }
|
||||
case 3:
|
||||
{
|
||||
notesSz = new nsPresentation::NotesSz();
|
||||
pReader->Skip(5); // len + start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0: { notesSz->cx = pReader->GetLong(); break; }
|
||||
case 1: { notesSz->cy = pReader->GetLong(); break; }
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: { pReader->SkipRecord(); break; }
|
||||
case 5:
|
||||
{
|
||||
sldSz = new nsPresentation::SldSz();
|
||||
pReader->Skip(5); // len + start attributes
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar_TypeNode();
|
||||
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0: { sldSz->cx = pReader->GetLong(); break; }
|
||||
case 1: { sldSz->cy = pReader->GetLong(); break; }
|
||||
case 2: { sldSz->type = pReader->GetUChar(); break; }
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case 6:
|
||||
{
|
||||
commentAuthors = new PPTX::Authors(File::m_pMainDocument);
|
||||
commentAuthors->fromPPTY(pReader);
|
||||
}break;
|
||||
case 7:
|
||||
{
|
||||
sectionLst = new nsPresentation::SectionLst();
|
||||
sectionLst->fromPPTY(pReader);
|
||||
}break;
|
||||
case 8:
|
||||
{
|
||||
if (m_bMacroEnabled)
|
||||
{
|
||||
m_pVbaProject = new OOX::VbaProject(File::m_pMainDocument);
|
||||
m_pVbaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pVbaProject.smart_dynamic_cast<OOX::File>();
|
||||
FileContainer::Add(file);
|
||||
}
|
||||
else
|
||||
pReader->SkipRecord();
|
||||
}break;
|
||||
case 9:
|
||||
{
|
||||
m_pJsaProject = new OOX::JsaProject(File::m_pMainDocument);
|
||||
m_pJsaProject->fromPPTY(pReader);
|
||||
|
||||
smart_ptr<OOX::File> file = m_pJsaProject.smart_dynamic_cast<OOX::File>();
|
||||
FileContainer::Add(file);
|
||||
}break;
|
||||
case 10:
|
||||
{
|
||||
comments = new PPTX::Comments(OOX::File::m_pMainDocument);
|
||||
comments->fromPPTY(pReader);
|
||||
}break;
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_end_pos);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("p:presentation"));
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
pWriter->WriteAttribute(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:p"), PPTX::g_Namespaces.p.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:m"), PPTX::g_Namespaces.m.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:w"), PPTX::g_Namespaces.w.m_strLink);
|
||||
|
||||
pWriter->WriteAttribute(_T("autoCompressPictures"), attrAutoCompressPictures);
|
||||
pWriter->WriteAttribute(_T("bookmarkIdSeed"), attrBookmarkIdSeed);
|
||||
pWriter->WriteAttribute(_T("compatMode"), attrCompatMode);
|
||||
pWriter->WriteAttribute(_T("conformance"), attrConformance);
|
||||
pWriter->WriteAttribute(_T("embedTrueTypeFonts"), attrEmbedTrueTypeFonts);
|
||||
pWriter->WriteAttribute(_T("firstSlideNum"), attrFirstSlideNum);
|
||||
pWriter->WriteAttribute(_T("removePersonalInfoOnSave"), attrRemovePersonalInfoOnSave);
|
||||
pWriter->WriteAttribute(_T("rtl"), attrRtl);
|
||||
pWriter->WriteAttribute(_T("saveSubsetFonts"), attrSaveSubsetFonts);
|
||||
pWriter->WriteAttribute(_T("serverZoom"), attrServerZoom);
|
||||
pWriter->WriteAttribute(_T("showSpecialPlsOnTitleSld"), attrShowSpecialPlsOnTitleSld);
|
||||
pWriter->WriteAttribute(_T("strictFirstAndLastChars"), attrStrictFirstAndLastChars);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->WriteArray(L"p:sldMasterIdLst", sldMasterIdLst);
|
||||
pWriter->WriteArray(L"p:notesMasterIdLst", notesMasterIdLst);
|
||||
pWriter->WriteArray(L"p:handoutMasterIdLst", handoutMasterIdLst);
|
||||
pWriter->WriteArray(L"p:embeddedFontLst", embeddedFontLst);
|
||||
pWriter->WriteArray(L"p:sldIdLst", sldIdLst);
|
||||
|
||||
pWriter->Write(sldSz);
|
||||
pWriter->Write(notesSz);
|
||||
pWriter->Write(photoAlbum);
|
||||
pWriter->Write(kinsoku);
|
||||
pWriter->Write(defaultTextStyle);
|
||||
|
||||
std::vector<Logic::Ext> extLst;
|
||||
|
||||
if (sectionLst.IsInit())
|
||||
{
|
||||
Logic::Ext exp;
|
||||
exp.sectionLst = sectionLst;
|
||||
extLst.push_back(exp);
|
||||
}
|
||||
pWriter->WriteArray(L"p:extLst", extLst);
|
||||
|
||||
pWriter->EndNode(L"p:presentation");
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
|
||||
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
@ -508,10 +146,6 @@ namespace PPTX
|
||||
}
|
||||
|
||||
private:
|
||||
AVSINLINE void Normalize()
|
||||
{
|
||||
attrBookmarkIdSeed.normalize(1, 2147483647);
|
||||
attrFirstSlideNum.normalize_positive();
|
||||
}
|
||||
AVSINLINE void Normalize();
|
||||
};
|
||||
} // namespace PPTX
|
||||
|
||||
@ -48,7 +48,7 @@ SOURCES += \
|
||||
../../../PPTXFormat/Logic/Colors/SchemeClr.cpp \
|
||||
../../../PPTXFormat/Logic/Fills/Blip.cpp \
|
||||
../../../PPTXFormat/Logic/Fills/BlipFill.cpp \
|
||||
../../../PPTXFormat/Logic/Table/TableCell.cpp \
|
||||
../../../PPTXFormat/Logic/Table/TableCell.cpp \
|
||||
../../../PPTXFormat/Logic/Timing/BuildNodeBase.cpp \
|
||||
../../../PPTXFormat/Logic/Timing/TimeNodeBase.cpp \
|
||||
../../../PPTXFormat/Logic/Transitions/TransitionBase.cpp \
|
||||
@ -62,7 +62,7 @@ SOURCES += \
|
||||
../../../PPTXFormat/Logic/EffectStyle.cpp \
|
||||
../../../PPTXFormat/Logic/Geometry.cpp \
|
||||
../../../PPTXFormat/Logic/GraphicFrame.cpp \
|
||||
../../../PPTXFormat/Logic/HeadingVariant.cpp \
|
||||
../../../PPTXFormat/Logic/HeadingVariant.cpp \
|
||||
../../../PPTXFormat/Logic/GrpSpPr.cpp \
|
||||
../../../PPTXFormat/Logic/Hyperlink.cpp \
|
||||
../../../PPTXFormat/Logic/NvGraphicFramePr.cpp \
|
||||
@ -79,6 +79,7 @@ SOURCES += \
|
||||
../../../PPTXFormat/Logic/UniEffect.cpp \
|
||||
../../../PPTXFormat/Logic/Runs/MathParaWrapper.cpp \
|
||||
../../../PPTXFormat/Logic/Controls.cpp \
|
||||
../../../PPTXFormat/Presentation.cpp \
|
||||
../../../PPTXFormat/FileContainer.cpp \
|
||||
../../../PPTXFormat/FileFactory.cpp \
|
||||
../../../PPTXFormat/FileMap.cpp \
|
||||
|
||||
@ -68,3 +68,4 @@
|
||||
#include "../../../PPTXFormat/FileFactory.cpp"
|
||||
#include "../../../PPTXFormat/FileMap.cpp"
|
||||
#include "../../../PPTXFormat/Folder.cpp"
|
||||
#include "../../../PPTXFormat/Presentation.cpp"
|
||||
|
||||
@ -339,6 +339,7 @@
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">./StdAfx.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PPTXFormat\Logic\UniFill.cpp" />
|
||||
<ClCompile Include="..\PPTXFormat\Presentation.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\Common\DocxFormat\Source\DocxFormat\Namespaces.h" />
|
||||
|
||||
@ -275,6 +275,9 @@
|
||||
<ClCompile Include="..\PPTXFormat\Logic\HeadingVariant.cpp">
|
||||
<Filter>PPTX\Logic</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\PPTXFormat\Presentation.cpp">
|
||||
<Filter>PPTX\Presentation</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Editor\BinaryFileReaderWriter.h">
|
||||
|
||||
@ -49,30 +49,28 @@ public:
|
||||
|
||||
if(m_ooxApp->m_nTotalTime.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nEndingTime = m_ooxApp->m_nTotalTime.get2();
|
||||
oParam.oRtf->m_oInformation.m_nEndingTime = m_ooxApp->m_nTotalTime.get();
|
||||
}
|
||||
if(m_ooxApp->m_nPages.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfPages = m_ooxApp->m_nPages.get2();
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfPages = m_ooxApp->m_nPages.get();
|
||||
}
|
||||
if(m_ooxApp->m_nWords.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfWords = m_ooxApp->m_nWords.get2();
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfWords = m_ooxApp->m_nWords.get();
|
||||
}
|
||||
if(m_ooxApp->m_nCharacters.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithoutSpace = m_ooxApp->m_nCharacters.get2();
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithoutSpace = m_ooxApp->m_nCharacters.get();
|
||||
}
|
||||
if(m_ooxApp->m_nCharactersWithSpaces.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithSpace = m_ooxApp->m_nCharactersWithSpaces.get2();
|
||||
oParam.oRtf->m_oInformation.m_nNumberOfCharactersWithSpace = m_ooxApp->m_nCharactersWithSpaces.get();
|
||||
}
|
||||
|
||||
if (m_ooxApp->m_sApplication.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_sApplication = m_ooxApp->m_sApplication.get2();
|
||||
oParam.oRtf->m_oInformation.m_sApplication = m_ooxApp->m_sApplication.get();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -49,23 +49,23 @@ public:
|
||||
|
||||
if (m_ooxCore->m_sTitle.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_sTitle = m_ooxCore->m_sTitle.get2();
|
||||
oParam.oRtf->m_oInformation.m_sTitle = m_ooxCore->m_sTitle.get();
|
||||
}
|
||||
if (m_ooxCore->m_sSubject.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_sSubject = m_ooxCore->m_sSubject.get2();
|
||||
oParam.oRtf->m_oInformation.m_sSubject = m_ooxCore->m_sSubject.get();
|
||||
}
|
||||
if (m_ooxCore->m_sCreator.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_sAuthor = m_ooxCore->m_sCreator.get2();
|
||||
oParam.oRtf->m_oInformation.m_sAuthor = m_ooxCore->m_sCreator.get();
|
||||
}
|
||||
if (m_ooxCore->m_sDescription.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_sComment = m_ooxCore->m_sDescription.get2();
|
||||
oParam.oRtf->m_oInformation.m_sComment = m_ooxCore->m_sDescription.get();
|
||||
}
|
||||
if (m_ooxCore->m_sKeywords.IsInit())
|
||||
{
|
||||
oParam.oRtf->m_oInformation.m_sKeywords = m_ooxCore->m_sKeywords.get2();
|
||||
oParam.oRtf->m_oInformation.m_sKeywords = m_ooxCore->m_sKeywords.get();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -81,11 +81,7 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
|
||||
|
||||
if (m_poDocPropsApp)
|
||||
{
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetDocSecurity(0);
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetScaleCrop(false);
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetLinksUpToDate(false);
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetSharedDoc(false);
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetHyperlinksChanged(false);
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetDefaults();
|
||||
}
|
||||
if (m_poDocPropsCore)
|
||||
{
|
||||
@ -170,10 +166,11 @@ bool OOXWriter::SaveByItemEnd()
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( sApplication );
|
||||
#if defined(INTVER)
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( VALUE2STR(INTVER) );
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
((OOX::CApp*)m_poDocPropsApp)->m_sApplication = sApplication;
|
||||
((OOX::CApp*)m_poDocPropsApp)->write(pathDocProps + FILE_SEPARATOR_STR + L"app.xml", pathDocProps.GetDirectory(), oContentTypes);
|
||||
|
||||
m_oRels.AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties", L"docProps/app.xml" );
|
||||
|
||||
@ -204,15 +204,12 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
|
||||
std::wstring sApplication = NSSystemUtils::GetEnvVariable(NSSystemUtils::gc_EnvApplicationName);
|
||||
if (sApplication.empty())
|
||||
sApplication = NSSystemUtils::gc_EnvApplicationNameDefault;
|
||||
pApp->SetApplication(sApplication);
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
pApp->SetDocSecurity(0);
|
||||
pApp->SetScaleCrop(false);
|
||||
pApp->SetLinksUpToDate(false);
|
||||
pApp->SetSharedDoc(false);
|
||||
pApp->SetHyperlinksChanged(false);
|
||||
pApp->m_sApplication = sApplication;
|
||||
pApp->SetDefaults();
|
||||
|
||||
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
|
||||
delete pApp;
|
||||
|
||||
@ -435,7 +435,7 @@ namespace VBA
|
||||
|
||||
virtual void load(CVbaFileStreamPtr stream);
|
||||
|
||||
_UINT32 TextOffset;
|
||||
_UINT32 TextOffset = 0xffffffff;
|
||||
};
|
||||
typedef boost::shared_ptr<MODULEOFFSET> MODULEOFFSETPtr;
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@ -132,6 +132,11 @@ CVbaFileStream::CVbaFileStream(POLE::Stream* stream, _UINT32 offset)
|
||||
return;
|
||||
}
|
||||
dataSize -= 1;
|
||||
|
||||
if (offset > dataSize)
|
||||
{
|
||||
return; //error;
|
||||
}
|
||||
|
||||
stream->seek(stream->tell() + offset);
|
||||
dataSize -= offset;
|
||||
@ -140,23 +145,24 @@ CVbaFileStream::CVbaFileStream(POLE::Stream* stream, _UINT32 offset)
|
||||
stream->read(data, dataSize);
|
||||
|
||||
unsigned char *dataCur = data;
|
||||
size_t dataPos = 0;
|
||||
|
||||
while (dataPos + 2 < dataSize)
|
||||
while (dataCur - data < dataSize - 2)
|
||||
{
|
||||
std::vector<unsigned char> arrChunk;
|
||||
_UINT16 header = *((_UINT32*)dataCur); dataCur += 2;
|
||||
|
||||
bool bCompressed = ((header & CHUNK_COMPRESSED) != 0);
|
||||
_UINT16 chunkSize = (header & CHUNK_LENMASK);
|
||||
_UINT16 chunkSize = (header & CHUNK_LENMASK) + 1;
|
||||
|
||||
bool bUnknown = false;
|
||||
if ((header & CHUNK_SIGMASK) != CHUNK_SIG)
|
||||
{
|
||||
bCompressed = true;
|
||||
chunkSize = 4094; //по факту
|
||||
bUnknown = true;
|
||||
}
|
||||
POLE::uint64 target = (dataCur - data) + chunkSize;
|
||||
|
||||
unsigned char *dataNext = dataCur + chunkSize;
|
||||
|
||||
if (bCompressed)
|
||||
{
|
||||
unsigned char nBitCount = 4;
|
||||
@ -203,8 +209,7 @@ CVbaFileStream::CVbaFileStream(POLE::Stream* stream, _UINT32 offset)
|
||||
}
|
||||
else
|
||||
{
|
||||
arrChunk.emplace_back();
|
||||
arrChunk.back() = *dataCur; dataCur++;
|
||||
arrChunk.push_back(*dataCur); dataCur++;
|
||||
++chunkPos;
|
||||
}
|
||||
}
|
||||
@ -215,7 +220,8 @@ CVbaFileStream::CVbaFileStream(POLE::Stream* stream, _UINT32 offset)
|
||||
arrChunk.resize(chunkSize);
|
||||
memcpy(arrChunk.data(), dataCur, chunkSize); dataCur += chunkSize;
|
||||
}
|
||||
dataPos = target;
|
||||
|
||||
dataCur = dataNext;
|
||||
arrChunks.insert(arrChunks.end(), arrChunk.begin(), arrChunk.end());
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,6 +103,9 @@ const std::wstring CVbaReader::convert()
|
||||
{
|
||||
for (size_t i = 0; i < DirStreamObject->ModulesRecord->modules.size(); ++i)
|
||||
{
|
||||
if (!DirStreamObject->ModulesRecord->modules[i])
|
||||
continue;
|
||||
|
||||
CP_XML_NODE(L"Module")
|
||||
{
|
||||
if (DirStreamObject->ModulesRecord->modules[i]->StreamNameRecord)
|
||||
@ -121,7 +124,10 @@ const std::wstring CVbaReader::convert()
|
||||
DirStreamObject->ModulesRecord->modules[i]->StreamNameRecord->StreamNameUnicode.value);
|
||||
|
||||
_UINT32 offset = DirStreamObject->ModulesRecord->modules[i]->OffsetRecord ?
|
||||
DirStreamObject->ModulesRecord->modules[i]->OffsetRecord->TextOffset : 0;//skip cache
|
||||
DirStreamObject->ModulesRecord->modules[i]->OffsetRecord->TextOffset : 0xffffffff;//skip cache
|
||||
|
||||
if (offset == 0xffffffff)
|
||||
continue; // error record
|
||||
|
||||
CVbaFileStreamPtr strmModule = vbaProject_file_->getNamedStream(streamName, offset);
|
||||
strmModule->CodePage = code_page_;
|
||||
|
||||
@ -514,7 +514,28 @@ const size_t hex_str2int(const std::wstring::const_iterator& it_begin, const std
|
||||
//}
|
||||
std::wstring toStdWString(std::string ansi_string, const _UINT32 code_page)
|
||||
{
|
||||
std::string sCodePage;
|
||||
//#if defined (_WIN32) || defined (_WIN64)
|
||||
// std::wstring sResult;
|
||||
//
|
||||
// int outsize_with_0 = MultiByteToWideChar(code_page, 0, ansi_string.c_str(), -1, NULL, NULL);
|
||||
//
|
||||
// sResult.resize(outsize_with_0);
|
||||
// if (MultiByteToWideChar(code_page, 0, ansi_string.c_str(), -1, (LPWSTR)sResult.c_str(), outsize_with_0) > 0)
|
||||
// {
|
||||
// sResult.erase(outsize_with_0 - 1);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// std::locale loc("");
|
||||
// std::ctype<wchar_t> const &facet = std::use_facet<std::ctype<wchar_t> >(loc);
|
||||
//
|
||||
// sResult.resize(ansi_string.size());
|
||||
//
|
||||
// facet.widen(ansi_string.c_str(), ansi_string.c_str() + ansi_string.size(), &sResult[0]);
|
||||
// }
|
||||
// return sResult;
|
||||
//#else
|
||||
std::string sCodePage;
|
||||
std::map<int, std::string>::const_iterator pFind = NSUnicodeConverter::mapEncodingsICU.find(code_page);
|
||||
if (pFind != NSUnicodeConverter::mapEncodingsICU.end())
|
||||
{
|
||||
@ -543,6 +564,7 @@ std::wstring toStdWString(std::string ansi_string, const _UINT32 code_page)
|
||||
|
||||
return result;
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
std::wstring toStdWString(char* ansi, int size, const _UINT32 code_page)
|
||||
{
|
||||
|
||||
@ -36,9 +36,7 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of Continue record in BIFF8
|
||||
class Continue: public BiffRecord
|
||||
class Continue: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(Continue)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(Continue)
|
||||
@ -47,7 +45,6 @@ public:
|
||||
~Continue();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
|
||||
@ -34,32 +34,43 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
HorizontalPageBreaks::HorizontalPageBreaks() {}
|
||||
HorizontalPageBreaks::~HorizontalPageBreaks() {}
|
||||
|
||||
HorizontalPageBreaks::HorizontalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
HorizontalPageBreaks::~HorizontalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr HorizontalPageBreaks::clone()
|
||||
{
|
||||
return BaseObjectPtr(new HorizontalPageBreaks(*this));
|
||||
}
|
||||
|
||||
void HorizontalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk ; i++)
|
||||
BaseObjectPtr HorizontalPageBreaks::clone()
|
||||
{
|
||||
HorzBrkPtr hb(new HorzBrk);
|
||||
record >> *hb;
|
||||
rgbrk.push_back(hb);
|
||||
return BaseObjectPtr(new HorizontalPageBreaks(*this));
|
||||
}
|
||||
}
|
||||
|
||||
void HorizontalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk; i++)
|
||||
{
|
||||
HorzBrkPtr hb(new HorzBrk);
|
||||
record >> *hb;
|
||||
rgbrk.push_back(hb);
|
||||
}
|
||||
}
|
||||
int HorizontalPageBreaks::serialize(std::wostream & stream)
|
||||
{
|
||||
if (rgbrk.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"rowBreaks")
|
||||
{
|
||||
CP_XML_ATTR(L"count", cbrk);
|
||||
CP_XML_ATTR(L"manualBreakCount", cbrk);
|
||||
|
||||
for (size_t i = 0; i < rgbrk.size(); ++i)
|
||||
{
|
||||
if (rgbrk[i])
|
||||
rgbrk[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -37,29 +37,24 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class HorizontalPageBreaks : public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(HorizontalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(HorizontalPageBreaks)
|
||||
public:
|
||||
HorizontalPageBreaks();
|
||||
~HorizontalPageBreaks();
|
||||
|
||||
// Logical representation of HorizontalPageBreaks record in BIFF8
|
||||
class HorizontalPageBreaks: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(HorizontalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(HorizontalPageBreaks)
|
||||
public:
|
||||
HorizontalPageBreaks();
|
||||
~HorizontalPageBreaks();
|
||||
BaseObjectPtr clone();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeHorizontalPageBreaks;
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeHorizontalPageBreaks;
|
||||
|
||||
virtual int serialize(std::wostream & stream);
|
||||
//-----------------------------
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
|
||||
};
|
||||
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
};
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -35,27 +35,23 @@
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
PicF::PicF()
|
||||
{
|
||||
}
|
||||
PicF::PicF() {}
|
||||
PicF::~PicF() {}
|
||||
|
||||
BaseObjectPtr PicF::clone()
|
||||
{
|
||||
return BaseObjectPtr(new PicF(*this));
|
||||
}
|
||||
|
||||
PicF::~PicF()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr PicF::clone()
|
||||
{
|
||||
return BaseObjectPtr(new PicF(*this));
|
||||
}
|
||||
|
||||
|
||||
void PicF::readFields(CFRecord& record)
|
||||
{
|
||||
Log::error("PicF record is not implemented.");
|
||||
record.skipNunBytes(record.getDataSize() - record.getRdPtr());
|
||||
}
|
||||
void PicF::readFields(CFRecord& record)
|
||||
{
|
||||
unsigned short unused, flags;
|
||||
record >> ptyp >> unused >> flags >> numScale;
|
||||
|
||||
fTopBottom = GETBIT(flags, 9);
|
||||
fBackFront = GETBIT(flags, 10);
|
||||
fSide = GETBIT(flags, 11);
|
||||
}
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -31,13 +31,10 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "BiffRecord.h"
|
||||
#include "../Biff_structures/Xnum.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
// Logical representation of PicF record in BIFF8
|
||||
class PicF: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(PicF)
|
||||
@ -45,13 +42,20 @@ class PicF: public BiffRecord
|
||||
public:
|
||||
PicF();
|
||||
~PicF();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typePicF;
|
||||
static const ElementType type = typePicF;
|
||||
|
||||
unsigned short ptyp;
|
||||
|
||||
bool fTopBottom;
|
||||
bool fBackFront;
|
||||
bool fSide;
|
||||
|
||||
Xnum numScale;
|
||||
|
||||
};
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -64,10 +64,14 @@ void SST::readFields(CFRecord& record)
|
||||
{
|
||||
XLUnicodeRichExtendedStringPtr element(new XLUnicodeRichExtendedString(recs));
|
||||
|
||||
if (record.getRdPtr() + 3 > record.getDataSize()) // If the break is at the XLUnicodeRichExtendedString boundary
|
||||
if (record.getRdPtr() == record.getDataSize())
|
||||
{
|
||||
element->appendNextContinue(record, false);
|
||||
}
|
||||
else if (record.getRdPtr() + 3 > record.getDataSize())
|
||||
{
|
||||
element->appendNextContinue(record, true);
|
||||
}
|
||||
|
||||
if (record.getRdPtr() + 3 > record.getDataSize())
|
||||
break;
|
||||
|
||||
@ -34,32 +34,43 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
VerticalPageBreaks::VerticalPageBreaks() {}
|
||||
VerticalPageBreaks::~VerticalPageBreaks() {}
|
||||
|
||||
VerticalPageBreaks::VerticalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
VerticalPageBreaks::~VerticalPageBreaks()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BaseObjectPtr VerticalPageBreaks::clone()
|
||||
{
|
||||
return BaseObjectPtr(new VerticalPageBreaks(*this));
|
||||
}
|
||||
|
||||
void VerticalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk ; ++i)
|
||||
BaseObjectPtr VerticalPageBreaks::clone()
|
||||
{
|
||||
VertBrkPtr vb(new VertBrk);
|
||||
record >> *vb;
|
||||
rgbrk.push_back(vb);
|
||||
return BaseObjectPtr(new VerticalPageBreaks(*this));
|
||||
}
|
||||
}
|
||||
|
||||
void VerticalPageBreaks::readFields(CFRecord& record)
|
||||
{
|
||||
record >> cbrk;
|
||||
for (int i = 0; i < cbrk; ++i)
|
||||
{
|
||||
VertBrkPtr vb(new VertBrk);
|
||||
record >> *vb;
|
||||
rgbrk.push_back(vb);
|
||||
}
|
||||
}
|
||||
int VerticalPageBreaks::serialize(std::wostream & stream)
|
||||
{
|
||||
if (rgbrk.empty()) return 0;
|
||||
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"colBreaks")
|
||||
{
|
||||
CP_XML_ATTR(L"count", cbrk);
|
||||
CP_XML_ATTR(L"manualBreakCount", cbrk);
|
||||
|
||||
for (size_t i = 0; i < rgbrk.size(); ++i)
|
||||
{
|
||||
if (rgbrk[i])
|
||||
rgbrk[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -36,27 +36,24 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class VerticalPageBreaks : public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(VerticalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(VerticalPageBreaks)
|
||||
public:
|
||||
VerticalPageBreaks();
|
||||
~VerticalPageBreaks();
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
// Logical representation of VerticalPageBreaks record in BIFF8
|
||||
class VerticalPageBreaks: public BiffRecord
|
||||
{
|
||||
BIFF_RECORD_DEFINE_TYPE_INFO(VerticalPageBreaks)
|
||||
BASE_OBJECT_DEFINE_CLASS_NAME(VerticalPageBreaks)
|
||||
public:
|
||||
VerticalPageBreaks();
|
||||
~VerticalPageBreaks();
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
BaseObjectPtr clone();
|
||||
|
||||
void readFields(CFRecord& record);
|
||||
|
||||
static const ElementType type = typeVerticalPageBreaks;
|
||||
static const ElementType type = typeVerticalPageBreaks;
|
||||
|
||||
virtual int serialize(std::wostream & stream);
|
||||
//-----------------------------
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
};
|
||||
|
||||
_UINT16 cbrk;
|
||||
BiffStructurePtrVector rgbrk;
|
||||
};
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -31,21 +31,33 @@
|
||||
*/
|
||||
|
||||
#include "HorzBrk.h"
|
||||
#include "../../../Common/simple_xml_writer.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
BiffStructurePtr HorzBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new HorzBrk(*this));
|
||||
}
|
||||
|
||||
|
||||
BiffStructurePtr HorzBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new HorzBrk(*this));
|
||||
}
|
||||
|
||||
void HorzBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> row >> colStart >> colEnd;
|
||||
}
|
||||
|
||||
|
||||
void HorzBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> row >> colStart >> colEnd;
|
||||
}
|
||||
int HorzBrk::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"brk")
|
||||
{
|
||||
CP_XML_ATTR(L"id", row);
|
||||
CP_XML_ATTR(L"max", colEnd);
|
||||
CP_XML_ATTR(L"man", 1);
|
||||
if (colStart > 0 )
|
||||
CP_XML_ATTR(L"min", colStart);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -36,25 +36,21 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
class CFRecord;
|
||||
|
||||
class HorzBrk : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(HorzBrk)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
static const ElementType type = typeHorzBrk;
|
||||
static const ElementType type = typeHorzBrk;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
virtual int serialize(std::wostream & stream);
|
||||
|
||||
RwU row;
|
||||
unsigned short colStart;
|
||||
unsigned short colEnd;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<HorzBrk> HorzBrkPtr;
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
@ -120,11 +120,21 @@ void OfficeArtRGFOPTE::load(XLS::CFRecord& record)
|
||||
}
|
||||
//-----complex load
|
||||
|
||||
for(std::vector<OfficeArtFOPTEPtr>::iterator it = rgfopte.begin(), itEnd = rgfopte.end(); it != itEnd; ++it)
|
||||
for (size_t i = 0; i < rgfopte.size(); ++i)
|
||||
{
|
||||
if((*it)->fComplex && (*it)->op > 0)
|
||||
if (!rgfopte[i]) continue;
|
||||
|
||||
if (rgfopte[i]->fComplex)
|
||||
{
|
||||
(*it)->ReadComplexData(record);
|
||||
if (rgfopte[i]->op == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (rgfopte[i]->op < 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
rgfopte[i]->ReadComplexData(record);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,20 +31,32 @@
|
||||
*/
|
||||
|
||||
#include "VertBrk.h"
|
||||
#include "../../../Common/simple_xml_writer.h"
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
|
||||
BiffStructurePtr VertBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new VertBrk(*this));
|
||||
}
|
||||
|
||||
void VertBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> col >> rowStart >> rowEnd;
|
||||
}
|
||||
|
||||
BiffStructurePtr VertBrk::clone()
|
||||
{
|
||||
return BiffStructurePtr(new VertBrk(*this));
|
||||
}
|
||||
void VertBrk::load(CFRecord& record)
|
||||
{
|
||||
record >> col >> rowStart >> rowEnd;
|
||||
}
|
||||
int VertBrk::serialize(std::wostream & stream)
|
||||
{
|
||||
CP_XML_WRITER(stream)
|
||||
{
|
||||
CP_XML_NODE(L"brk")
|
||||
{
|
||||
CP_XML_ATTR(L"id", col);
|
||||
CP_XML_ATTR(L"max", rowEnd);
|
||||
CP_XML_ATTR(L"man", 1);
|
||||
if (rowStart > 0)
|
||||
CP_XML_ATTR(L"min", rowStart);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -35,26 +35,22 @@
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
class VertBrk : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(VertBrk)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
|
||||
class CFRecord;
|
||||
static const ElementType type = typeVertBrk;
|
||||
|
||||
class VertBrk : public BiffStructure
|
||||
{
|
||||
BASE_STRUCTURE_DEFINE_CLASS_NAME(VertBrk)
|
||||
public:
|
||||
BiffStructurePtr clone();
|
||||
virtual void load(CFRecord& record);
|
||||
virtual int serialize(std::wostream & stream);
|
||||
|
||||
static const ElementType type = typeVertBrk;
|
||||
|
||||
virtual void load(CFRecord& record);
|
||||
|
||||
|
||||
ColU col;
|
||||
RwU rowStart;
|
||||
RwU rowEnd;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<VertBrk> VertBrkPtr;
|
||||
ColU col;
|
||||
RwU rowStart;
|
||||
RwU rowEnd;
|
||||
};
|
||||
typedef boost::shared_ptr<VertBrk> VertBrkPtr;
|
||||
|
||||
} // namespace XLS
|
||||
|
||||
|
||||
@ -178,13 +178,14 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
|
||||
unsigned char flags = 0;
|
||||
record >> cch >> flags;
|
||||
|
||||
fHighByte = GETBIT(flags, 0);
|
||||
|
||||
if (record.getDataSize() == record.getRdPtr())
|
||||
{
|
||||
if (appendNextContinue(record,false) == false)
|
||||
if (appendNextContinue(record, true) == false) //fHighByte MUST be specified in the first byte of the continue field of the Continue
|
||||
return;
|
||||
}
|
||||
|
||||
fHighByte = GETBIT(flags, 0);
|
||||
fExtSt = GETBIT(flags, 2);
|
||||
fRichSt = GETBIT(flags, 3);
|
||||
|
||||
@ -235,7 +236,11 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
|
||||
}
|
||||
if (record.getRdPtr() + cRun * 4 > record.getDataSize() && !cont_recs_.empty())
|
||||
{
|
||||
record.appendRawData(cont_recs_.front());
|
||||
unsigned char flags = 0;
|
||||
(*cont_recs_.front()) >> flags;
|
||||
fHighByte = (0x01 == flags);
|
||||
|
||||
record.appendRawData(cont_recs_.front()->getData() + 1, cont_recs_.front()->getDataSize() - 1);
|
||||
cont_recs_.pop_front();
|
||||
}
|
||||
for(size_t i = 0; i < cRun; ++i)
|
||||
@ -249,8 +254,12 @@ void XLUnicodeRichExtendedString::load(CFRecord& record)
|
||||
{
|
||||
if (record.getRdPtr() + cbExtRst > record.getDataSize() && !cont_recs_.empty())
|
||||
{
|
||||
record.appendRawData(cont_recs_.front());
|
||||
cont_recs_.pop_front();
|
||||
unsigned char flags = 0;
|
||||
(*cont_recs_.front()) >> flags;
|
||||
fHighByte = (0x01 == flags);
|
||||
|
||||
record.appendRawData(cont_recs_.front()->getData() + 1, cont_recs_.front()->getDataSize() - 1);
|
||||
cont_recs_.pop_front();
|
||||
}
|
||||
extRst.load(record);
|
||||
}
|
||||
@ -295,7 +304,7 @@ void XLUnicodeRichExtendedString::loadSymbols(CFRecord& record, const size_t cch
|
||||
}
|
||||
else
|
||||
{
|
||||
str_ = STR::toStdWString(inp_str, record.getGlobalWorkbookInfo()->CodePage).c_str();
|
||||
str_ = STR::toStdWString(inp_str, record.getGlobalWorkbookInfo()->CodePage);
|
||||
}
|
||||
}
|
||||
record.skipNunBytes(raw_length);
|
||||
|
||||
@ -92,8 +92,16 @@ const bool CUSTOMVIEW::loadContent(BinProcessor& proc)
|
||||
count--;
|
||||
}
|
||||
|
||||
proc.optional<HorizontalPageBreaks>();
|
||||
proc.optional<VerticalPageBreaks>();
|
||||
if (proc.optional<HorizontalPageBreaks>())
|
||||
{
|
||||
m_HorizontalPageBreaks = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
if (proc.optional<VerticalPageBreaks>())
|
||||
{
|
||||
m_VerticalPageBreaks = elements_.back();
|
||||
elements_.pop_back();
|
||||
}
|
||||
|
||||
proc.optional<Header>();
|
||||
proc.optional<Footer>();
|
||||
@ -188,6 +196,14 @@ int CUSTOMVIEW::serialize(std::wostream & stream)
|
||||
if (m_arSelection[i] == NULL) continue;
|
||||
m_arSelection[i]->serialize(CP_XML_STREAM());
|
||||
}
|
||||
if (m_HorizontalPageBreaks)
|
||||
{
|
||||
m_HorizontalPageBreaks->serialize(CP_XML_STREAM());
|
||||
}
|
||||
if (m_VerticalPageBreaks)
|
||||
{
|
||||
m_VerticalPageBreaks->serialize(CP_XML_STREAM());
|
||||
}
|
||||
//todooo пока не понятно как там определяется ref
|
||||
//if (m_AUTOFILTER)
|
||||
// m_AUTOFILTER->serialize(CP_XML_STREAM());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user