mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-01 16:51:51 +08:00
Compare commits
18 Commits
core-win-6
...
core-linux
| Author | SHA1 | Date | |
|---|---|---|---|
| 30d175144a | |||
| acf15abe41 | |||
| 5a7fc7f548 | |||
| e7326556e0 | |||
| c589d8fe8a | |||
| a28e8f1357 | |||
| 8b7bb944bc | |||
| 14ee946069 | |||
| 7aebdd8ec5 | |||
| 977baafc03 | |||
| 31b854bc70 | |||
| e274dc50d7 | |||
| d153db627b | |||
| 9cc6bc14c5 | |||
| 775c57be5d | |||
| da37aeb039 | |||
| 751c6647a2 | |||
| ec2344ccd5 |
@ -33,6 +33,7 @@
|
||||
#define COMMENTS_WRITER
|
||||
|
||||
#include "../../XlsxSerializerCom/Common/Common.h"
|
||||
#include "../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
|
||||
|
||||
namespace Writers
|
||||
{
|
||||
@ -50,21 +51,28 @@ namespace Writers
|
||||
std::wstring m_sComment;
|
||||
std::wstring m_sCommentExt;
|
||||
std::wstring m_sPeople;
|
||||
std::wstring m_sDocumentComment;
|
||||
std::wstring m_sDocumentCommentExt;
|
||||
std::wstring m_sDocumentPeople;
|
||||
|
||||
CommentsWriter(std::wstring sDir) : m_sDir(sDir)
|
||||
{
|
||||
}
|
||||
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sPeople)
|
||||
void setElements(std::wstring& sComment, std::wstring& sCommentExt, std::wstring& sPeople, std::wstring& sDocumentComment, std::wstring& sDocumentCommentExt, std::wstring& sDocumentPeople)
|
||||
{
|
||||
m_sComment = sComment;
|
||||
m_sCommentExt = sCommentExt;
|
||||
m_sPeople = sPeople;
|
||||
m_sDocumentComment = sDocumentComment;
|
||||
m_sDocumentCommentExt = sDocumentCommentExt;
|
||||
m_sDocumentPeople = sDocumentPeople;
|
||||
}
|
||||
void Write()
|
||||
{
|
||||
std::wstring sDir = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR;
|
||||
if(false == m_sComment.empty())
|
||||
{
|
||||
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("comments.xml");
|
||||
OOX::CPath filePath = sDir + OOX::FileTypes::Comments.DefaultFileName().GetPath();
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath.GetPath());
|
||||
@ -76,7 +84,7 @@ namespace Writers
|
||||
if(false == m_sCommentExt.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("commentsExtended.xml"));
|
||||
oFile.CreateFileW(sDir + OOX::FileTypes::CommentsExt.DefaultFileName().GetPath());
|
||||
oFile.WriteStringUTF8(g_string_commentExt_Start);
|
||||
oFile.WriteStringUTF8(m_sCommentExt);
|
||||
oFile.WriteStringUTF8(g_string_commentExt_End);
|
||||
@ -85,12 +93,43 @@ namespace Writers
|
||||
if(false == m_sPeople.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("people.xml"));
|
||||
oFile.CreateFileW(sDir + OOX::FileTypes::People.DefaultFileName().GetPath());
|
||||
oFile.WriteStringUTF8(g_string_people_Start);
|
||||
oFile.WriteStringUTF8(m_sPeople);
|
||||
oFile.WriteStringUTF8(g_string_people_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
|
||||
if(false == m_sDocumentComment.empty())
|
||||
{
|
||||
OOX::CPath filePath = sDir + OOX::FileTypes::DocumentComments.DefaultFileName().GetPath();
|
||||
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(filePath.GetPath());
|
||||
oFile.WriteStringUTF8(g_string_comment_Start);
|
||||
oFile.WriteStringUTF8(m_sDocumentComment);
|
||||
oFile.WriteStringUTF8(g_string_comment_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
if(false == m_sDocumentCommentExt.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sDir + OOX::FileTypes::DocumentCommentsExt.DefaultFileName().GetPath());
|
||||
oFile.WriteStringUTF8(g_string_commentExt_Start);
|
||||
oFile.WriteStringUTF8(m_sDocumentCommentExt);
|
||||
oFile.WriteStringUTF8(g_string_commentExt_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
if(false == m_sDocumentPeople.empty())
|
||||
{
|
||||
NSFile::CFileBinary oFile;
|
||||
oFile.CreateFileW(sDir + OOX::FileTypes::DocumentPeople.DefaultFileName().GetPath());
|
||||
oFile.WriteStringUTF8(g_string_people_Start);
|
||||
oFile.WriteStringUTF8(m_sDocumentPeople);
|
||||
oFile.WriteStringUTF8(g_string_people_End);
|
||||
oFile.CloseFile();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -3486,6 +3486,16 @@ public:
|
||||
READ1_DEF(length, res, this->ReadEndnotePr, &oEdnProps);
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(oEdnProps.toXML());
|
||||
}
|
||||
else if( c_oSer_SettingsType::DecimalSymbol == type )
|
||||
{
|
||||
std::wstring sDecimalSymbol = m_oBufferedStream.GetString3(length);
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:decimalSymbol w:val=\"" + XmlUtils::EncodeXmlString(sDecimalSymbol) + L"\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::ListSeparator == type )
|
||||
{
|
||||
std::wstring sListSeparator = m_oBufferedStream.GetString3(length);
|
||||
m_oFileWriter.m_oSettingWriter.AddSetting(L"<w:listSeparator w:val=\"" + XmlUtils::EncodeXmlString(sListSeparator) + L"\"/>");
|
||||
}
|
||||
else if( c_oSer_SettingsType::SdtGlobalColor == type )
|
||||
{
|
||||
rPr oRPr(m_oFileWriter.m_oFontTableWriter.m_mapFonts);
|
||||
@ -8703,6 +8713,7 @@ public:
|
||||
long nSettingsOffset = -1;
|
||||
long nDocumentOffset = -1;
|
||||
long nCommentsOffset = -1;
|
||||
long nDocumentCommentsOffset = -1;
|
||||
|
||||
std::vector<BYTE> aTypes;
|
||||
std::vector<long> aOffBits;
|
||||
@ -8737,6 +8748,10 @@ public:
|
||||
{
|
||||
nCommentsOffset = mtiOffBits;
|
||||
}
|
||||
else if(c_oSerTableTypes::DocumentComments == mtiType)
|
||||
{
|
||||
nDocumentCommentsOffset = mtiOffBits;
|
||||
}
|
||||
else
|
||||
{
|
||||
aTypes.push_back(mtiType);
|
||||
@ -8786,6 +8801,15 @@ public:
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
Binary_CommentsTableReader oBinary_DocumentCommentsTableReader(m_oBufferedStream, m_oFileWriter);
|
||||
if(-1 != nDocumentCommentsOffset)
|
||||
{
|
||||
int nOldPos = m_oBufferedStream.GetPos();
|
||||
m_oBufferedStream.Seek(nDocumentCommentsOffset);
|
||||
res = oBinary_DocumentCommentsTableReader.Read();
|
||||
if(c_oSerConstants::ReadOk != res)
|
||||
return res;
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < aTypes.size(); ++i)
|
||||
{
|
||||
@ -8936,6 +8960,7 @@ public:
|
||||
+ FILE_SEPARATOR_STR + L"_rels"
|
||||
+ FILE_SEPARATOR_STR + L"document.xml.rels";
|
||||
|
||||
//comments
|
||||
CComments& oComments= oBinary_CommentsTableReader.m_oComments;
|
||||
Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter;
|
||||
|
||||
@ -8943,25 +8968,47 @@ public:
|
||||
std::wstring sContentEx = oComments.writeContentExt(); //важно чтобы writeContentExt вызывался после writeContent
|
||||
std::wstring sPeople = oComments.writePeople();
|
||||
|
||||
oCommentsWriter.setElements(sContent, sContentEx, sPeople);
|
||||
std::wstring sDocumentContent = oBinary_DocumentCommentsTableReader.m_oComments.writeContent();
|
||||
std::wstring sDocumentContentEx = oBinary_DocumentCommentsTableReader.m_oComments.writeContentExt(); //важно чтобы writeContentExt вызывался после writeContent
|
||||
std::wstring sDocumentPeople = oBinary_DocumentCommentsTableReader.m_oComments.writePeople();
|
||||
|
||||
oCommentsWriter.setElements(sContent, sContentEx, sPeople, sDocumentContent, sDocumentContentEx, sDocumentPeople);
|
||||
|
||||
if(false == oCommentsWriter.m_sComment.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", L"comments.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml", L"/word", L"comments.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::Comments.RelationType(), OOX::FileTypes::Comments.DefaultFileName().GetPath(), std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(OOX::FileTypes::Comments.OverrideType(), L"/word", OOX::FileTypes::Comments.DefaultFileName().GetPath());
|
||||
}
|
||||
if(false == oCommentsWriter.m_sCommentExt.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended", L"commentsExtended.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml", L"/word", L"commentsExtended.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::CommentsExt.RelationType(), OOX::FileTypes::CommentsExt.DefaultFileName().GetPath(), std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(OOX::FileTypes::CommentsExt.OverrideType(), L"/word", OOX::FileTypes::CommentsExt.DefaultFileName().GetPath());
|
||||
}
|
||||
if(false == oCommentsWriter.m_sPeople.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(L"http://schemas.microsoft.com/office/2011/relationships/people", L"people.xml", std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml", L"/word", L"people.xml");
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::People.RelationType(), OOX::FileTypes::People.DefaultFileName().GetPath(), std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(OOX::FileTypes::People.OverrideType(), L"/word", OOX::FileTypes::People.DefaultFileName().GetPath());
|
||||
}
|
||||
if(false == oCommentsWriter.m_sDocumentComment.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::DocumentComments.RelationType(), OOX::FileTypes::DocumentComments.DefaultFileName().GetPath(), std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(OOX::FileTypes::DocumentComments.OverrideType(), L"/word", OOX::FileTypes::DocumentComments.DefaultFileName().GetPath());
|
||||
}
|
||||
if(false == oCommentsWriter.m_sDocumentCommentExt.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::DocumentCommentsExt.RelationType(), OOX::FileTypes::DocumentCommentsExt.DefaultFileName().GetPath(), std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(OOX::FileTypes::DocumentCommentsExt.OverrideType(), L"/word", OOX::FileTypes::DocumentCommentsExt.DefaultFileName().GetPath());
|
||||
}
|
||||
if(false == oCommentsWriter.m_sDocumentPeople.empty())
|
||||
{
|
||||
unsigned int rId;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::DocumentPeople.RelationType(), OOX::FileTypes::DocumentPeople.DefaultFileName().GetPath(), std::wstring(), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->Registration(OOX::FileTypes::DocumentPeople.OverrideType(), L"/word", OOX::FileTypes::DocumentPeople.DefaultFileName().GetPath());
|
||||
}
|
||||
|
||||
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
namespace Writers
|
||||
{
|
||||
static std::wstring g_string_set_Start = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?><w:settings xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:v=\"urn:schemas-microsoft-com:vml\">");
|
||||
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"15\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults><w:decimalSymbol w:val=\".\"/><w:listSeparator w:val=\",\"/>");
|
||||
static std::wstring g_string_set_Default = _T("<w:zoom w:percent=\"100\"/><w:characterSpacingControl w:val=\"doNotCompress\"/><w:compat><w:compatSetting w:name=\"compatibilityMode\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"15\"/><w:compatSetting w:name=\"overrideTableStyleFontSizeAndJustification\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"enableOpenTypeFeatures\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/><w:compatSetting w:name=\"doNotFlipMirrorIndents\" w:uri=\"http://schemas.microsoft.com/office/word\" w:val=\"1\"/></w:compat><w:themeFontLang w:val=\"en-US\" w:eastAsia=\"zh-CN\"/><w:shapeDefaults><o:shapedefaults v:ext=\"edit\" spidmax=\"1026\"/><o:shapelayout v:ext=\"edit\"><o:idmap v:ext=\"edit\" data=\"1\"/></o:shapelayout></w:shapeDefaults>");
|
||||
static std::wstring g_string_set_End = _T("</w:settings>");
|
||||
|
||||
class SettingWriter
|
||||
|
||||
@ -146,7 +146,8 @@ extern int g_nCurFormatVersion;
|
||||
Background = 12,
|
||||
VbaProject = 13,
|
||||
App = 15,
|
||||
Core = 16
|
||||
Core = 16,
|
||||
DocumentComments = 17
|
||||
};}
|
||||
namespace c_oSerSigTypes{enum c_oSerSigTypes
|
||||
{
|
||||
@ -809,7 +810,9 @@ extern int g_nCurFormatVersion;
|
||||
SdtGlobalColor = 6,
|
||||
SdtGlobalShowHighlight = 7,
|
||||
Compat = 8,
|
||||
DefaultTabStopTwips = 9
|
||||
DefaultTabStopTwips = 9,
|
||||
DecimalSymbol = 10,
|
||||
ListSeparator = 11
|
||||
};}
|
||||
namespace c_oSer_MathPrType{enum c_oSer_SettingsType
|
||||
{
|
||||
|
||||
@ -7535,6 +7535,18 @@ namespace BinDocxRW
|
||||
WriteCompat(oSettings.m_oCompat.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oDecimalSymbol.IsInit() && oSettings.m_oDecimalSymbol->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::DecimalSymbol);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSettings.m_oDecimalSymbol->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettings.m_oListSeparator.IsInit() && oSettings.m_oListSeparator->m_sVal.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::ListSeparator);
|
||||
m_oBcw.m_oStream.WriteStringW3(oSettings.m_oListSeparator->m_sVal.get());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
}
|
||||
if(oSettingsCustom.m_oSdtGlobalColor.IsInit())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSer_SettingsType::SdtGlobalColor);
|
||||
@ -8081,6 +8093,13 @@ namespace BinDocxRW
|
||||
oBinaryCommentsTableWriter.Write(*oDocx.m_pComments, oDocx.m_pCommentsExt, oDocx.m_pPeople, m_oParamsWriter.m_mapIgnoreComments);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
if(NULL != oDocx.m_pDocumentComments)
|
||||
{
|
||||
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
|
||||
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::DocumentComments);
|
||||
oBinaryCommentsTableWriter.Write(*oDocx.m_pDocumentComments, oDocx.m_pDocumentCommentsExt, oDocx.m_pDocumentPeople, m_oParamsWriter.m_mapIgnoreComments);
|
||||
this->WriteTableEnd(nCurPos);
|
||||
}
|
||||
|
||||
//Write StyleTable
|
||||
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FE921ACC42C4006B99B3"
|
||||
BuildableName = "libASCOfficeDocxFile2Lib_ios.a"
|
||||
BlueprintName = "ASCOfficeDocxFile2Lib"
|
||||
ReferencedContainer = "container:ASCOfficeDocxFile2Lib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -933,8 +933,8 @@ mc:Ignorable=\"w14 wp14\">";
|
||||
|
||||
for (size_t i = 0; i < numIds.size(); i++)
|
||||
{
|
||||
strm << L"<w:num w:numId=\"" << numIds[i] << L"\" >";
|
||||
strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\" />";
|
||||
strm << L"<w:num w:numId=\"" << numIds[i] << L"\">";
|
||||
strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\"/>";
|
||||
strm << L"</w:num>";
|
||||
}
|
||||
|
||||
@ -960,19 +960,19 @@ void docx_conversion_context::process_fonts()
|
||||
if (!arFonts[i]) continue;
|
||||
if (arFonts[i]->name().empty()) continue;
|
||||
|
||||
strm << L"<w:font w:name=\"" << arFonts[i]->name() << L"\" >";
|
||||
strm << L"<w:font w:name=\"" << arFonts[i]->name() << L"\">";
|
||||
|
||||
if (!arFonts[i]->charset().empty())
|
||||
strm << L"<w:charset w:val=\"" << arFonts[i]->charset() <<"\" />";
|
||||
strm << L"<w:charset w:val=\"" << arFonts[i]->charset() <<"\"/>";
|
||||
|
||||
if (!arFonts[i]->family().empty())
|
||||
strm << L"<w:family w:val=\"" << arFonts[i]->family() << "\" />";
|
||||
strm << L"<w:family w:val=\"" << arFonts[i]->family() << "\"/>";
|
||||
|
||||
if (!arFonts[i]->pitch().empty())
|
||||
strm << L"<w:pitch w:val=\"" << arFonts[i]->pitch() << "\" />";
|
||||
strm << L"<w:pitch w:val=\"" << arFonts[i]->pitch() << "\"/>";
|
||||
|
||||
if (!arFonts[i]->alt_name().empty())
|
||||
strm << L"<w:altName w:val=\"" << arFonts[i]->alt_name() << "\" />";
|
||||
strm << L"<w:altName w:val=\"" << arFonts[i]->alt_name() << "\"/>";
|
||||
|
||||
strm << L"</w:font>";
|
||||
}
|
||||
@ -995,7 +995,7 @@ void docx_conversion_context::process_styles()
|
||||
_Wostream << L"xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" ";
|
||||
_Wostream << L"xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" ";
|
||||
_Wostream << L"xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" ";
|
||||
_Wostream << L"mc:Ignorable=\"w14\"> ";
|
||||
_Wostream << L"mc:Ignorable=\"w14\">";
|
||||
|
||||
if (odf_reader::odf_document * doc = root())
|
||||
{
|
||||
@ -1067,28 +1067,32 @@ void docx_conversion_context::process_styles()
|
||||
|
||||
const std::wstring displayName = StyleDisplayName(arStyles[i]->name(), arStyles[i]->display_name(), arStyles[i]->type());
|
||||
|
||||
_Wostream << L"<w:name w:val=\"" << displayName << L"\" />";
|
||||
_Wostream << L"<w:name w:val=\"" << displayName << L"\"/>";
|
||||
|
||||
if (odf_reader::style_instance * baseOn = arStyles[i]->parent())
|
||||
{
|
||||
const std::wstring basedOnId = styles_map_.get(baseOn->name(), baseOn->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
else if (!arStyles[i]->is_default() && styles_map_.check(L"", arStyles[i]->type()))
|
||||
{
|
||||
const std::wstring basedOnId = styles_map_.get(L"", arStyles[i]->type());
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\" />";
|
||||
_Wostream << L"<w:basedOn w:val=\"" << basedOnId << "\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
_Wostream << L"<w:qFormat/>";
|
||||
}
|
||||
|
||||
if (odf_reader::style_instance * next = arStyles[i]->next())
|
||||
{
|
||||
const std::wstring nextId = styles_map_.get(next->name(), next->type());
|
||||
_Wostream << L"<w:next w:val=\"" << nextId << "\" />";
|
||||
_Wostream << L"<w:next w:val=\"" << nextId << "\"/>";
|
||||
}
|
||||
else if (arStyles[i]->is_default())
|
||||
{
|
||||
// self
|
||||
_Wostream << L"<w:next w:val=\"" << id << "\" />";
|
||||
_Wostream << L"<w:next w:val=\"" << id << "\"/>";
|
||||
}
|
||||
|
||||
if (odf_reader::style_content * content = arStyles[i]->content())
|
||||
|
||||
@ -123,16 +123,17 @@ public:
|
||||
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"avi") return typeVideo;
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"wma") return typeAudio;
|
||||
if (sExt == L"wav") return typeAudio;
|
||||
|
||||
if (sExt == L"mp3") return typeAudio;
|
||||
if (sExt == L"m4a") return typeAudio;
|
||||
if (sExt == L"m4v") return typeVideo;
|
||||
if (sExt == L"mp4") return typeVideo;
|
||||
if (sExt == L"mov") return typeVideo;
|
||||
if (sExt == L"mkv") return typeVideo;
|
||||
if (sExt == L"webm") return typeVideo;
|
||||
|
||||
if (sExt == L"wmv") return typeVideo;
|
||||
if (sExt == L"wma") return typeAudio;
|
||||
if (sExt == L"wav") return typeAudio;
|
||||
if (sExt == L"mp3") return typeAudio;
|
||||
if (sExt == L"m4a") return typeAudio;
|
||||
|
||||
return typeMedia;
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
|
||||
{
|
||||
CP_XML_NODE(L"a:spAutoFit");
|
||||
}
|
||||
else if ((bFitToSize) && (*bFitToSize))
|
||||
if ((bFitToSize) && (*bFitToSize))
|
||||
{
|
||||
CP_XML_NODE(L"a:normAutofit");
|
||||
//{
|
||||
|
||||
@ -145,8 +145,11 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Presentation);
|
||||
if (defaultStyle)instances.push_back(defaultStyle);
|
||||
|
||||
instances.push_back(baseStyleInst);
|
||||
instances.push_back(baseStyleInst);
|
||||
}
|
||||
else if (common_presentation_attlist_.presentation_class_)
|
||||
{
|
||||
instances.push_back(baseStyleInst);
|
||||
}
|
||||
if (grStyleInst)//обычная векторная фигура
|
||||
{
|
||||
|
||||
@ -56,6 +56,7 @@ void graphic_format_properties::add_attributes( const xml::attributes_wc_ptr & A
|
||||
CP_APPLY_ATTR(L"draw:fit-to-size", draw_fit_to_size_);
|
||||
CP_APPLY_ATTR(L"draw:fit-to-contour", draw_fit_to_contour_);
|
||||
CP_APPLY_ATTR(L"style:shrink-to-fit", style_shrink_to_fit_);
|
||||
CP_APPLY_ATTR(L"draw:fit-to-size", draw_fit_to_size_str_);
|
||||
|
||||
CP_APPLY_ATTR(L"draw:stroke", draw_stroke_);
|
||||
CP_APPLY_ATTR(L"draw:stroke-dash", draw_stroke_dash_);
|
||||
@ -100,7 +101,12 @@ void graphic_format_properties::add_attributes( const xml::attributes_wc_ptr & A
|
||||
common_padding_attlist_.add_attributes(Attributes);
|
||||
common_shadow_attlist_.add_attributes(Attributes);
|
||||
common_background_color_attlist_.add_attributes(Attributes);
|
||||
|
||||
|
||||
if (draw_fit_to_size_str_ && !style_shrink_to_fit_)
|
||||
{//https://bugs.documentfoundation.org/show_bug.cgi?id=97630
|
||||
if (*draw_fit_to_size_str_ == L"shrink-to-fit")
|
||||
style_shrink_to_fit_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
void graphic_format_properties::apply_to(std::vector<_property> & properties)
|
||||
|
||||
@ -95,6 +95,7 @@ public:
|
||||
_CP_OPT(bool) draw_auto_grow_width_;
|
||||
|
||||
_CP_OPT(bool) style_shrink_to_fit_;
|
||||
_CP_OPT(std::wstring) draw_fit_to_size_str_;
|
||||
_CP_OPT(bool) draw_fit_to_size_; // draw:fit-to-size="shrink-to-fit" style:shrink-to-fit="true" - cebre_1.odp
|
||||
_CP_OPT(bool) draw_fit_to_contour_;
|
||||
_CP_OPT(std::wstring) draw_wrap_influence_on_position_;
|
||||
|
||||
@ -65,18 +65,28 @@ HRESULT convert_single(std::wstring srcFileName)
|
||||
|
||||
std::wstring dstPath = srcFileName;// + ....
|
||||
|
||||
bool bTemplate = false;
|
||||
|
||||
std::wstring type;
|
||||
switch(fileChecker.nFileType)
|
||||
{
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCM: dstPath += L"-my.odt"; type = L"text"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTX:
|
||||
case AVS_OFFICESTUDIO_FILE_DOCUMENT_DOTM: dstPath += L"-my.ott"; type = L"text"; bTemplate = true; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX:
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: dstPath += L"-my.ods"; type = L"spreadsheet"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX:
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM: dstPath += L"-my.ots"; type = L"spreadsheet"; bTemplate = true; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX:
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: dstPath += L"-my.odp"; type = L"presentation"; break;
|
||||
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX:
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM: dstPath += L"-my.otp"; type = L"presentation"; bTemplate = true; break;
|
||||
default:
|
||||
return S_FALSE;
|
||||
}
|
||||
@ -94,7 +104,7 @@ HRESULT convert_single(std::wstring srcFileName)
|
||||
if (S_OK != oCOfficeUtils.ExtractToDirectory(srcFileName.c_str(), srcTempPath.c_str(), NULL, 0))
|
||||
return S_FALSE;
|
||||
|
||||
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", NULL);
|
||||
Oox2Odf::Converter converter(srcTempPath, type, L"C:\\Windows\\Fonts", bTemplate);
|
||||
|
||||
std::wstring sPassword;// = L"password";
|
||||
|
||||
|
||||
@ -123,9 +123,9 @@ namespace odf_writer
|
||||
rels_.add(r.relationships_[i]);
|
||||
}
|
||||
}
|
||||
manifect_file::manifect_file(std::wstring t)
|
||||
manifect_file::manifect_file(const std::wstring & type)
|
||||
{
|
||||
type_ = t;
|
||||
type_ = type;
|
||||
}
|
||||
binary_file::binary_file(const std::wstring &file_name, const std::string &value)
|
||||
{
|
||||
@ -137,9 +137,9 @@ namespace odf_writer
|
||||
simple_element elm(file_name_, value_);
|
||||
elm.write(RootPath, false);
|
||||
}
|
||||
mimetype_file::mimetype_file(std::wstring t)
|
||||
mimetype_file::mimetype_file(const std::wstring & type)
|
||||
{
|
||||
type_ = t;
|
||||
type_ = type;
|
||||
}
|
||||
void mimetype_file::write(const std::wstring & RootPath, bool add_padding)
|
||||
{
|
||||
@ -316,11 +316,17 @@ namespace odf_writer
|
||||
set_rels(rels_);
|
||||
}
|
||||
|
||||
odf_document::odf_document(std::wstring type)
|
||||
odf_document::odf_document(std::wstring type, bool bTemplate)
|
||||
{
|
||||
manifest_ = element_ptr(new manifect_file(type));
|
||||
mimetype_ = element_ptr(new mimetype_file(type));
|
||||
manifest_ = element_ptr(new manifect_file(type + (bTemplate ? L"-template" : L"")));
|
||||
mimetype_ = element_ptr(new mimetype_file(type + (bTemplate ? L"-template" : L"")));
|
||||
}
|
||||
|
||||
std::wstring odf_document::get_type()
|
||||
{
|
||||
return dynamic_cast<manifect_file*>(manifest_.get())->get_type();
|
||||
}
|
||||
|
||||
void odf_document::write_manifest(const std::wstring & RootPath)
|
||||
{
|
||||
if (mimetype_)
|
||||
|
||||
@ -91,8 +91,6 @@ namespace odf_writer
|
||||
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding = false) = 0;
|
||||
std::wstring local_path;
|
||||
private:
|
||||
element * element_;
|
||||
};
|
||||
|
||||
inline element::~element()
|
||||
@ -151,11 +149,13 @@ namespace odf_writer
|
||||
class manifect_file : public element
|
||||
{
|
||||
public:
|
||||
manifect_file(std::wstring type);
|
||||
manifect_file(const std::wstring & type);
|
||||
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding = false);
|
||||
void add_rels(rels & r);
|
||||
|
||||
std::wstring get_type() {return type_;}
|
||||
|
||||
rels *get_rels() {return &rels_;}
|
||||
|
||||
private:
|
||||
@ -178,7 +178,7 @@ namespace odf_writer
|
||||
class mimetype_file : public element
|
||||
{
|
||||
public:
|
||||
mimetype_file(std::wstring type);
|
||||
mimetype_file(const std::wstring & type);
|
||||
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding = false);
|
||||
|
||||
@ -201,7 +201,7 @@ namespace odf_writer
|
||||
class object_files : public element
|
||||
{
|
||||
public:
|
||||
object_files(){}
|
||||
object_files() {}
|
||||
|
||||
void set_content (content_content_ptr & _content);
|
||||
|
||||
@ -227,14 +227,16 @@ namespace odf_writer
|
||||
class odf_document : public element
|
||||
{
|
||||
public:
|
||||
odf_document(std::wstring type);
|
||||
odf_document(std::wstring type, bool bTemplate);
|
||||
|
||||
void add_object(element_ptr _object,bool root = false);
|
||||
void add_binary(const std::wstring &file_name, const std::string &value);
|
||||
|
||||
void set_rels(rels & r);
|
||||
|
||||
std::wstring get_type();
|
||||
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding = false);
|
||||
virtual void write(const std::wstring & RootPath, bool add_padding);
|
||||
void write_manifest(const std::wstring & RootPath);
|
||||
|
||||
manifect_file* get_manifest() {return dynamic_cast<manifect_file*>(manifest_.get());}
|
||||
|
||||
@ -163,8 +163,15 @@ void odf_conversion_context::end_document()
|
||||
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"meta.xml"));
|
||||
rels_.add(relationship(std::wstring(L"text/xml"), object_files->local_path + L"settings.xml"));
|
||||
|
||||
if (isRoot)object_files->local_path = L"/";
|
||||
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + object.content->get_name(), object_files->local_path));
|
||||
if (isRoot)
|
||||
{
|
||||
object_files->local_path = L"/";
|
||||
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + output_document_->get_type(), object_files->local_path));
|
||||
}
|
||||
else
|
||||
{
|
||||
rels_.add(relationship(std::wstring(L"application/vnd.oasis.opendocument.") + object.content->get_name(), object_files->local_path));
|
||||
}
|
||||
|
||||
output_document_->add_object(package::element_ptr(object_files), isRoot);
|
||||
}
|
||||
|
||||
@ -70,23 +70,17 @@
|
||||
#include "../../../DesktopEditor/common/Directory.h"
|
||||
#include "../../../DesktopEditor/common/SystemUtils.h"
|
||||
|
||||
#define PROGRESSEVENT_ID 0
|
||||
|
||||
using namespace cpdoccore;
|
||||
|
||||
namespace Oox2Odf
|
||||
{
|
||||
static double pt2emu(double Val)
|
||||
{
|
||||
return (Val * 360000 * 2.54) / 72;
|
||||
}
|
||||
Converter::Converter(const std::wstring & path, const std::wstring & type, const std::wstring & fontsPath, const ProgressCallback* CallBack)
|
||||
Converter::Converter(const std::wstring & path, const std::wstring & type, const std::wstring & fontsPath, bool bTemplate)
|
||||
{
|
||||
impl_ = NULL;
|
||||
|
||||
if (type == _T("text")) impl_ = new DocxConverter(path, CallBack);
|
||||
if (type == _T("spreadsheet")) impl_ = new XlsxConverter(path, CallBack);
|
||||
if (type == _T("presentation")) impl_ = new PptxConverter(path, CallBack);
|
||||
if (type == _T("text")) impl_ = new DocxConverter(path, bTemplate);
|
||||
if (type == _T("spreadsheet")) impl_ = new XlsxConverter(path, bTemplate);
|
||||
if (type == _T("presentation")) impl_ = new PptxConverter(path, bTemplate);
|
||||
|
||||
if (impl_)
|
||||
impl_->set_fonts_directory(fontsPath);
|
||||
@ -100,36 +94,16 @@ namespace Oox2Odf
|
||||
void Converter::convert()
|
||||
{
|
||||
if (!impl_)return;
|
||||
|
||||
if (impl_->bUserStopConvert) return;
|
||||
|
||||
impl_->convertDocument();
|
||||
}
|
||||
void Converter::write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID) const
|
||||
{
|
||||
if (!impl_)return;
|
||||
|
||||
if (impl_->bUserStopConvert) return;
|
||||
|
||||
return impl_->write(out_path, temp_path, password, documentID);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool OoxConverter::UpdateProgress(long nComplete)
|
||||
{
|
||||
if (pCallBack)
|
||||
{
|
||||
pCallBack->OnProgress (pCallBack->caller, PROGRESSEVENT_ID, nComplete);
|
||||
|
||||
bUserStopConvert = 0;
|
||||
pCallBack->OnProgressEx (pCallBack->caller, PROGRESSEVENT_ID, nComplete, &bUserStopConvert);
|
||||
|
||||
if (bUserStopConvert !=0 ) return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
void OoxConverter::write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID)
|
||||
{
|
||||
if (!output_document)return;
|
||||
@ -141,7 +115,7 @@ void OoxConverter::write(const std::wstring & out_path, const std::wstring & tem
|
||||
|
||||
if (password.empty())
|
||||
{
|
||||
output_document->write(out_path);
|
||||
output_document->write(out_path, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -155,8 +129,6 @@ void OoxConverter::write(const std::wstring & out_path, const std::wstring & tem
|
||||
|
||||
NSDirectory::DeleteDirectory(temp_folder);
|
||||
}
|
||||
|
||||
if (UpdateProgress(1000000))return;
|
||||
}
|
||||
std::wstring EncodeBase64(const std::string & value)
|
||||
{
|
||||
|
||||
@ -356,19 +356,14 @@ public:
|
||||
|
||||
void write(const std::wstring & out_path, const std::wstring & temp_path, const std::wstring & password, const std::wstring & documentID);
|
||||
|
||||
OoxConverter(const ProgressCallback* CallBack = NULL){
|
||||
oox_current_child_document = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
bUserStopConvert = 0;
|
||||
}
|
||||
OoxConverter()
|
||||
{
|
||||
oox_current_child_document = NULL;
|
||||
}
|
||||
virtual ~OoxConverter(){}
|
||||
|
||||
void set_fonts_directory (const std::wstring & fontsPath);
|
||||
|
||||
const ProgressCallback* pCallBack;
|
||||
short bUserStopConvert;
|
||||
bool UpdateProgress(long nComplete);
|
||||
|
||||
bool encrypt_document (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath);
|
||||
bool encrypt_file (const std::wstring &password, const std::wstring & srcPath, const std::wstring & dstPath, std::wstring &encrypt_info, int &size);
|
||||
|
||||
|
||||
@ -103,22 +103,18 @@ namespace Oox2Odf
|
||||
}
|
||||
return cols_1 == cols_2;
|
||||
}
|
||||
DocxConverter::DocxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
DocxConverter::DocxConverter(const std::wstring & path, bool bTemplate)
|
||||
{
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
|
||||
docx_document = new OOX::CDocx(oox_path);
|
||||
|
||||
output_document = new odf_writer::package::odf_document(L"text");
|
||||
output_document = new odf_writer::package::odf_document(L"text", bTemplate);
|
||||
odt_context = new odf_writer::odt_conversion_context(output_document);
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
//set flags to default
|
||||
current_section_properties = NULL;
|
||||
last_section_properties = NULL;
|
||||
|
||||
if (UpdateProgress(290000))return;
|
||||
}
|
||||
DocxConverter::~DocxConverter()
|
||||
{
|
||||
@ -190,19 +186,14 @@ void DocxConverter::convertDocument()
|
||||
convert_lists_styles();
|
||||
convert_styles();
|
||||
|
||||
if (UpdateProgress(300000))return;
|
||||
|
||||
convert_settings();
|
||||
|
||||
convert_document();
|
||||
|
||||
if (UpdateProgress(800000))return;
|
||||
//удалим уже ненужный документ docx
|
||||
delete docx_document; docx_document = NULL;
|
||||
|
||||
odt_context->end_document();
|
||||
|
||||
if (UpdateProgress(850000))return;
|
||||
}
|
||||
|
||||
void DocxConverter::convert_document()
|
||||
|
||||
@ -143,7 +143,7 @@ namespace Oox2Odf
|
||||
class DocxConverter : public OoxConverter
|
||||
{
|
||||
public:
|
||||
DocxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
|
||||
DocxConverter(const std::wstring & path, bool bTemplate);
|
||||
~DocxConverter();
|
||||
|
||||
virtual void convertDocument();
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../progressCallback.h"
|
||||
#include <string>
|
||||
|
||||
namespace Oox2Odf
|
||||
@ -41,7 +40,7 @@ namespace Oox2Odf
|
||||
class Converter
|
||||
{
|
||||
public:
|
||||
Converter(const std::wstring & path, const std::wstring & type, const std::wstring & fontsPath, const ProgressCallback* ffCallBack);
|
||||
Converter(const std::wstring & path, const std::wstring & type, const std::wstring & fontsPath, bool bTemplate);
|
||||
virtual ~Converter();
|
||||
|
||||
void convert();
|
||||
|
||||
@ -73,7 +73,7 @@ using namespace cpdoccore;
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
PptxConverter::PptxConverter(const std::wstring & path, bool bTemplate)
|
||||
{
|
||||
current_clrMap = NULL;
|
||||
current_slide = NULL;
|
||||
@ -84,8 +84,6 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
|
||||
output_document = NULL;
|
||||
odp_context = NULL;
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
|
||||
pptx_document = new PPTX::Document();
|
||||
@ -105,10 +103,8 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
|
||||
}
|
||||
presentation = presentation_ptr.operator->();
|
||||
|
||||
output_document = new odf_writer::package::odf_document(L"presentation");
|
||||
output_document = new odf_writer::package::odf_document(L"presentation", bTemplate);
|
||||
odp_context = new odf_writer::odp_conversion_context(output_document);
|
||||
|
||||
if (UpdateProgress(290000))return;
|
||||
}
|
||||
PptxConverter::~PptxConverter()
|
||||
{
|
||||
@ -186,20 +182,15 @@ void PptxConverter::convertDocument()
|
||||
|
||||
odp_context->start_document();
|
||||
|
||||
if (UpdateProgress(300000))return;
|
||||
|
||||
convert_styles();
|
||||
convert_settings();
|
||||
|
||||
convert_slides();
|
||||
|
||||
if (UpdateProgress(800000))return;
|
||||
//удалим уже ненужный документ pptx
|
||||
delete pptx_document; pptx_document = NULL;
|
||||
|
||||
odp_context->end_document();
|
||||
|
||||
if (UpdateProgress(850000))return;
|
||||
}
|
||||
void PptxConverter::convert_styles()
|
||||
{
|
||||
|
||||
@ -110,7 +110,7 @@ namespace Oox2Odf
|
||||
class PptxConverter : public OoxConverter
|
||||
{
|
||||
public:
|
||||
PptxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
|
||||
PptxConverter(const std::wstring & path, bool bTemplate);
|
||||
~PptxConverter();
|
||||
|
||||
virtual void convertDocument();
|
||||
|
||||
@ -65,20 +65,16 @@ using namespace cpdoccore;
|
||||
namespace Oox2Odf
|
||||
{
|
||||
|
||||
XlsxConverter::XlsxConverter(const std::wstring & path, const ProgressCallback* CallBack)
|
||||
XlsxConverter::XlsxConverter(const std::wstring & path, bool bTemplate)
|
||||
{
|
||||
const OOX::CPath oox_path(std::wstring(path.c_str()));
|
||||
|
||||
xlsx_document = new OOX::Spreadsheet::CXlsx(oox_path);
|
||||
|
||||
output_document = new odf_writer::package::odf_document(L"spreadsheet");
|
||||
output_document = new odf_writer::package::odf_document(L"spreadsheet", bTemplate);
|
||||
ods_context = new odf_writer::ods_conversion_context(output_document);
|
||||
|
||||
pCallBack = CallBack;
|
||||
|
||||
xlsx_current_container = NULL;
|
||||
|
||||
if (UpdateProgress(400000))return;
|
||||
}
|
||||
XlsxConverter::~XlsxConverter()
|
||||
{
|
||||
@ -147,16 +143,12 @@ void XlsxConverter::convertDocument()
|
||||
ods_context->start_document();
|
||||
|
||||
convert_styles();
|
||||
if (UpdateProgress(500000))return;
|
||||
|
||||
convert_sheets();
|
||||
|
||||
if (UpdateProgress(800000))return;
|
||||
delete xlsx_document; xlsx_document = NULL;
|
||||
|
||||
ods_context->end_document();
|
||||
|
||||
if (UpdateProgress(850000))return;
|
||||
}
|
||||
|
||||
void XlsxConverter::convert_sheets()
|
||||
|
||||
@ -135,7 +135,7 @@ namespace Oox2Odf
|
||||
public:
|
||||
friend class OoxConverter;
|
||||
|
||||
XlsxConverter(const std::wstring & path, const ProgressCallback* ffCallBack);
|
||||
XlsxConverter(const std::wstring & path, bool bTemplate);
|
||||
~XlsxConverter();
|
||||
|
||||
virtual void convertDocument();
|
||||
|
||||
@ -676,12 +676,12 @@ void PPT_FORMAT::CShapeWriter::WriteImageInfo()
|
||||
m_oWriter.WriteStringXML(pImageElement->m_sName);
|
||||
m_oWriter.WriteString(std::wstring(L"\""));
|
||||
|
||||
//if (!pImageElement->m_sDescription.empty())
|
||||
//{//бывает всякая разная бяка сохранена
|
||||
// m_oWriter.WriteString(std::wstring(L" descr=\""));
|
||||
// m_oWriter.WriteStringXML(pImageElement->m_sDescription);
|
||||
// m_oWriter.WriteString(std::wstring(L"\""));
|
||||
//}
|
||||
if (!pImageElement->m_sDescription.empty())
|
||||
{//бывает всякая разная бяка сохранена
|
||||
m_oWriter.WriteString(std::wstring(L" descr=\""));
|
||||
m_oWriter.WriteString(XmlUtils::EncodeXmlStringExtend(pImageElement->m_sDescription, true));
|
||||
m_oWriter.WriteString(std::wstring(L"\""));
|
||||
}
|
||||
m_oWriter.WriteString(std::wstring(L">"));
|
||||
|
||||
if (pVideoElement || pAudioElement)
|
||||
|
||||
@ -1464,8 +1464,7 @@ void CPPTUserInfo::LoadMainMaster(_UINT32 dwMasterID)
|
||||
CSlideInfo* pMasterWrapper = &m_arMasterWrapper[lIndexTheme];
|
||||
|
||||
// записываем шрифты ---------------------------------------------------------------
|
||||
int nCountFonts = m_arrFonts.size();
|
||||
for (int i = 0; i < nCountFonts; ++i)
|
||||
for (size_t i = 0; i < m_arrFonts.size(); ++i)
|
||||
{
|
||||
pTheme->m_arFonts.push_back(m_arrFonts[i]);
|
||||
}
|
||||
@ -1713,8 +1712,7 @@ void CPPTUserInfo::LoadMaster(_typeMaster type, CRecordSlide* pMaster, CSlideInf
|
||||
pMasterWrapper = new CSlideInfo();
|
||||
|
||||
// записываем шрифты ---------------------------------------------------------------
|
||||
int nCountFonts = m_arrFonts.size();
|
||||
for (int i = 0; i < nCountFonts; ++i)
|
||||
for (size_t i = 0; i < m_arrFonts.size(); ++i)
|
||||
{
|
||||
pTheme->m_arFonts.push_back(m_arrFonts[i]);
|
||||
}
|
||||
@ -2474,7 +2472,7 @@ void CPPTUserInfo::CreateDefaultStyle(PPT_FORMAT::CTextStyles& pStyle, PPT_FORMA
|
||||
|
||||
pCF->Size = 18;
|
||||
|
||||
pCF->font.font = new PPT_FORMAT::CFontProperty(pTheme->m_arFonts[0]);
|
||||
pCF->font.font = new PPT_FORMAT::CFontProperty(pTheme->m_arFonts.size() > 1 ? pTheme->m_arFonts[1] : pTheme->m_arFonts[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,6 @@ public:
|
||||
// original id -> natural id
|
||||
std::map<_UINT32, _UINT32> m_mapMasterOriginalIds;
|
||||
|
||||
// это как бы ППT-шная обертка над слайдом
|
||||
std::vector<CSlideInfo> m_arSlideWrapper;
|
||||
std::vector<CSlideInfo> m_arMasterWrapper;
|
||||
std::vector<CSlideInfo> m_arNotesWrapper;
|
||||
@ -80,11 +79,10 @@ public:
|
||||
CSlideInfo* m_pNotesMasterWrapper;
|
||||
CSlideInfo* m_pHandoutMasterWrapper;
|
||||
|
||||
// эти параметры - одни на весь документ.
|
||||
// чтобы поддержать нашу схему (пптх) - копируем их в темы
|
||||
std::vector<CRecordBlipStoreContainer*> m_arrBlipStore;
|
||||
std::vector<CFontProperty> m_arrFonts;
|
||||
PPT_FORMAT::CTextStyles m_oDefaultTextStyle;
|
||||
|
||||
PPT_FORMAT::CTextStyles m_oDefaultTextStyle;
|
||||
|
||||
vector_string m_PlaceholdersReplaceString[3]; //0-dates, 1 - headers, 2 - footers
|
||||
|
||||
@ -93,12 +91,10 @@ public:
|
||||
bool m_bHasFooter;
|
||||
int m_nFormatDate;
|
||||
|
||||
// чтобы загружать неизмененные элементы от других юзеров (предыдущих)
|
||||
CPPTDocumentInfo* m_pDocumentInfo;
|
||||
CRecordVbaProjectStg* m_VbaProjectStg;
|
||||
int m_lIndexThisUser;
|
||||
|
||||
// Animations structures
|
||||
std::map <_UINT32, Animations::CSlideTimeLine*> m_mapAnimations;
|
||||
|
||||
double m_nWriteSlideTimeOffset;
|
||||
@ -106,7 +102,6 @@ public:
|
||||
|
||||
std::map<_UINT32, CSlideShowSlideInfoAtom> m_mapTransitions;
|
||||
|
||||
// номера "пустых" картинок - в эти пути не будем сохранять
|
||||
std::vector<int> m_arOffsetPictures;
|
||||
bool m_bIsSetupEmpty;
|
||||
|
||||
|
||||
@ -2319,8 +2319,8 @@ void CRecordShapeContainer::SetUpTextStyle(std::wstring& strText, CTheme* pTheme
|
||||
pTextSettings->m_oStyles.ApplyAfter(pThemeWrapper->m_pStyles[nIndexType].get());
|
||||
}
|
||||
}
|
||||
if (eTypeOwn != NoPresent/* && eTypeOwn != Other*/ && eTypeOwn != eTypePersist && eTypeOwn != eTypeMaster)
|
||||
{
|
||||
if (eTypeOwn != NoPresent && eTypeOwn != Tx_TYPE_OTHER && eTypeOwn != eTypePersist && eTypeOwn != eTypeMaster)
|
||||
{//齐孟尧-2015年度职工考核报告.ppt
|
||||
int nIndexType = (int)eTypeOwn;
|
||||
|
||||
if (0 <= nIndexType && nIndexType < 9 && pLayout)
|
||||
|
||||
@ -211,6 +211,7 @@ namespace PPTX
|
||||
pWriter->WriteAttribute(_T("xmlns:cp"), PPTX::g_Namespaces.cp.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:dc"), PPTX::g_Namespaces.dc.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:dcterms"), PPTX::g_Namespaces.dcterms.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:dcmitype"), PPTX::g_Namespaces.dcmitype.m_strLink);
|
||||
pWriter->WriteAttribute(_T("xmlns:xsi"), PPTX::g_Namespaces.xsi.m_strLink);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
@ -224,14 +225,18 @@ namespace PPTX
|
||||
pWriter->WriteNodeValue2(_T("dc:language"), language);
|
||||
pWriter->WriteNodeValue2(_T("cp:lastModifiedBy"), lastModifiedBy);
|
||||
pWriter->WriteNodeValue2(_T("cp:revision"), revision);
|
||||
pWriter->WriteNodeValue2(_T("cp:lastPrinted"), lastPrinted);
|
||||
if (created.IsInit())
|
||||
|
||||
if ((lastPrinted.IsInit()) && (false == lastPrinted->empty()))
|
||||
{
|
||||
pWriter->WriteNodeValue2(_T("cp:lastPrinted"), lastPrinted);
|
||||
}
|
||||
if ((created.IsInit()) && (false == created->empty()))
|
||||
{
|
||||
pWriter->WriteNodeBegin(_T("dcterms:created xsi:type=\"dcterms:W3CDTF\""));
|
||||
pWriter->WriteStringXML(*created);
|
||||
pWriter->WriteNodeEnd(_T("dcterms:created"));
|
||||
}
|
||||
if (modified.IsInit())
|
||||
if ((modified.IsInit()) && (false == modified->empty()))
|
||||
{
|
||||
pWriter->WriteNodeBegin(_T("dcterms:modified xsi:type=\"dcterms:W3CDTF\""));
|
||||
pWriter->WriteStringXML(*modified);
|
||||
|
||||
@ -1083,7 +1083,7 @@ namespace PPTX
|
||||
file = parentFileAs<Slide>().Find(nvPicPr.nvPr.media.as<MediaFile>().link.get());
|
||||
smart_ptr<OOX::Media> mediaFile = file.smart_dynamic_cast<OOX::Media>();
|
||||
|
||||
if ( mediaFile.IsInit() == false && !nvPicPr.nvPr.extLst.empty())
|
||||
if ( (mediaFile.IsInit() == false || mediaFile->filename().GetPath() == L"NULL") && !nvPicPr.nvPr.extLst.empty())
|
||||
{
|
||||
//todooo - почему везде нулевой то? - сделать поиск по всем uri
|
||||
file = parentFileAs<Slide>().Find(nvPicPr.nvPr.extLst[0].link.get());
|
||||
|
||||
@ -78,6 +78,8 @@ namespace PPTX
|
||||
}
|
||||
Theme(OOX::Document *pMain, const OOX::CPath& filename) : WrapperFile(pMain), PPTX::FileContainer(pMain)
|
||||
{
|
||||
IFileContainer::Read( filename, filename );
|
||||
|
||||
FileMap map;
|
||||
|
||||
isThemeOverride = false;
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FCA31ACC429D006B99B3"
|
||||
BuildableName = "libPPTXFormatLib_ios.a"
|
||||
BlueprintName = "PPTXFormatLib"
|
||||
ReferencedContainer = "container:PPTXFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FCA31ACC429D006B99B3"
|
||||
BuildableName = "libPPTXFormatLib_ios.a"
|
||||
BlueprintName = "PPTXFormatLib"
|
||||
ReferencedContainer = "container:PPTXFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FCA31ACC429D006B99B3"
|
||||
BuildableName = "libPPTXFormatLib_ios.a"
|
||||
BlueprintName = "PPTXFormatLib"
|
||||
ReferencedContainer = "container:PPTXFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967B1281E27B44D00A129E2"
|
||||
BuildableName = "libRtfFormatLib.a"
|
||||
BlueprintName = "RtfFormatLib"
|
||||
ReferencedContainer = "container:RtfFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967B1281E27B44D00A129E2"
|
||||
BuildableName = "libRtfFormatLib.a"
|
||||
BlueprintName = "RtfFormatLib"
|
||||
ReferencedContainer = "container:RtfFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967B1281E27B44D00A129E2"
|
||||
BuildableName = "libRtfFormatLib.a"
|
||||
BlueprintName = "RtfFormatLib"
|
||||
ReferencedContainer = "container:RtfFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967AFBE1E2798B900A129E2"
|
||||
BuildableName = "libTxtXmlFormatLib.a"
|
||||
BlueprintName = "TxtXmlFormatLib"
|
||||
ReferencedContainer = "container:TxtXmlFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967AFBE1E2798B900A129E2"
|
||||
BuildableName = "libTxtXmlFormatLib.a"
|
||||
BlueprintName = "TxtXmlFormatLib"
|
||||
ReferencedContainer = "container:TxtXmlFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967AFBE1E2798B900A129E2"
|
||||
BuildableName = "libTxtXmlFormatLib.a"
|
||||
BlueprintName = "TxtXmlFormatLib"
|
||||
ReferencedContainer = "container:TxtXmlFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -34,4 +34,4 @@ if [ ! -f Makefile ]; then
|
||||
./config no-shared no-asm
|
||||
fi
|
||||
|
||||
make
|
||||
make build_libs
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FB8E1ACC4250006B99B3"
|
||||
BuildableName = "libDocxFormatLib_ios.a"
|
||||
BlueprintName = "DocxFormatLib"
|
||||
ReferencedContainer = "container:DocxFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FB8E1ACC4250006B99B3"
|
||||
BuildableName = "libDocxFormatLib_ios.a"
|
||||
BlueprintName = "DocxFormatLib"
|
||||
ReferencedContainer = "container:DocxFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FB8E1ACC4250006B99B3"
|
||||
BuildableName = "libDocxFormatLib_ios.a"
|
||||
BlueprintName = "DocxFormatLib"
|
||||
ReferencedContainer = "container:DocxFormatLib.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -1520,6 +1520,14 @@
|
||||
RelativePath="..\Source\XlsxFormat\Comments\Comments.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\Comments\ThreadedComments.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Source\XlsxFormat\WorkbookComments.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Drawing"
|
||||
|
||||
@ -369,6 +369,34 @@ namespace OOX
|
||||
std::map<int, int> m_mapComments; //id, index
|
||||
|
||||
};
|
||||
class CDocumentComments : public CComments
|
||||
{
|
||||
public:
|
||||
CDocumentComments(OOX::Document *pMain) : CComments(NULL)
|
||||
{
|
||||
File::m_pMainDocument = pMain;
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocumentComments = this;
|
||||
}
|
||||
CDocumentComments(OOX::Document *pMain, const CPath& oPath) : CComments(NULL, oPath)
|
||||
{
|
||||
File::m_pMainDocument = pMain;
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocumentComments = this;
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::DocumentComments;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
};
|
||||
class CCommentExt : public WritingElement
|
||||
{
|
||||
public:
|
||||
@ -488,6 +516,26 @@ namespace OOX
|
||||
std::vector<CCommentExt*> m_arrComments;
|
||||
std::map<int, int> m_mapComments; //paraId, index
|
||||
};
|
||||
class CDocumentCommentsExt : public CCommentsExt
|
||||
{
|
||||
public:
|
||||
CDocumentCommentsExt(OOX::Document *pMain) : CCommentsExt(NULL)
|
||||
{
|
||||
File::m_pMainDocument = pMain;
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocumentCommentsExt = this;
|
||||
}
|
||||
CDocumentCommentsExt(OOX::Document *pMain, const CPath& oPath) : CCommentsExt(NULL, oPath)
|
||||
{
|
||||
File::m_pMainDocument = pMain;
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocumentCommentsExt = this;
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::DocumentCommentsExt;
|
||||
}
|
||||
};
|
||||
|
||||
class CPresenceInfo : public WritingElement
|
||||
{
|
||||
@ -648,6 +696,27 @@ namespace OOX
|
||||
std::vector<CPerson*> m_arrPeoples;
|
||||
};
|
||||
|
||||
class CDocumentPeople : public CPeople
|
||||
{
|
||||
public:
|
||||
CDocumentPeople(OOX::Document *pMain) : CPeople(NULL)
|
||||
{
|
||||
File::m_pMainDocument = pMain;
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocumentPeople = this;
|
||||
}
|
||||
CDocumentPeople(OOX::Document *pMain, const CPath& oPath) : CPeople(NULL, oPath)
|
||||
{
|
||||
File::m_pMainDocument = pMain;
|
||||
CDocx* docx = dynamic_cast<CDocx*>(File::m_pMainDocument);
|
||||
if (docx) docx->m_pDocumentPeople = this;
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return FileTypes::DocumentPeople;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_COMMENTS_FILE_INCLUDE_H_
|
||||
|
||||
@ -64,7 +64,7 @@ namespace OOX
|
||||
m_mTable.insert( std::make_pair( _T("emf"), _T("image/x-emf")));
|
||||
m_mTable.insert( std::make_pair( _T("emz"), _T("image/x-emz")));
|
||||
m_mTable.insert( std::make_pair( _T("wmf"), _T("image/x-wmf")));
|
||||
m_mTable.insert( std::make_pair( _T("svg"), _T("image/svg+xml")));
|
||||
m_mTable.insert( std::make_pair( _T("svg"), _T("image/svg+xml")));
|
||||
m_mTable.insert( std::make_pair( _T("svm"), _T("image/svm")));
|
||||
m_mTable.insert( std::make_pair( _T("wav"), _T("audio/wav")));
|
||||
m_mTable.insert( std::make_pair( _T("wma"), _T("audio/x-wma")));
|
||||
@ -76,6 +76,7 @@ namespace OOX
|
||||
m_mTable.insert( std::make_pair( _T("mkv"), _T("video/unknown")));
|
||||
m_mTable.insert( std::make_pair( _T("avi"), _T("video/avi")));
|
||||
m_mTable.insert( std::make_pair( _T("wmv"), _T("video/x-wmv")));
|
||||
m_mTable.insert( std::make_pair( _T("webm"), _T("video/webm")));
|
||||
m_mTable.insert( std::make_pair( _T("xls"), _T("application/vnd.ms-excel")));
|
||||
m_mTable.insert( std::make_pair( _T("xlsm"), _T("application/vnd.ms-excel.sheet.macroEnabled.12")));
|
||||
m_mTable.insert( std::make_pair( _T("xlsb"), _T("application/vnd.ms-excel.sheet.binary.macroEnabled.12")));
|
||||
|
||||
@ -110,8 +110,13 @@ namespace OOX
|
||||
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
{
|
||||
std::wstring sXml;
|
||||
sXml = _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\">");
|
||||
|
||||
sXml = _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\">");
|
||||
if ( m_sTitle.IsInit() )
|
||||
{
|
||||
sXml += _T("<dc:title>");
|
||||
@ -166,19 +171,19 @@ namespace OOX
|
||||
sXml += XmlUtils::EncodeXmlString(m_sRevision.get());
|
||||
sXml += _T("</cp:revision>");
|
||||
}
|
||||
if ( m_sLastPrinted.IsInit() )
|
||||
if ( (m_sLastPrinted.IsInit()) && (!m_sLastPrinted->empty()))
|
||||
{
|
||||
sXml += _T("<cp:lastPrinted>");
|
||||
sXml += XmlUtils::EncodeXmlString(m_sLastPrinted.get());
|
||||
sXml += _T("</cp:lastPrinted>");
|
||||
}
|
||||
if ( m_sCreated.IsInit() )
|
||||
if ( (m_sCreated.IsInit()) && (!m_sCreated->empty()))
|
||||
{
|
||||
sXml += _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">");
|
||||
sXml += XmlUtils::EncodeXmlString(m_sCreated.get());
|
||||
sXml += _T("</dcterms:created>");
|
||||
}
|
||||
if ( m_sModified.IsInit() )
|
||||
if ( (m_sModified.IsInit()) && (!m_sModified->empty()))
|
||||
{
|
||||
sXml += _T("<dcterms:modified xsi:type=\"dcterms:W3CDTF\">");
|
||||
sXml += XmlUtils::EncodeXmlString(m_sModified.get());
|
||||
|
||||
@ -61,8 +61,33 @@ namespace OOX {
|
||||
OOX::CRels oRels( oFilePath / FILE_SEPARATOR_STR );
|
||||
IFileContainer::Read( oRels, oFilePath, oFilePath );
|
||||
|
||||
FixAfterRead();
|
||||
return true;
|
||||
}
|
||||
void CDocx::FixAfterRead()
|
||||
{
|
||||
//solve id conflict between comments and documentComments
|
||||
if(NULL != m_pComments && m_pComments->m_arrComments.size() > 0 && NULL != m_pDocumentComments && NULL != m_pDocumentComments->m_arrComments.size() > 0)
|
||||
{
|
||||
int maxId = INT_MIN;
|
||||
for (size_t i = 0; i < m_pComments->m_arrComments.size(); ++i)
|
||||
{
|
||||
OOX::CComment* pComment = m_pComments->m_arrComments[i];
|
||||
if (pComment->m_oId.IsInit() && maxId < pComment->m_oId->GetValue())
|
||||
{
|
||||
maxId = pComment->m_oId->GetValue();
|
||||
}
|
||||
}
|
||||
m_pDocumentComments->m_mapComments.clear();
|
||||
for (size_t i = 0; i < m_pDocumentComments->m_arrComments.size(); ++i)
|
||||
{
|
||||
OOX::CComment* pComment = m_pDocumentComments->m_arrComments[i];
|
||||
pComment->m_oId.Init();
|
||||
pComment->m_oId->SetValue(++maxId);
|
||||
m_pDocumentComments->m_mapComments.insert( std::make_pair( pComment->m_oId->GetValue(), i));
|
||||
}
|
||||
}
|
||||
}
|
||||
OOX::CHdrFtr *CDocx::GetHeaderOrFooter(const OOX::RId& rId) const
|
||||
{
|
||||
if ( m_pDocument )
|
||||
|
||||
@ -61,6 +61,9 @@ namespace OOX
|
||||
class CComments;
|
||||
class CCommentsExt;
|
||||
class CPeople;
|
||||
class CDocumentComments;
|
||||
class CDocumentCommentsExt;
|
||||
class CDocumentPeople;
|
||||
class VbaProject;
|
||||
class JsaProject;
|
||||
class CHdrFtr;
|
||||
@ -79,6 +82,7 @@ namespace OOX
|
||||
Read( oFilePath );
|
||||
}
|
||||
bool Read(const CPath& oFilePath);
|
||||
void FixAfterRead();
|
||||
bool Write(const CPath& oFilePath)
|
||||
{
|
||||
|
||||
@ -115,6 +119,9 @@ namespace OOX
|
||||
OOX::CComments *m_pComments; // word/comments.xml
|
||||
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
|
||||
OOX::CPeople *m_pPeople; // word/people.xml
|
||||
OOX::CDocumentComments *m_pDocumentComments; // word/documentComments.xml
|
||||
OOX::CDocumentCommentsExt *m_pDocumentCommentsExt;// word/documentCommentsExtended.xml
|
||||
OOX::CDocumentPeople *m_pDocumentPeople; // word/documentPeople.xml
|
||||
|
||||
OOX::VbaProject *m_pVbaProject;
|
||||
OOX::JsaProject *m_pJsaProject;
|
||||
@ -137,6 +144,9 @@ private:
|
||||
m_pComments = NULL;
|
||||
m_pCommentsExt = NULL;
|
||||
m_pPeople = NULL;
|
||||
m_pDocumentComments = NULL;
|
||||
m_pDocumentCommentsExt = NULL;
|
||||
m_pDocumentPeople = NULL;
|
||||
m_pVbaProject = NULL;
|
||||
m_pJsaProject = NULL;
|
||||
}
|
||||
|
||||
@ -97,10 +97,16 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new CHdrFtr( pMain, oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::Comments)
|
||||
return smart_ptr<OOX::File>(new CComments( pMain, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::DocumentComments)
|
||||
return smart_ptr<OOX::File>(new CDocumentComments( pMain, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::CommentsExt )
|
||||
return smart_ptr<OOX::File>(new CCommentsExt( pMain, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::DocumentCommentsExt )
|
||||
return smart_ptr<OOX::File>(new CDocumentCommentsExt( pMain, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::People )
|
||||
return smart_ptr<OOX::File>(new CPeople( pMain, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::DocumentPeople )
|
||||
return smart_ptr<OOX::File>(new CDocumentPeople( pMain, oFileName ));
|
||||
//common
|
||||
else if ( oRelation.Type() == FileTypes::Setting)
|
||||
return smart_ptr<OOX::File>(new CSettings( pMain, oFileName ));
|
||||
@ -214,10 +220,16 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new CHdrFtr( pMain, oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::Comments)
|
||||
return smart_ptr<OOX::File>(new CComments( pMain, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::DocumentComments)
|
||||
return smart_ptr<OOX::File>(new CDocumentComments( pMain, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::CommentsExt )
|
||||
return smart_ptr<OOX::File>(new CCommentsExt( pMain, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::DocumentCommentsExt )
|
||||
return smart_ptr<OOX::File>(new CDocumentCommentsExt( pMain, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::People )
|
||||
return smart_ptr<OOX::File>(new CPeople( pMain, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::DocumentPeople )
|
||||
return smart_ptr<OOX::File>(new CDocumentPeople( pMain, oFileName ));
|
||||
else if (pRelation->Type() == FileTypes::Data)
|
||||
return smart_ptr<OOX::File>(new CDiagramData( pMain, oRootPath, oFileName ));
|
||||
else if (pRelation->Type() == FileTypes::DiagDrawing)
|
||||
|
||||
@ -110,14 +110,26 @@ namespace OOX
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments");
|
||||
|
||||
const FileType DocumentComments (L"", L"commentsDocument.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
|
||||
L"http://schemas.onlyoffice.com/commentsDocument");
|
||||
|
||||
const FileType CommentsExt (L"", L"commentsExtended.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",
|
||||
L"http://schemas.microsoft.com/office/2011/relationships/commentsExtended");
|
||||
|
||||
const FileType DocumentCommentsExt (L"", L"commentsExtendedDocument.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",
|
||||
L"http://schemas.onlyoffice.com/commentsExtendedDocument");
|
||||
|
||||
const FileType People (L"", L"people.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml",
|
||||
L"http://schemas.microsoft.com/office/2011/relationships/people");
|
||||
|
||||
const FileType DocumentPeople (L"", L"peopleDocument.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml",
|
||||
L"http://schemas.onlyoffice.com/peopleDocument");
|
||||
|
||||
const FileType CustomXml (L"customXml", L"item.xml",
|
||||
L"",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml");
|
||||
|
||||
@ -1103,6 +1103,10 @@ namespace OOX
|
||||
et_x_Authors,
|
||||
et_x_CommentList,
|
||||
et_x_Comment,
|
||||
et_x_ThreadedComments,
|
||||
et_x_ThreadedComment,
|
||||
et_x_PersonList,
|
||||
et_x_Person,
|
||||
et_x_ConditionalFormatting,
|
||||
et_x_ConditionalFormattingRule,
|
||||
et_x_ColorScale,
|
||||
|
||||
456
Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h
Normal file
456
Common/DocxFormat/Source/XlsxFormat/Comments/ThreadedComments.h
Normal file
@ -0,0 +1,456 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2019
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
|
||||
* street, Riga, Latvia, EU, LV-1050.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef OOX_XLSXTREADEDCOMMENTS_FILE_INCLUDE_H_
|
||||
#define OOX_XLSXTREADEDCOMMENTS_FILE_INCLUDE_H_
|
||||
|
||||
#include "../Xlsx.h"
|
||||
#include "../Worksheets/Worksheet.h"
|
||||
#include "../SharedStrings/Si.h"
|
||||
|
||||
namespace OOX
|
||||
{
|
||||
namespace Spreadsheet
|
||||
{
|
||||
class CPerson : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CPerson)
|
||||
CPerson()
|
||||
{
|
||||
}
|
||||
virtual ~CPerson()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<person");
|
||||
WritingStringNullableAttrEncodeXmlString(L"displayName", displayName, *displayName);
|
||||
WritingStringNullableAttrString(L"userId", userId, *userId);
|
||||
WritingStringNullableAttrString(L"providerId", providerId, *providerId);
|
||||
WritingStringNullableAttrString(L"id", id, *id);
|
||||
writer.WriteString(L">");
|
||||
//writer.WriteString(L"<text>");
|
||||
//m_oText->toXML2(writer);
|
||||
//writer.WriteString(L"</text>");
|
||||
writer.WriteString(L"</person>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( L"extLst" == sName )
|
||||
{
|
||||
if ( oReader.IsEmptyNode() )
|
||||
continue;
|
||||
|
||||
int nParentDepth1 = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
|
||||
{
|
||||
//Ext element;
|
||||
//element.fromXML(oReader);
|
||||
//extLst.push_back (element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_ThreadedComment;
|
||||
}
|
||||
|
||||
private:
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, L"displayName", displayName )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"userId", userId )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"providerId", providerId )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"id", id )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable_string displayName;
|
||||
nullable_string userId;
|
||||
nullable_string providerId;
|
||||
nullable_string id;
|
||||
|
||||
//std::vector<Ext> extLst;
|
||||
};
|
||||
|
||||
class CPersonList : public OOX::File, public WritingElementWithChilds<CPerson>
|
||||
{
|
||||
public:
|
||||
CPersonList(OOX::Document* pMain) : OOX::File(pMain)
|
||||
{
|
||||
CXlsx* xlsx = dynamic_cast<CXlsx*>(pMain);
|
||||
if ((xlsx) && (!xlsx->m_arWorksheets.empty()))
|
||||
{
|
||||
xlsx->m_arWorksheets.back()->m_pPersonList = this;
|
||||
}
|
||||
}
|
||||
CPersonList(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain)
|
||||
{
|
||||
CXlsx* xlsx = dynamic_cast<CXlsx*>(pMain);
|
||||
if ((xlsx) && (!xlsx->m_arWorksheets.empty()))
|
||||
{
|
||||
xlsx->m_arWorksheets.back()->m_pPersonList = this;
|
||||
}
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
virtual ~CPersonList()
|
||||
{
|
||||
ClearItems();
|
||||
}
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
|
||||
CPath oRootPath;
|
||||
read(oRootPath, oPath);
|
||||
}
|
||||
virtual void read(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
m_oReadPath = oPath;
|
||||
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
if ( !oReader.FromFile( oPath.GetPath() ) )
|
||||
return;
|
||||
|
||||
if ( !oReader.ReadNextNode() )
|
||||
return;
|
||||
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if ( L"personList" == sName )
|
||||
{
|
||||
fromXML(oReader);
|
||||
}
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<personList ");
|
||||
writer.WriteString(L" xmlns=\"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments\"");
|
||||
writer.WriteString(L" xmlns:x=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"");
|
||||
writer.WriteString(L">");
|
||||
|
||||
for ( size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( m_arrItems[i] )
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteString(L"</personList>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( L"person" == sName )
|
||||
{
|
||||
m_arrItems.push_back(new CPerson(oReader));
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_PersonList;
|
||||
}
|
||||
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
{
|
||||
NSStringUtils::CStringBuilder sXml;
|
||||
sXml.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
|
||||
toXML(sXml);
|
||||
|
||||
std::wstring sPath = oPath.GetPath();
|
||||
NSFile::CFileBinary::SaveToFile(sPath, sXml.GetData());
|
||||
|
||||
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Spreadsheet::FileTypes::Persons;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
const CPath& GetReadPath()
|
||||
{
|
||||
return m_oReadPath;
|
||||
}
|
||||
private:
|
||||
CPath m_oReadPath;
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
}
|
||||
};
|
||||
class CThreadedComment : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CThreadedComment)
|
||||
CThreadedComment()
|
||||
{
|
||||
}
|
||||
virtual ~CThreadedComment()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<threadedComment");
|
||||
WritingStringNullableAttrEncodeXmlString(L"ref", ref, ref->ToString());
|
||||
WritingStringNullableAttrString(L"personId", personId, *personId);
|
||||
WritingStringNullableAttrString(L"id", id, *id);
|
||||
WritingStringNullableAttrString(L"dT", dT, *dT);
|
||||
writer.WriteString(L">");
|
||||
|
||||
writer.WriteString(L"<text>");
|
||||
m_oText->toXML2(writer);
|
||||
writer.WriteString(L"</text>");
|
||||
writer.WriteString(L"</threadedComment>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( _T("text") == sName )
|
||||
m_oText = oReader;
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_ThreadedComment;
|
||||
}
|
||||
|
||||
private:
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start( oReader )
|
||||
WritingElement_ReadAttributes_Read_if ( oReader, L"ref", ref )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"personId", personId )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"id", id )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"dT", dT )
|
||||
WritingElement_ReadAttributes_End( oReader )
|
||||
}
|
||||
public:
|
||||
nullable<SimpleTypes::CRelationshipId> ref;
|
||||
nullable_string personId;
|
||||
nullable_string id;
|
||||
nullable_string dT;
|
||||
|
||||
nullable<CSi> m_oText;
|
||||
};
|
||||
class CThreadedComments : public OOX::FileGlobalEnumerated, public OOX::IFileContainer, public WritingElementWithChilds<CThreadedComment>
|
||||
{
|
||||
public:
|
||||
CThreadedComments(OOX::Document* pMain) : OOX::IFileContainer(pMain), OOX::FileGlobalEnumerated(pMain)
|
||||
{
|
||||
CXlsx* xlsx = dynamic_cast<CXlsx*>(pMain);
|
||||
if ((xlsx) && (!xlsx->m_arWorksheets.empty()))
|
||||
{
|
||||
xlsx->m_arWorksheets.back()->m_pThreadedComments = this;
|
||||
}
|
||||
}
|
||||
CThreadedComments(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::IFileContainer(pMain), OOX::FileGlobalEnumerated(pMain)
|
||||
{
|
||||
CXlsx* xlsx = dynamic_cast<CXlsx*>(pMain);
|
||||
if ((xlsx) && (!xlsx->m_arWorksheets.empty()))
|
||||
{
|
||||
xlsx->m_arWorksheets.back()->m_pThreadedComments = this;
|
||||
}
|
||||
read( oRootPath, oPath );
|
||||
}
|
||||
virtual ~CThreadedComments()
|
||||
{
|
||||
}
|
||||
virtual void read(const CPath& oPath)
|
||||
{
|
||||
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
|
||||
CPath oRootPath;
|
||||
read(oRootPath, oPath);
|
||||
}
|
||||
virtual void read(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
m_oReadPath = oPath;
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
if ( !oReader.FromFile( oPath.GetPath() ) )
|
||||
return;
|
||||
|
||||
if ( !oReader.ReadNextNode() )
|
||||
return;
|
||||
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if ( L"ThreadedComments" == sName )
|
||||
{
|
||||
fromXML(oReader);
|
||||
}
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<ThreadedComments");
|
||||
writer.WriteString(L" xmlns=\"http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments\"");
|
||||
writer.WriteString(L" xmlns:x=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\"");
|
||||
writer.WriteString(L">");
|
||||
|
||||
for ( size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
if ( m_arrItems[i] )
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteString(L"</ThreadedComments>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes( oReader );
|
||||
|
||||
if ( oReader.IsEmptyNode() )
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while( oReader.ReadNextSiblingNode( nCurDepth ) )
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if ( L"threadedComment" == sName )
|
||||
m_arrItems.push_back(new CThreadedComment(oReader));
|
||||
}
|
||||
}
|
||||
|
||||
virtual EElementType getType () const
|
||||
{
|
||||
return et_x_ThreadedComments;
|
||||
}
|
||||
|
||||
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
{
|
||||
NSStringUtils::CStringBuilder sXml;
|
||||
sXml.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
|
||||
toXML(sXml);
|
||||
|
||||
std::wstring sPath = oPath.GetPath();
|
||||
NSFile::CFileBinary::SaveToFile(sPath, sXml.GetData());
|
||||
|
||||
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
|
||||
}
|
||||
virtual const OOX::FileType type() const
|
||||
{
|
||||
return OOX::Spreadsheet::FileTypes::ThreadedComments;
|
||||
}
|
||||
virtual const CPath DefaultDirectory() const
|
||||
{
|
||||
return type().DefaultDirectory();
|
||||
}
|
||||
virtual const CPath DefaultFileName() const
|
||||
{
|
||||
return type().DefaultFileName();
|
||||
}
|
||||
const CPath& GetReadPath()
|
||||
{
|
||||
return m_oReadPath;
|
||||
}
|
||||
private:
|
||||
CPath m_oReadPath;
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
}
|
||||
};
|
||||
} //Spreadsheet
|
||||
} // namespace OOX
|
||||
|
||||
#endif // OOX_XLSXTREADEDCOMMENTS_FILE_INCLUDE_H_
|
||||
@ -46,6 +46,8 @@
|
||||
#include "Worksheets/Worksheet.h"
|
||||
#include "CalcChain/CalcChain.h"
|
||||
#include "WorkbookComments.h"
|
||||
#include "Comments/ThreadedComments.h"
|
||||
#include "Comments/Comments.h"
|
||||
|
||||
#include "Table/Table.h"
|
||||
#include "ExternalLinks/ExternalLinks.h"
|
||||
@ -93,6 +95,10 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new CQueryTableFile( pMain, oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::Comments )
|
||||
return smart_ptr<OOX::File>(new CComments( pMain, oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::ThreadedComments )
|
||||
return smart_ptr<OOX::File>(new CThreadedComments( pMain, oRootPath, oFileName ));
|
||||
else if ( oRelation.Type() == FileTypes::Persons)
|
||||
return smart_ptr<OOX::File>(new CPersonList( pMain, oRootPath, oFileName));
|
||||
else if ( oRelation.Type() == FileTypes::WorkbookComments)
|
||||
return smart_ptr<OOX::File>(new WorkbookComments( pMain, oRootPath, oFileName));
|
||||
else if ( oRelation.Type() == FileTypes::ExternalLinks )
|
||||
@ -190,6 +196,10 @@ namespace OOX
|
||||
return smart_ptr<OOX::File>(new CChartDrawing( pMain, oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::Comments )
|
||||
return smart_ptr<OOX::File>(new CComments( pMain, oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::ThreadedComments )
|
||||
return smart_ptr<OOX::File>(new CThreadedComments( pMain, oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::Persons)
|
||||
return smart_ptr<OOX::File>(new CPersonList( pMain, oRootPath, oFileName));
|
||||
else if ( pRelation->Type() == OOX::FileTypes::Chart )
|
||||
return smart_ptr<OOX::File>(new CChartSpace( pMain, oRootPath, oFileName ));
|
||||
else if ( pRelation->Type() == FileTypes::ExternalLinks )
|
||||
|
||||
@ -72,6 +72,15 @@ namespace OOX
|
||||
L"application/vnd.openxmlformats-officedocument.spreadsheetml.calcChain+xml",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain");
|
||||
|
||||
const FileType ThreadedComments (L"../threadedComments", L"threadedComment.xml",
|
||||
L"application/vnd.ms-excel.threadedcomments+xml",
|
||||
L"http://schemas.microsoft.com/office/2017/10/relationships/threadedComment",
|
||||
L"threadedComments/threadedComment", true, true);
|
||||
|
||||
const FileType Persons (L"../persons", L"person.xml",
|
||||
L"application/vnd.ms-excel.person+xml",
|
||||
L"http://schemas.microsoft.com/office/2017/10/relationships/person");
|
||||
|
||||
const FileType Comments (L"../", L"comments.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include "Worksheet.h"
|
||||
|
||||
#include "../Comments/Comments.h"
|
||||
#include "../Comments/ThreadedComments.h"
|
||||
|
||||
#include "../../DocxFormat/External/HyperLink.h"
|
||||
#include "../../DocxFormat/Media/Image.h"
|
||||
|
||||
@ -57,6 +57,8 @@ namespace OOX
|
||||
class CComments;
|
||||
class CCommentItem;
|
||||
class CLegacyDrawingWorksheet;
|
||||
class CThreadedComments;
|
||||
class CPersonList;
|
||||
//необработанные child:
|
||||
//<cellWatches>
|
||||
//<customProperties>
|
||||
@ -144,7 +146,9 @@ namespace OOX
|
||||
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
|
||||
|
||||
//--------------------------------------------------------------------------------------------
|
||||
CComments *m_pComments;
|
||||
CComments *m_pComments;
|
||||
CPersonList *m_pPersonList;
|
||||
CThreadedComments *m_pThreadedComments;
|
||||
};
|
||||
} //Spreadsheet
|
||||
} // namespace OOX
|
||||
|
||||
@ -464,8 +464,8 @@
|
||||
7C560F841AA71A91000E5860 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
||||
CLANG_CXX_LIBRARY = "compiler-default";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
@ -504,8 +504,8 @@
|
||||
7C560F851AA71A91000E5860 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
|
||||
CLANG_CXX_LIBRARY = "compiler-default";
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FF0B1ACC4AF7006B99B3"
|
||||
BuildableName = "libfontengine_ios.a"
|
||||
BlueprintName = "fontengine"
|
||||
ReferencedContainer = "container:fontengine.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FF0B1ACC4AF7006B99B3"
|
||||
BuildableName = "libfontengine_ios.a"
|
||||
BlueprintName = "fontengine"
|
||||
ReferencedContainer = "container:fontengine.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FF0B1ACC4AF7006B99B3"
|
||||
BuildableName = "libfontengine_ios.a"
|
||||
BlueprintName = "fontengine"
|
||||
ReferencedContainer = "container:fontengine.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FECF1ACC4A67006B99B3"
|
||||
BuildableName = "libgraphics_ios.a"
|
||||
BlueprintName = "graphics"
|
||||
ReferencedContainer = "container:graphics.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FECF1ACC4A67006B99B3"
|
||||
BuildableName = "libgraphics_ios.a"
|
||||
BlueprintName = "graphics"
|
||||
ReferencedContainer = "container:graphics.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17C1FECF1ACC4A67006B99B3"
|
||||
BuildableName = "libgraphics_ios.a"
|
||||
BlueprintName = "graphics"
|
||||
ReferencedContainer = "container:graphics.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@ -75,6 +75,8 @@ namespace MetaFile
|
||||
virtual unsigned int GetRop2Mode() = 0;
|
||||
virtual IClip* GetClip() = 0;
|
||||
virtual int GetCharSpace() = 0;
|
||||
virtual bool IsWindowFlippedY() = 0;
|
||||
virtual bool IsWindowFlippedX() = 0;
|
||||
|
||||
bool OpenFromFile(const wchar_t* wsFilePath)
|
||||
{
|
||||
|
||||
@ -138,7 +138,40 @@ namespace MetaFile
|
||||
|
||||
TPointD oTL = TranslatePoint(dX, dY);
|
||||
TPointD oBR = TranslatePoint(dX + dW, dY + dH);
|
||||
m_pRenderer->DrawImage(&oImage, oTL.x, oTL.y, oBR.x - oTL.x, oBR.y - oTL.y);
|
||||
|
||||
double dImageX = oTL.x;
|
||||
double dImageY = oTL.y;
|
||||
double dImageW = oBR.x - oTL.x;
|
||||
double dImageH = oBR.y - oTL.y;
|
||||
|
||||
if (dImageH < 0 || dImageW < 0)
|
||||
{
|
||||
double dM11, dM12, dM21, dM22, dMx, dMy;
|
||||
m_pRenderer->GetTransform(&dM11, &dM12, &dM21, &dM22, &dMx, &dMy);
|
||||
|
||||
double dKx = 1, dKy = 1, dShiftKoefX = 0, dShiftKoefY = 0;
|
||||
if (dImageW < 0)
|
||||
{
|
||||
dKx = -1;
|
||||
dShiftKoefX = 2 * dImageX + dImageW;
|
||||
|
||||
dImageW = -dImageW;
|
||||
dImageX -= dImageW;
|
||||
}
|
||||
|
||||
if (dImageH < 0)
|
||||
{
|
||||
dKy = -1;
|
||||
dShiftKoefY = 2 * dImageY + dImageH;
|
||||
|
||||
dImageH = -dImageH;
|
||||
dImageY -= dImageH;
|
||||
}
|
||||
|
||||
m_pRenderer->SetTransform(dKx * dM11, dKx * dM12, dKy * dM21, dKy * dM22, dShiftKoefX * dM11 + dShiftKoefY * dM21 + dMx, dShiftKoefX * dM12 + dShiftKoefY * dM22 + dMy);
|
||||
}
|
||||
|
||||
m_pRenderer->DrawImage(&oImage, dImageX, dImageY, dImageW, dImageH);
|
||||
}
|
||||
void DrawString(std::wstring& wsText, unsigned int unCharsCount, double _dX, double _dY, double* pDx, int iGraphicsMode)
|
||||
{
|
||||
@ -303,13 +336,40 @@ namespace MetaFile
|
||||
double dM11, dM12, dM21, dM22, dRx, dRy;
|
||||
m_pRenderer->GetTransform(&dM11, &dM12, &dM21, &dM22, &dRx, &dRy);
|
||||
|
||||
double dShiftX = (dM11 < -0.001 ? (2 * dX - 2 * fW) * dM11 : 0);
|
||||
double dShiftY = (dM22 < -0.001 ? (2 * dY - 2 * fH) * dM22 : 0);
|
||||
double dShiftX = 0;
|
||||
double dShiftY = 0;
|
||||
|
||||
// Нам нужно знать в следствие чего происходит флип, из-за Window или Viewport
|
||||
if (dM11 < -0.00001)
|
||||
{
|
||||
dX -= fabs(fW);
|
||||
|
||||
if (m_pFile->IsWindowFlippedX())
|
||||
{
|
||||
dShiftX = (2 * dX + fabs(fW)) * dM11;
|
||||
}
|
||||
else
|
||||
{
|
||||
dShiftX = (2 * dX - fabs(fW)) * dM11;
|
||||
}
|
||||
}
|
||||
|
||||
if (dM22 < - 0.00001)
|
||||
{
|
||||
dY -= fabs(fH);
|
||||
if (m_pFile->IsWindowFlippedY())
|
||||
{
|
||||
dShiftY = (2 * dY + fabs(fH)) * dM22;
|
||||
}
|
||||
else
|
||||
{
|
||||
dShiftY = (2 * dY - fabs(fH)) * dM22;
|
||||
}
|
||||
}
|
||||
|
||||
m_pRenderer->ResetTransform();
|
||||
m_pRenderer->SetTransform(fabs(dM11), 0, 0, fabs(dM22), dShiftX + dRx, dShiftY + dRy);
|
||||
|
||||
|
||||
bChangeCTM = true;
|
||||
}
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ namespace MetaFile
|
||||
{
|
||||
CEmfClipCommandPath::CEmfClipCommandPath(CEmfPath* pPath, unsigned int unMode, TEmfXForm* pTransform) : m_oPath(pPath), m_unMode(unMode)
|
||||
{
|
||||
pTransform->Copy(&m_oTransform);
|
||||
m_oTransform.Copy(pTransform);
|
||||
}
|
||||
|
||||
CEmfClip::CEmfClip()
|
||||
|
||||
@ -215,7 +215,6 @@ static const struct ActionNamesEmf
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (0 == ulRecordIndex && EMR_HEADER != ulType)
|
||||
return SetError();
|
||||
|
||||
|
||||
@ -171,6 +171,16 @@ namespace MetaFile
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
bool IsWindowFlippedY()
|
||||
{
|
||||
TEmfWindow* pWindow = m_pDC->GetWindow();
|
||||
return (pWindow->ulH < 0);
|
||||
}
|
||||
bool IsWindowFlippedX()
|
||||
{
|
||||
TEmfWindow* pWindow = m_pDC->GetWindow();
|
||||
return (pWindow->ulW < 0);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -585,33 +585,8 @@ namespace MetaFile
|
||||
TEmfWindow* pWindow = GetWindow();
|
||||
TEmfWindow* pViewPort = GetViewport();
|
||||
|
||||
int nWindowX = pWindow->lX;
|
||||
int nWindowY = pWindow->lY;
|
||||
|
||||
double dPixelW = GetPixelWidth();
|
||||
double dPixelH = GetPixelHeight();
|
||||
|
||||
// Вообще отрицательных высоты и ширины быть не должно, но если так встречается, то
|
||||
// мы считаем, что это не перевернутая система координат, а просто сдвинутая
|
||||
|
||||
if (pWindow->ulH < 0)
|
||||
{
|
||||
if (dPixelH < 0)
|
||||
dPixelH = -dPixelH;
|
||||
|
||||
nWindowY += pWindow->ulH;
|
||||
}
|
||||
|
||||
if (pWindow->ulW < 0)
|
||||
{
|
||||
if (dPixelW < 0)
|
||||
dPixelW = -dPixelW;
|
||||
|
||||
nWindowY += pWindow->ulW;
|
||||
}
|
||||
|
||||
TEmfXForm oWindowXForm(1, 0, 0, 1, -nWindowX, -nWindowY);
|
||||
TEmfXForm oViewportXForm(dPixelW, 0, 0, dPixelH, pViewPort->lX, pViewPort->lY);
|
||||
TEmfXForm oWindowXForm(1, 0, 0, 1, -pWindow->lX, -pWindow->lY);
|
||||
TEmfXForm oViewportXForm((double)GetPixelWidth(), 0, 0, (double)GetPixelHeight(), pViewPort->lX, pViewPort->lY);
|
||||
|
||||
m_oFinalTransform.Init();
|
||||
m_oFinalTransform.Multiply(oWindowXForm, MWT_RIGHTMULTIPLY);
|
||||
|
||||
@ -185,6 +185,14 @@ class CSvmFile : virtual public IMetaFileBase
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
bool IsWindowFlippedY()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool IsWindowFlippedX()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
TSvmPoint m_oCurrnetOffset;
|
||||
|
||||
@ -343,6 +343,16 @@ namespace MetaFile
|
||||
{
|
||||
return m_pDC->GetCharSpacing();
|
||||
}
|
||||
bool IsWindowFlippedY()
|
||||
{
|
||||
TWmfWindow* pWindow = m_pDC->GetWindow();
|
||||
return (pWindow->h < 0);
|
||||
}
|
||||
bool IsWindowFlippedX()
|
||||
{
|
||||
TWmfWindow* pWindow = m_pDC->GetWindow();
|
||||
return (pWindow->w < 0);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967B0BC1E27A22E00A129E2"
|
||||
BuildableName = "libHtmlFile.a"
|
||||
BlueprintName = "HtmlFile"
|
||||
ReferencedContainer = "container:HtmlFile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967B0BC1E27A22E00A129E2"
|
||||
BuildableName = "libHtmlFile.a"
|
||||
BlueprintName = "HtmlFile"
|
||||
ReferencedContainer = "container:HtmlFile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "6967B0BC1E27A22E00A129E2"
|
||||
BuildableName = "libHtmlFile.a"
|
||||
BlueprintName = "HtmlFile"
|
||||
ReferencedContainer = "container:HtmlFile.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
File diff suppressed because it is too large
Load Diff
@ -100,6 +100,10 @@
|
||||
|
||||
- (int)sdk_odf2oox_dir:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath;
|
||||
|
||||
- (int)sdk_doct_bin2odt:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir;
|
||||
- (int)sdk_xlst_bin2ods:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir;
|
||||
- (int)sdk_pptt_bin2odp:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir;
|
||||
|
||||
- (int)sdk_dir2zip:(NSString*)nsFrom nsTo:(NSString*)nsTo;
|
||||
- (int)sdk_zip2dir:(NSString*)nsFrom nsTo:(NSString*)nsTo;
|
||||
|
||||
|
||||
@ -727,6 +727,143 @@ static std::wstring nsstring_to_wstring(NSString* nsstring)
|
||||
return NExtractTools::odf2oox_dir(from, to, temp, oInputParams);
|
||||
}
|
||||
|
||||
- (int)sdk_doct_bin2odt:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir {
|
||||
|
||||
NSString* nsTemporaryFile = [NSString stringWithFormat:@"%@%@.docx", NSTemporaryDirectory(), [[NSUUID UUID] UUIDString]];
|
||||
|
||||
std::wstring from = nsstring_to_wstring(nsFrom);
|
||||
std::wstring to = nsstring_to_wstring(nsTo);
|
||||
std::wstring temp = nsstring_to_wstring(nsTemp);
|
||||
std::wstring themeDir = nsstring_to_wstring(nsThemeDir);
|
||||
std::wstring temporaryfile = nsstring_to_wstring(nsTemporaryFile);
|
||||
|
||||
bool bFromChanges = (bool)fromChanges.boolValue;
|
||||
|
||||
NExtractTools::InputParams oInputParams;
|
||||
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
|
||||
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
|
||||
if (nil != self.password && self.password.length > 0) {
|
||||
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
|
||||
|
||||
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.docx";
|
||||
|
||||
if ((int)AVS_FILEUTILS_ERROR_CONVERT != NExtractTools::doct_bin2docx(from, sResultDecryptFile, temp, bFromChanges, themeDir, oInputParams)) {
|
||||
nRes = oox2mscrypt(sResultDecryptFile, temporaryfile, temp, oInputParams);
|
||||
} else {
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
} else {
|
||||
nRes = NExtractTools::doct_bin2docx(from, temporaryfile, temp, bFromChanges, themeDir, oInputParams);
|
||||
}
|
||||
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
NExtractTools::InputParams oInputParams;
|
||||
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
|
||||
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
|
||||
|
||||
nRes = NExtractTools::docx2odt(temporaryfile, to, temp, oInputParams);
|
||||
|
||||
[self removeFileAt:nsTemporaryFile];
|
||||
}
|
||||
|
||||
return nRes;
|
||||
}
|
||||
- (int)sdk_xlst_bin2ods:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir {
|
||||
|
||||
NSString* nsTemporaryFile = [NSString stringWithFormat:@"%@%@.xlsx", NSTemporaryDirectory(), [[NSUUID UUID] UUIDString]];
|
||||
|
||||
std::wstring from = nsstring_to_wstring(nsFrom);
|
||||
std::wstring to = nsstring_to_wstring(nsTo);
|
||||
std::wstring temp = nsstring_to_wstring(nsTemp);
|
||||
std::wstring themeDir = nsstring_to_wstring(nsThemeDir);
|
||||
std::wstring temporaryfile = nsstring_to_wstring(nsTemporaryFile);
|
||||
|
||||
bool bFromChanges = (bool)fromChanges.boolValue;
|
||||
|
||||
NExtractTools::InputParams oInputParams;
|
||||
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
|
||||
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
|
||||
if (nil != self.password && self.password.length > 0) {
|
||||
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
|
||||
|
||||
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.xlsx";
|
||||
|
||||
if ((int)AVS_FILEUTILS_ERROR_CONVERT != NExtractTools::xlst_bin2xlsx(from, sResultDecryptFile, temp, bFromChanges, themeDir, oInputParams)) {
|
||||
nRes = oox2mscrypt(sResultDecryptFile, temporaryfile, temp, oInputParams);
|
||||
} else {
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
} else {
|
||||
nRes = NExtractTools::xlst_bin2xlsx(from, temporaryfile, temp, bFromChanges, themeDir, oInputParams);
|
||||
}
|
||||
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
NExtractTools::InputParams oInputParams;
|
||||
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
|
||||
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
|
||||
|
||||
nRes = NExtractTools::xlsx2ods(temporaryfile, to, temp, oInputParams);
|
||||
|
||||
[self removeFileAt:nsTemporaryFile];
|
||||
}
|
||||
|
||||
return nRes;
|
||||
}
|
||||
- (int)sdk_pptt_bin2odp:(NSString*)nsFrom nsTo:(NSString*)nsTo nsTemp:(NSString*)nsTemp nsFontPath:(NSString*)nsFontPath fromChanges:(NSNumber*)fromChanges nsThemeDir:(NSString*)nsThemeDir {
|
||||
|
||||
NSString* nsTemporaryFile = [NSString stringWithFormat:@"%@%@.pptx", NSTemporaryDirectory(), [[NSUUID UUID] UUIDString]];
|
||||
|
||||
std::wstring from = nsstring_to_wstring(nsFrom);
|
||||
std::wstring to = nsstring_to_wstring(nsTo);
|
||||
std::wstring temp = nsstring_to_wstring(nsTemp);
|
||||
std::wstring themeDir = nsstring_to_wstring(nsThemeDir);
|
||||
std::wstring temporaryfile = nsstring_to_wstring(nsTemporaryFile);
|
||||
|
||||
bool bFromChanges = (bool)fromChanges.boolValue;
|
||||
|
||||
NExtractTools::InputParams oInputParams;
|
||||
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
|
||||
if (nil != self.password && self.password.length > 0) {
|
||||
oInputParams.m_sSavePassword = new std::wstring(nsstring_to_wstring(self.password));
|
||||
|
||||
std::wstring sResultDecryptFile = temp + FILE_SEPARATOR_STR + L"uncrypt_file.pptx";
|
||||
|
||||
if ((int)AVS_FILEUTILS_ERROR_CONVERT != NExtractTools::pptt_bin2pptx(from, sResultDecryptFile, temp, bFromChanges, themeDir, oInputParams)) {
|
||||
nRes = oox2mscrypt(sResultDecryptFile, temporaryfile, temp, oInputParams);
|
||||
} else {
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
} else {
|
||||
nRes = NExtractTools::pptt_bin2pptx(from, temporaryfile, temp, bFromChanges, themeDir, oInputParams);
|
||||
}
|
||||
|
||||
if (SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
NExtractTools::InputParams oInputParams;
|
||||
oInputParams.m_sFontDir = new std::wstring(nsstring_to_wstring(nsFontPath));
|
||||
oInputParams.m_bIsNoBase64 = new bool(self.isNoBase64);
|
||||
|
||||
nRes = NExtractTools::pptx2odp(temporaryfile, to, temp, oInputParams);
|
||||
|
||||
[self removeFileAt:nsTemporaryFile];
|
||||
}
|
||||
|
||||
return nRes;
|
||||
}
|
||||
|
||||
- (int)sdk_dir2zip:(NSString*)nsFrom nsTo:(NSString*)nsTo {
|
||||
std::wstring from = nsstring_to_wstring(nsFrom);
|
||||
std::wstring to = nsstring_to_wstring(nsTo);
|
||||
|
||||
@ -2538,7 +2538,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "compiler-default";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
ENABLE_BITCODE = NO;
|
||||
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
@ -2568,7 +2568,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "compiler-default";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
ENABLE_BITCODE = NO;
|
||||
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
|
||||
@ -1850,21 +1850,21 @@ namespace NExtractTools
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedPPTX, NULL, 0))
|
||||
{
|
||||
return pptx_dir2odp(sTempUnpackedPPTX, sTo, sTemp, params);
|
||||
return pptx_dir2odp(sTempUnpackedPPTX, sTo, sTemp, params, false); //add template ???
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// pptx_dir -> odp
|
||||
_UINT32 pptx_dir2odp (const std::wstring &sPptxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params )
|
||||
_UINT32 pptx_dir2odp (const std::wstring &sPptxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params, bool bTemplate)
|
||||
{
|
||||
std::wstring sTempUnpackedODP = sTemp + FILE_SEPARATOR_STR + _T("odp_unpacked");
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODP);
|
||||
std::wstring sTempUnpackedODP = sTemp + FILE_SEPARATOR_STR + _T("odp_unpacked");
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODP);
|
||||
|
||||
Oox2Odf::Converter converter(sPptxDir, _T("presentation"), params.getFontPath(), NULL);
|
||||
Oox2Odf::Converter converter(sPptxDir, _T("presentation"), params.getFontPath(), bTemplate);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::wstring password = params.getSavePassword();
|
||||
std::wstring documentID = params.getDocumentID();
|
||||
|
||||
@ -1873,12 +1873,13 @@ namespace NExtractTools
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODP, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}catch(...)
|
||||
{
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
// rtf -> docx
|
||||
_UINT32 rtf2docx (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
{
|
||||
@ -2415,17 +2416,17 @@ namespace NExtractTools
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedDOCX, NULL, 0))
|
||||
{
|
||||
return docx_dir2odt(sTempUnpackedDOCX, sTo, sTemp, params);
|
||||
return docx_dir2odt(sTempUnpackedDOCX, sTo, sTemp, params, false); //add Template ????
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// docx dir -> odt
|
||||
_UINT32 docx_dir2odt (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params )
|
||||
_UINT32 docx_dir2odt (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params, bool bTemplate)
|
||||
{
|
||||
std::wstring sTempUnpackedODT = sTemp + FILE_SEPARATOR_STR + L"odt_unpacked";
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODT);
|
||||
|
||||
Oox2Odf::Converter converter(sDocxDir, L"text", params.getFontPath(), NULL);
|
||||
Oox2Odf::Converter converter(sDocxDir, L"text", params.getFontPath(), bTemplate);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
try
|
||||
@ -2438,7 +2439,8 @@ namespace NExtractTools
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODT, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}catch(...)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
@ -2454,20 +2456,21 @@ namespace NExtractTools
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedXLSX, NULL, 0))
|
||||
{
|
||||
return xlsx_dir2ods(sTempUnpackedXLSX, sTo, sTemp, params);
|
||||
return xlsx_dir2ods(sTempUnpackedXLSX, sTo, sTemp, params, false); //add Template ???
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
_UINT32 xlsx_dir2ods (const std::wstring &sXlsxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
_UINT32 xlsx_dir2ods (const std::wstring &sXlsxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params, bool bTemplate)
|
||||
{
|
||||
std::wstring sTempUnpackedODS = sTemp + FILE_SEPARATOR_STR + L"ods_unpacked";
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODS);
|
||||
|
||||
|
||||
Oox2Odf::Converter converter(sXlsxDir, L"spreadsheet", params.getFontPath(), bTemplate);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
try
|
||||
{
|
||||
Oox2Odf::Converter converter(sXlsxDir, L"spreadsheet", params.getFontPath(), NULL);
|
||||
|
||||
std::wstring password = params.getSavePassword();
|
||||
std::wstring documentID = params.getDocumentID();
|
||||
|
||||
@ -2475,13 +2478,13 @@ namespace NExtractTools
|
||||
converter.write(sTempUnpackedODS, sTemp, password, documentID);
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
_UINT32 nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODS, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
return nRes;
|
||||
}catch(...)
|
||||
{
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODS, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
catch(...)
|
||||
{
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
_UINT32 mscrypt2oot (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
@ -3075,9 +3078,13 @@ namespace NExtractTools
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT == nFormatTo)
|
||||
{
|
||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params);
|
||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, false);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT == nFormatTo)
|
||||
{
|
||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, true);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF == nFormatTo)
|
||||
{
|
||||
nRes = docx_dir2rtf(sFrom, sTo, sTemp, params);
|
||||
}
|
||||
@ -3300,9 +3307,13 @@ namespace NExtractTools
|
||||
//else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params);
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params, false);
|
||||
}
|
||||
else
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params, true);
|
||||
}
|
||||
else
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_OTHER_JSON == nFormatTo)
|
||||
@ -3506,7 +3517,11 @@ namespace NExtractTools
|
||||
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP == nFormatTo)
|
||||
{
|
||||
nRes = pptx_dir2odp(sFrom, sTo, sTemp, params);
|
||||
nRes = pptx_dir2odp(sFrom, sTo, sTemp, params, false);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP == nFormatTo)
|
||||
{
|
||||
nRes = pptx_dir2odp(sFrom, sTo, sTemp, params, true);
|
||||
}
|
||||
else
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
@ -160,11 +160,11 @@ namespace NExtractTools
|
||||
_UINT32 odf_flat2oot_bin(const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
|
||||
_UINT32 docx2odt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 docx_dir2odt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 docx_dir2odt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params, bool bTemplate);
|
||||
_UINT32 xlsx2ods (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 xlsx_dir2ods (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 xlsx_dir2ods (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params, bool bTemplate);
|
||||
_UINT32 pptx2odp (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 pptx_dir2odp (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 pptx_dir2odp (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params, bool bTemplate);
|
||||
|
||||
_UINT32 fromMscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
_UINT32 mscrypt2oox (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params);
|
||||
|
||||
@ -1871,17 +1871,17 @@ namespace NExtractTools
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedPPTX, NULL, 0))
|
||||
{
|
||||
return pptx_dir2odp(sTempUnpackedPPTX, sTo, sTemp, params);
|
||||
return pptx_dir2odp(sTempUnpackedPPTX, sTo, sTemp, params, false); //add template ???
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// pptx_dir -> odp
|
||||
_UINT32 pptx_dir2odp (const std::wstring &sPptxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params )
|
||||
_UINT32 pptx_dir2odp (const std::wstring &sPptxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params, bool bTemplate)
|
||||
{
|
||||
std::wstring sTempUnpackedODP = sTemp + FILE_SEPARATOR_STR + _T("odp_unpacked");
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODP);
|
||||
|
||||
Oox2Odf::Converter converter(sPptxDir, _T("presentation"), params.getFontPath(), NULL);
|
||||
Oox2Odf::Converter converter(sPptxDir, _T("presentation"), params.getFontPath(), bTemplate);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
try
|
||||
@ -1894,7 +1894,8 @@ namespace NExtractTools
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODP, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}catch(...)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
@ -2376,17 +2377,17 @@ namespace NExtractTools
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedDOCX, NULL, 0))
|
||||
{
|
||||
return docx_dir2odt(sTempUnpackedDOCX, sTo, sTemp, params);
|
||||
return docx_dir2odt(sTempUnpackedDOCX, sTo, sTemp, params, false); //add Template ????
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
// docx dir -> odt
|
||||
_UINT32 docx_dir2odt (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params )
|
||||
_UINT32 docx_dir2odt (const std::wstring &sDocxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params, bool bTemplate)
|
||||
{
|
||||
std::wstring sTempUnpackedODT = sTemp + FILE_SEPARATOR_STR + L"odt_unpacked";
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODT);
|
||||
|
||||
Oox2Odf::Converter converter(sDocxDir, L"text", params.getFontPath(), NULL);
|
||||
Oox2Odf::Converter converter(sDocxDir, L"text", params.getFontPath(), bTemplate);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
try
|
||||
@ -2399,7 +2400,8 @@ namespace NExtractTools
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODT, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}catch(...)
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
@ -2415,20 +2417,21 @@ namespace NExtractTools
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
if (S_OK == oCOfficeUtils.ExtractToDirectory(sFrom, sTempUnpackedXLSX, NULL, 0))
|
||||
{
|
||||
return xlsx_dir2ods(sTempUnpackedXLSX, sTo, sTemp, params);
|
||||
return xlsx_dir2ods(sTempUnpackedXLSX, sTo, sTemp, params, false); //add Template ???
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
_UINT32 xlsx_dir2ods (const std::wstring &sXlsxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params)
|
||||
_UINT32 xlsx_dir2ods (const std::wstring &sXlsxDir, const std::wstring &sTo, const std::wstring &sTemp, InputParams& params, bool bTemplate)
|
||||
{
|
||||
std::wstring sTempUnpackedODS = sTemp + FILE_SEPARATOR_STR + L"ods_unpacked";
|
||||
NSDirectory::CreateDirectory(sTempUnpackedODS);
|
||||
|
||||
Oox2Odf::Converter converter(sXlsxDir, L"spreadsheet", params.getFontPath(), bTemplate);
|
||||
|
||||
_UINT32 nRes = 0;
|
||||
try
|
||||
{
|
||||
Oox2Odf::Converter converter(sXlsxDir, L"spreadsheet", params.getFontPath(), NULL);
|
||||
|
||||
std::wstring password = params.getSavePassword();
|
||||
std::wstring documentID = params.getDocumentID();
|
||||
|
||||
@ -2436,13 +2439,13 @@ namespace NExtractTools
|
||||
converter.write(sTempUnpackedODS, sTemp, password, documentID);
|
||||
|
||||
COfficeUtils oCOfficeUtils(NULL);
|
||||
_UINT32 nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODS, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
return nRes;
|
||||
}catch(...)
|
||||
{
|
||||
nRes = (S_OK == oCOfficeUtils.CompressFileOrDirectory(sTempUnpackedODS, sTo, false, password.empty() ? Z_DEFLATED : 0)) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return AVS_FILEUTILS_ERROR_CONVERT;
|
||||
catch(...)
|
||||
{
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
_UINT32 mscrypt2oot (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
|
||||
@ -2994,7 +2997,11 @@ namespace NExtractTools
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_ODT == nFormatTo)
|
||||
{
|
||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params);
|
||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, false);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_OTT == nFormatTo)
|
||||
{
|
||||
nRes = docx_dir2odt(sFrom, sTo, sTemp, params, true);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF == nFormatTo)
|
||||
{
|
||||
@ -3181,29 +3188,49 @@ namespace NExtractTools
|
||||
|
||||
_UINT32 fromXlsxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params, const std::wstring &sXlsxFile)
|
||||
{
|
||||
int nRes = 0;
|
||||
_UINT32 nRes = 0;
|
||||
if(0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo) && AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV != nFormatTo)
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo || AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM == nFormatTo ||
|
||||
AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX == nFormatTo || AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM == nFormatTo)
|
||||
{
|
||||
if(params.hasSavePassword())
|
||||
if (AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM == nFormatTo || AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX == nFormatTo || AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM == nFormatTo)
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
std::wstring sCTFrom = _T("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml");
|
||||
std::wstring sCTTo;
|
||||
switch(nFormatTo)
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSM: sCTTo = _T("application/vnd.ms-excel.sheet.macroEnabled.main+xml");break;
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTX: sCTTo = _T("application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml");break;
|
||||
case AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLTM: sCTTo = _T("application/vnd.ms-excel.template.macroEnabled.main+xml");break;
|
||||
}
|
||||
nRes = replaceContentType(sFrom, sCTFrom, sCTTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
if(params.hasSavePassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params);
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params, false);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_OTS == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params, true);
|
||||
}
|
||||
else
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
@ -3232,7 +3259,7 @@ namespace NExtractTools
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
|
||||
_UINT32 fromXlstBin(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||
{
|
||||
int nRes = 0;
|
||||
@ -3369,29 +3396,52 @@ namespace NExtractTools
|
||||
|
||||
_UINT32 fromPptxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||
{
|
||||
int nRes = 0;
|
||||
_UINT32 nRes = 0;
|
||||
if (0 != (AVS_OFFICESTUDIO_FILE_PRESENTATION & nFormatTo))
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
|
||||
if (AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX == nFormatTo ||
|
||||
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM == nFormatTo)
|
||||
{
|
||||
if(params.hasSavePassword())
|
||||
if (AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX == nFormatTo ||
|
||||
AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM == nFormatTo || AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM == nFormatTo)
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
std::wstring sCTFrom = _T("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml");
|
||||
std::wstring sCTTo;
|
||||
switch(nFormatTo)
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTM: sCTTo = _T("application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml");break;
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSX: sCTTo = _T("application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml");break;
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTX: sCTTo = _T("application/vnd.openxmlformats-officedocument.presentationml.template.main+xml");break;
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_POTM: sCTTo = _T("application/vnd.ms-powerpoint.template.macroEnabled.main+xml");break;
|
||||
case AVS_OFFICESTUDIO_FILE_PRESENTATION_PPSM: sCTTo = _T("application/vnd.ms-powerpoint.slideshow.macroEnabled.main+xml");break;
|
||||
}
|
||||
nRes = replaceContentType(sFrom, sCTFrom, sCTTo) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
if(params.hasSavePassword())
|
||||
{
|
||||
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx");
|
||||
nRes = dir2zip(sFrom, sToMscrypt);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = oox2mscrypt(sToMscrypt, sTo, sTemp, params);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_ODP == nFormatTo)
|
||||
{
|
||||
nRes = pptx_dir2odp(sFrom, sTo, sTemp, params);
|
||||
nRes = pptx_dir2odp(sFrom, sTo, sTemp, params, false);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_PRESENTATION_OTP == nFormatTo)
|
||||
{
|
||||
nRes = pptx_dir2odp(sFrom, sTo, sTemp, params, true);
|
||||
}
|
||||
else
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17DAB6771ACC371E005AF479"
|
||||
BuildableName = "iosTest.app"
|
||||
BlueprintName = "iosTest"
|
||||
ReferencedContainer = "container:iosTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17DAB6771ACC371E005AF479"
|
||||
BuildableName = "iosTest.app"
|
||||
BlueprintName = "iosTest"
|
||||
ReferencedContainer = "container:iosTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Release"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17DAB6771ACC371E005AF479"
|
||||
BuildableName = "iosTest.app"
|
||||
BlueprintName = "iosTest"
|
||||
ReferencedContainer = "container:iosTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "17DAB6771ACC371E005AF479"
|
||||
BuildableName = "iosTest.app"
|
||||
BlueprintName = "iosTest"
|
||||
ReferencedContainer = "container:iosTest.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
Reference in New Issue
Block a user