mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-15 20:36:10 +08:00
Compare commits
30 Commits
core-linux
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| a7bf12c052 | |||
| 5c01b23dee | |||
| db11b75a2e | |||
| 2ba4c18cdf | |||
| b264f20f29 | |||
| 5e04ea62f7 | |||
| 3d1db63c0e | |||
| f124d18256 | |||
| 9bffb65dcb | |||
| 2fbcc3832f | |||
| 97b4311e95 | |||
| 228b3a52e9 | |||
| 2f2236646d | |||
| 30603d0561 | |||
| 933af771b7 | |||
| c04a537d69 | |||
| e49d78db47 | |||
| 99ec420ee5 | |||
| f764b034a1 | |||
| 73fe023460 | |||
| 242af3c80e | |||
| 7756e4b8bd | |||
| 56a1d1f627 | |||
| 11bd4ff61d | |||
| 93a06d7f86 | |||
| 76d2d429b7 | |||
| c6de37dbad | |||
| d022e669f0 | |||
| 184e79bae1 | |||
| e6581671c8 |
@ -71,7 +71,11 @@ namespace OpenXmlContentTypes
|
||||
static const wchar_t* Bmp = L"image/bmp";
|
||||
static const wchar_t* Pcz = L"image/x-pcz";
|
||||
}
|
||||
|
||||
namespace DocPrContentTypes
|
||||
{
|
||||
static const wchar_t* App = L"application/vnd.openxmlformats-officedocument.extended-properties+xml";
|
||||
static const wchar_t* Core = L"application/vnd.openxmlformats-package.core-properties+xml";
|
||||
}
|
||||
namespace WordprocessingMLContentTypes
|
||||
{
|
||||
// WordprocessingML content types
|
||||
@ -137,7 +141,7 @@ namespace OpenXmlNamespaces
|
||||
|
||||
namespace OpenXmlRelationshipTypes
|
||||
{
|
||||
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
static const wchar_t* CoreProperties = L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
|
||||
static const wchar_t* ExtendedProperties = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
|
||||
|
||||
static const wchar_t* Theme = L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
||||
|
||||
@ -64,6 +64,8 @@ namespace DocFileFormat
|
||||
DocumentContentTypesFile._defaultTypes.insert( make_pair( L"xml", std::wstring( OpenXmlContentTypes::Xml ) ) );
|
||||
|
||||
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId1"), OpenXmlRelationshipTypes::OfficeDocument, L"word/document.xml") );
|
||||
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId2"), OpenXmlRelationshipTypes::CoreProperties, L"docProps/core.xml") );
|
||||
MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( L"rId3"), OpenXmlRelationshipTypes::ExtendedProperties, L"docProps/app.xml") );
|
||||
}
|
||||
|
||||
|
||||
@ -195,14 +197,18 @@ namespace DocFileFormat
|
||||
delete storageOut;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int OpenXmlPackage::RegisterDocument()
|
||||
void OpenXmlPackage::RegisterDocPr()
|
||||
{
|
||||
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
|
||||
AddPart( L"docProps", L"app.xml", DocPrContentTypes::App, L"");
|
||||
AddPart( L"docProps", L"core.xml", DocPrContentTypes::Core, L"");
|
||||
}
|
||||
int OpenXmlPackage::RegisterDocumentMacros()
|
||||
void OpenXmlPackage::RegisterDocument()
|
||||
{
|
||||
return AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
|
||||
AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocument, L"");
|
||||
}
|
||||
void OpenXmlPackage::RegisterDocumentMacros()
|
||||
{
|
||||
AddPart( L"word", L"document.xml", WordprocessingMLContentTypes::MainDocumentMacro, L"");
|
||||
}
|
||||
int OpenXmlPackage::RegisterVbaProject()
|
||||
{
|
||||
|
||||
@ -165,8 +165,9 @@ namespace DocFileFormat
|
||||
HRESULT SaveOLEObject ( const std::wstring& fileName, const OleObjectFileStructure& oleObjectFileStructure );
|
||||
HRESULT SaveEmbeddedObject ( const std::wstring& fileName, const std::string& data );
|
||||
|
||||
int RegisterDocument();
|
||||
int RegisterDocumentMacros();
|
||||
void RegisterDocPr();
|
||||
void RegisterDocument();
|
||||
void RegisterDocumentMacros();
|
||||
int RegisterFontTable();
|
||||
int RegisterNumbering();
|
||||
int RegisterSettings();
|
||||
|
||||
@ -35,6 +35,10 @@
|
||||
#include "../../DesktopEditor/raster/BgraFrame.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Core.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
|
||||
|
||||
namespace ImageHelper
|
||||
{
|
||||
struct __BITMAPINFOHEADER
|
||||
@ -211,6 +215,37 @@ namespace DocFileFormat
|
||||
{
|
||||
RegisterDocument();
|
||||
}
|
||||
OOX::CContentTypes oContentTypes;
|
||||
OOX::CPath pathDocProps = m_strOutputPath + FILE_SEPARATOR_STR + _T("docProps");
|
||||
NSDirectory::CreateDirectory(pathDocProps.GetPath());
|
||||
|
||||
OOX::CPath DocProps = std::wstring(_T("docProps"));
|
||||
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#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)
|
||||
{
|
||||
pCore->SetCreator(_T(""));
|
||||
pCore->SetLastModifiedBy(_T(""));
|
||||
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
|
||||
delete pCore;
|
||||
}
|
||||
RegisterDocPr();
|
||||
|
||||
WritePackage();
|
||||
|
||||
|
||||
@ -21,8 +21,6 @@ include($$PWD/../../../Common/3dParty/boost/boost.pri)
|
||||
|
||||
DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
_USE_LIBXML2_READER_ \
|
||||
LIBXML_READER_ENABLED \
|
||||
DONT_WRITE_EMBEDDED_FONTS \
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -318,20 +318,29 @@ public:
|
||||
docRGB Color;
|
||||
CThemeColor ThemeColor;
|
||||
|
||||
bool bValue;
|
||||
bool bColor;
|
||||
bool bThemeColor;
|
||||
Shd()
|
||||
{
|
||||
Value = shd_Nil;
|
||||
bValue = false;
|
||||
bColor = false;
|
||||
bThemeColor = false;
|
||||
}
|
||||
std::wstring ToString()
|
||||
{
|
||||
std::wstring sShd;
|
||||
if(bColor || (bThemeColor && ThemeColor.IsNoEmpty()))
|
||||
if(bValue || bColor || (bThemeColor && ThemeColor.IsNoEmpty()))
|
||||
{
|
||||
sShd += L"<w:shd w:val=\"clear\" w:color=\"auto\"";
|
||||
sShd += L"<w:shd";
|
||||
if(bValue)
|
||||
{
|
||||
if(shd_Nil == Value)
|
||||
sShd += L" w:val=\"nil\"";
|
||||
else
|
||||
sShd += L" w:val=\"clear\"";
|
||||
}
|
||||
sShd += L" w:color=\"auto\"";
|
||||
if(bColor)
|
||||
sShd += L" w:fill=\"" + Color.ToString() + L"\"";
|
||||
if(bThemeColor && ThemeColor.IsNoEmpty())
|
||||
|
||||
@ -266,7 +266,10 @@ private:
|
||||
Shd* pShd = static_cast<Shd*>(poResult);
|
||||
switch(type)
|
||||
{
|
||||
case c_oSerShdType::Value: pShd->Value = m_oBufferedStream.GetUChar();break;
|
||||
case c_oSerShdType::Value:
|
||||
pShd->bValue = true;
|
||||
pShd->Value = m_oBufferedStream.GetUChar();
|
||||
break;
|
||||
case c_oSerShdType::Color:
|
||||
pShd->bColor = true;
|
||||
pShd->Color = ReadColor();
|
||||
@ -451,11 +454,8 @@ public:
|
||||
{
|
||||
Shd oShd;
|
||||
oBinary_CommonReader2.ReadShdOut(length, &oShd);
|
||||
if(shd_Nil != oShd.Value)
|
||||
{
|
||||
orPr->bShd = true;
|
||||
orPr->Shd = oShd.ToString();
|
||||
}
|
||||
orPr->bShd = true;
|
||||
orPr->Shd = oShd.ToString();
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_rPrType::RStyle:
|
||||
@ -801,15 +801,7 @@ public:
|
||||
{
|
||||
Shd oShd;
|
||||
oBinary_CommonReader2.ReadShdOut(length, &oShd);
|
||||
if(shd_Nil != oShd.Value)
|
||||
{
|
||||
pCStringWriter->WriteString(oShd.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sShd(L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"auto\"/>");
|
||||
pCStringWriter->WriteString(sShd);
|
||||
}
|
||||
pCStringWriter->WriteString(oShd.ToString());
|
||||
break;
|
||||
}
|
||||
case c_oSerProp_pPrType::WidowControl:
|
||||
@ -1782,11 +1774,8 @@ public:
|
||||
{
|
||||
Shd oShd;
|
||||
oBinary_CommonReader2.ReadShdOut(length, &oShd);
|
||||
if(shd_Nil != oShd.Value)
|
||||
{
|
||||
pWiterTblPr->Shd = oShd.ToString();
|
||||
m_sCurTableShd = pWiterTblPr->Shd;
|
||||
}
|
||||
pWiterTblPr->Shd = oShd.ToString();
|
||||
m_sCurTableShd = pWiterTblPr->Shd;
|
||||
}
|
||||
else if( c_oSerProp_tblPrType::tblpPr == type )
|
||||
{
|
||||
@ -2244,10 +2233,7 @@ public:
|
||||
bCellShd = true;
|
||||
Shd oShd;
|
||||
oBinary_CommonReader2.ReadShdOut(length, &oShd);
|
||||
if(shd_Nil != oShd.Value)
|
||||
{
|
||||
pCStringWriter->WriteString(oShd.ToString());
|
||||
}
|
||||
pCStringWriter->WriteString(oShd.ToString());
|
||||
}
|
||||
else if( c_oSerProp_cellPrType::TableCellBorders == type )
|
||||
{
|
||||
@ -7449,6 +7435,8 @@ public:
|
||||
{
|
||||
PPTX::Logic::CNvPr pNonVisualDrawingProps(L"wp");
|
||||
res = Read1(length, &Binary_DocumentTableReader::ReadDocPr, this, &pNonVisualDrawingProps);
|
||||
|
||||
pNonVisualDrawingProps.id = pDrawingProperty->m_nDocPr;
|
||||
pDrawingProperty->sDocPr = pNonVisualDrawingProps.toXML2(L"wp:docPr");
|
||||
}
|
||||
else
|
||||
|
||||
@ -87,10 +87,14 @@ namespace BinDocxRW
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
|
||||
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, pHdrFtr->m_arrShapeTypes);
|
||||
|
||||
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
|
||||
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
|
||||
m_pOfficeDrawingConverter->ClearShapeTypes();
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
|
||||
m_pOfficeDrawingConverter->SetRels(oldRels);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3016,25 +3016,13 @@ namespace BinDocxRW
|
||||
bool m_bWriteSectPr;//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
|
||||
//---------------------------------
|
||||
BinaryDocumentTableWriter(ParamsWriter& oParamsWriter, ParamsDocumentWriter& oParamsDocumentWriter, std::map<int, bool>* mapIgnoreComments, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter):
|
||||
m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter),m_oBcw(oParamsWriter),bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter),brPrs(oParamsWriter),btblPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
|
||||
m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter), m_oBcw(oParamsWriter),bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter),brPrs(oParamsWriter),btblPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
|
||||
{
|
||||
pBackground = NULL;
|
||||
pSectPr = NULL;
|
||||
poDocument = NULL;
|
||||
m_bWriteSectPr = false;
|
||||
}
|
||||
void prepareOfficeDrawingConverter(NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer *rels, std::vector<std::wstring>& aShapeTypes)
|
||||
{
|
||||
smart_ptr<OOX::IFileContainer> oldRels = pOfficeDrawingConverter->GetRels();
|
||||
pOfficeDrawingConverter->SetRels(rels);
|
||||
|
||||
for(size_t i = 0, length = aShapeTypes.size(); i < length; ++i)
|
||||
{
|
||||
std::wstring& sShapeType = aShapeTypes[i];
|
||||
pOfficeDrawingConverter->AddShapeType(sShapeType);
|
||||
}
|
||||
pOfficeDrawingConverter->SetRels(oldRels);
|
||||
}
|
||||
void WriteVbaProject(OOX::VbaProject& oVbaProject)
|
||||
{
|
||||
m_oBcw.m_oStream.StartRecord(0);
|
||||
@ -3131,23 +3119,6 @@ namespace BinDocxRW
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
//Write JsaProject
|
||||
if (NULL != poDocument)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = poDocument->Get(OOX::FileTypes::JsaProject);
|
||||
if (pFile.IsInit() && OOX::FileTypes::JsaProject == pFile->type())
|
||||
{
|
||||
OOX::JsaProject& jsaProject = pFile.as<OOX::JsaProject>();
|
||||
BYTE* pData = NULL;
|
||||
DWORD nBytesCount;
|
||||
if(NSFile::CFileBinary::ReadAllBytes(jsaProject.filename().GetPath(), &pData, nBytesCount))
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
|
||||
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void WriteBackground (OOX::Logic::CBackground* pBackground)
|
||||
{
|
||||
@ -7741,7 +7712,7 @@ namespace BinDocxRW
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteNotes(oFootnotes.m_arrFootnote, oParamsDocumentWriter, oFootnotes.m_arrShapeTypes);
|
||||
WriteNotes(oFootnotes.m_arrFootnote, oParamsDocumentWriter);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
void WriteEndnotes(OOX::CEndnotes& oEndnotes)
|
||||
@ -7750,20 +7721,27 @@ namespace BinDocxRW
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
|
||||
int nStart = m_oBcw.WriteItemWithLengthStart();
|
||||
WriteNotes(oEndnotes.m_arrEndnote, oParamsDocumentWriter, oEndnotes.m_arrShapeTypes);
|
||||
WriteNotes(oEndnotes.m_arrEndnote, oParamsDocumentWriter);
|
||||
m_oBcw.WriteItemWithLengthEnd(nStart);
|
||||
}
|
||||
void WriteNotes(const std::vector<OOX::CFtnEdn*>& arrNotes, ParamsDocumentWriter& oParamsDocumentWriter, std::vector<std::wstring>& arrShapeTypes)
|
||||
void WriteNotes(const std::vector<OOX::CFtnEdn*>& arrNotes, ParamsDocumentWriter& oParamsDocumentWriter)
|
||||
{
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
|
||||
smart_ptr<OOX::IFileContainer> oldRels = m_pOfficeDrawingConverter->GetRels();
|
||||
m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
|
||||
m_pOfficeDrawingConverter->ClearShapeTypes();
|
||||
|
||||
int nCurPos = 0;
|
||||
for(size_t i = 0 ; i < arrNotes.size(); ++i)
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::Note);
|
||||
WriteNote(*arrNotes[i], oParamsDocumentWriter, arrShapeTypes);
|
||||
WriteNote(*arrNotes[i], oBinaryDocumentTableWriter);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
m_pOfficeDrawingConverter->SetRels(oldRels);
|
||||
}
|
||||
void WriteNote(const OOX::CFtnEdn& oFtnEdn, ParamsDocumentWriter& oParamsDocumentWriter, std::vector<std::wstring>& arrShapeTypes)
|
||||
void WriteNote(const OOX::CFtnEdn& oFtnEdn, BinaryDocumentTableWriter & oBinaryDocumentTableWriter)
|
||||
{
|
||||
int nCurPos = 0;
|
||||
if(oFtnEdn.m_oType.IsInit())
|
||||
@ -7778,10 +7756,6 @@ namespace BinDocxRW
|
||||
m_oBcw.m_oStream.WriteLONG(oFtnEdn.m_oId->GetValue());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
|
||||
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, NULL);
|
||||
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, arrShapeTypes);
|
||||
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerNotes::NoteContent);
|
||||
oBinaryDocumentTableWriter.WriteDocumentContent(oFtnEdn.m_arrItems);
|
||||
@ -7864,101 +7838,93 @@ namespace BinDocxRW
|
||||
|
||||
OOX::CDocx oDocx = OOX::CDocx(OOX::CPath(sDir));
|
||||
|
||||
m_oParamsWriter.m_poTheme = oDocx.GetTheme();
|
||||
m_oParamsWriter.m_oSettings = oDocx.GetSettings();
|
||||
m_oParamsWriter.m_poTheme = oDocx.m_pTheme;
|
||||
m_oParamsWriter.m_oSettings = oDocx.m_pSettings;
|
||||
|
||||
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(oDocx.GetTheme());
|
||||
*oBufferedStream.m_pTheme = smart_ptr<PPTX::Theme>(oDocx.m_pTheme);
|
||||
oBufferedStream.m_pTheme->AddRef();
|
||||
|
||||
OOX::CFontTable* pFontTable = oDocx.GetFontTable();
|
||||
|
||||
if(NULL != pFontTable)
|
||||
m_oParamsWriter.m_pFontProcessor->setFontTable(pFontTable);
|
||||
if(NULL != oDocx.m_pFontTable)
|
||||
m_oParamsWriter.m_pFontProcessor->setFontTable(oDocx.m_pFontTable);
|
||||
|
||||
//ищем первый SectPr и расставляем pageBreak
|
||||
OOX::CDocument* poDocument = oDocx.GetDocument();
|
||||
|
||||
if (poDocument == NULL) return;
|
||||
OOX::Logic::CSectionProperty* pFirstSectPr = poDocument->m_oSectPr.GetPointer();
|
||||
if (oDocx.m_pDocument == NULL) return;
|
||||
OOX::Logic::CSectionProperty* pFirstSectPr = oDocx.m_pDocument->m_oSectPr.GetPointer();
|
||||
|
||||
this->WriteMainTableStart();
|
||||
|
||||
int nCurPos = 0;
|
||||
|
||||
//Write Settings
|
||||
OOX::CSettings* pSettings = oDocx.GetSettings();
|
||||
if(NULL != pSettings)
|
||||
if(NULL != oDocx.m_pSettings)
|
||||
{
|
||||
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
|
||||
oBinarySettingsTableWriter.Write(*pSettings);
|
||||
oBinarySettingsTableWriter.Write(*oDocx.m_pSettings);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
//Write Comments
|
||||
OOX::CComments* pComments = oDocx.GetComments();
|
||||
OOX::CCommentsExt* pCommentsExt = oDocx.GetCommentsExt();
|
||||
OOX::CPeople* pPeople = oDocx.GetPeople();
|
||||
if(NULL != pComments)
|
||||
if(NULL != oDocx.m_pComments)
|
||||
{
|
||||
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Comments);
|
||||
oBinaryCommentsTableWriter.Write(*pComments, pCommentsExt, pPeople, m_oParamsWriter.m_mapIgnoreComments);
|
||||
oBinaryCommentsTableWriter.Write(*oDocx.m_pComments, oDocx.m_pCommentsExt, oDocx.m_pPeople, m_oParamsWriter.m_mapIgnoreComments);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
//Write StyleTable
|
||||
OOX::CStyles* pStyles = oDocx.GetStyles();
|
||||
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
|
||||
if(NULL != pStyles)
|
||||
if(NULL != oDocx.m_pStyles)
|
||||
{
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
|
||||
oBinaryStyleTableWriter.Write(*pStyles);
|
||||
oBinaryStyleTableWriter.Write(*oDocx.m_pStyles);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
//Write Numbering
|
||||
OOX::CNumbering* pNumbering = oDocx.GetNumbering();
|
||||
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
|
||||
if(NULL != pNumbering)
|
||||
if(NULL != oDocx.m_pNumbering)
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
|
||||
oBinaryNumberingTableWriter.Write(*pNumbering);
|
||||
oBinaryNumberingTableWriter.Write(*oDocx.m_pNumbering);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
BinDocxRW::BinaryNotesTableWriter oBinaryNotesWriter(m_oParamsWriter);
|
||||
//Write Footnotes
|
||||
OOX::CFootnotes* pFootnotes = oDocx.GetFootnotes();
|
||||
if(NULL != pFootnotes)
|
||||
if(NULL != oDocx.m_pFootnotes)
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Footnotes);
|
||||
oBinaryNotesWriter.WriteFootnotes(*pFootnotes);
|
||||
oBinaryNotesWriter.WriteFootnotes(*oDocx.m_pFootnotes);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
//Write Endnotes
|
||||
OOX::CEndnotes* pEndnotes = oDocx.GetEndnotes();
|
||||
if(NULL != pEndnotes)
|
||||
if(NULL != oDocx.m_pEndnotes)
|
||||
{
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Endnotes);
|
||||
oBinaryNotesWriter.WriteEndnotes(*pEndnotes);
|
||||
oBinaryNotesWriter.WriteEndnotes(*oDocx.m_pEndnotes);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument, &m_oParamsWriter.m_mapIgnoreComments);
|
||||
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, oDocx.m_pDocument, &m_oParamsWriter.m_mapIgnoreComments);
|
||||
|
||||
//Write DocumentTable
|
||||
ParamsDocumentWriter oParamsDocumentWriter(poDocument);
|
||||
ParamsDocumentWriter oParamsDocumentWriter(oDocx.m_pDocument);
|
||||
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
|
||||
|
||||
//DocumentTable всегда пишем последней, чтобы сначала заполнить все вспомогательные структуры, а при заполении документа, вызывать методы типа Style_Add...
|
||||
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
|
||||
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_pRels, poDocument->m_arrShapeTypes);
|
||||
|
||||
m_oParamsWriter.m_pOfficeDrawingConverter->SetRels(oParamsDocumentWriter.m_pRels);
|
||||
m_oParamsWriter.m_pOfficeDrawingConverter->ClearShapeTypes();
|
||||
|
||||
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
|
||||
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
|
||||
oBinaryDocumentTableWriter.poDocument = poDocument;
|
||||
oBinaryDocumentTableWriter.pBackground = oDocx.m_pDocument->m_oBackground.GetPointer();
|
||||
oBinaryDocumentTableWriter.poDocument = oDocx.m_pDocument;
|
||||
|
||||
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
|
||||
|
||||
//Write Vba
|
||||
if(NULL != oDocx.m_pVbaProject)
|
||||
{
|
||||
@ -7966,9 +7932,22 @@ namespace BinDocxRW
|
||||
oBinaryDocumentTableWriter.WriteVbaProject(*oDocx.m_pVbaProject);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
//Write JsaProject
|
||||
if (NULL != oDocx.m_pJsaProject)
|
||||
{
|
||||
BYTE* pData = NULL;
|
||||
DWORD nBytesCount;
|
||||
if(NSFile::CFileBinary::ReadAllBytes(oDocx.m_pJsaProject->filename().GetPath(), &pData, nBytesCount))
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
|
||||
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
}
|
||||
|
||||
// Write content
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
|
||||
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
|
||||
oBinaryDocumentTableWriter.Write(oDocx.m_pDocument->m_arrItems);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
|
||||
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::HdrFtr);
|
||||
|
||||
@ -298,7 +298,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const std::wstring& sSrcFileName,
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
|
||||
@ -16,8 +16,6 @@ include($$PWD/../../Common/3dParty/boost/boost.pri)
|
||||
|
||||
DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
USE_AVSOFFICESTUDIO_XMLUTILS \
|
||||
SOLUTION_ASCOFFICEDOCXFILE2 \
|
||||
#DISABLE_FILE_DOWNLOADER \
|
||||
|
||||
@ -22,8 +22,6 @@ include($$PWD/../../Common/3dParty/boost/boost.pri)
|
||||
DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
LIBXML_READER_ENABLED \
|
||||
DONT_WRITE_EMBEDDED_FONTS
|
||||
|
||||
@ -288,6 +286,7 @@ SOURCES += \
|
||||
../src/docx/xlsx_table_state.cpp \
|
||||
../src/docx/xlsx_textcontext.cpp \
|
||||
../src/docx/xlsx_pivots_context.cpp \
|
||||
../src/docx/xlsx_data_validation.cpp \
|
||||
../src/docx/xlsx_utils.cpp \
|
||||
../src/docx/xlsx_xf.cpp
|
||||
}
|
||||
@ -551,6 +550,7 @@ HEADERS += \
|
||||
../src/docx/xlsx_table_position.h \
|
||||
../src/docx/xlsx_table_state.h \
|
||||
../src/docx/xlsx_textcontext.h \
|
||||
../src/docx/xlsx_data_validation.h \
|
||||
../src/docx/xlsx_utils.h \
|
||||
../src/docx/xlsx_xf.h \
|
||||
../include/logging.h \
|
||||
|
||||
@ -101,3 +101,4 @@
|
||||
#include "../src/docx/xlsx_utils.cpp"
|
||||
#include "../src/docx/xlsx_xf.cpp"
|
||||
#include "../src/docx/xlsx_pivots_context.cpp"
|
||||
#include "../src/docx/xlsx_data_validation.cpp""
|
||||
|
||||
@ -777,7 +777,8 @@ void docx_conversion_context::process_section(std::wostream & strm, odf_reader::
|
||||
{
|
||||
double page_width = 0;
|
||||
const odf_reader::page_layout_instance * pp = root()->odf_context().pageLayoutContainer().page_layout_first();
|
||||
if (pp)
|
||||
|
||||
if ((pp) && (pp->properties()))
|
||||
{
|
||||
odf_reader::style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
|
||||
if (attr_page.fo_page_width_)
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
#include "../../DesktopEditor/common/File.h"
|
||||
#include "../../DesktopEditor/raster/Metafile/MetaFile.h"
|
||||
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
|
||||
#include "../../Common/DocxFormat/Source/Base/Base.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
@ -284,8 +285,8 @@ 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 Online Editor</dc:creator>";
|
||||
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE Online Editor</cp:lastModifiedBy>";
|
||||
//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>";
|
||||
|
||||
@ -300,8 +301,12 @@ void app_file::write(const std::wstring & RootPath)
|
||||
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
|
||||
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
|
||||
|
||||
resStream << L"<Application>OnlyOffice</Application>";
|
||||
resStream << L"</Properties>";
|
||||
resStream << L"<Application>ONLYOFFICE";
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
resStream << L"/" << std::wstring(s.begin(), s.end()) ;
|
||||
#endif
|
||||
resStream << L"</Application></Properties>";
|
||||
|
||||
simple_element elm(L"app.xml", resStream.str());
|
||||
elm.write(RootPath);
|
||||
|
||||
@ -116,7 +116,7 @@ public:
|
||||
int priority = 1;
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
for (int i = 0 ; i < conditionalFormattings_.size(); i++)
|
||||
for (size_t i = 0 ; i < conditionalFormattings_.size(); i++)
|
||||
{
|
||||
conditionalFormatting & c = conditionalFormattings_[i];
|
||||
|
||||
@ -126,7 +126,7 @@ public:
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", c.ref);
|
||||
|
||||
for (int j = 0 ; j < c.rules.size(); j++)
|
||||
for (size_t j = 0 ; j < c.rules.size(); j++)
|
||||
{
|
||||
if (c.rules[j].type < 1 || c.rules[j].type > 5) continue;
|
||||
|
||||
@ -171,7 +171,7 @@ public:
|
||||
if (c.rules[j].minLength) CP_XML_ATTR(L"minLength", *c.rules[j].minLength);
|
||||
if (c.rules[j].maxLength) CP_XML_ATTR(L"maxLength", *c.rules[j].maxLength);
|
||||
|
||||
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
@ -189,11 +189,11 @@ public:
|
||||
CP_XML_ATTR(L"type", L"colorScale");
|
||||
CP_XML_NODE(L"colorScale")
|
||||
{
|
||||
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
for (int k = 0; k < c.rules[j].color.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].color.size(); k++)
|
||||
{
|
||||
CP_XML_NODE(L"color")
|
||||
{
|
||||
@ -209,7 +209,7 @@ public:
|
||||
{
|
||||
if (c.rules[j].showValue) CP_XML_ATTR(L"showValue", *c.rules[j].showValue);
|
||||
|
||||
for (int k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
for (size_t k = 0; k < c.rules[j].cfvo.size(); k++)
|
||||
{
|
||||
c.rules[j].cfvo[k].serialize(CP_XML_STREAM());
|
||||
}
|
||||
|
||||
212
ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp
Normal file
212
ASCOfficeOdfFile/src/docx/xlsx_data_validation.cpp
Normal file
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#include "xlsx_data_validation.h"
|
||||
#include "xlsx_utils.h"
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <cpdoccore/xml/simple_xml_writer.h>
|
||||
#include <cpdoccore/CPSharedPtr.h>
|
||||
|
||||
#include "../formulasconvert/formulasconvert.h"
|
||||
#include "../../../Common/DocxFormat/Source/XML/Utils.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_dataValidation
|
||||
{
|
||||
public:
|
||||
xlsx_dataValidation() : showErrorMessage(false), showInputMessage(false), showDropDown(false), allowBlank(false) {}
|
||||
|
||||
std::wstring ref;
|
||||
std::wstring activate_ref;
|
||||
std::wstring type;
|
||||
std::wstring formula1;
|
||||
std::wstring formula2;
|
||||
std::wstring operator_;
|
||||
bool showErrorMessage;
|
||||
bool showInputMessage;
|
||||
bool showDropDown;
|
||||
bool allowBlank;
|
||||
};
|
||||
typedef shared_ptr<xlsx_dataValidation>::Type xlsx_dataValidation_ptr;
|
||||
|
||||
class xlsx_dataValidations_context::Impl
|
||||
{
|
||||
public:
|
||||
|
||||
void serialize(std::wostream & _Wostream)
|
||||
{
|
||||
if (mapActivateDataValidations.empty()) return;
|
||||
|
||||
CP_XML_WRITER(_Wostream)
|
||||
{
|
||||
CP_XML_NODE(L"dataValidations")
|
||||
{
|
||||
CP_XML_ATTR(L"count", mapActivateDataValidations.size());
|
||||
|
||||
for (std::map<std::wstring, xlsx_dataValidation_ptr>::iterator it = mapActivateDataValidations.begin();
|
||||
it != mapActivateDataValidations.end(); ++it)
|
||||
{
|
||||
CP_XML_NODE(L"dataValidation")
|
||||
{
|
||||
CP_XML_ATTR(L"sqref", it->second->activate_ref);
|
||||
CP_XML_ATTR(L"allowBlank", it->second->allowBlank);
|
||||
CP_XML_ATTR(L"operator", it->second->operator_);
|
||||
CP_XML_ATTR(L"showDropDown", it->second->showDropDown);
|
||||
CP_XML_ATTR(L"showErrorMessage", it->second->showErrorMessage);
|
||||
CP_XML_ATTR(L"showInputMessage", it->second->showInputMessage);
|
||||
CP_XML_ATTR(L"type", it->second->type);
|
||||
|
||||
if (!it->second->formula1.empty())
|
||||
{
|
||||
CP_XML_NODE(L"formula1")
|
||||
{
|
||||
CP_XML_STREAM() << it->second->formula1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!it->second->formula2.empty())
|
||||
{
|
||||
CP_XML_NODE(L"formula2")
|
||||
{
|
||||
CP_XML_STREAM() << it->second->formula2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mapActivateDataValidations.clear();
|
||||
}
|
||||
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapDataValidations; //for all tables
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr> mapActivateDataValidations; //in current table
|
||||
};
|
||||
|
||||
xlsx_dataValidations_context::xlsx_dataValidations_context() :
|
||||
impl_(new xlsx_dataValidations_context::Impl())
|
||||
{}
|
||||
|
||||
xlsx_dataValidations_context::~xlsx_dataValidations_context()
|
||||
{
|
||||
}
|
||||
void xlsx_dataValidations_context::serialize(std::wostream & _Wostream)
|
||||
{
|
||||
return impl_->serialize(_Wostream);
|
||||
}
|
||||
void xlsx_dataValidations_context::activate(const std::wstring & name, const std::wstring & ref)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFindActivate = impl_->mapActivateDataValidations.find(name);
|
||||
|
||||
if (pFindActivate != impl_->mapActivateDataValidations.end())
|
||||
{
|
||||
pFindActivate->second->activate_ref += L" " + ref;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind != impl_->mapDataValidations.end())
|
||||
{
|
||||
pFind->second->activate_ref = ref;
|
||||
impl_->mapActivateDataValidations.insert(std::make_pair(name, pFind->second));
|
||||
}
|
||||
}
|
||||
}
|
||||
void xlsx_dataValidations_context::add_help_msg(const std::wstring & name, bool val)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showInputMessage = val;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_error_msg(const std::wstring & name, bool val)
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
pFind->second->showErrorMessage = val;
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add(const std::wstring & name, const std::wstring &ref)
|
||||
{
|
||||
xlsx_dataValidation_ptr _new = xlsx_dataValidation_ptr(new xlsx_dataValidation());
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
_new->ref = converter.convert_named_ref(ref, false, L";");
|
||||
|
||||
impl_->mapDataValidations.insert(std::make_pair(name, _new));
|
||||
}
|
||||
|
||||
void xlsx_dataValidations_context::add_formula(const std::wstring & name, const std::wstring & f) // todooo пооптимальней
|
||||
{
|
||||
std::map<std::wstring, xlsx_dataValidation_ptr>::iterator pFind = impl_->mapDataValidations.find(name);
|
||||
|
||||
if (pFind == impl_->mapDataValidations.end()) return;
|
||||
|
||||
formulasconvert::odf2oox_converter converter;
|
||||
int pos = -1;
|
||||
std::wstring val;
|
||||
|
||||
if ( 0 <= (pos = f.find(L"cell-content-is-in-list"))) //oooc: , of:
|
||||
{
|
||||
pFind->second->type = L"list";
|
||||
val = f.substr(24 + pos, f.size() - 25 - pos);
|
||||
|
||||
if ( val.substr(0, 1) == L"\"")
|
||||
{
|
||||
XmlUtils::replace_all(val, L"\"", L"");
|
||||
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
|
||||
if ( std::wstring::npos != val.find(L";") )//convert formula replacing ; on ,
|
||||
{
|
||||
pFind->second->formula1 = L"\"" + pFind->second->formula1 + L"\"";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pFind->second->formula1 = converter.convert(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,44 +1,61 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef COMMON_UTILS_INCLUDE_H_
|
||||
#define COMMON_UTILS_INCLUDE_H_
|
||||
|
||||
#include "../SystemUtility/SystemUtility.h"
|
||||
#include <vector>
|
||||
|
||||
namespace Common
|
||||
{
|
||||
void readAllShapeTypes(const OOX::CPath& oPath, std::vector<std::wstring>& aShapetypes);
|
||||
} // namespace Common
|
||||
|
||||
#endif // COMMON_UTILS_INCLUDE_H_
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <cpdoccore/CPOptional.h>
|
||||
#include <cpdoccore/CPScopedPtr.h>
|
||||
#include <string>
|
||||
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
class xlsx_dataValidations_context
|
||||
{
|
||||
public:
|
||||
xlsx_dataValidations_context();
|
||||
~xlsx_dataValidations_context();
|
||||
|
||||
void add(const std::wstring & name, const std::wstring & ref);
|
||||
void add_formula(const std::wstring & name, const std::wstring & f);
|
||||
void add_help_msg(const std::wstring & name, bool val);
|
||||
void add_error_msg(const std::wstring & name, bool val);
|
||||
|
||||
void activate(const std::wstring & name, const std::wstring & ref);
|
||||
|
||||
void serialize(std::wostream & _Wostream);
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
@ -54,6 +54,8 @@ public:
|
||||
std::wstringstream sort_;
|
||||
std::wstringstream autofilter_;
|
||||
std::wstringstream conditionalFormatting_;
|
||||
std::wstringstream picture_background_;
|
||||
std::wstringstream dataValidations_;
|
||||
std::wstringstream ole_objects_;
|
||||
std::wstringstream page_props_;
|
||||
|
||||
@ -138,7 +140,14 @@ std::wostream & xlsx_xml_worksheet::page_properties()
|
||||
{
|
||||
return impl_->page_props_;
|
||||
}
|
||||
|
||||
std::wostream & xlsx_xml_worksheet::picture_background()
|
||||
{
|
||||
return impl_->picture_background_;
|
||||
}
|
||||
std::wostream & xlsx_xml_worksheet::dataValidations()
|
||||
{
|
||||
return impl_->dataValidations_;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
rels & xlsx_xml_worksheet::sheet_rels()
|
||||
{
|
||||
@ -178,6 +187,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
|
||||
CP_XML_STREAM() << impl_->conditionalFormatting_.str();
|
||||
|
||||
CP_XML_STREAM() << impl_->dataValidations_.str();
|
||||
if (!impl_->hyperlinks_.str().empty())
|
||||
{
|
||||
CP_XML_NODE(L"hyperlinks")
|
||||
@ -207,6 +217,7 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
|
||||
CP_XML_STREAM() << impl_->ole_objects_.str();
|
||||
}
|
||||
}
|
||||
CP_XML_STREAM() << impl_->picture_background_.str();
|
||||
|
||||
//CP_XML_NODE(L"headerFooter){}
|
||||
|
||||
|
||||
@ -61,6 +61,8 @@ public:
|
||||
std::wostream & comments();
|
||||
std::wostream & autofilter();
|
||||
std::wostream & conditionalFormatting();
|
||||
std::wostream & picture_background();
|
||||
std::wostream & dataValidations();
|
||||
std::wostream & sort();
|
||||
std::wostream & ole_objects();
|
||||
std::wostream & page_properties();
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
xlsx_table_metrics & get_table_metrics() { return xlsx_table_metrics_; }
|
||||
xlsx_drawing_context & get_drawing_context() { return xlsx_drawing_context_; }
|
||||
xlsx_comments_context & get_comments_context() { return xlsx_comments_context_; }
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() {return xlsx_conditionalFormatting_context_;}
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context() { return xlsx_conditionalFormatting_context_;}
|
||||
|
||||
void table_column_last_width(double w) { table_column_last_width_ = w; }
|
||||
double table_column_last_width() const { return table_column_last_width_; };
|
||||
|
||||
@ -324,6 +324,10 @@ void xlsx_table_context::serialize_background(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_background(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_data_validation(std::wostream & _Wostream)
|
||||
{
|
||||
return xlsx_conversion_context_->get_dataValidations_context().serialize(_Wostream);
|
||||
}
|
||||
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
|
||||
{
|
||||
return state()->serialize_hyperlinks(_Wostream);
|
||||
|
||||
@ -91,6 +91,7 @@ public:
|
||||
void serialize_ole_objects (std::wostream & _Wostream);
|
||||
void serialize_page_properties (std::wostream & _Wostream);
|
||||
void serialize_background (std::wostream & _Wostream);
|
||||
void serialize_data_validation (std::wostream & _Wostream);
|
||||
|
||||
xlsx_table_metrics & get_table_metrics();
|
||||
|
||||
|
||||
@ -49,13 +49,6 @@
|
||||
namespace cpdoccore {
|
||||
namespace oox {
|
||||
|
||||
void removeCharsFromString( std::wstring &str, std::wstring charsToRemove )
|
||||
{
|
||||
for ( unsigned int i = 0; i < charsToRemove.length(); ++i )
|
||||
{
|
||||
str.erase( std::remove(str.begin(), str.end(), charsToRemove[i]), str.end() );
|
||||
}
|
||||
}
|
||||
|
||||
class xlsx_text_context::Impl: boost::noncopyable
|
||||
{
|
||||
|
||||
@ -437,6 +437,7 @@ void xlsx_conversion_context::end_table()
|
||||
get_table_context().serialize_autofilter (current_sheet().autofilter());
|
||||
get_table_context().serialize_sort (current_sheet().sort());
|
||||
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
|
||||
get_table_context().serialize_data_validation (current_sheet().dataValidations());
|
||||
|
||||
get_drawing_context().set_odf_packet_path (root()->get_folder());
|
||||
get_drawing_context().process_objects (get_table_metrics());
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#include "xlsx_defined_names.h"
|
||||
#include "xlsx_table_metrics.h"
|
||||
#include "xlsx_pivots_context.h"
|
||||
#include "xlsx_data_validation.h"
|
||||
#include "oox_chart_context.h"
|
||||
|
||||
#include "mediaitems.h"
|
||||
@ -179,6 +180,7 @@ public:
|
||||
xlsx_drawing_context_handle & get_drawing_context_handle();
|
||||
xlsx_comments_context & get_comments_context();
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_dataValidations_context& get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
mediaitems & get_mediaitems() { return mediaitems_; }
|
||||
|
||||
@ -212,6 +214,7 @@ private:
|
||||
xlsx_pivots_context xlsx_pivots_context_;
|
||||
xlsx_drawing_context_handle xlsx_drawing_context_handle_;
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -233,8 +233,9 @@ void object_odf_context::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.set_paragraph_state (false);
|
||||
Context.set_run_state (false);
|
||||
|
||||
Context.get_math_context().base_font_size_ = baseFontHeight_;
|
||||
|
||||
Context.start_math_formula();
|
||||
Context.get_math_context().base_font_size_ = baseFontHeight_;
|
||||
office_math_->oox_convert(Context.get_math_context());
|
||||
Context.end_math_formula();
|
||||
|
||||
|
||||
@ -41,9 +41,10 @@ std::wostream & operator << (std::wostream & _Wostream, const chart_data_label_n
|
||||
{
|
||||
switch(_Val.get_type())
|
||||
{
|
||||
case chart_data_label_number::none: _Wostream << L"none"; break;
|
||||
case chart_data_label_number::value: _Wostream << L"value"; break;
|
||||
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
|
||||
case chart_data_label_number::none: _Wostream << L"none"; break;
|
||||
case chart_data_label_number::value: _Wostream << L"value"; break;
|
||||
case chart_data_label_number::percentage : _Wostream << L"percentage"; break;
|
||||
case chart_data_label_number::value_and_percentage: _Wostream << L"value-and-percentage"; break;
|
||||
}
|
||||
return _Wostream;
|
||||
}
|
||||
@ -59,9 +60,10 @@ chart_data_label_number chart_data_label_number::parse(const std::wstring & Str)
|
||||
return chart_data_label_number( value );
|
||||
else if (tmp == L"percentage")
|
||||
return chart_data_label_number( percentage );
|
||||
else
|
||||
else if (tmp == L"value-and-percentage")
|
||||
return chart_data_label_number( value_and_percentage );
|
||||
else
|
||||
{
|
||||
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
|
||||
return chart_data_label_number( none );
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +45,8 @@ public:
|
||||
{
|
||||
none,
|
||||
value,
|
||||
percentage
|
||||
percentage,
|
||||
value_and_percentage
|
||||
};
|
||||
|
||||
chart_data_label_number() {}
|
||||
|
||||
@ -61,6 +61,7 @@ private:
|
||||
|
||||
document_context::document_context() : impl_( new document_context::Impl() )
|
||||
{
|
||||
level = 0;
|
||||
}
|
||||
|
||||
document_context::~document_context()
|
||||
|
||||
@ -45,10 +45,11 @@ class document_context
|
||||
public:
|
||||
document_context();
|
||||
virtual ~document_context();
|
||||
|
||||
public:
|
||||
|
||||
void set_last_paragraph(text::paragraph * Paragraph);
|
||||
text::paragraph * get_last_paragraph();
|
||||
|
||||
int level;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
|
||||
@ -151,6 +151,8 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (page_layout_instance * lastPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
|
||||
lastPageLayout->docx_serialize(Context.output_stream(), Context);
|
||||
//Context.remove_page_properties();
|
||||
}
|
||||
|
||||
@ -80,7 +80,16 @@ void chart_chart::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
|
||||
void chart_chart::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
if CP_CHECK_NAME(L"text", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"content-validations")
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_validations_);
|
||||
}
|
||||
else
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
void chart_title_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
|
||||
@ -60,7 +60,10 @@ private:
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
|
||||
|
||||
public:
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr content_validations_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
|
||||
@ -105,6 +108,10 @@ private:
|
||||
|
||||
public:
|
||||
chart_chart_attlist attlist_;
|
||||
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr content_validations_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
|
||||
|
||||
@ -233,6 +233,14 @@ enum ElementType
|
||||
typeTableDatabaseRange,
|
||||
typeTableSort,
|
||||
typeTableSortBy,
|
||||
typeTableCalculationSettings,
|
||||
typeTableNullDate,
|
||||
typeTableShapes,
|
||||
typeTableContentValidation,
|
||||
typeTableContentValidations,
|
||||
typeTableHelpMassage,
|
||||
typeTableErrorMassage,
|
||||
typeTableErrorMacro,
|
||||
|
||||
typeTableFilter,
|
||||
typeTableFilterAnd,
|
||||
@ -411,9 +419,6 @@ enum ElementType
|
||||
|
||||
typeScriptEventListener,
|
||||
|
||||
typeTableCalculationSettings,
|
||||
typeTableNullDate,
|
||||
|
||||
typeNumberNumberStyle,
|
||||
typeNumberDataStyle,
|
||||
typeNumberText,
|
||||
@ -436,7 +441,6 @@ enum ElementType
|
||||
typeNumberMinutes,
|
||||
typeNumberSeconds,
|
||||
typeNumberAmPm,
|
||||
typeTableShapes,
|
||||
|
||||
typeChartChart,
|
||||
typeChartTitle,
|
||||
|
||||
@ -54,11 +54,25 @@ const wchar_t * office_presentation::name = L"presentation";
|
||||
void office_presentation::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
if CP_CHECK_NAME(L"draw", L"page")
|
||||
{
|
||||
CP_CREATE_ELEMENT(pages_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"tracked-changes")
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"content-validations")
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_validations_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"presentation", L"footer-decl")
|
||||
{
|
||||
CP_CREATE_ELEMENT(footer_decls_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"presentation", L"date-time-decl")
|
||||
{
|
||||
CP_CREATE_ELEMENT(date_time_decls_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -62,10 +62,13 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
office_element_ptr_array date_time_decls_;
|
||||
office_element_ptr_array footer_decls_;
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr content_validations_;
|
||||
|
||||
office_element_ptr_array date_time_decls_;
|
||||
office_element_ptr_array footer_decls_;
|
||||
|
||||
office_element_ptr_array pages_;
|
||||
office_element_ptr_array pages_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -63,6 +63,10 @@ void office_spreadsheet::add_child_element( xml::sax * Reader, const std::wstrin
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"content-validations")
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_validations_);
|
||||
}
|
||||
else
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
@ -88,6 +92,9 @@ void office_spreadsheet::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (database_ranges_)
|
||||
database_ranges_->xlsx_convert(Context);
|
||||
|
||||
if (content_validations_)
|
||||
content_validations_->xlsx_convert(Context);
|
||||
|
||||
if (data_pilot_tables_)
|
||||
data_pilot_tables_->xlsx_convert(Context);
|
||||
|
||||
|
||||
@ -62,12 +62,12 @@ public:
|
||||
office_element_ptr database_ranges_;
|
||||
office_element_ptr data_pilot_tables_;
|
||||
office_element_ptr tracked_changes_;
|
||||
|
||||
office_element_ptr content_validations_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
// table:calculation-settings
|
||||
// table:consolidation
|
||||
// table:content-validations
|
||||
// table:dde-links
|
||||
// table:label-ranges
|
||||
|
||||
|
||||
@ -101,6 +101,10 @@ void office_text::add_child_element( xml::sax * Reader, const std::wstring & Ns,
|
||||
{
|
||||
CP_CREATE_ELEMENT(tracked_changes_);
|
||||
}
|
||||
else if CP_CHECK_NAME(L"table", L"content-validations")
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_validations_);
|
||||
}
|
||||
else if (is_text_content(Ns, Name))
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
|
||||
@ -67,7 +67,9 @@ private:
|
||||
// TODO: table-decls
|
||||
|
||||
office_element_ptr tracked_changes_;
|
||||
office_element_ptr_array content_;
|
||||
office_element_ptr content_validations_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
// TODO: text-page-sequence
|
||||
// TODO: office-text-content-epilogue:
|
||||
// TODO: table-functions
|
||||
|
||||
@ -213,7 +213,7 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
|
||||
double kf_max_width_ms =1.;
|
||||
|
||||
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();//
|
||||
if (pp)
|
||||
if ((pp) && (pp->properties()))
|
||||
{
|
||||
style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
|
||||
if (attr_page.fo_page_width_)
|
||||
|
||||
@ -53,7 +53,7 @@ namespace odf_reader {
|
||||
|
||||
void removeCharsFromString( std::wstring &str, std::wstring charsToRemove )
|
||||
{
|
||||
for ( unsigned int i = 0; i < charsToRemove.length(); ++i )
|
||||
for ( size_t i = 0; i < charsToRemove.length(); ++i )
|
||||
{
|
||||
str.erase( std::remove(str.begin(), str.end(), charsToRemove[i]), str.end() );
|
||||
}
|
||||
@ -292,14 +292,14 @@ void text_format_properties_content::pptx_convert_as_list(oox::pptx_conversion_c
|
||||
w_font = font->name();
|
||||
|
||||
//'Arial' глючит
|
||||
removeCharsFromString(w_font, _T("'"));
|
||||
removeCharsFromString(w_font, L"'");
|
||||
}
|
||||
|
||||
if (w_font.length()>0)
|
||||
{
|
||||
CP_XML_NODE(L"a:buFont")
|
||||
{
|
||||
removeCharsFromString(w_font, _T("'"));
|
||||
removeCharsFromString(w_font, L"'");
|
||||
CP_XML_ATTR(L"typeface", w_font);
|
||||
if ((style_font_charset_))
|
||||
{
|
||||
|
||||
@ -728,7 +728,61 @@ void table_shapes::add_child_element( xml::sax * Reader, const std::wstring & Ns
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:content-validations
|
||||
const wchar_t * table_content_validations::ns = L"table";
|
||||
const wchar_t * table_content_validations::name = L"content-validations";
|
||||
|
||||
void table_content_validations::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:content-validation
|
||||
const wchar_t * table_content_validation::ns = L"table";
|
||||
const wchar_t * table_content_validation::name = L"content-validation";
|
||||
|
||||
void table_content_validation::add_attributes(xml::attributes_wc_ptr const & Attributes)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:name", table_name_);
|
||||
CP_APPLY_ATTR(L"table:condition", table_condition_);
|
||||
CP_APPLY_ATTR(L"table:display-list", table_display_list_);
|
||||
CP_APPLY_ATTR(L"table:allowempty-cell", table_allowempty_cell_);
|
||||
CP_APPLY_ATTR(L"table:base-cell-address", table_base_cell_address_);
|
||||
}
|
||||
void table_content_validation::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:content-validation
|
||||
const wchar_t * table_error_message::ns = L"table";
|
||||
const wchar_t * table_error_message::name = L"error-message";
|
||||
|
||||
void table_error_message::add_attributes(xml::attributes_wc_ptr const & Attributes)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:title", table_title_);
|
||||
CP_APPLY_ATTR(L"table:message-type", table_message_type_);
|
||||
CP_APPLY_ATTR(L"table:display", table_display_);
|
||||
}
|
||||
void table_error_message::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// table:content-validation
|
||||
const wchar_t * table_help_message::ns = L"table";
|
||||
const wchar_t * table_help_message::name = L"help-message";
|
||||
|
||||
void table_help_message::add_attributes(xml::attributes_wc_ptr const & Attributes)
|
||||
{
|
||||
CP_APPLY_ATTR(L"table:title", table_title_);
|
||||
CP_APPLY_ATTR(L"table:message-type", table_message_type_);
|
||||
CP_APPLY_ATTR(L"table:display", table_display_);
|
||||
}
|
||||
void table_help_message::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
CP_CREATE_ELEMENT(content_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,6 +653,7 @@ public:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_table);
|
||||
|
||||
//table:content-shapes
|
||||
class table_shapes : public office_element_impl<table_shapes>
|
||||
{
|
||||
public:
|
||||
@ -676,5 +677,105 @@ private:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_shapes);
|
||||
|
||||
//table:content-validations
|
||||
class table_content_validations : public office_element_impl<table_content_validations>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableContentValidations;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
|
||||
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);
|
||||
|
||||
office_element_ptr_array content_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_content_validations);
|
||||
|
||||
//table:content-validation
|
||||
class table_content_validation : public office_element_impl<table_content_validation>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableContentValidation;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
|
||||
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_OPT(std::wstring) table_name_;
|
||||
_CP_OPT(odf_types::Bool) table_allowempty_cell_;
|
||||
_CP_OPT(std::wstring) table_display_list_;
|
||||
_CP_OPT(std::wstring) table_condition_;
|
||||
_CP_OPT(std::wstring) table_base_cell_address_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_content_validation);
|
||||
|
||||
//table:error-message
|
||||
class table_error_message : public office_element_impl<table_error_message>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableErrorMassage;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
|
||||
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_OPT(std::wstring) table_title_;
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
_CP_OPT(std::wstring) table_message_type_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_error_message);
|
||||
|
||||
//table:help-message
|
||||
class table_help_message : public office_element_impl<table_help_message>
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
static const ElementType type = typeTableHelpMassage;
|
||||
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context) ;
|
||||
|
||||
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_OPT(std::wstring) table_title_;
|
||||
_CP_OPT(odf_types::Bool) table_display_;
|
||||
_CP_OPT(std::wstring) table_message_type_;
|
||||
|
||||
office_element_ptr_array content_;
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(table_help_message);
|
||||
|
||||
//table:error-macro
|
||||
}
|
||||
}
|
||||
|
||||
@ -803,11 +803,13 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
is_style_visible = (!cellStyleName.empty() || defaultColumnCellStyle) ? true : false;
|
||||
|
||||
if ( content_.elements_.size() > 0 ||
|
||||
!formula.empty() ||
|
||||
if ( content_.elements_.size() > 0 || attlist_.table_content_validation_name_ || !formula.empty() ||
|
||||
( t_val == oox::XlsxCellType::n && !number_val.empty()) ||
|
||||
( t_val == oox::XlsxCellType::b && bool_val) ||
|
||||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val)) is_data_visible = true;
|
||||
(( t_val == oox::XlsxCellType::str || oox::XlsxCellType::inlineStr) && str_val))
|
||||
{
|
||||
is_data_visible = true;
|
||||
}
|
||||
|
||||
if (attlist_.table_number_columns_repeated_ < 199 && last_cell_) last_cell_ = false;
|
||||
|
||||
@ -837,15 +839,20 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
|
||||
|
||||
if (skip_next_cell)break;
|
||||
|
||||
// пустые ячейки пропускаем.
|
||||
|
||||
// пустые ячейки пропускаем.
|
||||
if ( is_data_visible || ((cellStyle || defaultColumnCellStyle) && is_style_visible))
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
std::wstring ref = oox::getCellAddress(Context.current_table_column(), Context.current_table_row());
|
||||
if (attlist_.table_content_validation_name_)
|
||||
{
|
||||
Context.get_dataValidations_context().activate(*attlist_.table_content_validation_name_, ref);
|
||||
}
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"c")
|
||||
{
|
||||
CP_XML_ATTR(L"r", oox::getCellAddress(Context.current_table_column(), Context.current_table_row()));
|
||||
CP_XML_ATTR(L"r", ref);
|
||||
CP_XML_ATTR(L"t", oox::cellType2Str(t_val));
|
||||
CP_XML_ATTR(L"s", xfId_last_set);
|
||||
|
||||
@ -887,6 +894,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
CP_XML_NODE(L"v") { CP_XML_CONTENT((int)(bool_val.get())); }
|
||||
}
|
||||
|
||||
}
|
||||
if ( is_data_visible || (cellStyle && is_style_visible && !last_cell_))
|
||||
{
|
||||
@ -1179,5 +1187,38 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
|
||||
}
|
||||
}
|
||||
|
||||
void table_content_validations::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
void table_content_validation::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
std::wstring name = table_name_.get_value_or(L"");
|
||||
|
||||
Context.get_dataValidations_context().add(name, table_base_cell_address_.get_value_or(L""));
|
||||
Context.get_dataValidations_context().add_formula(name, table_condition_.get_value_or(L""));
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
if (content_[i]->get_type() == typeTableErrorMassage)
|
||||
{
|
||||
Context.get_dataValidations_context().add_error_msg(name, true);
|
||||
}
|
||||
else if (content_[i]->get_type() == typeTableErrorMassage)
|
||||
{
|
||||
Context.get_dataValidations_context().add_help_msg(name, true);
|
||||
}
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
}
|
||||
void table_error_message::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
void table_help_message::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,14 +312,29 @@ void paragraph::afterCreate(document_context * Context)
|
||||
// вызывается сразу после создания объекта
|
||||
if (Context)
|
||||
{
|
||||
// выставляем у предыдущего параграфа указатель на следующий (т.е. на вновь созданный)
|
||||
if (paragraph * prevPar = Context->get_last_paragraph())
|
||||
prevPar->set_next(this);
|
||||
|
||||
// запоминаем в контексте вновь созданный параграф
|
||||
Context->set_last_paragraph(this);
|
||||
Context->level++;
|
||||
// выставляем у предыдущего параграфа указатель на следующий (т.е. на вновь созданный)
|
||||
|
||||
if (Context->level == 1)
|
||||
{
|
||||
if (paragraph * prevPar = Context->get_last_paragraph())
|
||||
{
|
||||
prevPar->set_next(this);
|
||||
}
|
||||
|
||||
// запоминаем в контексте вновь созданный параграф
|
||||
Context->set_last_paragraph(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
void paragraph::afterReadContent(document_context * Context)
|
||||
{
|
||||
if (Context)
|
||||
{
|
||||
Context->level--;
|
||||
}
|
||||
}
|
||||
|
||||
const wchar_t * emptyParagraphContent = L"<w:pPr></w:pPr><w:r><w:rPr></w:rPr></w:r>";
|
||||
|
||||
const wchar_t * emptyParagraphDrawing = L"<w:p><w:pPr></w:pPr></w:p>";
|
||||
@ -435,27 +450,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
std::wostream & _Wostream = Context.output_stream();
|
||||
|
||||
if (next_par_)
|
||||
{
|
||||
// проверяем не сменит ли следующий параграф свойства страницы.
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в конце текущего параграфа
|
||||
// распечатать свойства раздела
|
||||
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
|
||||
|
||||
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
is_empty = false;
|
||||
}
|
||||
}
|
||||
if (next_section_ || next_end_section_)
|
||||
{
|
||||
Context.get_section_context().get().is_dump_ = true;
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(styleName);
|
||||
|
||||
if (masterPageName)
|
||||
@ -469,6 +463,27 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
is_empty = false;
|
||||
}
|
||||
|
||||
if (next_par_)
|
||||
{
|
||||
// проверяем не сменит ли следующий параграф свойства страницы.
|
||||
// если да — устанавливаем контексту флаг на то что необходимо в текущем параграфе
|
||||
// распечатать свойства раздела/секции
|
||||
//проверить ... не она ли текущая - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
|
||||
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
|
||||
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
|
||||
|
||||
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
|
||||
{
|
||||
Context.next_dump_page_properties(true);
|
||||
is_empty = false;
|
||||
}
|
||||
}
|
||||
if (next_section_/* || next_end_section_*/)
|
||||
{
|
||||
Context.get_section_context().get().is_dump_ = true;
|
||||
is_empty = false;
|
||||
}
|
||||
std::wstringstream strm;
|
||||
if (Context.process_page_properties(strm))
|
||||
{
|
||||
@ -604,7 +619,10 @@ void h::afterCreate()
|
||||
{
|
||||
paragraph_.afterCreate( getContext() );
|
||||
}
|
||||
|
||||
void h::afterReadContent()
|
||||
{
|
||||
paragraph_.afterReadContent( getContext() );
|
||||
}
|
||||
void h::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
paragraph_.docx_convert(Context);
|
||||
@ -627,7 +645,10 @@ void p::afterCreate()
|
||||
{
|
||||
paragraph_.afterCreate( getContext() );
|
||||
}
|
||||
|
||||
void p::afterReadContent()
|
||||
{
|
||||
paragraph_.afterReadContent( getContext() );
|
||||
}
|
||||
std::wostream & p::text_to_stream(std::wostream & _Wostream) const
|
||||
{
|
||||
return paragraph_.text_to_stream(_Wostream);
|
||||
|
||||
@ -73,7 +73,8 @@ public:
|
||||
}
|
||||
|
||||
void afterCreate(document_context * ctx);
|
||||
|
||||
void afterReadContent(document_context * ctx);
|
||||
|
||||
void docx_convert (oox::docx_conversion_context & Context) ;
|
||||
void xlsx_convert (oox::xlsx_conversion_context & Context) ;
|
||||
void pptx_convert (oox::pptx_conversion_context & Context) ;
|
||||
@ -114,7 +115,9 @@ public:
|
||||
void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
virtual void afterCreate();
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
virtual void afterReadContent();
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
paragraph paragraph_;
|
||||
|
||||
@ -151,8 +154,9 @@ public:
|
||||
void pptx_convert(oox::pptx_conversion_context & Context) ;
|
||||
|
||||
virtual void afterCreate();
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
virtual void afterReadContent();
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
p(){};
|
||||
paragraph paragraph_;
|
||||
@ -245,7 +249,8 @@ public:
|
||||
void docx_convert(oox::docx_conversion_context & Context);
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
virtual void afterCreate();
|
||||
|
||||
virtual void afterCreate();
|
||||
virtual void afterReadContent();
|
||||
|
||||
private:
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4311;4267;4996;4172"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4311;4267;4996;4172"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
@ -642,6 +642,14 @@
|
||||
RelativePath="..\src\docx\xlsx_conditionalFormatting.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\docx\xlsx_data_validation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\docx\xlsx_data_validation.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\docx\xlsx_defined_names.cpp"
|
||||
>
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4311;4267;4996;4172"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4311;4267;4996;4172"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -22,8 +22,6 @@ include($$PWD/../../Common/3dParty/boost/boost.pri)
|
||||
DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
LIBXML_READER_ENABLED \
|
||||
DONT_WRITE_EMBEDDED_FONTS
|
||||
|
||||
|
||||
@ -151,13 +151,17 @@ namespace odf_writer
|
||||
CP_XML_ATTR(L"xmlns:smil", L"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0");
|
||||
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0");
|
||||
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart");
|
||||
CP_XML_ATTR(L"office:version", L"1.2");
|
||||
CP_XML_ATTR(L"office:version", L"1.2");
|
||||
|
||||
CP_XML_NODE(L"office:meta")
|
||||
{
|
||||
CP_XML_NODE(L"meta:generator")
|
||||
{
|
||||
CP_XML_STREAM() << L"ONLYOFFICE Online Editor";
|
||||
CP_XML_STREAM() << L"ONLYOFFICE";
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
CP_XML_STREAM() << L"/" << std::wstring (s.begin(), s.end() );
|
||||
#endif
|
||||
}
|
||||
CP_XML_NODE(L"meta:initial-creator");
|
||||
CP_XML_NODE(L"meta:creation-date");
|
||||
|
||||
@ -141,7 +141,7 @@ odf_writer::odf_conversion_context* DocxConverter::odf_context()
|
||||
PPTX::Theme* DocxConverter::oox_theme()
|
||||
{
|
||||
if (docx_document)
|
||||
return docx_document->GetTheme();
|
||||
return docx_document->m_pTheme;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@ -151,22 +151,17 @@ OOX::IFileContainer* DocxConverter::current_document()
|
||||
return oox_current_child_document;
|
||||
else
|
||||
{
|
||||
OOX::CDocument *oox_doc = docx_document->GetDocument();
|
||||
return dynamic_cast<OOX::IFileContainer*>(oox_doc);
|
||||
return dynamic_cast<OOX::IFileContainer*>(docx_document->m_pDocument);
|
||||
}
|
||||
}
|
||||
NSCommon::smart_ptr<OOX::File> DocxConverter::find_file_by_id(std::wstring sId)
|
||||
{
|
||||
OOX::CDocument *oox_doc = docx_document->GetDocument();
|
||||
|
||||
smart_ptr<OOX::File> oFile;
|
||||
if (oox_doc)
|
||||
{
|
||||
if (oox_current_child_document)
|
||||
oFile = oox_current_child_document->Find(sId);
|
||||
else
|
||||
oFile = oox_doc->Find(sId);
|
||||
}
|
||||
|
||||
if (oox_current_child_document)
|
||||
oFile = oox_current_child_document->Find(sId);
|
||||
else if (docx_document->m_pDocument)
|
||||
oFile = docx_document->m_pDocument->Find(sId);
|
||||
|
||||
return oFile;
|
||||
}
|
||||
@ -185,10 +180,9 @@ std::wstring DocxConverter::find_link_by_id (std::wstring sId, int type)
|
||||
}
|
||||
if (!ref.empty()) return ref;
|
||||
|
||||
OOX::CDocument *oox_doc = docx_document->GetDocument();
|
||||
if (oox_doc == NULL) return L"";
|
||||
if (docx_document->m_pDocument == NULL) return L"";
|
||||
|
||||
oFile = oox_doc->Find(sId);
|
||||
oFile = docx_document->m_pDocument->Find(sId);
|
||||
ref = OoxConverter::find_link_by(oFile, type);
|
||||
|
||||
return ref;
|
||||
@ -221,8 +215,7 @@ void DocxConverter::convertDocument()
|
||||
|
||||
void DocxConverter::convert_document()
|
||||
{
|
||||
const OOX::CDocument* document = docx_document->GetDocument();
|
||||
if (!document)return;
|
||||
if (!docx_document->m_pDocument)return;
|
||||
|
||||
std::vector<_section> sections;
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
@ -231,13 +224,13 @@ void DocxConverter::convert_document()
|
||||
|
||||
OOX::Logic::CSectionProperty* prev = NULL;
|
||||
|
||||
for (size_t i = 0; i < document->m_arrItems.size(); ++i)
|
||||
for (size_t i = 0; i < docx_document->m_pDocument->m_arrItems.size(); ++i)
|
||||
{
|
||||
if ((document->m_arrItems[i]) == NULL) continue;
|
||||
if ((docx_document->m_pDocument->m_arrItems[i]) == NULL) continue;
|
||||
|
||||
if (document->m_arrItems[i]->getType() == OOX::et_w_p)
|
||||
if (docx_document->m_pDocument->m_arrItems[i]->getType() == OOX::et_w_p)
|
||||
{
|
||||
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(document->m_arrItems[i]);
|
||||
OOX::Logic::CParagraph * para = dynamic_cast<OOX::Logic::CParagraph *>(docx_document->m_pDocument->m_arrItems[i]);
|
||||
|
||||
if ((para) && (para->m_oParagraphProperty))
|
||||
{
|
||||
@ -260,15 +253,17 @@ void DocxConverter::convert_document()
|
||||
}
|
||||
_section section;
|
||||
|
||||
section.props = document->m_oSectPr.GetPointer();
|
||||
section.props = docx_document->m_pDocument->m_oSectPr.GetPointer();
|
||||
section.start_para = last_section_start;
|
||||
section.end_para = document->m_arrItems.size();
|
||||
section.end_para = docx_document->m_pDocument->m_arrItems.size();
|
||||
section.bContinue = compare (prev, section.props);
|
||||
|
||||
sections.push_back(section);
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------
|
||||
|
||||
convert(docx_document->m_pDocument->m_oSectPr.GetPointer(), false, L"Standard");
|
||||
|
||||
odt_context->text_context()->clear_params();
|
||||
|
||||
for (size_t sect = 0; sect < sections.size(); sect++)
|
||||
@ -277,7 +272,7 @@ void DocxConverter::convert_document()
|
||||
|
||||
for (size_t i = sections[sect].start_para; i < sections[sect].end_para; ++i)
|
||||
{
|
||||
convert(document->m_arrItems[i]);
|
||||
convert(docx_document->m_pDocument->m_arrItems[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1419,7 +1414,7 @@ void DocxConverter::apply_HF_from(OOX::Logic::CSectionProperty *props, OOX::Logi
|
||||
}
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection)
|
||||
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name)
|
||||
{
|
||||
if (oox_section_pr == NULL) return;
|
||||
current_section_properties = NULL;
|
||||
@ -1444,18 +1439,24 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if (!last_section_properties && (!bSection || continuous == false || oox_section_pr->m_oTitlePg.IsInit()))
|
||||
{
|
||||
last_section_properties = oox_section_pr;
|
||||
}
|
||||
else if (!bSection || continuous == false)
|
||||
|
||||
bool bDefault = (master_name == L"Standard");
|
||||
|
||||
if (!bDefault)
|
||||
{
|
||||
apply_HF_from(last_section_properties, oox_section_pr);
|
||||
if (!last_section_properties && (!bSection || continuous == false || oox_section_pr->m_oTitlePg.IsInit()))
|
||||
{
|
||||
last_section_properties = oox_section_pr;
|
||||
}
|
||||
else if (!bSection || continuous == false)
|
||||
{
|
||||
apply_HF_from(last_section_properties, oox_section_pr);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if (!bSection || continuous == false)
|
||||
{
|
||||
odt_context->page_layout_context()->add_master_page(bSection ? L"" : L"Standard");
|
||||
odt_context->page_layout_context()->add_master_page(master_name);
|
||||
}
|
||||
|
||||
bool present_header = false;
|
||||
@ -1572,7 +1573,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
|
||||
//nullable<SimpleTypes::CDecimalNumber<> > m_oCode;
|
||||
}
|
||||
convert(docx_document->GetDocument()->m_oBackground.GetPointer(), 1);//подложка - вот в таком она месте :(, причём одна на все разделы, не как в оо
|
||||
convert(docx_document->m_pDocument->m_oBackground.GetPointer(), 1);//подложка - вот в таком она месте :(, причём одна на все разделы, не как в оо
|
||||
//nullable<ComplexTypes::Word::CTextDirection > m_oTextDirection;
|
||||
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oRtlGutter;
|
||||
//nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign;
|
||||
@ -1592,7 +1593,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
|
||||
if (continuous == false || oox_section_pr->m_oTitlePg.IsInit())
|
||||
{
|
||||
OOX::Logic::CSectionProperty* s = last_section_properties;
|
||||
OOX::Logic::CSectionProperty* s = last_section_properties ? last_section_properties : oox_section_pr;
|
||||
|
||||
bool present_title_page = s->m_oTitlePg.IsInit() ? true : false;
|
||||
bool present_odd_even_pages = odt_context->page_layout_context()->even_and_left_headers_;
|
||||
@ -1621,7 +1622,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
if (s->m_arrHeaderReference[i]->m_oId.IsInit())
|
||||
{
|
||||
convert_hdr_ftr(s->m_arrHeaderReference[i]->m_oId->GetValue());
|
||||
convert(docx_document->GetDocument()->m_oBackground.GetPointer(), 2);
|
||||
convert(docx_document->m_pDocument->m_oBackground.GetPointer(), 2);
|
||||
}
|
||||
|
||||
odt_context->end_header_footer();
|
||||
@ -1649,7 +1650,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
if (s->m_arrFooterReference[i]->m_oId.IsInit())
|
||||
{
|
||||
convert_hdr_ftr(s->m_arrFooterReference[i]->m_oId->GetValue());
|
||||
convert(docx_document->GetDocument()->m_oBackground.GetPointer(), 3);
|
||||
convert(docx_document->m_pDocument->m_oBackground.GetPointer(), 3);
|
||||
}
|
||||
|
||||
odt_context->end_header_footer();
|
||||
@ -1659,7 +1660,8 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
if (!add_odd_even_pages_footer && present_odd_even_pages) odt_context->add_empty_footer(1);
|
||||
if (!add_default_footer && (present_odd_even_pages || present_title_page)) odt_context->add_empty_footer(0);
|
||||
|
||||
odt_context->is_paragraph_in_current_section_ = true;
|
||||
if (!bDefault)
|
||||
odt_context->is_paragraph_in_current_section_ = true;
|
||||
|
||||
//odt_context->set_master_page_name(odt_context->page_layout_context()->last_master() ?
|
||||
// odt_context->page_layout_context()->last_master()->get_name() : L"");
|
||||
@ -1701,24 +1703,27 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool b
|
||||
odt_context->add_section_columns(num_columns,
|
||||
oox_section_pr->m_oCols->m_arrColumns.size() > 0 ? -1 : default_space_pt , separator );
|
||||
|
||||
std::vector<std::pair<double,double>> width_space;
|
||||
|
||||
for (size_t i = 0; i< oox_section_pr->m_oCols->m_arrColumns.size(); i++)
|
||||
if (num_columns > 1) //
|
||||
{
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i] == NULL) continue;
|
||||
std::vector<std::pair<double,double>> width_space;
|
||||
|
||||
double space = default_space_pt;
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oSpace.IsInit())
|
||||
space = oox_section_pr->m_oCols->m_arrColumns[i]->m_oSpace->ToPoints();
|
||||
|
||||
double w = -1;
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oW.IsInit())
|
||||
w = oox_section_pr->m_oCols->m_arrColumns[i]->m_oW->ToPoints();
|
||||
for (size_t i = 0; i < oox_section_pr->m_oCols->m_arrColumns.size(); i++)
|
||||
{
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i] == NULL) continue;
|
||||
|
||||
double space = default_space_pt;
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oSpace.IsInit())
|
||||
space = oox_section_pr->m_oCols->m_arrColumns[i]->m_oSpace->ToPoints();
|
||||
|
||||
width_space.push_back(std::pair<double,double>(w, space));
|
||||
}
|
||||
double w = -1;
|
||||
if (oox_section_pr->m_oCols->m_arrColumns[i]->m_oW.IsInit())
|
||||
w = oox_section_pr->m_oCols->m_arrColumns[i]->m_oW->ToPoints();
|
||||
|
||||
width_space.push_back(std::pair<double,double>(w, space));
|
||||
}
|
||||
|
||||
odt_context->add_section_column(width_space);
|
||||
odt_context->add_section_column(width_space);
|
||||
}
|
||||
}
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
|
||||
@ -2335,8 +2340,7 @@ void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::
|
||||
{
|
||||
if (oox_font_theme == NULL) return;
|
||||
|
||||
PPTX::Theme * docx_theme= docx_document->GetTheme();
|
||||
if (docx_theme == NULL) return;
|
||||
if (docx_document->m_pTheme == NULL) return;
|
||||
|
||||
std::wstring font;
|
||||
|
||||
@ -2344,23 +2348,23 @@ void DocxConverter::convert(SimpleTypes::CTheme<>* oox_font_theme, _CP_OPT(std::
|
||||
{
|
||||
case SimpleTypes::themeMajorAscii:
|
||||
case SimpleTypes::themeMajorHAnsi :
|
||||
font = docx_theme->themeElements.fontScheme.majorFont.latin.typeface;
|
||||
font = docx_document->m_pTheme->themeElements.fontScheme.majorFont.latin.typeface;
|
||||
break;
|
||||
case SimpleTypes::themeMajorBidi:
|
||||
font = docx_theme->themeElements.fontScheme.majorFont.cs.typeface;
|
||||
font = docx_document->m_pTheme->themeElements.fontScheme.majorFont.cs.typeface;
|
||||
break;
|
||||
case SimpleTypes::themeMajorEastAsia:
|
||||
font = docx_theme->themeElements.fontScheme.majorFont.ea.typeface;
|
||||
font = docx_document->m_pTheme->themeElements.fontScheme.majorFont.ea.typeface;
|
||||
break;
|
||||
case SimpleTypes::themeMinorAscii:
|
||||
case SimpleTypes::themeMinorHAnsi:
|
||||
font = docx_theme->themeElements.fontScheme.minorFont.latin.typeface;
|
||||
font = docx_document->m_pTheme->themeElements.fontScheme.minorFont.latin.typeface;
|
||||
break;
|
||||
case SimpleTypes::themeMinorBidi:
|
||||
font = docx_theme->themeElements.fontScheme.minorFont.cs.typeface;
|
||||
font = docx_document->m_pTheme->themeElements.fontScheme.minorFont.cs.typeface;
|
||||
break;
|
||||
case SimpleTypes::themeMinorEastAsia:
|
||||
font = docx_theme->themeElements.fontScheme.minorFont.ea.typeface;
|
||||
font = docx_document->m_pTheme->themeElements.fontScheme.minorFont.ea.typeface;
|
||||
break;
|
||||
}
|
||||
if (!font.empty()) odf_font_name = font;
|
||||
@ -2867,11 +2871,9 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
|
||||
}
|
||||
if(theme_color && result == false)
|
||||
{
|
||||
PPTX::Theme * docx_theme= docx_document->GetTheme();
|
||||
|
||||
std::map<std::wstring, PPTX::Logic::UniColor>::iterator pFind = docx_theme->themeElements.clrScheme.Scheme.find(theme_color->ToString());
|
||||
std::map<std::wstring, PPTX::Logic::UniColor>::iterator pFind = docx_document->m_pTheme->themeElements.clrScheme.Scheme.find(theme_color->ToString());
|
||||
|
||||
if (pFind != docx_theme->themeElements.clrScheme.Scheme.end())
|
||||
if (pFind != docx_document->m_pTheme->themeElements.clrScheme.Scheme.end())
|
||||
{
|
||||
PPTX::Logic::UniColor & color = pFind->second;
|
||||
|
||||
@ -2890,38 +2892,36 @@ void DocxConverter::convert(ComplexTypes::Word::CColor *color, _CP_OPT(odf_types
|
||||
PPTX::Logic::ClrMap* DocxConverter::oox_clrMap()
|
||||
{
|
||||
//return current_clrMap; todoooo
|
||||
OOX::CSettings * docx_settings = docx_document->GetSettings();
|
||||
if (!docx_settings) return NULL;
|
||||
if (!docx_document->m_pSettings) return NULL;
|
||||
|
||||
return docx_settings->m_oClrSchemeMapping.GetPointer();
|
||||
return docx_document->m_pSettings->m_oClrSchemeMapping.GetPointer();
|
||||
}
|
||||
void DocxConverter::convert_settings()
|
||||
{
|
||||
if (!odt_context) return;
|
||||
|
||||
OOX::CSettings * docx_settings = docx_document->GetSettings();
|
||||
if (!docx_settings) return;
|
||||
if (!docx_document->m_pSettings) return;
|
||||
|
||||
if (docx_settings->m_oZoom.IsInit())
|
||||
if (docx_document->m_pSettings->m_oZoom.IsInit())
|
||||
{
|
||||
}
|
||||
if (docx_settings->m_oMirrorMargins.IsInit())
|
||||
if (docx_document->m_pSettings->m_oMirrorMargins.IsInit())
|
||||
{
|
||||
odt_context->page_layout_context()->set_pages_mirrored(true);
|
||||
}
|
||||
|
||||
odt_context->page_layout_context()->even_and_left_headers_ = docx_settings->m_oEvenAndOddHeaders.IsInit();
|
||||
odt_context->page_layout_context()->even_and_left_headers_ = docx_document->m_pSettings->m_oEvenAndOddHeaders.IsInit();
|
||||
|
||||
if (docx_settings->m_oPrintTwoOnOne.IsInit())
|
||||
if (docx_document->m_pSettings->m_oPrintTwoOnOne.IsInit())
|
||||
{
|
||||
if (docx_settings->m_oGutterAtTop.IsInit()){} //portrait
|
||||
if (docx_document->m_pSettings->m_oGutterAtTop.IsInit()){} //portrait
|
||||
else {}//landscape
|
||||
}
|
||||
|
||||
if (docx_settings->m_oDefaultTabStop.IsInit())
|
||||
if (docx_document->m_pSettings->m_oDefaultTabStop.IsInit())
|
||||
{
|
||||
_CP_OPT(odf_types::length) length;
|
||||
convert(docx_settings->m_oDefaultTabStop->m_oVal.GetPointer(), length);
|
||||
convert(docx_document->m_pSettings->m_oDefaultTabStop->m_oVal.GetPointer(), length);
|
||||
|
||||
odf_writer::odf_style_state_ptr state;
|
||||
if (odt_context->styles_context()->find_odf_default_style_state(odf_types::style_family::Paragraph, state) && state)
|
||||
@ -2941,7 +2941,7 @@ void DocxConverter::convert_lists_styles()
|
||||
{
|
||||
if (!odt_context) return;
|
||||
|
||||
OOX::CNumbering * lists_styles = docx_document->GetNumbering();
|
||||
OOX::CNumbering * lists_styles = docx_document->m_pNumbering;
|
||||
|
||||
if (!lists_styles)return;
|
||||
|
||||
@ -2979,27 +2979,25 @@ void DocxConverter::convert_lists_styles()
|
||||
void DocxConverter::convert_styles()
|
||||
{
|
||||
if (!odt_context) return;
|
||||
|
||||
OOX::CStyles * docx_styles = docx_document->GetStyles();
|
||||
|
||||
if (!docx_styles)return;
|
||||
if (!docx_document->m_pStyles)return;
|
||||
|
||||
//nullable<OOX::CLatentStyles > m_oLatentStyles;
|
||||
|
||||
convert(docx_styles->m_oDocDefaults.GetPointer());
|
||||
convert(docx_document->m_pStyles->m_oDocDefaults.GetPointer());
|
||||
|
||||
for (size_t i=0; i< docx_styles->m_arrStyle.size(); i++)
|
||||
for (size_t i=0; i< docx_document->m_pStyles->m_arrStyle.size(); i++)
|
||||
{
|
||||
if (docx_styles->m_arrStyle[i] == NULL) continue;
|
||||
if (docx_document->m_pStyles->m_arrStyle[i] == NULL) continue;
|
||||
|
||||
if (!current_font_size.empty())
|
||||
{
|
||||
current_font_size.erase(current_font_size.begin() + 1, current_font_size.end());
|
||||
}
|
||||
|
||||
convert(docx_styles->m_arrStyle[i]);
|
||||
convert(docx_document->m_pStyles->m_arrStyle[i]);
|
||||
|
||||
if (i == 0 && docx_styles->m_arrStyle[i]->m_oDefault.IsInit() && docx_styles->m_arrStyle[i]->m_oDefault->ToBool())
|
||||
if (i == 0 && docx_document->m_pStyles->m_arrStyle[i]->m_oDefault.IsInit() && docx_document->m_pStyles->m_arrStyle[i]->m_oDefault->ToBool())
|
||||
{
|
||||
//NADIE_COMO_TU.docx тут дефолтовый стиль не прописан явно, берем тот что Normal
|
||||
odf_writer::odf_style_state_ptr def_style_state;
|
||||
@ -3285,7 +3283,7 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
|
||||
if (oox_num_lvl->m_oLvlPicBulletId.IsInit() && oox_num_lvl->m_oLvlPicBulletId->m_oVal.IsInit())
|
||||
{
|
||||
int id = oox_num_lvl->m_oLvlPicBulletId->m_oVal->GetValue();
|
||||
OOX::CNumbering * lists_styles = docx_document->GetNumbering();
|
||||
OOX::CNumbering * lists_styles = docx_document->m_pNumbering;
|
||||
|
||||
for (size_t i = 0; (lists_styles) && (i < lists_styles->m_arrNumPicBullet.size()); i++)
|
||||
{
|
||||
@ -3582,12 +3580,11 @@ void DocxConverter::convert(OOX::Logic::CEndnoteReference* oox_ref)
|
||||
}
|
||||
void DocxConverter::convert_comment(int oox_comm_id)
|
||||
{
|
||||
OOX::CComments * docx_comments = docx_document->GetComments();
|
||||
if (!docx_comments)return;
|
||||
if (!docx_document->m_pComments)return;
|
||||
|
||||
for (size_t comm = 0 ; comm < docx_comments->m_arrComments.size(); comm++)
|
||||
for (size_t comm = 0 ; comm < docx_document->m_pComments->m_arrComments.size(); comm++)
|
||||
{
|
||||
OOX::CComment* oox_comment = docx_comments->m_arrComments[comm];
|
||||
OOX::CComment* oox_comment = docx_document->m_pComments->m_arrComments[comm];
|
||||
|
||||
if (oox_comment == NULL) continue;
|
||||
if (oox_comment->m_oId.IsInit() == false) continue;
|
||||
@ -3611,14 +3608,13 @@ void DocxConverter::convert_comment(int oox_comm_id)
|
||||
}
|
||||
void DocxConverter::convert_footnote(int oox_ref_id)
|
||||
{
|
||||
OOX::CFootnotes * footnotes = docx_document->GetFootnotes();
|
||||
if (!footnotes)return;
|
||||
if (!docx_document->m_pFootnotes)return;
|
||||
|
||||
odt_context->start_note(oox_ref_id, 1);
|
||||
|
||||
for (size_t n = 0 ; n < footnotes->m_arrFootnote.size(); n++)
|
||||
for (size_t n = 0 ; n < docx_document->m_pFootnotes->m_arrFootnote.size(); n++)
|
||||
{
|
||||
OOX::CFtnEdn* oox_note = footnotes->m_arrFootnote[n];
|
||||
OOX::CFtnEdn* oox_note = docx_document->m_pFootnotes->m_arrFootnote[n];
|
||||
|
||||
if (oox_note == NULL) continue;
|
||||
if (oox_note->m_oId.IsInit() == false) continue;
|
||||
@ -3639,14 +3635,13 @@ void DocxConverter::convert_footnote(int oox_ref_id)
|
||||
}
|
||||
void DocxConverter::convert_endnote(int oox_ref_id)
|
||||
{
|
||||
OOX::CEndnotes * endnotes = docx_document->GetEndnotes();
|
||||
if (!endnotes)return;
|
||||
if (!docx_document->m_pEndnotes)return;
|
||||
|
||||
odt_context->start_note(oox_ref_id, 2);
|
||||
|
||||
for (size_t n = 0 ; n < endnotes->m_arrEndnote.size(); n++)
|
||||
for (size_t n = 0 ; n < docx_document->m_pEndnotes->m_arrEndnote.size(); n++)
|
||||
{
|
||||
OOX::CFtnEdn* oox_note = endnotes->m_arrEndnote[n];
|
||||
OOX::CFtnEdn* oox_note = docx_document->m_pEndnotes->m_arrEndnote[n];
|
||||
|
||||
if (oox_note == NULL) continue;
|
||||
if (oox_note->m_oId.IsInit() == false) continue;
|
||||
|
||||
@ -184,7 +184,7 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::Logic::CBackground *oox_background, int type);
|
||||
void convert(OOX::Logic::CSdt *oox_sdt);
|
||||
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection);
|
||||
void convert(OOX::Logic::CSectionProperty *oox_section_pr, bool bSection, const std::wstring & master_name = L"");
|
||||
void convert(OOX::Logic::CParagraph *oox_paragraph);
|
||||
void convert(OOX::Logic::CRun *oox_run);
|
||||
void convert(OOX::Logic::CParagraphProperty *oox_para_prop, odf_writer::style_paragraph_properties *paragraph_properties);
|
||||
|
||||
@ -32,9 +32,10 @@
|
||||
#include "XlsxConverter.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Workbook/Workbook.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Comments/Comments.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/SharedStrings/SharedStrings.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Styles/Styles.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Worksheet.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/CalcChain/CalcChain.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinks.h"
|
||||
#include "../../../Common/DocxFormat/Source/XlsxFormat/ExternalLinks/ExternalLinkPath.h"
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4996"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -23,8 +23,6 @@ DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
LIBXML_READER_ENABLED \
|
||||
USE_LITE_READER \
|
||||
_USE_XMLLITE_READER_ \
|
||||
_PRESENTATION_WRITER_ \
|
||||
_SVG_CONVERT_TO_IMAGE_ \
|
||||
DONT_WRITE_EMBEDDED_FONTS
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "../../../ASCOfficePPTXFile/Editor/DefaultNotesTheme.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
|
||||
#include "../../../ASCOfficeXlsFile2/source/Common/simple_xml_writer.h"
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include "../Reader/PPTDocumentInfo.h"
|
||||
@ -60,8 +61,6 @@ namespace NSPresentationEditor
|
||||
static std::wstring g_string_core = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\
|
||||
<dc:title>Slide 1</dc:title>\
|
||||
<dc:creator>OnlyOffice</dc:creator>\
|
||||
<cp:lastModifiedBy>OnlyOffice</cp:lastModifiedBy>\
|
||||
<cp:revision>1</cp:revision>\
|
||||
</cp:coreProperties>");
|
||||
}
|
||||
@ -278,60 +277,127 @@ void NSPresentationEditor::CPPTXWriter::WriteContentTypes()
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WriteApp(CFile& oFile)
|
||||
{
|
||||
std::wstring str1 = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
|
||||
<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">\
|
||||
<TotalTime>0</TotalTime>\
|
||||
<Words>0</Words>\
|
||||
<Application>OnlyOffice</Application>\
|
||||
<PresentationFormat>On-screen Show (4:3)</PresentationFormat>\
|
||||
<Paragraphs>0</Paragraphs>");
|
||||
std::wstringstream strm;
|
||||
|
||||
oFile.WriteStringUTF8(str1);
|
||||
|
||||
oFile.WriteStringUTF8(L"<Slides>" + std::to_wstring(m_pDocument->m_arSlides.size()) + L"</Slides>");
|
||||
oFile.WriteStringUTF8(L"<Notes>" + std::to_wstring(m_pDocument->m_arNotes.size()) + L"</Notes>");
|
||||
|
||||
oFile.WriteStringUTF8(L"<HiddenSlides>0</HiddenSlides>\
|
||||
<MMClips>2</MMClips>\
|
||||
<ScaleCrop>false</ScaleCrop>\
|
||||
<HeadingPairs>\
|
||||
<vt:vector size=\"4\" baseType=\"variant\">");
|
||||
|
||||
int nCountThemes = (int)m_pDocument->m_arThemes.size();
|
||||
int nCountSlides = (int)m_pDocument->m_arSlides.size();
|
||||
|
||||
std::wstring strThemes = L"<vt:variant><vt:lpstr>Theme</vt:lpstr></vt:variant><vt:variant><vt:i4>" +std::to_wstring(nCountThemes) +
|
||||
L"</vt:i4></vt:variant>";
|
||||
|
||||
std::wstring strSlides = L"<vt:variant><vt:lpstr>Slide Titles</vt:lpstr></vt:variant><vt:variant><vt:i4>" +
|
||||
std::to_wstring(nCountSlides) + L"</vt:i4></vt:variant></vt:vector></HeadingPairs>";
|
||||
|
||||
std::wstring strTitles = L"<TitlesOfParts><vt:vector size=\"" + std::to_wstring(nCountSlides + nCountThemes) + L"\" baseType=\"lpstr\">";
|
||||
|
||||
oFile.WriteStringUTF8(strThemes + strSlides + strTitles);
|
||||
|
||||
std::wstring strMemory = _T("");
|
||||
for (int i = 1; i <= nCountThemes; ++i)
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
strMemory += L"<vt:lpstr>Theme " + std::to_wstring(i) + L"</vt:lpstr>";
|
||||
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/docPropsVTypess");
|
||||
}
|
||||
CP_XML_NODE(L"Application")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
#if defined(INTVER)
|
||||
CP_XML_NODE(L"AppVersion")
|
||||
{
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
CP_XML_STREAM() << std::wstring(s.begin(), s.end());
|
||||
}
|
||||
#endif
|
||||
CP_XML_NODE(L"TotalTime")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"Words")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
CP_XML_NODE(L"PresentationFormat")
|
||||
{
|
||||
CP_XML_STREAM() << L"On-screen Show (4:3)";
|
||||
}
|
||||
CP_XML_NODE(L"Paragraphs")
|
||||
{
|
||||
CP_XML_STREAM() << 0;
|
||||
}
|
||||
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() << 2;
|
||||
}
|
||||
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_ATTR(L"vt:lpstr", L"Theme");
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:i4", m_pDocument->m_arThemes.size());
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:lpstr", L"Slide Titles");
|
||||
}
|
||||
CP_XML_NODE(L"vt:variant")
|
||||
{
|
||||
CP_XML_ATTR(L"vt:i4", 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= nCountSlides; ++i)
|
||||
{
|
||||
strMemory += L"<vt:lpstr>Slide " + std::to_wstring(i) + L"</vt:lpstr>";
|
||||
}
|
||||
|
||||
std::wstring str5 = _T("</vt:vector>\
|
||||
</TitlesOfParts>\
|
||||
<Company></Company>\
|
||||
<LinksUpToDate>false</LinksUpToDate>\
|
||||
<SharedDoc>false</SharedDoc>\
|
||||
<HyperlinksChanged>false</HyperlinksChanged>\
|
||||
<AppVersion>4.4000</AppVersion>\
|
||||
</Properties>");
|
||||
|
||||
strMemory += str5;
|
||||
|
||||
oFile.WriteStringUTF8(strMemory);
|
||||
oFile.WriteStringUTF8(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
oFile.WriteStringUTF8(strm.str());
|
||||
}
|
||||
|
||||
void NSPresentationEditor::CPPTXWriter::WritePresInfo()
|
||||
|
||||
@ -959,7 +959,7 @@ public:
|
||||
case NSOfficeDrawing::adjust10Value:
|
||||
{
|
||||
LONG lIndexAdj = pProperty->m_ePID - NSOfficeDrawing::adjustValue;
|
||||
if (lIndexAdj >= 0 && lIndexAdj < pShape->m_arAdjustments.size())
|
||||
if (lIndexAdj >= 0 && lIndexAdj < (LONG)pShape->m_arAdjustments.size())
|
||||
{
|
||||
pShape->m_oCustomVML.LoadAdjusts(lIndexAdj, (LONG)pProperty->m_lValue);
|
||||
}
|
||||
@ -1639,7 +1639,7 @@ public:
|
||||
}
|
||||
|
||||
//------ shape properties ----------------------------------------------------------------------------------------
|
||||
for (int nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
|
||||
for (size_t nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
|
||||
{
|
||||
CPPTElement oElement;
|
||||
oElement.SetUpProperties(pElement, pTheme, pSlideWrapper, pSlide, &oArrayOptions[nIndexProp]->m_oProperties);
|
||||
@ -1756,7 +1756,7 @@ public:
|
||||
}
|
||||
else
|
||||
{//image, audio, video ....
|
||||
for (int nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
|
||||
for (size_t nIndexProp = 0; nIndexProp < oArrayOptions.size(); ++nIndexProp)
|
||||
{
|
||||
CPPTElement oElement;
|
||||
oElement.SetUpProperties(pElement, pTheme, pSlideWrapper, pSlide, &oArrayOptions[nIndexProp]->m_oProperties);
|
||||
|
||||
@ -70,7 +70,7 @@ public:
|
||||
|
||||
int sz = pStream->tell() - m_lOffsetInStream;
|
||||
|
||||
if (sz >= m_oHeader.RecLen)
|
||||
if (sz >= (int)m_oHeader.RecLen)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
if (m_arrSIs.size() < 1) return;
|
||||
|
||||
int pos_text = 0, pos_si = 0;
|
||||
int ind = 0;
|
||||
size_t ind = 0;
|
||||
|
||||
for (size_t i = 0; i < pText->m_arParagraphs.size(); i++)
|
||||
{
|
||||
|
||||
@ -65,6 +65,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -937,6 +937,12 @@ void CDrawingConverter::SetEmbedDstPath(const std::wstring& sPath)
|
||||
|
||||
NSDirectory::CreateDirectory(sPath);
|
||||
}
|
||||
|
||||
void CDrawingConverter::ClearShapeTypes()
|
||||
{
|
||||
m_mapShapeTypes.clear();
|
||||
}
|
||||
|
||||
HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
|
||||
{
|
||||
std::wstring strXml = L"<main ";
|
||||
@ -974,20 +980,24 @@ HRESULT CDrawingConverter::AddShapeType(const std::wstring& bsXml)
|
||||
|
||||
if (oNode.IsValid())
|
||||
{
|
||||
CPPTShape* pShape = new CPPTShape();
|
||||
pShape->m_bIsShapeType = true;
|
||||
|
||||
XmlUtils::CXmlNode oNodeST = oNode.ReadNodeNoNS(L"shapetype");
|
||||
|
||||
std::wstring strId = oNodeST.GetAttribute(L"id");
|
||||
pShape->LoadFromXMLShapeType(oNodeST);
|
||||
|
||||
CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
|
||||
pS->setBaseShape(CBaseShapePtr(pShape));
|
||||
|
||||
LoadCoordSize(oNodeST, pS);
|
||||
//if (m_mapShapeTypes.find(strId) == m_mapShapeTypes.end())//?? с затиранием ???
|
||||
{
|
||||
CPPTShape* pShape = new CPPTShape();
|
||||
pShape->m_bIsShapeType = true;
|
||||
|
||||
pShape->LoadFromXMLShapeType(oNodeST);
|
||||
|
||||
m_mapShapeTypes.insert(std::pair<std::wstring, CShapePtr>(strId, pS));
|
||||
CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
|
||||
pS->setBaseShape(CBaseShapePtr(pShape));
|
||||
|
||||
LoadCoordSize(oNodeST, pS);
|
||||
|
||||
m_mapShapeTypes.insert(std::make_pair(strId, pS));
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
@ -1094,6 +1104,12 @@ PPTX::Logic::SpTreeElem CDrawingConverter::ObjectFromXml(const std::wstring& sXm
|
||||
}
|
||||
else if (strName == L"pict" || strName == L"object")
|
||||
{
|
||||
//сначала shape type
|
||||
XmlUtils::CXmlNode oNodeST;
|
||||
if (oParseNode.GetNode(L"v:shapetype", oNodeST))
|
||||
{
|
||||
AddShapeType(oNodeST.GetXml());
|
||||
}
|
||||
XmlUtils::CXmlNodes oChilds;
|
||||
if (oParseNode.GetNodes(L"*", oChilds))
|
||||
{
|
||||
@ -1148,10 +1164,6 @@ PPTX::Logic::SpTreeElem CDrawingConverter::ObjectFromXml(const std::wstring& sXm
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (L"shapetype" == strNameP)
|
||||
{
|
||||
AddShapeType(oNodeP.GetXml());
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
@ -1447,6 +1459,13 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
|
||||
}
|
||||
else if (strName == L"pict" || strName == L"object")
|
||||
{
|
||||
//сначала shape type
|
||||
XmlUtils::CXmlNode oNodeST;
|
||||
if (oParseNode.GetNode(L"v:shapetype", oNodeST))
|
||||
{
|
||||
AddShapeType(oNodeST.GetXml());
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNodes oChilds;
|
||||
if (oParseNode.GetNodes(L"*", oChilds))
|
||||
{
|
||||
@ -1487,10 +1506,6 @@ bool CDrawingConverter::ParceObject(const std::wstring& strXml, std::wstring** p
|
||||
doc_LoadGroup(pElem, oNodeP, pMainProps, true);
|
||||
}
|
||||
}
|
||||
else if (L"shapetype" == strNameP)
|
||||
{
|
||||
AddShapeType(oNodeP.GetXml());
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
@ -2817,6 +2832,13 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
|
||||
if (bIsTop) pTree->m_lGroupIndex = 0;
|
||||
else pTree->m_lGroupIndex = 1;
|
||||
|
||||
//сначала shape type
|
||||
XmlUtils::CXmlNode oNodeST;
|
||||
if (oNode.GetNode(L"v:shapetype", oNodeST))
|
||||
{
|
||||
AddShapeType(oNodeST.GetXml());
|
||||
}
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (oNode.GetNodes(L"*", oNodes))
|
||||
{
|
||||
@ -2828,30 +2850,7 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
|
||||
|
||||
std::wstring strNameP = XmlUtils::GetNameNoNS(oNodeT.GetName());
|
||||
|
||||
if (L"shapetype" == strNameP)
|
||||
{
|
||||
//AddShapeType(oNodeT.GetXml());
|
||||
std::wstring strId = oNodeT.GetAttribute(L"id");
|
||||
|
||||
if (strId.length() > 0)
|
||||
{
|
||||
if (m_mapShapeTypes.find(strId) == m_mapShapeTypes.end())
|
||||
{
|
||||
CPPTShape* pShape = new CPPTShape();
|
||||
pShape->m_bIsShapeType = true;
|
||||
|
||||
pShape->LoadFromXMLShapeType(oNodeT);
|
||||
|
||||
CShapePtr pS = CShapePtr(new CShape(NSBaseShape::unknown, 0));
|
||||
pS->setBaseShape(CBaseShapePtr(pShape));
|
||||
|
||||
LoadCoordSize(oNodeT, pS);
|
||||
|
||||
m_mapShapeTypes.insert(std::pair<std::wstring, CShapePtr>(strId, pS));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (L"shape" == strNameP ||
|
||||
if (L"shape" == strNameP ||
|
||||
L"rect" == strNameP ||
|
||||
L"oval" == strNameP ||
|
||||
L"line" == strNameP ||
|
||||
@ -2873,6 +2872,8 @@ void CDrawingConverter::doc_LoadGroup(PPTX::Logic::SpTreeElem *result, XmlUtils:
|
||||
if (_el.is_init())
|
||||
pTree->SpTreeElems.push_back(_el);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -225,7 +225,8 @@ namespace NSBinPptxRW
|
||||
void SetMediaDstPath (const std::wstring& sMediaPath);
|
||||
void SetEmbedDstPath (const std::wstring& sEmbedPath);
|
||||
|
||||
HRESULT AddShapeType (const std::wstring& sXml);
|
||||
void ClearShapeTypes ();
|
||||
|
||||
HRESULT AddObject (const std::wstring& sXml, std::wstring** pMainProps);
|
||||
|
||||
HRESULT SaveObject (long lStart, long lLength, const std::wstring& sMainProps, std::wstring & sXml);
|
||||
@ -293,6 +294,7 @@ namespace NSBinPptxRW
|
||||
|
||||
void Clear();
|
||||
HRESULT SetCurrentRelsPath();
|
||||
HRESULT AddShapeType (const std::wstring& sXml);
|
||||
};
|
||||
}
|
||||
#endif //OOX_IFILE_CONTAINER_INCLUDE_H_
|
||||
|
||||
@ -1280,6 +1280,14 @@ namespace NSBinPptxRW
|
||||
|
||||
m_pWriter->WriteString(strRels);
|
||||
}
|
||||
void CRelsGenerator::WritePresentationComments(int nComment)
|
||||
{
|
||||
std::wstring strRels = L"<Relationship Id=\"rId" + std::to_wstring( m_lNextRelsID++ ) +
|
||||
L"\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments\" Target=\"comments/comment" +
|
||||
std::to_wstring(nComment) + L".xml\"/>";
|
||||
|
||||
m_pWriter->WriteString(strRels);
|
||||
}
|
||||
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject, bool bIsJsaProject)
|
||||
{
|
||||
if (bIsNotesMaster)
|
||||
|
||||
@ -424,6 +424,7 @@ namespace NSBinPptxRW
|
||||
void WriteThemes (int nCount);
|
||||
void WriteSlides (int nCount);
|
||||
void WriteSlideComments (int nComment);
|
||||
void WritePresentationComments (int nComment);
|
||||
int WriteChart (int nChartNumber, _INT32 lDocType);
|
||||
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
|
||||
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
|
||||
|
||||
@ -32,7 +32,6 @@
|
||||
#pragma once
|
||||
#include "Converter.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/App.h"
|
||||
|
||||
#include "DefaultNotesMaster.h"
|
||||
#include "DefaultNotesTheme.h"
|
||||
@ -823,6 +822,24 @@ namespace NSBinPptxRW
|
||||
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
|
||||
++nCurrentRels;
|
||||
}
|
||||
if (m_oPresentation.comments.is_init())
|
||||
{
|
||||
m_oReader.m_pRels->WritePresentationComments(nComment);
|
||||
OOX::CPath pathFolderCommentDir = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("comments");
|
||||
if (1 == nComment)
|
||||
{
|
||||
NSDirectory::CreateDirectory (pathFolderCommentDir.GetPath());
|
||||
}
|
||||
std::wstring strCommentFile = L"comment" + std::to_wstring(nComment) + L".xml";
|
||||
|
||||
oXmlWriter.ClearNoAttack();
|
||||
m_oPresentation.comments->toXmlWriter(&oXmlWriter);
|
||||
|
||||
OOX::CPath pathComment = pathFolderCommentDir + FILE_SEPARATOR_STR + strCommentFile;
|
||||
oXmlWriter.SaveToFile(pathComment.GetPath());
|
||||
|
||||
++nComment;
|
||||
}
|
||||
|
||||
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init(), m_oPresentation.m_pJsaProject.is_init());
|
||||
m_oReader.m_pRels->CloseRels();
|
||||
@ -1012,11 +1029,12 @@ namespace NSBinPptxRW
|
||||
{
|
||||
m_oApp.TotalTime = 0;
|
||||
m_oApp.Words = 0;
|
||||
m_oApp.Application = L"OnlyOffice";
|
||||
std::wstring sApplication = L"ONLYOFFICE";
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
m_oApp.AppVersion = std::wstring(s.begin(), s.end());
|
||||
sApplication += L"/" + std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
m_oApp.Application = sApplication;
|
||||
m_oApp.PresentationFormat = L"On-screen Show (4:3)";
|
||||
m_oApp.Paragraphs = 0;
|
||||
m_oApp.Slides = (int)m_arSlides.size();
|
||||
@ -1058,7 +1076,6 @@ namespace NSBinPptxRW
|
||||
m_oApp.LinksUpToDate = false;
|
||||
m_oApp.SharedDoc = false;
|
||||
m_oApp.HyperlinksChanged = false;
|
||||
m_oApp.AppVersion = _T("3.0000");
|
||||
}
|
||||
void CreateDefaultCore()
|
||||
{
|
||||
|
||||
@ -40,10 +40,12 @@
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Rels.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/ContentTypes.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Media.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
|
||||
#include "../../DesktopEditor/common/Directory.h"
|
||||
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Image.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
namespace PPTX
|
||||
@ -87,12 +89,71 @@ namespace PPTX
|
||||
|
||||
void FileContainer::read(const OOX::CPath& filename)
|
||||
{
|
||||
//OOX::IFileContainer::read(filename);
|
||||
}
|
||||
|
||||
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path)
|
||||
{
|
||||
}
|
||||
const bool FileContainer::IsExist(const OOX::FileType& oType) const
|
||||
{
|
||||
for (size_t i = 0; i < m_arContainer.size(); ++i)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = m_arContainer[i];
|
||||
|
||||
if (oType == pFile->type())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
smart_ptr<OOX::File> FileContainer::Get(const OOX::FileType& oType)
|
||||
{
|
||||
for (size_t i = 0; i < m_arContainer.size(); ++i)
|
||||
{
|
||||
smart_ptr<OOX::File> &pFile = m_arContainer[i];
|
||||
if (oType == pFile->type())
|
||||
return pFile;
|
||||
}
|
||||
|
||||
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile( m_oUnknown ));
|
||||
}
|
||||
|
||||
void FileContainer::Get(const OOX::FileType& oType, std::vector<smart_ptr<OOX::File>> & files)
|
||||
{
|
||||
for (size_t i = 0; i < m_arContainer.size(); ++i)
|
||||
{
|
||||
smart_ptr<OOX::File> &pFile = m_arContainer[i];
|
||||
|
||||
if ( oType == pFile->type() )
|
||||
files.push_back(pFile);
|
||||
}
|
||||
}
|
||||
std::wstring FileContainer::GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = IFileContainer::Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
std::wstring FileContainer::GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
std::wstring FileContainer::GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = IFileContainer::Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event)
|
||||
{
|
||||
bool bIsSlide = false;
|
||||
@ -178,9 +239,11 @@ namespace PPTX
|
||||
void FileContainer::write(OOX::CRels& rels, const OOX::CPath& curdir, const OOX::CPath& directory, OOX::CContentTypes& content) const
|
||||
{
|
||||
std::map<std::wstring, size_t> mNamePair;
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
|
||||
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
|
||||
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
|
||||
smart_ptr<OOX::Media> pMedia = pFile.smart_dynamic_cast<OOX::Media>();
|
||||
|
||||
@ -217,6 +280,7 @@ namespace PPTX
|
||||
|
||||
OOX::CSystemUtility::CreateDirectories(directory / defdir);
|
||||
pFile->write(directory / defdir / name, directory, content);
|
||||
|
||||
rels.Registration(pPair->first, pFile->type(), defdir / name);
|
||||
}
|
||||
}
|
||||
@ -229,9 +293,9 @@ namespace PPTX
|
||||
|
||||
void FileContainer::WrittenSetFalse()
|
||||
{
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.begin(); pPair != m_mContainer.end(); ++pPair)
|
||||
for (size_t i = 0; i < m_arContainer.size(); i++)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
smart_ptr<OOX::File> &pFile = m_arContainer[i];
|
||||
|
||||
smart_ptr<PPTX::WrapperFile> pWrapFile = pFile.smart_dynamic_cast<PPTX::WrapperFile>();
|
||||
smart_ptr<PPTX::FileContainer> pWrapCont = pFile.smart_dynamic_cast<PPTX::FileContainer>();
|
||||
|
||||
@ -55,32 +55,14 @@ namespace PPTX
|
||||
virtual ~FileContainer()
|
||||
{
|
||||
}
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::Image> p = Get<OOX::Image>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
virtual std::wstring GetLinkFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::External> pExt = Find(rid).smart_dynamic_cast<OOX::External>();
|
||||
if (pExt.IsInit())
|
||||
return pExt->Uri().m_strFilename;
|
||||
const bool IsExist(const OOX::FileType& oType) const;
|
||||
|
||||
smart_ptr<OOX::Media> pMedia = Find(rid).smart_dynamic_cast<OOX::Media>();
|
||||
if (pMedia.IsInit())
|
||||
return pMedia->filename().m_strFilename;
|
||||
|
||||
return _T("");
|
||||
}
|
||||
virtual std::wstring GetOleFromRId(const OOX::RId& rid)const
|
||||
{
|
||||
smart_ptr<OOX::OleObject> p = Get<OOX::OleObject>(rid);
|
||||
if (!p.is_init())
|
||||
return _T("");
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
smart_ptr<OOX::File> Get(const OOX::FileType& oType);
|
||||
void Get(const OOX::FileType& oType, std::vector<smart_ptr<OOX::File>> & files);
|
||||
|
||||
virtual std::wstring GetImagePathNameFromRId(const OOX::RId& rid)const;
|
||||
virtual std::wstring GetLinkFromRId (const OOX::RId& rid)const;
|
||||
virtual std::wstring GetOleFromRId (const OOX::RId& rid)const;
|
||||
protected:
|
||||
void read(const OOX::CPath& filename);
|
||||
void read(const OOX::CRels& rels, const OOX::CPath& path);
|
||||
|
||||
@ -79,12 +79,13 @@ namespace PPTX
|
||||
if (_presentation->IsExist(OOX::FileTypes::VbaProject))
|
||||
{
|
||||
_presentation->m_bMacroEnabled = true;
|
||||
_presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>();
|
||||
_presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>();
|
||||
}
|
||||
if (_presentation->IsExist(OOX::FileTypes::JsaProject))
|
||||
{
|
||||
_presentation->m_pJsaProject = _presentation->Get(OOX::FileTypes::JsaProject).smart_dynamic_cast<OOX::JsaProject>();
|
||||
_presentation->m_pJsaProject = _presentation->Get(OOX::FileTypes::JsaProject).smart_dynamic_cast<OOX::JsaProject>();
|
||||
}
|
||||
_presentation->comments = _presentation->Get(OOX::Presentation::FileTypes::SlideComments).smart_dynamic_cast<PPTX::Comments>();
|
||||
}
|
||||
|
||||
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)
|
||||
@ -190,17 +191,17 @@ namespace PPTX
|
||||
return true;//FileContainer::exist(OOX::Presentation::FileTypes::Presentation);
|
||||
}
|
||||
|
||||
void Document::extractPictures(const OOX::CPath& path)
|
||||
{
|
||||
OOX::CSystemUtility::CreateDirectories(path);
|
||||
FileContainer::ExtractPictures(path);
|
||||
}
|
||||
//void Document::extractPictures(const OOX::CPath& path)
|
||||
//{
|
||||
// OOX::CSystemUtility::CreateDirectories(path);
|
||||
// FileContainer::ExtractPictures(path);
|
||||
//}
|
||||
|
||||
void Document::extractPictures(const OOX::CPath& source, const OOX::CPath& path)
|
||||
{
|
||||
//read(source);
|
||||
extractPictures(path);
|
||||
}
|
||||
//void Document::extractPictures(const OOX::CPath& source, const OOX::CPath& path)
|
||||
//{
|
||||
// //read(source);
|
||||
// extractPictures(path);
|
||||
//}
|
||||
|
||||
long Document::CountFiles(const OOX::CPath& path)
|
||||
{
|
||||
|
||||
@ -50,8 +50,8 @@ namespace PPTX
|
||||
|
||||
const bool isValid(const OOX::CPath& path) const;
|
||||
|
||||
void extractPictures(const OOX::CPath& path);
|
||||
void extractPictures(const OOX::CPath& source, const OOX::CPath& path);
|
||||
//void extractPictures(const OOX::CPath& path);
|
||||
//void extractPictures(const OOX::CPath& source, const OOX::CPath& path);
|
||||
private:
|
||||
long CountFiles(const OOX::CPath& path);
|
||||
};
|
||||
|
||||
@ -135,8 +135,14 @@ namespace PPTX
|
||||
{
|
||||
smart_ptr<OOX::OleObject> pOleObject;
|
||||
|
||||
if (pRels != NULL) pOleObject = pRels->Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<FileContainer>()) pOleObject = parentFileAs<FileContainer>().Get<OOX::OleObject>(oRId);
|
||||
if (pRels != NULL)
|
||||
pOleObject = pRels->Get<OOX::OleObject>(oRId);
|
||||
else
|
||||
{
|
||||
OOX::IFileContainer* pContainer = dynamic_cast<OOX::IFileContainer*>(const_cast<PPTX::WrapperFile*>(parentFile));
|
||||
if (pContainer)
|
||||
pOleObject = pContainer->Get<OOX::OleObject>(oRId);
|
||||
}
|
||||
|
||||
if (pOleObject.IsInit())
|
||||
return pOleObject->filename().m_strFilename;
|
||||
|
||||
@ -385,7 +385,7 @@ namespace PPTX
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
@ -440,9 +440,10 @@ namespace PPTX
|
||||
std::wstring sXmlOptions, sMediaPath, sEmbedPath;
|
||||
BinXlsxRW::CXlsxSerializer::CreateXlsxFolders (sXmlOptions, sDstEmbeddedTemp, sMediaPath, sEmbedPath);
|
||||
|
||||
std::map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
|
||||
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
|
||||
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
|
||||
boost::unordered_map<std::wstring, size_t> old_enum_map = oXlsx.m_mapEnumeratedGlobal;
|
||||
|
||||
NSBinPptxRW::CBinaryFileReader* old_reader = oDrawingConverter.m_pReader;
|
||||
NSBinPptxRW::CRelsGenerator* old_rels = pReader->m_pRels;
|
||||
|
||||
oXlsx.m_mapEnumeratedGlobal.clear();
|
||||
|
||||
@ -502,12 +503,14 @@ namespace PPTX
|
||||
smart_ptr<OOX::OleObject> ole_file = m_OleObjectFile;
|
||||
if (ole_file.IsInit() == false)
|
||||
{
|
||||
if (pRels != NULL) ole_file = pRels->Get<OOX::OleObject>(oRId);
|
||||
|
||||
else if(parentFileIs<Slide>()) ole_file = parentFileAs<Slide>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideLayout>()) ole_file = parentFileAs<SlideLayout>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<SlideMaster>()) ole_file = parentFileAs<SlideMaster>().Get<OOX::OleObject>(oRId);
|
||||
else if(parentFileIs<Theme>()) ole_file = parentFileAs<Theme>().Get<OOX::OleObject>(oRId);
|
||||
if (pRels != NULL)
|
||||
ole_file = pRels->Get<OOX::OleObject>(oRId);
|
||||
else
|
||||
{
|
||||
OOX::IFileContainer* pContainer = dynamic_cast<OOX::IFileContainer*>(const_cast<PPTX::WrapperFile*>(parentFile));
|
||||
if (pContainer)
|
||||
ole_file = pContainer->Get<OOX::OleObject>(oRId);
|
||||
}
|
||||
}
|
||||
return ole_file;
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@
|
||||
#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"
|
||||
@ -72,8 +73,6 @@ namespace PPTX
|
||||
}
|
||||
virtual void read(const OOX::CPath& filename, FileMap& map)
|
||||
{
|
||||
//FileContainer::read(filename, map);
|
||||
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNode.FromXmlFile(filename.m_strFilename);
|
||||
|
||||
@ -235,6 +234,7 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
pWriter->WriteRecord2(9, m_pJsaProject);
|
||||
pWriter->WriteRecord2(10, comments);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
@ -362,6 +362,11 @@ namespace PPTX
|
||||
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();
|
||||
@ -479,6 +484,7 @@ namespace PPTX
|
||||
bool m_bMacroEnabled;
|
||||
smart_ptr<OOX::VbaProject> m_pVbaProject;
|
||||
smart_ptr<OOX::JsaProject> m_pJsaProject;
|
||||
smart_ptr<PPTX::Comments> comments;
|
||||
|
||||
void SetClrMap(Logic::ClrMap map) {m_clrMap = map;}
|
||||
void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;}
|
||||
|
||||
@ -26,8 +26,6 @@ include($$PWD/../../../../Common/3dParty/boost/boost.pri)
|
||||
DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML \
|
||||
#DISABLE_FILE_DOWNLOADER \
|
||||
CXIMAGE_DONT_DECLARE_TCHAR \
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -21,8 +21,6 @@ include($$PWD/../../../Common/3dParty/boost/boost.pri)
|
||||
|
||||
DEFINES += UNICODE _UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
LIBXML_READER_ENABLED \
|
||||
DONT_WRITE_EMBEDDED_FONTS \
|
||||
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -52,7 +52,7 @@ bool OOXHeaderReader::Parse( ReaderParameter oParam, std::wstring sRID, TextItem
|
||||
oOOXTextItemReader.Parse(*it, oParam );
|
||||
}
|
||||
|
||||
oParam.oReader->m_currentContainer = dynamic_cast<OOX::IFileContainer*>(oParam.oDocx->GetDocument());
|
||||
oParam.oReader->m_currentContainer = dynamic_cast<OOX::IFileContainer*>(oParam.oDocx->m_pDocument);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -59,75 +59,65 @@ bool OOXReader::Parse()
|
||||
oReaderParameter.oRtf = &m_oDocument;
|
||||
oReaderParameter.oReader = this;
|
||||
|
||||
OOX::CSettings* settings = inputDocxFile.GetSettings();
|
||||
if (settings)
|
||||
if (inputDocxFile.m_pSettings)
|
||||
{ //важно чтобы первыми читались именно settings (например для footnote)
|
||||
OOXSettingsReader oSettingsReader( settings );
|
||||
OOXSettingsReader oSettingsReader( inputDocxFile.m_pSettings );
|
||||
oSettingsReader.Parse( oReaderParameter );
|
||||
}
|
||||
|
||||
OOX::CFontTable* fontTable = inputDocxFile.GetFontTable();
|
||||
if (fontTable)
|
||||
if (inputDocxFile.m_pFontTable)
|
||||
{
|
||||
OOXFontTableReader oFontTableReader( fontTable );
|
||||
OOXFontTableReader oFontTableReader( inputDocxFile.m_pFontTable );
|
||||
oFontTableReader.Parse( oReaderParameter );
|
||||
}
|
||||
|
||||
PPTX::Theme* theme = inputDocxFile.GetTheme();
|
||||
if (theme)
|
||||
if (inputDocxFile.m_pTheme)
|
||||
{
|
||||
OOXThemeReader oThemeReader( theme );
|
||||
OOXThemeReader oThemeReader( inputDocxFile.m_pTheme );
|
||||
oThemeReader.Parse( oReaderParameter );
|
||||
}
|
||||
|
||||
OOX::CNumbering* numbering = inputDocxFile.GetNumbering();
|
||||
if (numbering)
|
||||
if (inputDocxFile.m_pNumbering)
|
||||
{
|
||||
OOXNumberingReader oNumberingReader( numbering );
|
||||
OOXNumberingReader oNumberingReader( inputDocxFile.m_pNumbering );
|
||||
oNumberingReader.Parse(oReaderParameter );
|
||||
}
|
||||
|
||||
OOX::CStyles* styles = inputDocxFile.GetStyles();
|
||||
if (styles)
|
||||
if (inputDocxFile.m_pStyles)
|
||||
{
|
||||
OOXStyleTableReader oStyleTableReader( styles );
|
||||
OOXStyleTableReader oStyleTableReader( inputDocxFile.m_pStyles );
|
||||
oStyleTableReader.Parse( oReaderParameter );
|
||||
}
|
||||
|
||||
OOX::CApp* app = inputDocxFile.GetApp();
|
||||
if (app)
|
||||
if (inputDocxFile.m_pApp)
|
||||
{
|
||||
OOXAppReader oDocPropAppReader( app );
|
||||
OOXAppReader oDocPropAppReader( inputDocxFile.m_pApp );
|
||||
oDocPropAppReader.Parse( oReaderParameter );
|
||||
}
|
||||
|
||||
OOX::CCore* core = inputDocxFile.GetCore();
|
||||
if (core)
|
||||
if (inputDocxFile.m_pCore)
|
||||
{
|
||||
OOXCoreReader oDocPropCoreReader( core);
|
||||
OOXCoreReader oDocPropCoreReader( inputDocxFile.m_pCore );
|
||||
oDocPropCoreReader.Parse(oReaderParameter );
|
||||
}
|
||||
|
||||
OOX::CFootnotes* footnotes = inputDocxFile.GetFootnotes();
|
||||
if (footnotes)
|
||||
if (inputDocxFile.m_pFootnotes)
|
||||
{
|
||||
OOXFootnotesReader oFootnotesReader( footnotes );
|
||||
OOXFootnotesReader oFootnotesReader( inputDocxFile.m_pFootnotes );
|
||||
oFootnotesReader.Parse( oReaderParameter);
|
||||
}
|
||||
|
||||
OOX::CEndnotes* endnotes = inputDocxFile.GetEndnotes();
|
||||
if (endnotes)
|
||||
if (inputDocxFile.m_pEndnotes)
|
||||
{
|
||||
OOXFootnotesReader oEndnotesReader( endnotes );
|
||||
OOXFootnotesReader oEndnotesReader( inputDocxFile.m_pEndnotes );
|
||||
oEndnotesReader.Parse( oReaderParameter);
|
||||
}
|
||||
|
||||
OOX::CDocument* document = inputDocxFile.GetDocument();
|
||||
if (document)
|
||||
if (inputDocxFile.m_pDocument)
|
||||
{
|
||||
m_currentContainer = dynamic_cast<OOX::IFileContainer*>(document);
|
||||
m_currentContainer = dynamic_cast<OOX::IFileContainer*>(inputDocxFile.m_pDocument);
|
||||
|
||||
OOXDocumentReader oDocReader( document );
|
||||
OOXDocumentReader oDocReader( inputDocxFile.m_pDocument );
|
||||
oDocReader.Parse( oReaderParameter );
|
||||
}
|
||||
|
||||
|
||||
@ -979,8 +979,7 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
|
||||
|
||||
int fmt_index = style_ref->idx.get() -1;
|
||||
|
||||
PPTX::Theme *theme = oParam.oDocx->GetTheme();
|
||||
if (!theme || fmt_index <0) return;
|
||||
if (!oParam.oDocx->m_pTheme || fmt_index <0) return;
|
||||
|
||||
if (style_ref->Color.is<PPTX::Logic::SchemeClr>() == false) return;
|
||||
|
||||
@ -990,21 +989,21 @@ void OOXShapeReader::Parse( ReaderParameter oParam, RtfShapePtr& pOutput, PPTX::
|
||||
|
||||
if (type == 1)
|
||||
{
|
||||
if (fmt_index < 1000 && fmt_index < theme->themeElements.fmtScheme.fillStyleLst.size())
|
||||
if (fmt_index < 1000 && fmt_index < oParam.oDocx->m_pTheme->themeElements.fmtScheme.fillStyleLst.size())
|
||||
{
|
||||
Parse(oParam, pOutput, &theme->themeElements.fmtScheme.fillStyleLst[fmt_index], &color);
|
||||
Parse(oParam, pOutput, &oParam.oDocx->m_pTheme->themeElements.fmtScheme.fillStyleLst[fmt_index], &color);
|
||||
}
|
||||
else if (fmt_index > 1000 && ((fmt_index-1000) < theme->themeElements.fmtScheme.bgFillStyleLst.size()))
|
||||
else if (fmt_index > 1000 && ((fmt_index-1000) < oParam.oDocx->m_pTheme->themeElements.fmtScheme.bgFillStyleLst.size()))
|
||||
{
|
||||
fmt_index -= 1000;
|
||||
|
||||
Parse(oParam, pOutput, &theme->themeElements.fmtScheme.bgFillStyleLst[fmt_index], &color);
|
||||
Parse(oParam, pOutput, &oParam.oDocx->m_pTheme->themeElements.fmtScheme.bgFillStyleLst[fmt_index], &color);
|
||||
}
|
||||
}
|
||||
|
||||
if (type == 2 && fmt_index < theme->themeElements.fmtScheme.lnStyleLst.size())
|
||||
if (type == 2 && fmt_index < oParam.oDocx->m_pTheme->themeElements.fmtScheme.lnStyleLst.size())
|
||||
{
|
||||
Parse(oParam, pOutput, &theme->themeElements.fmtScheme.lnStyleLst[fmt_index], &color);
|
||||
Parse(oParam, pOutput, &oParam.oDocx->m_pTheme->themeElements.fmtScheme.lnStyleLst[fmt_index], &color);
|
||||
}
|
||||
|
||||
//if (style_matrix_ref->getType() == OOX::et_a_effectRef && fmt_index < theme->m_oThemeElements.m_oFmtScheme.m_oEffectStyleLst.m_arrEffectStyle.size())
|
||||
|
||||
@ -147,7 +147,7 @@ bool OOXWriter::SaveByItemEnd()
|
||||
|
||||
if (m_poDocPropsApp)
|
||||
{
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"OnlyOffice" );
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetApplication ( L"ONLYOFFICE" );
|
||||
#if defined(INTVER)
|
||||
((OOX::CApp*)m_poDocPropsApp)->SetAppVersion ( VALUE2STR(INTVER) );
|
||||
#endif
|
||||
|
||||
@ -19,8 +19,6 @@ include(../../../Common/base.pri)
|
||||
DEFINES += UNICODE \
|
||||
_UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
DONT_WRITE_EMBEDDED_FONTS \
|
||||
LIBXML_READER_ENABLED
|
||||
|
||||
|
||||
@ -169,58 +169,48 @@ namespace Docx2Txt
|
||||
|
||||
void Converter_Impl::convert(TxtXml::ITxtXmlEvent& Event)
|
||||
{
|
||||
OOX::CDocument *pDocument = NULL;
|
||||
OOX::CStyles *pStyles = NULL;
|
||||
OOX::CNumbering *pNumbering = NULL;
|
||||
|
||||
m_lPercent = 100000;
|
||||
m_bCancelled = Event.Progress(0, m_lPercent);
|
||||
if(m_bCancelled)
|
||||
return;
|
||||
|
||||
smart_ptr<OOX::File> pFileD = m_inputFile.Find(OOX::FileTypes::Document);
|
||||
if (pFileD.IsInit() && OOX::FileTypes::Document == pFileD->type())
|
||||
pDocument = (OOX::CDocument*)pFileD.operator->();
|
||||
|
||||
smart_ptr<OOX::File> pFileS = pDocument->Find(OOX::FileTypes::Style);
|
||||
if (pFileS.IsInit() && OOX::FileTypes::Style == pFileS->type())
|
||||
pStyles = (OOX::CStyles*)pFileS.operator->();
|
||||
OOX::CDocument *pDocument = m_inputFile.m_pDocument;
|
||||
OOX::CStyles *pStyles = m_inputFile.m_pStyles;
|
||||
OOX::CNumbering *pNumbering = m_inputFile.m_pNumbering;
|
||||
|
||||
smart_ptr<OOX::File> pFileN = pDocument->Find(OOX::FileTypes::Numbering);
|
||||
if (pFileN.IsInit() && OOX::FileTypes::Numbering == pFileN->type())
|
||||
if (pNumbering)
|
||||
{
|
||||
pNumbering = (OOX::CNumbering*)pFileN.operator->();
|
||||
|
||||
ListCount = pNumbering->m_arrNum.size();
|
||||
Lists = new int[9 * ListCount];
|
||||
if(Lists == NULL)
|
||||
return;
|
||||
for(int i = 0; i < 9 * ListCount; i++)
|
||||
for (int i = 0; i < 9 * ListCount; i++)
|
||||
Lists[i] = 0;
|
||||
}
|
||||
if(pDocument->m_arrItems.size() > 0)
|
||||
{
|
||||
m_lAddition = 800000;
|
||||
Notes.clear();
|
||||
|
||||
convert(pDocument->m_arrItems, m_outputFile.m_listContent, Event, true, pDocument, pNumbering, pStyles);
|
||||
|
||||
if(NoteCount != 0)
|
||||
if (!pDocument) return;
|
||||
if (pDocument->m_arrItems.empty()) return;
|
||||
|
||||
m_lAddition = 800000;
|
||||
Notes.clear();
|
||||
|
||||
convert(pDocument->m_arrItems, m_outputFile.m_listContent, Event, true, pDocument, pNumbering, pStyles);
|
||||
|
||||
if(NoteCount != 0)
|
||||
{
|
||||
m_outputFile.m_listContent.push_back(L"");
|
||||
m_outputFile.m_listContent.push_back(L"---------------------------");
|
||||
|
||||
for(std::map<std::wstring, std::vector<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
|
||||
{
|
||||
m_outputFile.m_listContent.push_back(L"");
|
||||
m_outputFile.m_listContent.push_back(L"---------------------------");
|
||||
bool bFirst = true;
|
||||
|
||||
for(std::map<std::wstring, std::vector<std::wstring>>::const_iterator iter_map = Notes.begin(); iter_map != Notes.end(); iter_map++)
|
||||
for(std::vector<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
|
||||
{
|
||||
bool bFirst = true;
|
||||
if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter);
|
||||
else m_outputFile.m_listContent.push_back(*iter);
|
||||
|
||||
for(std::vector<std::wstring>::const_iterator iter = iter_map->second.begin(); iter != iter_map->second.end(); iter++)
|
||||
{
|
||||
if (bFirst) m_outputFile.m_listContent.push_back(iter_map->first + L" " + *iter);
|
||||
else m_outputFile.m_listContent.push_back(*iter);
|
||||
|
||||
bFirst = false;
|
||||
}
|
||||
bFirst = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -473,22 +463,21 @@ namespace Docx2Txt
|
||||
|
||||
bool inField = false;
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator it = pParagraph->m_arrItems.begin();
|
||||
it != pParagraph->m_arrItems.end(); ++it)
|
||||
for (size_t i = 0; i < pParagraph->m_arrItems.size(); ++i)
|
||||
{
|
||||
if (*it== NULL) continue;
|
||||
if (pParagraph->m_arrItems[i] == NULL) continue;
|
||||
|
||||
if ((*it)->getType() == OOX::et_w_r)
|
||||
if (pParagraph->m_arrItems[i]->getType() == OOX::et_w_r)
|
||||
{
|
||||
OOX::Logic::CRun *run = dynamic_cast<OOX::Logic::CRun*>(*it);
|
||||
OOX::Logic::CRun *run = dynamic_cast<OOX::Logic::CRun*>(pParagraph->m_arrItems[i]);
|
||||
|
||||
for (std::vector<OOX::WritingElement*>::iterator jt = run->m_arrItems.begin(); jt != run->m_arrItems.end(); jt++)
|
||||
for (size_t j = 0; j < run->m_arrItems.size(); ++j)
|
||||
{
|
||||
if (*jt== NULL) continue;
|
||||
if (run->m_arrItems[j] == NULL) continue;
|
||||
|
||||
if ((*jt)->getType() == OOX::et_w_fldChar)
|
||||
if (run->m_arrItems[j]->getType() == OOX::et_w_fldChar)
|
||||
{
|
||||
OOX::Logic::CFldChar *fldChar = dynamic_cast<OOX::Logic::CFldChar*>(*jt);
|
||||
OOX::Logic::CFldChar *fldChar = dynamic_cast<OOX::Logic::CFldChar*>(run->m_arrItems[j]);
|
||||
|
||||
if ((fldChar) && (fldChar->m_oFldCharType.IsInit()))
|
||||
{
|
||||
@ -503,13 +492,13 @@ namespace Docx2Txt
|
||||
if ((run->m_oRunProperty) && (run->m_oRunProperty->m_oCaps.Init()) && (run->m_oRunProperty->m_oCaps->m_oVal.ToBool())) caps = true;
|
||||
|
||||
std::wstring wstr;
|
||||
if ((*jt)->getType() == OOX::et_w_tab)
|
||||
if (run->m_arrItems[j]->getType() == OOX::et_w_tab)
|
||||
{
|
||||
wstr = L"\x09";
|
||||
}
|
||||
else if ((*jt)->getType() == OOX::et_w_t)
|
||||
else if (run->m_arrItems[j]->getType() == OOX::et_w_t)
|
||||
{
|
||||
OOX::Logic::CText* text = dynamic_cast<OOX::Logic::CText*>(*jt);
|
||||
OOX::Logic::CText* text = dynamic_cast<OOX::Logic::CText*>(run->m_arrItems[j]);
|
||||
wstr = text->m_sText;
|
||||
if(caps)
|
||||
{
|
||||
@ -518,49 +507,38 @@ namespace Docx2Txt
|
||||
}
|
||||
}
|
||||
|
||||
if ((*jt)->getType() == OOX::et_w_footnoteReference || (*it)->getType() == OOX::et_w_endnoteReference)
|
||||
if (run->m_arrItems[j]->getType() == OOX::et_w_footnoteReference ||
|
||||
pParagraph->m_arrItems[i]->getType() == OOX::et_w_endnoteReference)
|
||||
{// todooo Ref ????
|
||||
|
||||
std::vector<std::wstring> notes_content;
|
||||
|
||||
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(*jt);
|
||||
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(*jt);
|
||||
OOX::Logic::CFootnoteReference* footnote_ref = dynamic_cast<OOX::Logic::CFootnoteReference*>(run->m_arrItems[j]);
|
||||
OOX::Logic::CEndnoteReference* endnote_ref = dynamic_cast<OOX::Logic::CEndnoteReference*>(run->m_arrItems[j]);
|
||||
NoteCount++;
|
||||
|
||||
if (footnote_ref)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::FootNote);
|
||||
if (pFile.IsInit())
|
||||
if (footnote_ref && m_inputFile.m_pFootnotes)
|
||||
{
|
||||
for (size_t r = 0; r < m_inputFile.m_pFootnotes->m_arrFootnote.size(); r++)
|
||||
{
|
||||
OOX::CFootnotes *pFootnotes = (OOX::CFootnotes*)pFile.operator->();
|
||||
|
||||
for (size_t r = 0; r < pFootnotes->m_arrFootnote.size(); r++)
|
||||
{
|
||||
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pFootnotes->m_arrFootnote[r]);
|
||||
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(m_inputFile.m_pFootnotes->m_arrFootnote[r]);
|
||||
|
||||
if (note && note->m_oId == footnote_ref->m_oId)
|
||||
{
|
||||
convert(pFootnotes->m_arrFootnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
|
||||
}
|
||||
if (note && note->m_oId == footnote_ref->m_oId)
|
||||
{
|
||||
convert(m_inputFile.m_pFootnotes->m_arrFootnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
|
||||
}
|
||||
}
|
||||
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
|
||||
}
|
||||
if (endnote_ref)
|
||||
if (endnote_ref && m_inputFile.m_pEndnotes)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pDocument->Find(OOX::FileTypes::EndNote);
|
||||
if (pFile.IsInit())
|
||||
for (size_t r =0; r < m_inputFile.m_pEndnotes->m_arrEndnote.size(); r++)
|
||||
{
|
||||
OOX::CEndnotes *pEndnotes = (OOX::CEndnotes*)pFile.operator->();
|
||||
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(m_inputFile.m_pEndnotes->m_arrEndnote[r]);
|
||||
|
||||
for (size_t r =0; r < pEndnotes->m_arrEndnote.size(); r++)
|
||||
if (note && note->m_oId == endnote_ref->m_oId)
|
||||
{
|
||||
OOX::CFtnEdn* note = dynamic_cast<OOX::CFtnEdn*>(pEndnotes->m_arrEndnote[r]);
|
||||
|
||||
if (note && note->m_oId == endnote_ref->m_oId)
|
||||
{
|
||||
convert(pEndnotes->m_arrEndnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
|
||||
}
|
||||
convert(m_inputFile.m_pEndnotes->m_arrEndnote[r]->m_arrItems, notes_content, Event, false, pDocument, pNumbering, pStyles);
|
||||
}
|
||||
}
|
||||
Notes.insert(std::make_pair(ToWString(NoteCount), notes_content));
|
||||
|
||||
@ -218,7 +218,7 @@ void CTxtXmlFile::CreateDocxEmpty(const std::wstring & _strDirectory, Writers::F
|
||||
OOX::CApp* pApp = new OOX::CApp(NULL);
|
||||
if (pApp)
|
||||
{
|
||||
pApp->SetApplication(L"OnlyOffice");
|
||||
pApp->SetApplication(L"ONLYOFFICE");
|
||||
#if defined(INTVER)
|
||||
pApp->SetAppVersion(VALUE2STR(INTVER));
|
||||
#endif
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include <boost/make_shared.hpp>
|
||||
|
||||
#include "../../../ASCOfficeOdfFile/include/cpdoccore/utf8cpp/utf8.h"
|
||||
#include "../../../Common/DocxFormat/Source/Base/Base.h"
|
||||
|
||||
#include "external_items.h"
|
||||
#include "../../../DesktopEditor/common/File.h"
|
||||
@ -235,8 +236,8 @@ 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"<dc:creator>ONLYOFFICE</dc:creator>";
|
||||
//resStream << L"<cp:lastModifiedBy>ONLYOFFICE</cp:lastModifiedBy>";
|
||||
resStream << L"<cp:revision>1</cp:revision>";
|
||||
resStream << L"</cp:coreProperties>";
|
||||
|
||||
@ -251,8 +252,12 @@ void app_file::write(const std::wstring & RootPath)
|
||||
resStream << L"<Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" "
|
||||
L"xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\" >";
|
||||
|
||||
resStream << L"<Application>ONLYOFFICE Editor</Application>";
|
||||
resStream << L"</Properties>";
|
||||
resStream << L"<Application>ONLYOFFICE";
|
||||
#if defined(INTVER)
|
||||
std::string s = VALUE2STR(INTVER);
|
||||
resStream << L"/" << std::wstring(s.begin(), s.end());
|
||||
#endif
|
||||
resStream << L"</Application></Properties>";
|
||||
|
||||
simple_element elm(L"app.xml", resStream.str());
|
||||
elm.write(RootPath);
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -52,6 +52,7 @@
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="false"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -346,6 +346,7 @@
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
|
||||
@ -18,8 +18,6 @@ include(../../../Common/base.pri)
|
||||
|
||||
DEFINES += UNICODE _UNICODE \
|
||||
_USE_LIBXML2_READER_ \
|
||||
_USE_XMLLITE_READER_ \
|
||||
USE_LITE_READER \
|
||||
LIBXML_READER_ENABLED \
|
||||
DONT_WRITE_EMBEDDED_FONTS
|
||||
|
||||
@ -52,6 +50,7 @@ SOURCES += \
|
||||
../Source/DocxFormat/Logic/Table.cpp \
|
||||
../Source/DocxFormat/Logic/TableProperty.cpp \
|
||||
../Source/DocxFormat/Logic/Vml.cpp \
|
||||
../Source/DocxFormat/Media/VbaProject.cpp \
|
||||
../Source/DocxFormat/Math/oMath.cpp \
|
||||
../Source/DocxFormat/Math/oMathContent.cpp \
|
||||
../Source/DocxFormat/Math/oMathPara.cpp \
|
||||
@ -60,6 +59,7 @@ SOURCES += \
|
||||
../Source/XlsxFormat/Chart/ChartSerialize.cpp \
|
||||
../Source/XlsxFormat/Common.cpp \
|
||||
../Source/XlsxFormat/Xlsx.cpp \
|
||||
../Source/XlsxFormat/Worksheets/Worksheet.cpp \
|
||||
../Source/XlsxFormat/Worksheets/SheetData.cpp \
|
||||
../Source/DocxFormat/FileFactory.cpp \
|
||||
../Source/DocxFormat/IFileContainer.cpp \
|
||||
@ -70,7 +70,6 @@ SOURCES += \
|
||||
../Source/Common/Index.cpp \
|
||||
../Source/Common/NumFormat.cpp \
|
||||
../Source/Common/Position.cpp \
|
||||
../Source/Common/Utils.cpp \
|
||||
../Source/Common/Wrap.cpp \
|
||||
../Source/Common/ZIndex.cpp \
|
||||
../Source/Common/SimpleTypes_Word.cpp \
|
||||
@ -106,7 +105,6 @@ HEADERS += docxformatlib.h \
|
||||
../Source/Common/SimpleTypes_Word.h \
|
||||
../Source/Common/Size.h \
|
||||
../Source/Common/Unit.h \
|
||||
../Source/Common/Utils.h \
|
||||
../Source/Common/Wrap.h \
|
||||
../Source/Common/ZIndex.h \
|
||||
../Source/DocxFormat/Drawing/Drawing.h \
|
||||
@ -231,6 +229,7 @@ HEADERS += docxformatlib.h \
|
||||
../Source/XlsxFormat/SimpleTypes_Spreadsheet.h \
|
||||
../Source/XlsxFormat/Workbook.h \
|
||||
../Source/XlsxFormat/WritingElement.h \
|
||||
../Source/DocxFormat/WorkbookComments.h \
|
||||
../Source/XlsxFormat/Xlsx.h \
|
||||
../Source/XML/Utils.h \
|
||||
../Source/XML/XmlSimple.h \
|
||||
|
||||
@ -48,23 +48,24 @@
|
||||
#include "../Source/DocxFormat/Math/oMath.cpp"
|
||||
#include "../Source/DocxFormat/Math/oMathContent.cpp"
|
||||
#include "../Source/DocxFormat/Math/oMathPara.cpp"
|
||||
#include "../Source/MathEquation/MathEquation.cpp"
|
||||
#include "../Source/DocxFormat/Media/VbaProject.cpp"
|
||||
#include "../Source/DocxFormat/Docx.cpp"
|
||||
#include "../Source/XlsxFormat/Chart/ChartSerialize.cpp"
|
||||
#include "../Source/XlsxFormat/Common.cpp"
|
||||
#include "../Source/DocxFormat/FileFactory.cpp"
|
||||
#include "../Source/DocxFormat/IFileContainer.cpp"
|
||||
#include "../Source/XlsxFormat/FileFactory_Spreadsheet.cpp"
|
||||
#include "../Source/DocxFormat/Drawing/DrawingExt.cpp"
|
||||
#include "../Source/MathEquation/MathEquation.cpp"
|
||||
#include "../Source/Common/Align.cpp"
|
||||
#include "../Source/Common/Color.cpp"
|
||||
#include "../Source/Common/Index.cpp"
|
||||
#include "../Source/Common/NumFormat.cpp"
|
||||
#include "../Source/Common/Position.cpp"
|
||||
#include "../Source/Common/Utils.cpp"
|
||||
#include "../Source/Common/Wrap.cpp"
|
||||
#include "../Source/Common/ZIndex.cpp"
|
||||
#include "../Source/Common/SimpleTypes_Word.cpp"
|
||||
#include "../Source/SystemUtility/SystemUtility.cpp"
|
||||
#include "../Source/XlsxFormat/Chart/ChartSerialize.cpp"
|
||||
#include "../Source/XlsxFormat/Common.cpp"
|
||||
#include "../Source/XlsxFormat/FileFactory_Spreadsheet.cpp"
|
||||
#include "../Source/XlsxFormat/Xlsx.cpp"
|
||||
#include "../Source/XlsxFormat/Worksheets/SheetData.cpp"
|
||||
#include "../Source/XlsxFormat/Worksheets/Worksheet.cpp"
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;DONT_WRITE_EMBEDDED_FONTS"
|
||||
PreprocessorDefinitions="_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;DONT_WRITE_EMBEDDED_FONTS"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@ -52,6 +52,7 @@
|
||||
ProgramDataBaseFileName="$(IntDir)\DocxFormat.pdb"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4005;4311;4312"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
@ -113,7 +114,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
PreprocessorDefinitions="_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
@ -180,7 +181,7 @@
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories=".\..\Source\XML\libxml2\XML\include;.\..\Source\Utility;.\..\Source\XML;.\..\Source\Common;..\..\..\..\..\Redist;..\..\ASCOfficeOdtFile\Source\OfficeSvmFile"
|
||||
PreprocessorDefinitions="USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
PreprocessorDefinitions="_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
ProgramDataBaseFileName="$(IntDir)\DocxFormat.pdb"
|
||||
@ -245,7 +246,7 @@
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
AdditionalIncludeDirectories=".\..\Source\XML\libxml2\XML\include;.\..\Source\Utility;.\..\Source\XML;.\..\Source\Common;..\..\..\..\..\Redist;..\..\ASCOfficeOdtFile\Source\OfficeSvmFile"
|
||||
PreprocessorDefinitions="USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
PreprocessorDefinitions="_USE_LIBXML2_READER_;LIBXML_READER_ENABLED"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
ProgramDataBaseFileName="$(IntDir)\DocxFormat.pdb"
|
||||
@ -1204,6 +1205,10 @@
|
||||
RelativePath="..\Source\DocxFormat\Media\OleObject.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\DocxFormat\Media\VbaProject.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\DocxFormat\Media\VbaProject.h"
|
||||
>
|
||||
@ -1376,14 +1381,6 @@
|
||||
RelativePath="..\Source\Common\Unit.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\Common\Utils.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\Common\Utils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\Common\Wrap.cpp"
|
||||
>
|
||||
@ -1679,6 +1676,10 @@
|
||||
RelativePath="..\Source\XlsxFormat\Worksheets\SheetData.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Worksheets\Worksheet.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Worksheets\Worksheet.h"
|
||||
>
|
||||
|
||||
@ -42,6 +42,9 @@
|
||||
#define _T(x) __T(x)
|
||||
#define __T(x) L##x
|
||||
|
||||
#define VALUE_TO_STRING(x) #x
|
||||
#define VALUE2STR(x) VALUE_TO_STRING(x)
|
||||
|
||||
#if defined(_WIN32) || defined (_WIN64)
|
||||
#include <TCHAR.H>
|
||||
// windows-stype separator for paths i.e. 'c:\home\documents\file.ext'
|
||||
|
||||
@ -145,7 +145,6 @@ namespace NSCommon
|
||||
this->m_pPointer = new Type(oNode);
|
||||
return *this;
|
||||
}
|
||||
#ifdef _USE_XMLLITE_READER_
|
||||
nullable<Type>& operator=(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
@ -153,7 +152,6 @@ namespace NSCommon
|
||||
this->m_pPointer = new Type(oReader);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
nullable<Type>& operator=(const wchar_t* cwsValue)
|
||||
{
|
||||
RELEASEOBJECT(this->m_pPointer);
|
||||
|
||||
@ -1,56 +0,0 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "Utils.h"
|
||||
|
||||
#include "../../../DesktopEditor/xml/include/xmlutils.h"
|
||||
|
||||
|
||||
void Common::readAllShapeTypes(const OOX::CPath& oPath, std::vector<std::wstring>& aShapetypes)
|
||||
{
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
if ( !oReader.FromFile( oPath.GetPath() ) )
|
||||
return;
|
||||
|
||||
while ( false != oReader.ReadNextNode() )
|
||||
{
|
||||
std::wstring sName = oReader.GetName();
|
||||
if(_T("v:shapetype") == sName)
|
||||
{
|
||||
std::wstring sXml = oReader.GetOuterXml();
|
||||
if(false == sXml.empty())
|
||||
aShapetypes.push_back(sXml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -39,9 +39,6 @@
|
||||
#include "../Common/SimpleTypes_Word.h"
|
||||
#include "../Common/SimpleTypes_Shared.h"
|
||||
|
||||
#define VALUE_TO_STRING(x) #x
|
||||
#define VALUE2STR(x) VALUE_TO_STRING(x)
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
class CApp : public OOX::File
|
||||
@ -195,15 +192,20 @@ namespace OOX
|
||||
{
|
||||
sXml += _T("<Application>");
|
||||
sXml += m_sApplication.get();
|
||||
if ( m_sAppVersion.IsInit() )
|
||||
{
|
||||
sXml += L"/";
|
||||
sXml += m_sAppVersion.get();
|
||||
}
|
||||
sXml += _T("</Application>");
|
||||
}
|
||||
|
||||
if ( m_sAppVersion.IsInit() )
|
||||
{
|
||||
sXml += _T("<AppVersion>");
|
||||
sXml += m_sAppVersion.get();
|
||||
sXml += _T("</AppVersion>");
|
||||
}
|
||||
//if ( m_sAppVersion.IsInit() ) - only for ms editors versions
|
||||
//{
|
||||
// sXml += _T("<AppVersion>");
|
||||
// sXml += m_sAppVersion.get(); // error in ms editors - "2.4.510.0"
|
||||
// sXml += _T("</AppVersion>");
|
||||
//}
|
||||
|
||||
if ( m_nCharacters.IsInit() )
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user