From daf44553faa4aebca286e681527f582758719cf7 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Sun, 28 Aug 2016 14:03:32 +0300 Subject: [PATCH] DocFormatReader - small refactoring --- ASCOfficeDocFile/Common/FormatUtils.h | 53 +++--- ASCOfficeDocFile/Common/XmlTools.h | 171 +++++++++++++++--- .../DocDocxConverter/AbstractOpenXmlMapping.h | 8 +- .../CharacterPropertiesMapping.cpp | 12 +- .../CharacterPropertiesMapping.h | 4 +- .../DocDocxConverter/ContentTypes.h | 4 +- .../DocDocxConverter/DocumentMapping.cpp | 6 +- .../DocDocxConverter/DocumentMapping.h | 2 +- .../DocDocxConverter/FontTableMapping.cpp | 2 +- .../DocDocxConverter/LanguageIdMapping.cpp | 2 +- .../DocDocxConverter/LanguageIdMapping.h | 2 +- .../DocDocxConverter/MemoryStream.h | 10 - .../DocDocxConverter/NumberingMapping.cpp | 4 +- .../OfficeDrawing/MetafilePictBlip.h | 2 +- .../OfficeDrawing/ShapeType.h | 2 +- .../DocDocxConverter/OleObjectMapping.h | 2 +- .../DocDocxConverter/OpenXmlPackage.cpp | 126 +++++++------ .../DocDocxConverter/OpenXmlPackage.h | 2 - .../ParagraphPropertiesMapping.cpp | 4 +- .../ParagraphPropertiesMapping.h | 4 +- .../DocDocxConverter/PropertiesMapping.cpp | 2 +- .../DocDocxConverter/PropertiesMapping.h | 7 +- ASCOfficeDocFile/DocDocxConverter/RGBColor.h | 43 +++-- .../SectionPropertiesMapping.cpp | 5 +- .../SectionPropertiesMapping.h | 2 +- .../DocDocxConverter/SettingsMapping.h | 2 +- .../DocDocxConverter/SprmTDefTable.h | 2 - .../DocDocxConverter/StyleSheetMapping.cpp | 2 +- .../TableCellPropertiesMapping.cpp | 2 +- .../TableCellPropertiesMapping.h | 2 +- .../TablePropertiesMapping.cpp | 2 +- .../DocDocxConverter/TablePropertiesMapping.h | 2 +- .../TableRowPropertiesMapping.cpp | 2 +- .../TableRowPropertiesMapping.h | 2 +- .../DocDocxConverter/TextboxMapping.cpp | 11 +- .../DocDocxConverter/TextboxMapping.h | 4 +- .../DocDocxConverter/VMLPictureMapping.cpp | 2 +- .../DocDocxConverter/VMLPictureMapping.h | 2 +- .../DocDocxConverter/VMLShapeMapping.cpp | 21 +-- .../DocDocxConverter/VMLShapeMapping.h | 4 +- .../DocDocxConverter/VMLShapeTypeMapping.cpp | 2 +- .../DocDocxConverter/VMLShapeTypeMapping.h | 2 +- .../DocDocxConverter/WordDocument.cpp | 5 +- .../WordprocessingDocument.cpp | 54 +++--- .../DocFormatLib/DocFormatLib.cpp | 3 - .../PPTFormatLib/Reader/ReadStructures.h | 22 ++- ASCOfficePPTXFile/Editor/Drawing/Attributes.h | 10 +- ASCOfficePPTXFile/Editor/Drawing/Metric.h | 5 +- .../BaseShape/PPTShape/CustomGeomShape.h | 14 +- ASCOfficePPTXFile/Editor/XmlWriter.h | 64 +++---- DesktopEditor/common/Directory.h | 12 ++ X2tConverter/src/ASCConverters.cpp | 2 +- 52 files changed, 431 insertions(+), 307 deletions(-) diff --git a/ASCOfficeDocFile/Common/FormatUtils.h b/ASCOfficeDocFile/Common/FormatUtils.h index 09bd7f3aed..9f35d064ad 100644 --- a/ASCOfficeDocFile/Common/FormatUtils.h +++ b/ASCOfficeDocFile/Common/FormatUtils.h @@ -41,25 +41,25 @@ #include #include - #include #include #include "utf8.h" #if defined(_WIN32) || defined(_WIN64) - #include - #include + #include + #include #else - #include "../../DesktopEditor/common/ASCVariant.h" - #include "../../Common/DocxFormat/Source/Base/ASCString.h" + //#include "../../DesktopEditor/common/ASCVariant.h" + //#include "../../Common/DocxFormat/Source/Base/ASCString.h" #endif #include "../../DesktopEditor/common/Types.h" -#include "../../Common/DocxFormat/Source/XML/stringcommon.h" #include "../../Common/DocxFormat/Source/Base/unicode_util.h" #include "../../UnicodeConverter/UnicodeConverter.h" +#include + namespace DocFormatUtils { typedef unsigned char Bool8; @@ -768,10 +768,11 @@ namespace DocFormatUtils static inline std::wstring IntToWideString(int value) { - CString strValue; - strValue.Format(_T("%d"), value); + wchar_t sVal[32]={}; + _itow(value, sVal, 10); + std::wstring strValue; - return string2std_string(strValue); + return std::wstring(sVal); } static inline std::wstring DoubleToWideString(double value) { @@ -827,29 +828,35 @@ namespace DocFormatUtils // wchar_t strValue[size] = _T( "\0" ); -// if ( format != NULL ) -// { + if ( format == NULL ) return L""; // swprintf_s( strValue, size, format, value ); -// } - CString format_str; - format_str.Format(format , value); +//// } +// CString format_str; +// format_str.Format(format , value); - return string2std_string( format_str ); + std::wstringstream sstream; + sstream << boost::wformat(format) % value; + return sstream.str(); + //return string2std_string( format_str ); } static inline std::wstring DoubleToFormattedWideString( double value, wchar_t* format ) { - std::wstring wstr; + if ( format == NULL ) return L""; + //std::wstring wstr; - if ( format != NULL ) - { - CString strValue; - strValue.Format(format, value); + //if ( format != NULL ) + //{ + // CString strValue; + // strValue.Format(format, value); - wstr = string2std_string( strValue ); - } + // wstr = string2std_string( strValue ); + //} - return wstr; + //return wstr; + std::wstringstream sstream; + sstream << boost::wformat(format) % value; + return sstream.str(); } static inline void SetBytes( unsigned char *bytes, int value ) diff --git a/ASCOfficeDocFile/Common/XmlTools.h b/ASCOfficeDocFile/Common/XmlTools.h index 08398e6880..b6bdf2a2b6 100644 --- a/ASCOfficeDocFile/Common/XmlTools.h +++ b/ASCOfficeDocFile/Common/XmlTools.h @@ -34,14 +34,14 @@ #include #include #include +// +//#if defined(_WIN32) || defined(_WIN64) +//#else +// #include "../../DesktopEditor/common/ASCVariant.h" +// #include "../../Common/DocxFormat/Source/Base/ASCString.h" +//#endif -#if defined(_WIN32) || defined(_WIN64) - #include - #include -#else - #include "../../DesktopEditor/common/ASCVariant.h" - #include "../../Common/DocxFormat/Source/Base/ASCString.h" -#endif +#include "../../DesktopEditor/Common/File.h" inline static std::wstring ReplaceString(std::wstring subject, const std::wstring& search, const std::wstring& replace) { @@ -118,12 +118,12 @@ namespace XMLTools std::basic_string GetXMLString() { - std::basic_string xmlString( _T( "" ) ); + std::basic_string xmlString( L"" ); xmlString += m_Name; - xmlString += std::basic_string( _T( "=\"" ) ); + xmlString += std::basic_string( L"=\"" ); xmlString += m_Value; - xmlString += std::basic_string( _T( "\"" ) ); + xmlString += std::basic_string( L"\"" ); return xmlString; } @@ -165,7 +165,7 @@ namespace XMLTools /*========================================================================================================*/ - XMLElement( const T* prefix, const T* localName ) : m_Name( std::basic_string( prefix ) + std::basic_string( _T( ":" ) ) + std::basic_string( localName ) ), m_ElementText( _T( "" ) ) + XMLElement( const T* prefix, const T* localName ) : m_Name( std::basic_string( prefix ) + std::basic_string( L":" ) + std::basic_string( localName ) ), m_ElementText( L"" ) { } @@ -341,25 +341,25 @@ namespace XMLTools std::basic_string GetXMLString() { - std::basic_string xmlString( _T( "" ) ); + std::basic_string xmlString( L""); - bool bIsNameExists = ( m_Name != std::basic_string( _T( "" ) ) ); - bool bIsTextExists = ( m_ElementText != std::basic_string( _T( "" ) ) ); + bool bIsNameExists = ( m_Name != std::basic_string( L"") ); + bool bIsTextExists = ( m_ElementText != std::basic_string( L"") ); if ( bIsNameExists ) { - xmlString += std::basic_string( _T( "<" ) ) + m_Name; + xmlString += std::basic_string( L"<" ) + m_Name; } if ( ( bIsNameExists ) && ( m_AttributeMap.size() > 0 ) ) { for ( AttMapIterator iter = m_AttributeMap.begin(); iter != m_AttributeMap.end(); iter++ ) { - xmlString += std::basic_string( _T( " " ) ); + xmlString += std::basic_string( L" " ); xmlString += iter->first; - xmlString += std::basic_string( _T( "=\"" ) ); + xmlString += std::basic_string( L"=\"" ); xmlString += iter->second; - xmlString += std::basic_string( _T( "\"" ) ); + xmlString += std::basic_string( L"\"" ); } } @@ -367,7 +367,7 @@ namespace XMLTools { if ( bIsNameExists ) { - xmlString += std::basic_string( _T( ">" ) ); + xmlString += std::basic_string( L">" ); } for ( ElementsIterator iter = m_Elements.begin(); iter != m_Elements.end(); iter++ ) @@ -382,16 +382,16 @@ namespace XMLTools if ( bIsNameExists ) { - xmlString += std::basic_string( _T( "( L"( _T( ">" ) ); + xmlString += std::basic_string( L">" ); } } else { if ( bIsNameExists ) { - xmlString += std::basic_string( _T( "/>" ) ); + xmlString += std::basic_string( L"/>" ); } } @@ -413,4 +413,131 @@ namespace XMLTools } }; + + class CStringXmlWriter + { + std::wstring m_str; + + public: + CStringXmlWriter(){} + std::wstring GetXmlString() + { + return m_str; + } + void SetXmlString(const std::wstring& strValue) + { + m_str = strValue; + } + bool SaveToFile(const std::wstring& strFilePath, bool bEncodingToUTF8 = false) + { + NSFile::CFileBinary file; + if (!file.CreateFileW(strFilePath)) return false; + + if (bEncodingToUTF8) + file.WriteStringUTF8(m_str); + else + { + std::string s(m_str.begin(), m_str.end()); + file.WriteFile((unsigned char*)s.c_str(), s.length()); + } + file.CloseFile(); + return true; + } + + void WriteString(const std::wstring & strValue) + { + m_str += strValue; + } + void WriteInteger(int Value, int Base = 10) + { + wchar_t str[33]={}; + _itow(Value, str, Base); + m_str += str; + } + void WriteDouble(double Value) + { + int *dec = NULL, *sign = NULL; + char *str = _fcvt( Value , 4, dec, sign); + + if (str) + { + std::string sA(str); + delete []str; + m_str += std::wstring(sA.begin(), sA.end()); + } + else + { + m_str += L"0"; + } + } + void WriteBoolean(bool Value) + { + if (Value) + m_str += L"true"; + else + m_str += L"false"; + } + void WriteNodeBegin(const std::wstring& strNodeName, bool bAttributed = false) + { + m_str += L"<" + strNodeName; + + if (!bAttributed) + m_str += L">"; + } + void WriteNodeEnd(const std::wstring& strNodeName, bool bEmptyNode = false, bool bEndNode = true) + { + if (bEmptyNode) + { + if (bEndNode) + m_str += L"/>"; + else + m_str += L">"; + } + else + m_str += L""; + } + void WriteNode(const std::wstring& strNodeName, const std::wstring& strNodeValue) + { + if (strNodeValue.length() == 0) + m_str += L"<" + strNodeName + L"/>"; + else + m_str += L"<" + strNodeName + L">" + strNodeValue + L""; + } + void WriteNode(const std::wstring& strNodeName, int nValue, int nBase = 10, const std::wstring& strTextBeforeValue = L"", const std::wstring& strTextAfterValue = L"") + { + WriteNodeBegin(strNodeName); + WriteString(strTextBeforeValue); + WriteInteger(nValue, nBase); + WriteString(strTextAfterValue); + WriteNodeEnd(strNodeName); + } + void WriteNode(const std::wstring& strNodeName, double dValue) + { + WriteNodeBegin(strNodeName); + WriteDouble(dValue); + WriteNodeEnd(strNodeName); + } + void WriteAttribute(const std::wstring& strAttributeName, const std::wstring& strAttributeValue) + { + m_str += L" " + strAttributeName + L"=\"" + strAttributeValue + L"\""; + } + void WriteAttribute(const std::wstring& strAttributeName, int nValue, int nBase = 10, const std::wstring& strTextBeforeValue = L"", const std::wstring& strTextAfterValue = L"") + { + WriteString(L" " + strAttributeName + L"="); + WriteString(L"\""); + WriteString(strTextBeforeValue); + WriteInteger(nValue, nBase); + WriteString(strTextAfterValue); + WriteString(L"\""); + } + void WriteAttribute(const std::wstring& strAttributeName, double dValue) + { + WriteString(L" " + strAttributeName + L"="); + WriteString(L"\""); + WriteDouble(dValue); + WriteString(L"\""); + } + }; + + } diff --git a/ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h b/ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h index deda4d2ddb..fddae659ca 100644 --- a/ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h @@ -31,19 +31,19 @@ */ #pragma once -#include "../../Common/DocxFormat/Source/XML/xmlutils.h" +#include "../Common/XmlTools.h" namespace DocFileFormat { class AbstractOpenXmlMapping { public: - AbstractOpenXmlMapping (XmlUtils::CXmlWriter* pWriter) : m_pXmlWriter(pWriter) + AbstractOpenXmlMapping (XMLTools::CStringXmlWriter* pWriter) : m_pXmlWriter(pWriter) { } - inline XmlUtils::CXmlWriter* GetXMLWriter() + inline XMLTools::CStringXmlWriter* GetXMLWriter() { return m_pXmlWriter; } @@ -55,6 +55,6 @@ namespace DocFileFormat protected: - XmlUtils::CXmlWriter* m_pXmlWriter; + XMLTools::CStringXmlWriter* m_pXmlWriter; }; } diff --git a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp index 873df56dac..82dc8bcc83 100644 --- a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp @@ -34,7 +34,7 @@ namespace DocFileFormat { - CharacterPropertiesMapping::CharacterPropertiesMapping( XmlUtils::CXmlWriter* writer, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded) + CharacterPropertiesMapping::CharacterPropertiesMapping( XMLTools::CStringXmlWriter* writer, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded) : PropertiesMapping( writer ), _isRunStyleNeeded(isRunStyleNeeded), _isOwnRPr(true), _isRTL(false) { _doc = doc; @@ -294,11 +294,13 @@ namespace DocFileFormat case sprmCCv: { - CString rgbColor; + std::wstringstream sstream; - rgbColor.Format( _T( "%02x%02x%02x" ), /*R*/iter->Arguments[0], /*G*/iter->Arguments[1], /*B*/iter->Arguments[2] ); - - colorVal->SetValue( rgbColor.GetString() ); + sstream << boost::wformat(L"%02x%02x%02x") % iter->Arguments[0] % /*G*/iter->Arguments[1] % /*B*/iter->Arguments[2]; + colorVal->SetValue(sstream.str().c_str()); + //CString rgbColor; + //rgbColor.Format( _T( "%02x%02x%02x" ), /*R*/iter->Arguments[0], /*G*/iter->Arguments[1], /*B*/iter->Arguments[2] ); + //colorVal->SetValue( rgbColor.GetString() ); }break; case sprmCOldHighlight: diff --git a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h index 2ce702b6de..47f0b8d4ad 100644 --- a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h @@ -54,7 +54,7 @@ namespace DocFileFormat class CharacterPropertiesMapping: public PropertiesMapping, public IMapping { public: - CharacterPropertiesMapping( XmlUtils::CXmlWriter* writer, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded = true ); + CharacterPropertiesMapping( XMLTools::CStringXmlWriter* writer, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded = true ); CharacterPropertiesMapping( XMLTools::XMLElement* rPr, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded = true ); virtual ~CharacterPropertiesMapping(); void Apply( IVisitable* chpx ); @@ -74,7 +74,7 @@ namespace DocFileFormat virtual void appendFlagElement( XMLTools::XMLElement* node, const SinglePropertyModifier& sprm, const wchar_t* elementName, bool unique ); private: - XmlUtils::CXmlWriter pRunPr; + XMLTools::CStringXmlWriter pRunPr; WordDocument* _doc; XMLTools::XMLElement* _rPr; diff --git a/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h b/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h index 4479b14d77..fd10a975b7 100644 --- a/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h +++ b/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h @@ -32,12 +32,12 @@ #pragma once #if defined(_WIN32) || defined(_WIN64) - #include - #include + #include #else #include "../../DesktopEditor/common/ASCVariant.h" #include "../../Common/DocxFormat/Source/Base/ASCString.h" #endif +#include namespace OpenXmlContentTypes { diff --git a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp index e51b5adf11..974216c826 100755 --- a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp @@ -42,7 +42,7 @@ namespace DocFileFormat { DocumentMapping::DocumentMapping(ConversionContext* context, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false), - _fldCharCounter(0), AbstractOpenXmlMapping( new XmlUtils::CXmlWriter() ), _sectionNr(0), _footnoteNr(0), + _fldCharCounter(0), AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ), _sectionNr(0), _footnoteNr(0), _endnoteNr(0), _commentNr(0), _caller(caller) { m_document = NULL; @@ -55,7 +55,7 @@ namespace DocFileFormat _isTextBoxContent = false; } - DocumentMapping::DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false), + DocumentMapping::DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller):_skipRuns(0), _lastValidPapx(NULL), _lastValidSepx(NULL), _writeInstrText(false), _fldCharCounter(0), AbstractOpenXmlMapping(writer), _sectionNr(0), _footnoteNr(0), _endnoteNr(0), _commentNr(0), _caller(caller) { @@ -658,7 +658,7 @@ namespace DocFileFormat chpxObj->Convert(rPr); RELEASEOBJECT(rPr); } - XmlUtils::CXmlWriter OleWriter; + XMLTools::CStringXmlWriter OleWriter; VMLPictureMapping oVmlMapper (m_context, &OleWriter, true, _caller); if (m_document->bOlderVersion) diff --git a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h index c236fc7f1c..0884543962 100644 --- a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h @@ -69,7 +69,7 @@ namespace DocFileFormat public: DocumentMapping(ConversionContext* context, IMapping* caller); - DocumentMapping(ConversionContext* context, XmlUtils::CXmlWriter* writer, IMapping* caller); + DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller); virtual ~DocumentMapping(); virtual void Apply( IVisitable* visited ) = 0; diff --git a/ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp index 6c526ef6a8..9f426574aa 100644 --- a/ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp @@ -34,7 +34,7 @@ namespace DocFileFormat { - FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XmlUtils::CXmlWriter() ) + FontTableMapping::FontTableMapping( ConversionContext* ctx ): AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ) { _ctx = ctx; } diff --git a/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp index 1f3f73b1e3..1393b637dd 100644 --- a/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp @@ -35,7 +35,7 @@ namespace DocFileFormat { - LanguageIdMapping::LanguageIdMapping (XmlUtils::CXmlWriter* pWriter, LanguageType type) : PropertiesMapping (pWriter) + LanguageIdMapping::LanguageIdMapping (XMLTools::CStringXmlWriter* pWriter, LanguageType type) : PropertiesMapping (pWriter) { _type = type; } diff --git a/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h b/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h index 0ff58b0c5d..bb9226f85c 100644 --- a/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h @@ -48,7 +48,7 @@ namespace DocFileFormat class LanguageIdMapping : public PropertiesMapping, public IMapping { public: - LanguageIdMapping( XmlUtils::CXmlWriter* writer, LanguageType type ); + LanguageIdMapping( XMLTools::CStringXmlWriter* writer, LanguageType type ); LanguageIdMapping( XMLTools::XMLElement* parentElement, LanguageType type ); virtual ~LanguageIdMapping(); void Apply( IVisitable* lid ); diff --git a/ASCOfficeDocFile/DocDocxConverter/MemoryStream.h b/ASCOfficeDocFile/DocDocxConverter/MemoryStream.h index cb29b27225..40e68225ed 100644 --- a/ASCOfficeDocFile/DocDocxConverter/MemoryStream.h +++ b/ASCOfficeDocFile/DocDocxConverter/MemoryStream.h @@ -150,16 +150,6 @@ public: //------------------------------------------------------------------------------------------------------ - //ATL::CAtlFile oFile; - //if (SUCCEEDED(oFile.Create(L"d:\\blop.dat",GENERIC_WRITE, FILE_SHARE_WRITE, CREATE_ALWAYS))) - //{ - // DWORD nFileBuff = 0L; - // oFile.Write (pBytes, count, &nFileBuff); - // oFile.Close(); - //} - - //------------------------------------------------------------------------------------------------------ - if ( !isResultNeeded ) { RELEASEARRAYOBJECTS (pBytes); diff --git a/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp index 38f17e4c47..c1ef3865e0 100644 --- a/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp @@ -34,7 +34,7 @@ namespace DocFileFormat { - NumberingMapping::NumberingMapping(ConversionContext* context) : AbstractOpenXmlMapping(new XmlUtils::CXmlWriter()), m_context(context), m_document(NULL), m_xmldocument(NULL) + NumberingMapping::NumberingMapping(ConversionContext* context) : AbstractOpenXmlMapping(new XMLTools::CStringXmlWriter()), m_context(context), m_document(NULL), m_xmldocument(NULL) { if (m_context) { @@ -548,7 +548,7 @@ namespace DocFileFormat { if (!lvl) return; - XmlUtils::CXmlWriter oWriterTemp; //Временный writer,что не нарушать последовательность записи + XMLTools::CStringXmlWriter oWriterTemp; //Временный writer,что не нарушать последовательность записи //rPr RevisionData rev(lvl->grpprlChpx); CharacterPropertiesMapping cpMapping(&oWriterTemp, m_document, &rev, lvl->grpprlPapx, false); diff --git a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h index f17e4d7943..3af9c77a4b 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h +++ b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h @@ -157,7 +157,7 @@ class CMetaFileBuffer { public: bool m_bIsValid; - CString m_sExtension; + std::wstring m_sExtension; private: BYTE* m_pMetaHeader; BYTE* m_pMetaFile; diff --git a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h index 53310b5fbb..218ae8929a 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h +++ b/ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h @@ -33,8 +33,8 @@ #include "ProtectionBooleanProperties.h" #include "../IVisitable.h" +#include "../../Common/XmlTools.h" -#include "../../../Common/DocxFormat/Source/XML/xmlutils.h" #include diff --git a/ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h b/ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h index 29120ff537..0b011a3a83 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h @@ -43,7 +43,7 @@ namespace DocFileFormat class OleObjectMapping: public AbstractOpenXmlMapping, public IMapping { public: - OleObjectMapping(XmlUtils::CXmlWriter* writer, ConversionContext* context, PictureDescriptor* pict, IMapping* caller, const std::wstring& shapeId) + OleObjectMapping(XMLTools::CStringXmlWriter* writer, ConversionContext* context, PictureDescriptor* pict, IMapping* caller, const std::wstring& shapeId) : AbstractOpenXmlMapping(writer), m_context(NULL), _pict(NULL), _caller(NULL), _shapeId(shapeId) { diff --git a/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp b/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp index 238278e239..30a266a43b 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp @@ -44,9 +44,8 @@ #include "OleObjectMapping.h" #include "VMLPictureMapping.h" -#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h" -#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" #include "../../DesktopEditor/common/File.h" +#include "../../DesktopEditor/common/Directory.h" #include "../Common/XmlTools.h" @@ -58,47 +57,44 @@ namespace DocFileFormat FootnotesRelationshipsFile( _T( "word/_rels/footnotes.xml.rels" ) ), EndnotesRelationshipsFile( _T( "word/_rels/endnotes.xml.rels" ) ), CommentsRelationshipsFile( _T( "word/_rels/comments.xml.rels" ) ), NumberingRelationshipsFile( _T( "word/_rels/numbering.xml.rels" ) ) { - this->docFile = _docFile; + docFile = _docFile; - this->DocumentContentTypesFile._defaultTypes.insert( make_pair( _T( "rels" ), std::wstring( OpenXmlContentTypes::Relationships ) ) ); - this->DocumentContentTypesFile._defaultTypes.insert( make_pair( _T( "xml" ), std::wstring( OpenXmlContentTypes::Xml ) ) ); + DocumentContentTypesFile._defaultTypes.insert( make_pair( _T( "rels" ), std::wstring( OpenXmlContentTypes::Relationships ) ) ); + DocumentContentTypesFile._defaultTypes.insert( make_pair( _T( "xml" ), std::wstring( OpenXmlContentTypes::Xml ) ) ); - this->MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( _T( "rId1" ) ), OpenXmlRelationshipTypes::OfficeDocument, _T( "word/document.xml" ) ) ); + MainRelationshipsFile.Relationships.push_back( Relationship( std::wstring( _T( "rId1" ) ), OpenXmlRelationshipTypes::OfficeDocument, _T( "word/document.xml" ) ) ); } void OpenXmlPackage::WritePackage() - { - FileSystem::Directory::CreateDirectory( std_string2string(m_strOutputPath) + FILE_SEPARATOR_STR + _T( "_rels" )); - this->WriteRelsFile( this->MainRelationshipsFile ); + NSDirectory::CreateDirectoryW( m_strOutputPath + FILE_SEPARATOR_STR + L"_rels" ); + WriteRelsFile( MainRelationshipsFile ); - FileSystem::Directory::CreateDirectory( std_string2string(m_strOutputPath) - + FILE_SEPARATOR_STR + _T( "word" ) - + FILE_SEPARATOR_STR + _T( "_rels") ); + NSDirectory::CreateDirectoryW( m_strOutputPath + FILE_SEPARATOR_STR + L"word" + FILE_SEPARATOR_STR + L"_rels" ); - this->WriteRelsFile( this->DocumentRelationshipsFile ); + WriteRelsFile( DocumentRelationshipsFile ); - this->WriteRelsFile( this->FootnotesRelationshipsFile ); + WriteRelsFile( FootnotesRelationshipsFile ); - this->WriteRelsFile( this->EndnotesRelationshipsFile ); + WriteRelsFile( EndnotesRelationshipsFile ); - this->WriteRelsFile( this->CommentsRelationshipsFile ); + WriteRelsFile( CommentsRelationshipsFile ); - this->WriteRelsFile( this->NumberingRelationshipsFile ); + WriteRelsFile( NumberingRelationshipsFile ); - for ( std::list::const_iterator iter = this->HeaderRelationshipsFiles.begin(); iter != this->HeaderRelationshipsFiles.end(); iter++ ) + for ( std::list::const_iterator iter = HeaderRelationshipsFiles.begin(); iter != HeaderRelationshipsFiles.end(); iter++ ) { - this->WriteRelsFile( *iter ); + WriteRelsFile( *iter ); } - for ( std::list::const_iterator iter = this->FooterRelationshipsFiles.begin(); iter != this->FooterRelationshipsFiles.end(); iter++ ) + for ( std::list::const_iterator iter = FooterRelationshipsFiles.begin(); iter != FooterRelationshipsFiles.end(); iter++ ) { - this->WriteRelsFile( *iter ); + WriteRelsFile( *iter ); } - this->WriteContentTypesFile( this->DocumentContentTypesFile ); + WriteContentTypesFile( DocumentContentTypesFile ); } void OpenXmlPackage::SaveToFile( const std::wstring& outputDir, const std::wstring& fileName, const std::wstring& XMLContent ) @@ -206,40 +202,40 @@ namespace DocFileFormat int OpenXmlPackage::RegisterFontTable() { - return this->AddPart( _T( "word" ), _T( "fontTable.xml" ), WordprocessingMLContentTypes::FontTable, OpenXmlRelationshipTypes::FontTable ); + return AddPart( _T( "word" ), _T( "fontTable.xml" ), WordprocessingMLContentTypes::FontTable, OpenXmlRelationshipTypes::FontTable ); } int OpenXmlPackage::RegisterNumbering() { - return this->AddPart( _T( "word" ), _T( "numbering.xml" ), WordprocessingMLContentTypes::Numbering, OpenXmlRelationshipTypes::Numbering ); + return AddPart( _T( "word" ), _T( "numbering.xml" ), WordprocessingMLContentTypes::Numbering, OpenXmlRelationshipTypes::Numbering ); } int OpenXmlPackage::RegisterSettings() { - return this->AddPart( _T( "word" ), _T( "settings.xml" ), WordprocessingMLContentTypes::Settings, OpenXmlRelationshipTypes::Settings ); + return AddPart( _T( "word" ), _T( "settings.xml" ), WordprocessingMLContentTypes::Settings, OpenXmlRelationshipTypes::Settings ); } int OpenXmlPackage::RegisterStyleSheet() { - return this->AddPart( _T( "word" ), _T( "styles.xml" ), WordprocessingMLContentTypes::Styles, OpenXmlRelationshipTypes::Styles ); + return AddPart( _T( "word" ), _T( "styles.xml" ), WordprocessingMLContentTypes::Styles, OpenXmlRelationshipTypes::Styles ); } int OpenXmlPackage::RegisterHeader() { - this->HeaderRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/header" ) ) + FormatUtils::IntToWideString( ++this->_headerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) ); + HeaderRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/header" ) ) + FormatUtils::IntToWideString( ++_headerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) ); - return this->AddPart( _T( "word" ), ( std::wstring( _T( "header" ) ) + FormatUtils::IntToWideString( this->_headerCounter ) + std::wstring( _T( ".xml" ) ) ).c_str(), WordprocessingMLContentTypes::Header, OpenXmlRelationshipTypes::Header ); + return AddPart( _T( "word" ), ( std::wstring( _T( "header" ) ) + FormatUtils::IntToWideString( _headerCounter ) + std::wstring( _T( ".xml" ) ) ).c_str(), WordprocessingMLContentTypes::Header, OpenXmlRelationshipTypes::Header ); } int OpenXmlPackage::AddHeaderPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) { int relID = 0; - if ( !this->HeaderRelationshipsFiles.empty() ) + if ( !HeaderRelationshipsFiles.empty() ) { - this->HeaderRelationshipsFiles.back().Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++this->HeaderRelationshipsFiles.back().RelID ) ), relationshipType, fileName, targetMode ) ); + HeaderRelationshipsFiles.back().Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++HeaderRelationshipsFiles.back().RelID ) ), relationshipType, fileName, targetMode ) ); - relID = this->HeaderRelationshipsFiles.back().RelID; + relID = HeaderRelationshipsFiles.back().RelID; } return relID; @@ -247,20 +243,20 @@ namespace DocFileFormat int OpenXmlPackage::RegisterFooter() { - this->FooterRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/footer" ) ) + FormatUtils::IntToWideString( ++this->_footerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) ); + FooterRelationshipsFiles.push_back( RelationshipsFile( ( std::wstring( _T( "word/_rels/footer" ) ) + FormatUtils::IntToWideString( ++_footerCounter ) + std::wstring( _T( ".xml.rels" ) ) ) ) ); - return this->AddPart( _T( "word" ), ( std::wstring( _T( "footer" ) ) + FormatUtils::IntToWideString( _footerCounter ) + std::wstring( _T( ".xml" ) ) ).c_str(), WordprocessingMLContentTypes::Footer, OpenXmlRelationshipTypes::Footer ); + return AddPart( _T( "word" ), ( std::wstring( _T( "footer" ) ) + FormatUtils::IntToWideString( _footerCounter ) + std::wstring( _T( ".xml" ) ) ).c_str(), WordprocessingMLContentTypes::Footer, OpenXmlRelationshipTypes::Footer ); } int OpenXmlPackage::AddFooterPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) { int relID = 0; - if ( !this->FooterRelationshipsFiles.empty() ) + if ( !FooterRelationshipsFiles.empty() ) { - this->FooterRelationshipsFiles.back().Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++this->FooterRelationshipsFiles.back().RelID ) ), relationshipType, fileName, targetMode ) ); + FooterRelationshipsFiles.back().Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++FooterRelationshipsFiles.back().RelID ) ), relationshipType, fileName, targetMode ) ); - relID = this->FooterRelationshipsFiles.back().RelID; + relID = FooterRelationshipsFiles.back().RelID; } return relID; @@ -268,52 +264,52 @@ namespace DocFileFormat int OpenXmlPackage::RegisterFootnotes() { - return this->AddPart( _T( "word" ), _T( "footnotes.xml" ), WordprocessingMLContentTypes::Footnotes, OpenXmlRelationshipTypes::Footnotes ); + return AddPart( _T( "word" ), _T( "footnotes.xml" ), WordprocessingMLContentTypes::Footnotes, OpenXmlRelationshipTypes::Footnotes ); } int OpenXmlPackage::AddFootnotesPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) { - this->FootnotesRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++FootnotesRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); + FootnotesRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++FootnotesRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); - return this->FootnotesRelationshipsFile.RelID; + return FootnotesRelationshipsFile.RelID; } int OpenXmlPackage::RegisterEndnotes() { - return this->AddPart( _T( "word" ), _T( "endnotes.xml" ), WordprocessingMLContentTypes::Endnotes, OpenXmlRelationshipTypes::Endnotes ); + return AddPart( _T( "word" ), _T( "endnotes.xml" ), WordprocessingMLContentTypes::Endnotes, OpenXmlRelationshipTypes::Endnotes ); } int OpenXmlPackage::AddEndnotesPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) { - this->EndnotesRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++this->EndnotesRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); + EndnotesRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++EndnotesRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); - return this->EndnotesRelationshipsFile.RelID; + return EndnotesRelationshipsFile.RelID; } int OpenXmlPackage::RegisterComments() { - return this->AddPart( _T( "word" ), _T( "comments.xml" ), WordprocessingMLContentTypes::Comments, OpenXmlRelationshipTypes::Comments ); + return AddPart( _T( "word" ), _T( "comments.xml" ), WordprocessingMLContentTypes::Comments, OpenXmlRelationshipTypes::Comments ); } int OpenXmlPackage::AddCommentsPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) { - this->CommentsRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++this->CommentsRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); + CommentsRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++CommentsRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); - return this->CommentsRelationshipsFile.RelID; + return CommentsRelationshipsFile.RelID; } int OpenXmlPackage::AddNumberingPart( const std::wstring& fileName, const std::wstring& relationshipType, const std::wstring& targetMode ) { - this->NumberingRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++this->NumberingRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); + NumberingRelationshipsFile.Relationships.push_back( Relationship( ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( ++NumberingRelationshipsFile.RelID ) ), relationshipType, fileName, targetMode ) ); - return this->NumberingRelationshipsFile.RelID; + return NumberingRelationshipsFile.RelID; } void OpenXmlPackage::WriteRelsFile( const RelationshipsFile& relationshipsFile ) { if ( !relationshipsFile.Relationships.empty() ) { - XmlUtils::CXmlWriter writer; + XMLTools::CStringXmlWriter writer; writer.WriteNodeBegin( _T( "?xml version=\"1.0\" encoding=\"UTF-8\"?" ) ); writer.WriteNodeBegin( _T( "Relationships" ), TRUE ); @@ -342,13 +338,13 @@ namespace DocFileFormat std::wstring pathFileName = m_strOutputPath + FILE_SEPARATOR_STR + relationshipsFile.FileName; - writer.SaveToFile(std_string2string(pathFileName),TRUE); + writer.SaveToFile(pathFileName, TRUE); } } void OpenXmlPackage::WriteContentTypesFile( const ContentTypesFile& contentTypesFile ) { - XmlUtils::CXmlWriter writer; + XMLTools::CStringXmlWriter writer; // write content types writer.WriteNodeBegin( _T( "?xml version=\"1.0\" encoding=\"UTF-8\"?" ) ); @@ -359,19 +355,19 @@ namespace DocFileFormat writer.WriteNodeEnd( _T( "" ), TRUE, FALSE ); - for ( std::map::iterator iter = this->DocumentContentTypesFile._defaultTypes.begin(); iter != this->DocumentContentTypesFile._defaultTypes.end(); iter++ ) + for ( std::map::iterator iter = DocumentContentTypesFile._defaultTypes.begin(); iter != DocumentContentTypesFile._defaultTypes.end(); iter++ ) { writer.WriteNodeBegin( _T( "Default" ), TRUE ); writer.WriteAttribute( _T( "Extension" ), iter->first.c_str() ); - writer.WriteAttribute( _T( "ContentType" ), this->DocumentContentTypesFile._defaultTypes[iter->first].c_str() ); + writer.WriteAttribute( _T( "ContentType" ), DocumentContentTypesFile._defaultTypes[iter->first].c_str() ); writer.WriteNodeEnd( _T( "" ), TRUE ); } - for ( std::map::iterator iter = this->DocumentContentTypesFile._partOverrides.begin(); iter != this->DocumentContentTypesFile._partOverrides.end(); iter++ ) + for ( std::map::iterator iter = DocumentContentTypesFile._partOverrides.begin(); iter != DocumentContentTypesFile._partOverrides.end(); iter++ ) { writer.WriteNodeBegin( _T( "Override" ), TRUE ); writer.WriteAttribute( _T( "PartName" ), iter->first.c_str() ); - writer.WriteAttribute( _T( "ContentType" ), this->DocumentContentTypesFile._partOverrides[iter->first].c_str() ); + writer.WriteAttribute( _T( "ContentType" ), DocumentContentTypesFile._partOverrides[iter->first].c_str() ); writer.WriteNodeEnd( _T( "" ), TRUE ); } @@ -379,7 +375,7 @@ namespace DocFileFormat std::wstring pathFileName = m_strOutputPath + FILE_SEPARATOR_STR + _T( "[Content_Types].xml" ); - writer.SaveToFile(std_string2string(pathFileName),TRUE); + writer.SaveToFile(pathFileName, TRUE); } int OpenXmlPackage::RegisterImage(const IMapping* mapping, Global::BlipType blipType) @@ -437,15 +433,15 @@ namespace DocFileFormat partOverride += fileName; - this->DocumentContentTypesFile._partOverrides.insert( make_pair( partOverride, contentType ) ); + DocumentContentTypesFile._partOverrides.insert( make_pair( partOverride, contentType ) ); } if ( relationshipType != _T( "" ) ) { - this->DocumentRelationshipsFile.Relationships.push_back( Relationship( (std::wstring ( _T( "rId" ) ) + FormatUtils::IntToWideString( ++this->relID ) ), relationshipType, fileName, targetMode ) ); + DocumentRelationshipsFile.Relationships.push_back( Relationship( (std::wstring ( _T( "rId" ) ) + FormatUtils::IntToWideString( ++relID ) ), relationshipType, fileName, targetMode ) ); } - return this->relID; + return relID; } int OpenXmlPackage::AddPart( const IMapping* mapping, const std::wstring& packageDir, const std::wstring& fileName, const std::wstring& contentType, const std::wstring& relationshipType, const std::wstring& targetMode ) @@ -456,31 +452,31 @@ namespace DocFileFormat { if ( typeid(*mapping) == typeid(MainDocumentMapping) ) { - relID = this->AddPart( packageDir, fileName, contentType, relationshipType, targetMode ); + relID = AddPart( packageDir, fileName, contentType, relationshipType, targetMode ); } else if ( typeid(*mapping) == typeid(HeaderMapping) ) { - relID = this->AddHeaderPart( fileName, relationshipType, targetMode ); + relID = AddHeaderPart( fileName, relationshipType, targetMode ); } else if ( typeid(*mapping) == typeid(FooterMapping) ) { - relID = this->AddFooterPart( fileName, relationshipType, targetMode ); + relID = AddFooterPart( fileName, relationshipType, targetMode ); } else if ( typeid(*mapping) == typeid(FootnotesMapping) ) { - relID = this->AddFootnotesPart( fileName, relationshipType, targetMode ); + relID = AddFootnotesPart( fileName, relationshipType, targetMode ); } else if ( typeid(*mapping) == typeid(EndnotesMapping) ) { - relID = this->AddEndnotesPart( fileName, relationshipType, targetMode ); + relID = AddEndnotesPart( fileName, relationshipType, targetMode ); } else if ( typeid(*mapping) == typeid(CommentsMapping) ) { - relID = this->AddCommentsPart( fileName, relationshipType, targetMode ); + relID = AddCommentsPart( fileName, relationshipType, targetMode ); } else if ( typeid(*mapping) == typeid(NumberingMapping) ) { - relID = this->AddNumberingPart( fileName, relationshipType, targetMode ); + relID = AddNumberingPart( fileName, relationshipType, targetMode ); } } diff --git a/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h b/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h index 97eda917bf..782af0d1a2 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h +++ b/ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h @@ -36,8 +36,6 @@ #include "WordDocument.h" #include "IMapping.h" -#include "../../Common/DocxFormat/Source/XML/xmlutils.h" - namespace DocFileFormat { struct Relationship diff --git a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp index e378df7e2c..f8fb816828 100644 --- a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp @@ -35,7 +35,7 @@ namespace DocFileFormat { - ParagraphPropertiesMapping::ParagraphPropertiesMapping(XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, bool isParagraphStyleNeeded) + ParagraphPropertiesMapping::ParagraphPropertiesMapping(XMLTools::CStringXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, bool isParagraphStyleNeeded) : PropertiesMapping( writer ), m_context(NULL), _pPr(NULL), _framePr(NULL), _sepx(NULL), _paraEndChpx(NULL), _sectionNr(0), m_document(NULL), _isParagraphStyleNeeded(isParagraphStyleNeeded) { @@ -50,7 +50,7 @@ namespace DocFileFormat _isSectionPageBreak = 0; } - ParagraphPropertiesMapping::ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded ) + ParagraphPropertiesMapping::ParagraphPropertiesMapping( XMLTools::CStringXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded ) : PropertiesMapping( writer ), m_context(NULL), _pPr(NULL), _framePr(NULL), _sepx(NULL), _paraEndChpx(NULL), _sectionNr(0), m_document(NULL), _isParagraphStyleNeeded(isParagraphStyleNeeded) { diff --git a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h index 74657a74bc..f3c6231f7b 100644 --- a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h @@ -46,8 +46,8 @@ namespace DocFileFormat class ParagraphPropertiesMapping: public PropertiesMapping, public IMapping { public: - ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, bool isParagraphStyleNeeded = true ); - ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded = true ); + ParagraphPropertiesMapping( XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, bool isParagraphStyleNeeded = true ); + ParagraphPropertiesMapping( XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isBidi, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded = true ); virtual ~ParagraphPropertiesMapping(); void Apply(IVisitable* visited); diff --git a/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp index dc05e7bd42..c082fb4d66 100644 --- a/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp @@ -237,7 +237,7 @@ namespace DocFileFormat } brcTypeMapLock.Leave(); } - PropertiesMapping::PropertiesMapping (XmlUtils::CXmlWriter* pWriter) : m_pXmlWriter(pWriter) + PropertiesMapping::PropertiesMapping (XMLTools::CStringXmlWriter* pWriter) : m_pXmlWriter(pWriter) { init(); } diff --git a/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h index 21d66215b1..5b4cdb82d7 100644 --- a/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h @@ -32,14 +32,13 @@ #pragma once #include "../Common/XmlTools.h" + #include "Global.h" #include "BorderCode.h" #include "RGBColor.h" #include "ShadingDescriptor.h" #include "SinglePropertyModifier.h" -#include "../../Common/DocxFormat/Source/XML/xmlutils.h" - #include "../Win32/ASCOfficeCriticalSection.h" //for linux make inside @@ -48,7 +47,7 @@ namespace DocFileFormat class PropertiesMapping { public: - PropertiesMapping( XmlUtils::CXmlWriter* writer ); + PropertiesMapping( XMLTools::CStringXmlWriter* writer ); protected: static void init(); @@ -72,7 +71,7 @@ namespace DocFileFormat protected: - XmlUtils::CXmlWriter* m_pXmlWriter; + XMLTools::CStringXmlWriter* m_pXmlWriter; static std::map brcTypeMap; static ASCOfficeCriticalSection brcTypeMapLock; diff --git a/ASCOfficeDocFile/DocDocxConverter/RGBColor.h b/ASCOfficeDocFile/DocDocxConverter/RGBColor.h index 94d5599ce5..a1227351de 100644 --- a/ASCOfficeDocFile/DocDocxConverter/RGBColor.h +++ b/ASCOfficeDocFile/DocDocxConverter/RGBColor.h @@ -33,15 +33,7 @@ #include "../../DesktopEditor/common/Types.h" -#if defined(_WIN32) || defined(_WIN64) - #include - #include -#else - #include "../../DesktopEditor/common/ASCVariant.h" - #include "../../Common/DocxFormat/Source/Base/ASCString.h" -#endif - -#include "../../Common/DocxFormat/Source/XML/stringcommon.h" +#include namespace DocFileFormat { @@ -69,8 +61,9 @@ namespace DocFileFormat // wchar_t rgbColor6[7]; // wchar_t rgbColor8[9]; - CString rgbColor6; - CString rgbColor8; + //CString rgbColor6; + //CString rgbColor8; + std::wstringstream rgbColor6, rgbColor8; if( order == RedFirst ) { @@ -83,11 +76,16 @@ namespace DocFileFormat //Alpha this->Alpha = bytes[3]; - rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue ); - rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha ); + //rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue ); + //rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha ); - SixDigitHexCode = string2std_string( rgbColor6 ); - EightDigitHexCode = string2std_string( rgbColor8 ); + //SixDigitHexCode = string2std_string( rgbColor6 ); + //EightDigitHexCode = string2std_string( rgbColor8 ); + rgbColor6 << boost::wformat( L"%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue; + rgbColor8 << boost::wformat( L"%02x%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue % /*A*/this->Alpha; + + SixDigitHexCode = rgbColor6.str(); + EightDigitHexCode = rgbColor8.str(); } else if ( order == RedLast ) { @@ -100,12 +98,17 @@ namespace DocFileFormat //Alpha this->Alpha = bytes[3]; - rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue ); - rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha ); + //rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue ); + //rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha ); - SixDigitHexCode = string2std_string( rgbColor6 ); - EightDigitHexCode = string2std_string( rgbColor8 ); - } + //SixDigitHexCode = string2std_string( rgbColor6 ); + //EightDigitHexCode = string2std_string( rgbColor8 ); + rgbColor6 << boost::wformat( L"%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue; + rgbColor8 << boost::wformat( L"%02x%02x%02x%02x" ) % /*R*/this->Red % /*G*/this->Green % /*B*/this->Blue % /*A*/this->Alpha; + + SixDigitHexCode = rgbColor6.str(); + EightDigitHexCode = rgbColor8.str(); + } RELEASEARRAYOBJECTS( bytes ); } diff --git a/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp index 769f5e9e1e..6178802698 100644 --- a/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp @@ -36,7 +36,7 @@ namespace DocFileFormat { // Creates a new SectionPropertiesMapping which writes the properties to the given writer - SectionPropertiesMapping::SectionPropertiesMapping (XmlUtils::CXmlWriter* pWriter, ConversionContext* pContext, int nSelectProperties) : PropertiesMapping (pWriter) + SectionPropertiesMapping::SectionPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, ConversionContext* pContext, int nSelectProperties) : PropertiesMapping (pWriter) { m_bDeleteNode = TRUE; m_pXmlNode = new XMLTools::XMLElement (_T("w:sectPr")); @@ -456,9 +456,6 @@ namespace DocFileFormat break; default: -#ifdef _DEBUG - // //ATLTRACE (_T("SectionPropertiesMapping - UNKNOWN SPRM : 0x%x\n"), iter->OpCode); -#endif break; } } diff --git a/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h index 59ae56c7cb..f16bb3bd8b 100644 --- a/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h @@ -156,7 +156,7 @@ namespace DocFileFormat { public: // Creates a new SectionPropertiesMapping which writes the properties to the given writer - SectionPropertiesMapping (XmlUtils::CXmlWriter* writer, ConversionContext* ctx, int nSelectProperties); + SectionPropertiesMapping (XMLTools::CStringXmlWriter* writer, ConversionContext* ctx, int nSelectProperties); // Creates a new SectionPropertiesMapping which appends the properties to a given node. SectionPropertiesMapping (XMLTools::XMLElement* sectPr, ConversionContext* ctx, int nSelectProperties); virtual ~SectionPropertiesMapping(); diff --git a/ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h b/ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h index 8d5326751b..8a6e23a0d0 100644 --- a/ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h @@ -58,7 +58,7 @@ namespace DocFileFormat { private: ConversionContext* _ctx; - XmlUtils::CXmlWriter m_oXmlWriter; + XMLTools::CStringXmlWriter m_oXmlWriter; public: SettingsMapping( ConversionContext* ctx/*, OpenXmlPart targetPart*/ ); diff --git a/ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h b/ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h index 24c084c33b..a774e3f228 100644 --- a/ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h +++ b/ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h @@ -123,8 +123,6 @@ namespace DocFileFormat rgTc80.push_back(oTC80); } - // static int m = 0; //ATLTRACE(L"PUSH: %d\n", m); ++m; - break; } diff --git a/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp index ff1dad0b3f..f163db5d8c 100644 --- a/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp @@ -38,7 +38,7 @@ namespace DocFileFormat std::map StyleSheetMapping::m_mapStyleId; ASCOfficeCriticalSection StyleSheetMapping::m_mapStyleIdLock; - StyleSheetMapping::StyleSheetMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XmlUtils::CXmlWriter() ) + StyleSheetMapping::StyleSheetMapping( ConversionContext* ctx ) : AbstractOpenXmlMapping( new XMLTools::CStringXmlWriter() ) { _ctx = ctx; m_document = _ctx->_doc; diff --git a/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp index ca73562eeb..b377e93e9d 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp @@ -35,7 +35,7 @@ namespace DocFileFormat { - TableCellPropertiesMapping::TableCellPropertiesMapping (XmlUtils::CXmlWriter* pWriter, const std::vector* tableGrid, int gridIndex, int cellIndex) : + TableCellPropertiesMapping::TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector* tableGrid, int gridIndex, int cellIndex) : PropertiesMapping(pWriter) { _width = 0; diff --git a/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h index e398840e16..215c336f84 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h @@ -58,7 +58,7 @@ namespace DocFileFormat public: virtual ~TableCellPropertiesMapping(); - TableCellPropertiesMapping (XmlUtils::CXmlWriter* pWriter, const std::vector* tableGrid, int gridIndex, int cellIndex); + TableCellPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, const std::vector* tableGrid, int gridIndex, int cellIndex); virtual void Apply( IVisitable* visited ); inline int GetGridSpan() const diff --git a/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp index 7d8df9e47e..a8b718606a 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp @@ -34,7 +34,7 @@ namespace DocFileFormat { - TablePropertiesMapping::TablePropertiesMapping (XmlUtils::CXmlWriter* pWriter, StyleSheet* styles, std::vector* grid, bool isTableStyleNeeded ): + TablePropertiesMapping::TablePropertiesMapping (XMLTools::CStringXmlWriter* pWriter, StyleSheet* styles, std::vector* grid, bool isTableStyleNeeded ): PropertiesMapping(pWriter), _tblPr(NULL), _tblGrid(NULL), _tblBorders(NULL), _grid(NULL), brcLeft(NULL), brcTop(NULL), brcBottom(NULL), brcRight(NULL), brcHorz(NULL), brcVert(NULL), _styles(NULL), _isTableStyleNeeded(isTableStyleNeeded) diff --git a/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h index 4ba72b5003..9db2a200ae 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h @@ -71,7 +71,7 @@ namespace DocFileFormat class TablePropertiesMapping: public PropertiesMapping, public IMapping { public: - TablePropertiesMapping( XmlUtils::CXmlWriter* writer, StyleSheet* styles, std::vector* grid, bool isTableStyleNeeded = true ); + TablePropertiesMapping( XMLTools::CStringXmlWriter* writer, StyleSheet* styles, std::vector* grid, bool isTableStyleNeeded = true ); virtual ~TablePropertiesMapping(); void Apply( IVisitable* visited ); diff --git a/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp index 105a91d644..9ddbf66824 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp @@ -35,7 +35,7 @@ namespace DocFileFormat { - TableRowPropertiesMapping::TableRowPropertiesMapping (XmlUtils::CXmlWriter* pWriter, CharacterPropertyExceptions* rowEndChpx) : PropertiesMapping(pWriter), _trPr(NULL), _tblPrEx(NULL), _rowEndChpx(NULL) + TableRowPropertiesMapping::TableRowPropertiesMapping (XMLTools::CStringXmlWriter* pWriter, CharacterPropertyExceptions* rowEndChpx) : PropertiesMapping(pWriter), _trPr(NULL), _tblPrEx(NULL), _rowEndChpx(NULL) { _trPr = new XMLTools::XMLElement(_T( "w:trPr")); _tblPrEx = new XMLTools::XMLElement(_T( "w:tblPrEx")); diff --git a/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h index e57f95b3a7..1322b7b23b 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h @@ -51,7 +51,7 @@ namespace DocFileFormat CharacterPropertyExceptions* _rowEndChpx; public: - TableRowPropertiesMapping( XmlUtils::CXmlWriter* writer, CharacterPropertyExceptions* rowEndChpx ); + TableRowPropertiesMapping( XMLTools::CStringXmlWriter* writer, CharacterPropertyExceptions* rowEndChpx ); virtual ~TableRowPropertiesMapping(); virtual void Apply( IVisitable* visited ); }; diff --git a/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp index 2a4aa33a53..6ec2ca7a5d 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp @@ -42,7 +42,7 @@ namespace DocFileFormat { int TextboxMapping::TextboxCount = 0; - TextboxMapping::TextboxMapping (ConversionContext* ctx, int nTBIndex, XmlUtils::CXmlWriter* writer, IMapping* caller ): DocumentMapping( ctx, writer, caller ), m_nTBIndex(0) + TextboxMapping::TextboxMapping (ConversionContext* ctx, int nTBIndex, XMLTools::CStringXmlWriter* writer, IMapping* caller ): DocumentMapping( ctx, writer, caller ), m_nTBIndex(0) { TextboxCount++; m_nTBIndex = nTBIndex; @@ -50,7 +50,7 @@ namespace DocFileFormat } - TextboxMapping::TextboxMapping (ConversionContext* ctx, XmlUtils::CXmlWriter* writer, IMapping* caller) : DocumentMapping( ctx, writer, caller ), m_nTBIndex(0) + TextboxMapping::TextboxMapping (ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, IMapping* caller) : DocumentMapping( ctx, writer, caller ), m_nTBIndex(0) { TextboxCount++; m_nTBIndex = TextboxCount - 1; @@ -91,15 +91,14 @@ namespace DocFileFormat m_pXmlWriter->WriteNodeBegin(_T("v:textbox"), true); if(m_dxTextLeft >= 0 && m_dyTextTop >= 0 && m_dxTextRight >= 0 && m_dyTextBottom >= 0) { - m_pXmlWriter->WriteAttribute( _T( "inset" ), std_string2string( - FormatUtils::DoubleToWideString(m_dxTextLeft) + + m_pXmlWriter->WriteAttribute( _T( "inset" ), FormatUtils::DoubleToWideString(m_dxTextLeft) + _T("pt,") + FormatUtils::DoubleToWideString(m_dyTextTop) + _T("pt,") + FormatUtils::DoubleToWideString(m_dxTextRight) + - _T("pt,") + FormatUtils::DoubleToWideString(m_dyTextBottom) + _T("pt"))); + _T("pt,") + FormatUtils::DoubleToWideString(m_dyTextBottom) + _T("pt")); } if (!m_sTextBoxStyle.empty()) { - m_pXmlWriter->WriteAttribute( _T( "style" ), std_string2string(m_sTextBoxStyle)); + m_pXmlWriter->WriteAttribute( _T( "style" ), m_sTextBoxStyle); } m_pXmlWriter->WriteNodeEnd( _T( "" ), true, false ); diff --git a/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h b/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h index 20521e070f..0215201063 100644 --- a/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h @@ -40,8 +40,8 @@ namespace DocFileFormat { public: - TextboxMapping(ConversionContext* ctx, int textboxIndex, XmlUtils::CXmlWriter* writer, IMapping* caller); - TextboxMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, IMapping* caller); + TextboxMapping(ConversionContext* ctx, int textboxIndex, XMLTools::CStringXmlWriter* writer, IMapping* caller); + TextboxMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, IMapping* caller); virtual ~TextboxMapping(); virtual void Apply(IVisitable* visited); diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp index 8bb50203e5..cc048fa215 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp @@ -201,7 +201,7 @@ namespace DocFileFormat } } - VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer) + VMLPictureMapping::VMLPictureMapping(ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture) : PropertiesMapping(writer) { m_ctx = ctx; m_isOlePreview = olePreview; diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h index 821ed76126..a83a3d92ec 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h @@ -51,7 +51,7 @@ namespace DocFileFormat class VMLPictureMapping: public PropertiesMapping, public IMapping { public: - VMLPictureMapping( ConversionContext* ctx, XmlUtils::CXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false ); + VMLPictureMapping( ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false ); virtual ~VMLPictureMapping(); virtual void Apply( IVisitable* visited ); std::wstring GetShapeId() const; diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp index c5d31112de..f96f4b8f01 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp @@ -56,9 +56,11 @@ #include "../../DesktopEditor/common/String.h" +#include "../Common/FormatUtils.h" + namespace DocFileFormat { - VMLShapeMapping::VMLShapeMapping (ConversionContext* pConv, XmlUtils::CXmlWriter* pWriter, Spa* pSpa, PictureDescriptor* pPicture, IMapping* pCaller, bool isInlineShape) : PropertiesMapping(pWriter) + VMLShapeMapping::VMLShapeMapping (ConversionContext* pConv, XMLTools::CStringXmlWriter* pWriter, Spa* pSpa, PictureDescriptor* pPicture, IMapping* pCaller, bool isInlineShape) : PropertiesMapping(pWriter) { m_isInlineShape = isInlineShape; m_isBullete = false; @@ -281,7 +283,7 @@ namespace DocFileFormat std::wstring adjValues[8]; ShadowStyleBooleanProperties shadowBoolean(0); - std::vector arrInscribe; + std::vector arrInscribe; std::list::const_iterator end = options.end(); for (std::list::const_iterator iter = options.begin(); iter != end; ++iter) @@ -422,8 +424,7 @@ namespace DocFileFormat case lineWidth: { EmuValue eLineWidth ((int)iter->op ); - CString sWidth; sWidth.Format(_T("%fpt"), eLineWidth.ToPoints()); - m_pXmlWriter->WriteAttribute(_T("strokeweight"), sWidth); + m_pXmlWriter->WriteAttribute(_T("strokeweight"), FormatUtils::DoubleToWideString(eLineWidth.ToPoints()) + _T("pt")); }break; case lineDashing: { @@ -1304,8 +1305,6 @@ namespace DocFileFormat top = TwipsValue((pSpa->yaBottom + pSpa->yaTop) * 0.5 - (pSpa->xaRight - pSpa->xaLeft) * 0.5); } - // //ATLTRACE (L"left : %f, top : %f\n", left.ToPoints(), top.ToPoints()); - appendStyleProperty (style, _T( "margin-left" ), ( FormatUtils::DoubleToWideString(left.ToPoints()) + std::wstring( _T( "pt" ) ) )); appendStyleProperty (style, _T( "margin-top" ), ( FormatUtils::DoubleToWideString(top.ToPoints()) + std::wstring( _T( "pt" ) ) )); appendStyleProperty (style, _T( "width" ), ( FormatUtils::DoubleToWideString(width.ToPoints()) + std::wstring( _T( "pt" ) ) )); @@ -1936,7 +1935,7 @@ namespace DocFileFormat } // - std::vector VMLShapeMapping::GetTextRectangles(const OptionEntry& inscribe) const + std::vector VMLShapeMapping::GetTextRectangles(const OptionEntry& inscribe) const { MemoryStream reader(inscribe.opComplex, inscribe.op + 6); @@ -1944,7 +1943,7 @@ namespace DocFileFormat unsigned short allocElems = reader.ReadUInt16(); unsigned short cb = reader.ReadUInt16(); - std::vector rectangles; + std::vector rectangles; if (16 != cb) return rectangles; // TODO: доделать @@ -1959,9 +1958,9 @@ namespace DocFileFormat rc.right = reader.ReadInt32(); rc.bottom = reader.ReadInt32(); - CString rectangle; - rectangle.Format(L"%d,%d,%d,%d", rc.top, rc.left, rc.right, rc.bottom); - rectangles.push_back(rectangle); + std::wstringstream sstream; + sstream << boost::wformat(L"%d,%d,%d,%d") % rc.top % rc.left % rc.right % rc.bottom; + rectangles.push_back(sstream.str()); } return rectangles; diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h index f0e6d2d31b..9607624dfe 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h @@ -59,7 +59,7 @@ namespace DocFileFormat { public: - VMLShapeMapping (ConversionContext* ctx ,XmlUtils::CXmlWriter* writer, Spa* pSpa, PictureDescriptor* pict, IMapping* caller, bool bullet = false); + VMLShapeMapping (ConversionContext* ctx ,XMLTools::CStringXmlWriter* writer, Spa* pSpa, PictureDescriptor* pict, IMapping* caller, bool bullet = false); virtual ~VMLShapeMapping(); virtual void Apply(IVisitable* visited); @@ -120,7 +120,7 @@ namespace DocFileFormat std::wstring GetLineFrom (const ChildAnchor* pAnchor) const; std::wstring GetLineTo (const ChildAnchor* pAnchor) const; - std::vector GetTextRectangles(const OptionEntry& inscribe) const; + std::vector GetTextRectangles(const OptionEntry& inscribe) const; private: bool m_isInlineShape; diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp index 958e8f950f..87e1af4dda 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp @@ -36,7 +36,7 @@ namespace DocFileFormat { - VMLShapeTypeMapping::VMLShapeTypeMapping (XmlUtils::CXmlWriter* pWriter, bool isInlineShape) : PropertiesMapping(pWriter), _lock(NULL), _isInlineShape(isInlineShape) + VMLShapeTypeMapping::VMLShapeTypeMapping (XMLTools::CStringXmlWriter* pWriter, bool isInlineShape) : PropertiesMapping(pWriter), _lock(NULL), _isInlineShape(isInlineShape) { this->_lock = new XMLTools::XMLElement( _T( "o:lock" ) ); appendValueAttribute( this->_lock, _T( "v:ext" ), _T( "edit" ) ); diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h b/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h index 19d6ac5656..aa362bf167 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h @@ -44,7 +44,7 @@ namespace DocFileFormat bool _isInlineShape; public: - VMLShapeTypeMapping(XmlUtils::CXmlWriter* writer, bool isInlineShape = false ); + VMLShapeTypeMapping(XMLTools::CStringXmlWriter* writer, bool isInlineShape = false ); virtual ~VMLShapeTypeMapping(); virtual void Apply( IVisitable* visited ); /// Returns the id of the referenced type diff --git a/ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp b/ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp index e90ebdfd76..6b8ea9a933 100644 --- a/ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp @@ -36,8 +36,9 @@ #include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h" #include "../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h" -#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" + #include "../../DesktopEditor/common/File.h" +#include "../../DesktopEditor/common/Directory.h" namespace DocFileFormat { @@ -450,7 +451,7 @@ namespace DocFileFormat { if (m_sTempFolder.empty()) { - m_sTempFolder = FileSystem::Directory::GetTempPath().GetBuffer(); + m_sTempFolder = NSFile::CFileBinary::GetTempPathW(); } m_sTempDecryptFileName = m_sTempFolder + FILE_SEPARATOR_STR + L"~tempFile.doc"; diff --git a/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp b/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp index 66ac56bd8a..6f20179131 100644 --- a/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp @@ -32,10 +32,8 @@ #include "WordprocessingDocument.h" -#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h" -#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" - #include "../../DesktopEditor/raster/BgraFrame.h" +#include "../../DesktopEditor/Common/Directory.h" namespace ImageHelper { @@ -184,29 +182,32 @@ namespace DocFileFormat void WordprocessingDocument::SaveDocument() { - OOX::CPath pathWord = CString(m_strOutputPath.c_str()) + FILE_SEPARATOR_STR + _T( "word" ); - FileSystem::Directory::CreateDirectory( pathWord.GetPath() ); - + std::wstring pathWord = m_strOutputPath + FILE_SEPARATOR_STR + _T( "word" ) ; + //OOX::CPath pathWord = CString(m_strOutputPath.c_str()) + FILE_SEPARATOR_STR + _T( "word" ); + //FileSystem::Directory::CreateDirectory( pathWord.GetPath() ); + NSDirectory::CreateDirectoryW( pathWord ); WritePackage(); //Write main content. (word directory) - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T("document.xml" ) ), DocumentXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "fontTable.xml" ) ), FontTableXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "styles.xml" ) ), StyleSheetXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "footnotes.xml" ) ), FootnotesXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "endnotes.xml" ) ), EndnotesXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "numbering.xml" ) ), NumberingXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "comments.xml" ) ), CommentsXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "settings.xml" ) ), SettingsXML ); - SaveToFile(string2std_string(pathWord.GetPath()), std::wstring( _T( "customizations.xml" ) ),CommandTableXML ); + SaveToFile(pathWord, std::wstring( _T("document.xml" ) ), DocumentXML ); + SaveToFile(pathWord, std::wstring( _T( "fontTable.xml" ) ), FontTableXML ); + SaveToFile(pathWord, std::wstring( _T( "styles.xml" ) ), StyleSheetXML ); + SaveToFile(pathWord, std::wstring( _T( "footnotes.xml" ) ), FootnotesXML ); + SaveToFile(pathWord, std::wstring( _T( "endnotes.xml" ) ), EndnotesXML ); + SaveToFile(pathWord, std::wstring( _T( "numbering.xml" ) ), NumberingXML ); + SaveToFile(pathWord, std::wstring( _T( "comments.xml" ) ), CommentsXML ); + SaveToFile(pathWord, std::wstring( _T( "settings.xml" ) ), SettingsXML ); + SaveToFile(pathWord, std::wstring( _T( "customizations.xml" ) ),CommandTableXML ); if (!ImagesList.empty()) { - OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T( "media" ); - - FileSystem::Directory::CreateDirectory( pathMedia.GetPath() ); + std::wstring pathMedia = pathWord + FILE_SEPARATOR_STR + _T( "media" ); + //OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T( "media" ); + //FileSystem::Directory::CreateDirectory( pathMedia.GetPath() ); + + NSDirectory::CreateDirectoryW(pathMedia); int i = 1; @@ -220,12 +221,12 @@ namespace DocFileFormat if (Global::msoblipDIB == iter->blipType) {//user_manual_v52.doc - std::wstring file_name = string2std_string(pathMedia.GetPath()) + FILE_SEPARATOR_STR + _T("image") + FormatUtils::IntToWideString(i++); + std::wstring file_name = pathMedia + FILE_SEPARATOR_STR + _T("image") + FormatUtils::IntToWideString(i++); iter->blipType = ImageHelper::SaveImageToFileFromDIB(bytes, iter->data.size(), file_name); } else { - SaveToFile(string2std_string(pathMedia.GetPath()), std::wstring(_T("image" )) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)bytes, (unsigned int)iter->data.size()); + SaveToFile(pathMedia, std::wstring(_T("image" )) + FormatUtils::IntToWideString(i++) + iter->ext, (void*)bytes, (unsigned int)iter->data.size()); } RELEASEARRAYOBJECTS(bytes); @@ -235,14 +236,15 @@ namespace DocFileFormat if (!OleObjectsList.empty()) { - OOX::CPath pathObjects = pathWord + FILE_SEPARATOR_STR + _T( "embeddings" ); - - FileSystem::Directory::CreateDirectory( pathObjects.GetPath()); + std::wstring pathObjects = pathWord + FILE_SEPARATOR_STR + _T( "embeddings") ; + //OOX::CPath pathObjects = pathWord + FILE_SEPARATOR_STR + _T( "embeddings" ); + //FileSystem::Directory::CreateDirectory( pathObjects.GetPath()); + NSDirectory::CreateDirectoryW( pathObjects ); int i = 1; for (std::list::iterator iter = OleObjectsList.begin(); iter != OleObjectsList.end(); ++iter) { - std::wstring fileName = string2std_string(pathObjects.GetPath()) + FILE_SEPARATOR_STR + _T( "oleObject" ) + FormatUtils::IntToWideString(i++) + iter->ext; + std::wstring fileName = pathObjects + FILE_SEPARATOR_STR + _T( "oleObject" ) + FormatUtils::IntToWideString(i++) + iter->ext; if (!iter->data.empty()) { @@ -260,12 +262,12 @@ namespace DocFileFormat for (std::list::iterator iter = HeaderXMLList.begin(); iter != HeaderXMLList.end(); ++iter) { - SaveToFile(string2std_string(pathWord.GetPath()), ( std::wstring( _T( "header" ) ) + FormatUtils::IntToWideString(++headersCount) + std::wstring( _T( ".xml" ) ) ), *iter); + SaveToFile(pathWord, ( std::wstring( _T( "header" ) ) + FormatUtils::IntToWideString(++headersCount) + std::wstring( _T( ".xml" ) ) ), *iter); } for (std::list::iterator iter = FooterXMLList.begin(); iter != FooterXMLList.end(); ++iter) { - SaveToFile(string2std_string(pathWord.GetPath()), ( std::wstring( _T( "footer" ) ) + FormatUtils::IntToWideString(++footersCount) + std::wstring( _T( ".xml" ) ) ), *iter); + SaveToFile(pathWord, ( std::wstring( _T( "footer" ) ) + FormatUtils::IntToWideString(++footersCount) + std::wstring( _T( ".xml" ) ) ), *iter); } } } diff --git a/ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp b/ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp index a5c80edf86..f21ff7cba9 100644 --- a/ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp +++ b/ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp @@ -32,9 +32,6 @@ #include "DocFormatLib.h" #include "../DocDocxConverter/Converter.h" -//#include "../DocxDocConverter/FileConverter.h" - -#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" #include "../../OfficeUtils/src/OfficeUtils.h" HRESULT COfficeDocFile::LoadFromFile(const std::wstring & docFile, const std::wstring & docxDirectory, const std::wstring & password, ProgressCallback *ffCallBack ) diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h b/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h index e1a9c6bec3..f48f66621c 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h @@ -90,23 +90,26 @@ struct SFileIdCluster } }; #if !defined(_WIN32) && !defined (_WIN64) - struct POINT - { - long x; - long y; - }; - struct SIZE + typedef struct tagPOINT + { + long x; + long y; + } POINT; + + typedef struct tagSIZE { long cx; long cy; - }; - struct RECT + }SIZE; + + typedef struct tagRECT { long left; long top; long right; long bottom; - }; + }RECT; + #endif namespace Gdiplus { @@ -151,7 +154,6 @@ namespace Gdiplus short Checksum; // Checksum value for previous 10 WORDs }WmfPlaceableFileHeader; } - #endif class CMetaHeader { diff --git a/ASCOfficePPTXFile/Editor/Drawing/Attributes.h b/ASCOfficePPTXFile/Editor/Drawing/Attributes.h index ec50d965a6..9784b3a7db 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Attributes.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Attributes.h @@ -31,12 +31,12 @@ */ #pragma once -#if defined(_WIN32) || defined(_WIN64) - #include - #include -#else +//#if defined(_WIN32) || defined(_WIN64) +// #include +// #include +//#else #include "../../PPTXLib/Linux/PPTXFormatLib/linux_gdiplus.h" -#endif +//#endif #include "Metric.h" #include "Effects.h" diff --git a/ASCOfficePPTXFile/Editor/Drawing/Metric.h b/ASCOfficePPTXFile/Editor/Drawing/Metric.h index 9d3af68293..7ea4076749 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Metric.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Metric.h @@ -30,13 +30,16 @@ * */ #pragma once -#include #if !defined(_WIN32) && !defined(_WIN64) #include "../../../DesktopEditor/common/ASCVariant.h" #include "../../../Common/DocxFormat/Source/Base/ASCString.h" +#else + #include #endif +#include + namespace NSPresentationEditor { const double c_dMasterUnitsToInchKoef = 1.0 / 576; diff --git a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h index dbac415eff..250ec86cc9 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h @@ -36,13 +36,6 @@ #include "../../../Attributes.h" #include "Formula.h" -#ifdef max -#undef max -#endif -#ifdef min -#undef min -#endif - namespace NSCustomVML { using namespace NSPresentationEditor; @@ -78,7 +71,7 @@ namespace NSCustomVML ~CSegment() { } - int Read(WORD value) + int Read(WORD value)//from rtf segments { int repeate = 0; if (value >= 0x2000 && value < 0x20FF) @@ -127,7 +120,7 @@ namespace NSCustomVML } return (std::max)(1, repeate); } - void Read(POLE::Stream* pStream) + void Read(POLE::Stream* pStream)//from binary ms segments { WORD mem = StreamUtils::ReadWORD(pStream); BYTE type = mem & 0x07; @@ -222,7 +215,7 @@ namespace NSCustomVML m_nCount = (mem >> 5) & 0x00FF; } - void Read(NSOfficeDrawing::CBinaryReader& oReader) + void Read(NSOfficeDrawing::CBinaryReader& oReader)//from binary ms segments { WORD mem = oReader.ReadWORD(); @@ -231,7 +224,6 @@ namespace NSCustomVML { m_eRuler = (RulesType)type; m_nCount = (mem & 0x1FFF); - //m_nCount = (WORD)GetCountPoints2(m_eRuler); m_nCount = (WORD)GetCountPoints2(m_eRuler, m_nCount); return; } diff --git a/ASCOfficePPTXFile/Editor/XmlWriter.h b/ASCOfficePPTXFile/Editor/XmlWriter.h index 27b32fbf02..755d93e815 100644 --- a/ASCOfficePPTXFile/Editor/XmlWriter.h +++ b/ASCOfficePPTXFile/Editor/XmlWriter.h @@ -47,15 +47,15 @@ namespace NSBinPptxRW { static std::wstring g_bstr_nodeopen = L"<"; static std::wstring g_bstr_nodeclose = L">"; - static std::wstring g_bstr_nodeopen_slash = L""; + static std::wstring g_bstr_nodeopen_slash = L""; static std::wstring g_bstr_node_space = L" "; static std::wstring g_bstr_node_equal = L"="; static std::wstring g_bstr_node_quote = L"\""; static std::wstring g_bstr_boolean_true = L"true"; - static std::wstring g_bstr_boolean_false = L"false"; - static std::wstring g_bstr_boolean_true2 = L"1"; - static std::wstring g_bstr_boolean_false2 = L"0"; + static std::wstring g_bstr_boolean_false = L"false"; + static std::wstring g_bstr_boolean_true2 = L"1"; + static std::wstring g_bstr_boolean_false2 = L"0"; AVSINLINE static double FABS(double dVal) { @@ -715,21 +715,21 @@ namespace NSBinPptxRW m_oWriter.WriteString(g_bstr_nodeclose); } -#ifdef _WIN32 - template - AVSINLINE void WriteArray(const CString& strName, const CAtlArray& arr) - { - size_t nCount = arr.GetCount(); - if (0 != nCount) - { - StartNode(strName); - m_oWriter.WriteString(g_bstr_nodeclose); - for (size_t i = 0; i < nCount; ++i) - arr[i].toXmlWriter(this); - EndNode(strName); - } - } -#endif //#ifdef _WIN32 +//#ifdef _WIN32 +// template +// AVSINLINE void WriteArray(const CString& strName, const CAtlArray& arr) +// { +// size_t nCount = arr.GetCount(); +// if (0 != nCount) +// { +// StartNode(strName); +// m_oWriter.WriteString(g_bstr_nodeclose); +// for (size_t i = 0; i < nCount; ++i) +// arr[i].toXmlWriter(this); +// EndNode(strName); +// } +// } +//#endif //#ifdef _WIN32 template AVSINLINE void WriteArray(const CString& strName, const std::vector& arr) { @@ -744,18 +744,18 @@ namespace NSBinPptxRW } } -#ifdef _WIN32 - template - AVSINLINE void WriteArray2(const CAtlArray& arr) - { - size_t nCount = arr.GetCount(); - if (0 != nCount) - { - for (size_t i = 0; i < nCount; ++i) - arr[i].toXmlWriter(this); - } - } -#endif //#ifdef _WIN32 +//#ifdef _WIN32 +// template +// AVSINLINE void WriteArray2(const CAtlArray& arr) +// { +// size_t nCount = arr.GetCount(); +// if (0 != nCount) +// { +// for (size_t i = 0; i < nCount; ++i) +// arr[i].toXmlWriter(this); +// } +// } +//#endif //#ifdef _WIN32 template AVSINLINE void WriteArray2(const std::vector& arr) { diff --git a/DesktopEditor/common/Directory.h b/DesktopEditor/common/Directory.h index 0e67f56b53..d7900b5661 100644 --- a/DesktopEditor/common/Directory.h +++ b/DesktopEditor/common/Directory.h @@ -58,6 +58,18 @@ #include #endif +#ifndef FILE_SEPARATOR + #if defined(_WIN32) || defined(_WIN64) + #define FILE_SEPARATOR + #define FILE_SEPARATOR_CHAR '\\' + #define FILE_SEPARATOR_STR _T("\\") + #else + #define FILE_SEPARATOR + #define FILE_SEPARATOR_CHAR '/' + #define FILE_SEPARATOR_STR _T("/") + #endif +#endif + namespace NSDirectory { #if !defined(_WIN32) && !defined (_WIN64) diff --git a/X2tConverter/src/ASCConverters.cpp b/X2tConverter/src/ASCConverters.cpp index 4fca2f4041..5fdca20f74 100644 --- a/X2tConverter/src/ASCConverters.cpp +++ b/X2tConverter/src/ASCConverters.cpp @@ -902,7 +902,7 @@ namespace NExtractTools { COfficeDocFile docFile; docFile.m_sTempFolder = sTemp; - long hRes = docFile.LoadFromFile( sFrom, sTo, params.m_sPassword ? *params.m_sPassword : L"", NULL); + long hRes = docFile.LoadFromFile( sFrom, sTo, params.getPassword(), NULL); if (AVS_ERROR_DRM == hRes) { if(!params.getDontSaveAdditional())