diff --git a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp index 09d15b256b..622bb0dfd0 100644 --- a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp @@ -3,7 +3,8 @@ namespace DocFileFormat { - CharacterPropertiesMapping::CharacterPropertiesMapping( XmlUtils::CXmlWriter* writer, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded) : PropertiesMapping( writer ), _isRunStyleNeeded(isRunStyleNeeded), _isOwnRPr(true) + CharacterPropertiesMapping::CharacterPropertiesMapping( XmlUtils::CXmlWriter* writer, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded) + : PropertiesMapping( writer ), _isRunStyleNeeded(isRunStyleNeeded), _isOwnRPr(true), _isRTL(false) { this->_doc = doc; this->_rPr = new XMLTools::XMLElement( _T( "w:rPr" ) ); @@ -13,7 +14,8 @@ namespace DocFileFormat this->_currentIstd = USHRT_MAX; } - CharacterPropertiesMapping::CharacterPropertiesMapping( XMLTools::XMLElement* rPr, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded ): PropertiesMapping( NULL ), _isRunStyleNeeded(isRunStyleNeeded), _isOwnRPr(false) + CharacterPropertiesMapping::CharacterPropertiesMapping( XMLTools::XMLElement* rPr, WordDocument* doc, RevisionData* rev, ParagraphPropertyExceptions* currentPapx, bool styleChpx, bool isRunStyleNeeded ) + : PropertiesMapping( NULL ), _isRunStyleNeeded(isRunStyleNeeded), _isOwnRPr(false), _isRTL(false) { this->_doc = doc; this->_rPr = rPr; @@ -81,10 +83,10 @@ namespace DocFileFormat void CharacterPropertiesMapping::convertSprms( list* sprms, XMLTools::XMLElement* parent ) { - XMLTools::XMLElement* rFonts = new XMLTools::XMLElement( _T( "w:rFonts" ) ); - XMLTools::XMLElement* color = new XMLTools::XMLElement( _T( "w:color" ) ); - XMLTools::XMLAttribute* colorVal = new XMLTools::XMLAttribute( _T( "w:val" ) ); - XMLTools::XMLElement* lang = new XMLTools::XMLElement( _T( "w:lang" ) ); + XMLTools::XMLElement * rFonts = new XMLTools::XMLElement ( _T( "w:rFonts" ) ); + XMLTools::XMLElement * color = new XMLTools::XMLElement ( _T( "w:color" ) ); + XMLTools::XMLAttribute * colorVal = new XMLTools::XMLAttribute( _T( "w:val" ) ); + XMLTools::XMLElement * lang = new XMLTools::XMLElement ( _T( "w:lang" ) ); // флаг наличия стиля для баги - http://bugzserver/show_bug.cgi?id=13353 TODO : найти в чем создан такой документ bool haveStyle = FALSE; @@ -109,6 +111,7 @@ namespace DocFileFormat case 0x085A : // Element flags appendFlagElement( parent, *iter, _T( "rtl" ), true ); + this->_isRTL = true; break; case 0x0835 : diff --git a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h index 95a78b82cd..a5312fa5cd 100644 --- a/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h @@ -29,6 +29,7 @@ namespace DocFileFormat void Apply( IVisitable* chpx ); bool CheckIsSymbolFont(); + bool _isRTL; private: void convertSprms( list* sprms, XMLTools::XMLElement* parent ); list buildHierarchy( const StyleSheet* styleSheet, unsigned short istdStart ); diff --git a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp index 3784960185..bdb346dfa9 100644 --- a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp @@ -38,8 +38,23 @@ namespace DocFileFormat namespace DocFileFormat { - // Looks into the section table to find out if this CP is the end of a section + // Looks into the section table to find out if this CP is the end & current of a sections + + int DocumentMapping::getCurrentSection(int cp) + { + //if cp is the last char of a section, the next section will start at cp +1 + int current = 0; + for (std::vector::iterator iter = m_document->SectionPlex->CharacterPositions.begin() + 1; iter != m_document->SectionPlex->CharacterPositions.end(); ++iter) + { + if (cp < *iter) + { + break; + } + current++; + } + return m_document->SectionPlex->CharacterPositions[current + 1]; + } bool DocumentMapping::isSectionEnd(int cp) { bool result = false; @@ -133,8 +148,15 @@ namespace DocFileFormat m_pXmlWriter->WriteNodeBegin(_T("w:p"), TRUE); writeParagraphRsid(papx); - // check for section properties - +// ----------- check for section properties + bool isBidi = false; + SectionPropertyExceptions* currentSection = findValidSepx(getCurrentSection(cp)); + if (currentSection) + { + isBidi = currentSection->isBidi; + } + +//----------------------------------------------------------- if (sectionEnd) { // this is the last paragraph of this section @@ -142,7 +164,7 @@ namespace DocFileFormat if (papx) { - ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, findValidSepx(cpEnd), _sectionNr); + ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi, findValidSepx(cpEnd), _sectionNr); papx->Convert(&oMapping); } @@ -154,7 +176,7 @@ namespace DocFileFormat if (papx) { - ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx); + ParagraphPropertiesMapping oMapping(m_pXmlWriter, m_context, m_document, paraEndChpx, isBidi); papx->Convert(&oMapping); } } diff --git a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h index de87b4aa0c..6f747f3129 100644 --- a/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h @@ -44,6 +44,8 @@ namespace DocFileFormat protected: + /// Looks into the section table to find out if this CP is the current of a section + int getCurrentSection(int cp); /// Looks into the section table to find out if this CP is the end of a section bool isSectionEnd( int cp ); /// Writes a Paragraph that starts at the given cp and diff --git a/ASCOfficeDocFile/DocDocxConverter/Global.h b/ASCOfficeDocFile/DocDocxConverter/Global.h index 346b76418a..28561f4515 100644 --- a/ASCOfficeDocFile/DocDocxConverter/Global.h +++ b/ASCOfficeDocFile/DocDocxConverter/Global.h @@ -121,9 +121,9 @@ namespace Global static const wchar_t JustificationCode[10][15] = { - _T( "left" ), + _T( "start" ), _T( "center" ), - _T( "right" ), + _T( "end" ), _T( "both" ), _T( "distribute" ), _T( "mediumKashida" ), diff --git a/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h b/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h index 30a91548ab..8edd9c8c41 100644 --- a/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h @@ -22,8 +22,7 @@ namespace DocFileFormat virtual ~LanguageIdMapping(); void Apply( IVisitable* lid ); - private: - wstring getLanguageCode( LanguageId* lid ); + static wstring getLanguageCode( LanguageId* lid ); private: LanguageType _type; diff --git a/ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp index 6ef3594c2c..65dffdbef4 100644 --- a/ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp @@ -26,12 +26,24 @@ namespace DocFileFormat m_pXmlWriter->WriteNodeBegin(_T("w:document"), TRUE ); // Namespaces - m_pXmlWriter->WriteAttribute(_T("xmlns:w"), OpenXmlNamespaces::WordprocessingML ); - m_pXmlWriter->WriteAttribute(_T("xmlns:v"), OpenXmlNamespaces::VectorML ); - m_pXmlWriter->WriteAttribute(_T("xmlns:o"), OpenXmlNamespaces::Office ); - m_pXmlWriter->WriteAttribute(_T("xmlns:w10"), OpenXmlNamespaces::OfficeWord ); - m_pXmlWriter->WriteAttribute(_T("xmlns:r"), OpenXmlNamespaces::Relationships ); + m_pXmlWriter->WriteAttribute(_T("xmlns:w"), OpenXmlNamespaces::WordprocessingML ); + m_pXmlWriter->WriteAttribute(_T("xmlns:v"), OpenXmlNamespaces::VectorML ); + m_pXmlWriter->WriteAttribute(_T("xmlns:o"), OpenXmlNamespaces::Office ); + m_pXmlWriter->WriteAttribute(_T("xmlns:w10"), OpenXmlNamespaces::OfficeWord ); + m_pXmlWriter->WriteAttribute(_T("xmlns:r"), OpenXmlNamespaces::Relationships ); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wpc"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:mc"), _T("http://schemas.openxmlformats.org/markup-compatibility/2006")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:m"), _T("http://schemas.openxmlformats.org/officeDocument/2006/math")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wp14"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wp"), _T("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:w14"), _T("http://schemas.microsoft.com/office/word/2010/wordml")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wpg"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wpi"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingInk")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wne"), _T("http://schemas.microsoft.com/office/word/2006/wordml")); + //m_pXmlWriter->WriteAttribute(_T("xmlns:wps"), _T("http://schemas.microsoft.com/office/word/2010/wordprocessingShape")); + //m_pXmlWriter->WriteAttribute(_T("mc:Ignorable"), _T("w14 wp14")); + m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeBegin( _T("w:body"), FALSE ); diff --git a/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp index b6da26ecff..1f4872b30c 100644 --- a/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp @@ -424,7 +424,8 @@ namespace DocFileFormat m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE ); // pPr - ParagraphPropertiesMapping oppMapping(m_pXmlWriter, m_context, m_document, NULL); + bool isBidi = false; + ParagraphPropertiesMapping oppMapping(m_pXmlWriter, m_context, m_document, NULL, isBidi); lvl->grpprlPapx->Convert(&oppMapping); // пишем rPr diff --git a/ASCOfficeDocFile/DocDocxConverter/OleObject.h b/ASCOfficeDocFile/DocDocxConverter/OleObject.h index ee79bda8bf..1aab20ec0e 100644 --- a/ASCOfficeDocFile/DocDocxConverter/OleObject.h +++ b/ASCOfficeDocFile/DocDocxConverter/OleObject.h @@ -42,10 +42,8 @@ namespace DocFileFormat { HRESULT res = S_OK; - POLE::Stream* ObjectPoolStorage = //docStorage->GetStorage()->stream("ObjectPool"); - new POLE::Stream(oleStorage, "ObjectPool"); + POLE::Stream* ObjectPoolStorage = new POLE::Stream(oleStorage, "ObjectPool"); - //if (oleStorage->enterDirectory("ObjectPool")) if (ObjectPoolStorage) { ObjectId = getOleEntryName( chpx ); @@ -64,7 +62,8 @@ namespace DocFileFormat { processCompObjStream( name + "CompObj" ); } - //oleStorage->leaveDirectory(); + + processEquationNativeStream( name + "Equation Native" ); } //oleStorage->leaveDirectory(); delete ObjectPoolStorage; @@ -131,6 +130,36 @@ namespace DocFileFormat { } } + + void processEquationNativeStream( const string& eqStream ) + { + try + { + POLE::Stream* pCompStream = NULL; + HRESULT res = S_OK; + + pCompStream = new POLE::Stream(oleStorage, eqStream); + + if ( pCompStream ) + { + VirtualStreamReader reader( pCompStream ); + + int sz = reader.GetSize(); + + unsigned char *Buffer = reader.ReadBytes( sz, true ); + + if (Buffer) + { + delete []Buffer; + } + + delete pCompStream; + } + } + catch (...) + { + } + } void processCompObjStream( const string& compStream ) { @@ -139,10 +168,7 @@ namespace DocFileFormat POLE::Stream* pCompStream = NULL; HRESULT res = S_OK; - pCompStream = //oleStorage->stream(compStream); - new POLE::Stream(oleStorage, compStream); - - //res = oleStorage->OpenStream( compStream.c_str(), NULL, STGM_SHARE_EXCLUSIVE, NULL, &pCompStream ); + pCompStream = new POLE::Stream(oleStorage, compStream); if ( pCompStream ) { @@ -170,9 +196,7 @@ namespace DocFileFormat POLE::Stream* pOleStream; HRESULT res = S_OK; - pOleStream = //oleStorage->stream(oleStreamName); - new POLE::Stream(oleStorage, oleStreamName); - //res = oleStorage->OpenStream( oleStream.c_str(), NULL, STGM_SHARE_EXCLUSIVE, NULL, &pOleStream ); + pOleStream = new POLE::Stream(oleStorage, oleStreamName); if ( pOleStream ) { diff --git a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp index 918ea81989..2cfad3c976 100644 --- a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp @@ -4,24 +4,33 @@ namespace DocFileFormat { - ParagraphPropertiesMapping::ParagraphPropertiesMapping(XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isParagraphStyleNeeded) : PropertiesMapping( writer ), m_context(NULL), _pPr(NULL), _framePr(NULL), _sepx(NULL), _paraEndChpx(NULL), _sectionNr(0), m_document(NULL), _isParagraphStyleNeeded(isParagraphStyleNeeded) + ParagraphPropertiesMapping::ParagraphPropertiesMapping(XmlUtils::CXmlWriter* 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) { - m_document = document; - m_context = context; + m_document = document; + m_context = context; - _pPr = new XMLTools::XMLElement( _T( "w:pPr" ) ); - _framePr = new XMLTools::XMLElement( _T( "w:framePr" ) ); - _paraEndChpx = paraEndChpx; + _pPr = new XMLTools::XMLElement( _T( "w:pPr" ) ); + _framePr = new XMLTools::XMLElement( _T( "w:framePr" ) ); + + _paraEndChpx = paraEndChpx; + _isBidi = isBidi; } - ParagraphPropertiesMapping::ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* context, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, 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) + ParagraphPropertiesMapping::ParagraphPropertiesMapping( XmlUtils::CXmlWriter* 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) { - m_document = document; - m_context = context; + m_document = document; + m_context = context; + + _pPr = new XMLTools::XMLElement( _T( "w:pPr" ) ); + _framePr = new XMLTools::XMLElement( _T( "w:framePr" ) ); + + _paraEndChpx = paraEndChpx; + _isBidi = isBidi; - _pPr = new XMLTools::XMLElement( _T( "w:pPr" ) ); - _framePr = new XMLTools::XMLElement( _T( "w:framePr" ) ); - _paraEndChpx = paraEndChpx; _sepx = sepx; _sectionNr = sectionNr; } @@ -114,6 +123,7 @@ namespace DocFileFormat case sprmPFBiDi: { appendFlagElement( _pPr, *iter, _T( "bidi" ), true ); + _isBidi = true; } break; @@ -256,6 +266,10 @@ namespace DocFileFormat case sprmPJc: case sprmPJc80: { + if (this->_isBidi && (iter->Arguments[0] == 0 || iter->Arguments[0] == 2)) + { + iter->Arguments[0] = (iter->Arguments[0] == 0 ? 2 : 0); + } RELEASEOBJECT( jc ); jc = new XMLTools::XMLElement( _T( "w:jc" ) ); XMLTools::XMLAttribute jcVal( _T( "w:val" ), FormatUtils::MapValueToWideString( iter->Arguments[0], &Global::JustificationCode[0][0], 10, 15 ).c_str() ); diff --git a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h index 049113cfab..8b91b494ee 100644 --- a/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h +++ b/ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h @@ -15,8 +15,8 @@ namespace DocFileFormat class ParagraphPropertiesMapping: public PropertiesMapping, public IMapping { public: - ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, bool isParagraphStyleNeeded = true ); - ParagraphPropertiesMapping( XmlUtils::CXmlWriter* writer, ConversionContext* ctx, WordDocument* document, CharacterPropertyExceptions* paraEndChpx, SectionPropertyExceptions* sepx, int sectionNr, bool isParagraphStyleNeeded = true ); + 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 ); virtual ~ParagraphPropertiesMapping(); void Apply(IVisitable* visited); @@ -31,5 +31,6 @@ namespace DocFileFormat int _sectionNr; bool _isParagraphStyleNeeded; + bool _isBidi; }; } diff --git a/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp index b122ea8610..182afb9b30 100644 --- a/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp @@ -299,7 +299,7 @@ namespace DocFileFormat if (NULL == m_arrWidth) m_arrWidth = new short [m_nColumns]; - unsigned char nInd = iter->Arguments[0]; + unsigned char nInd = iter->Arguments[0]; m_arrWidth[nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize); } } @@ -313,7 +313,7 @@ namespace DocFileFormat if (NULL == m_arrSpace) m_arrSpace = new short[m_nColumns]; - unsigned char nInd = iter->Arguments[0]; + unsigned char nInd = iter->Arguments[0]; m_arrSpace [nInd] = FormatUtils::BytesToInt16 (iter->Arguments, 1, iter->argumentsSize); } } diff --git a/ASCOfficeDocFile/DocDocxConverter/SectionPropertyExceptions.h b/ASCOfficeDocFile/DocDocxConverter/SectionPropertyExceptions.h index fec4f74eee..7902de589d 100644 --- a/ASCOfficeDocFile/DocDocxConverter/SectionPropertyExceptions.h +++ b/ASCOfficeDocFile/DocDocxConverter/SectionPropertyExceptions.h @@ -4,17 +4,28 @@ namespace DocFileFormat { - class SectionPropertyExceptions: public PropertyExceptions - { - public: - /// Parses the bytes to retrieve a SectionPropertyExceptions - SectionPropertyExceptions( unsigned char* bytes, int size ): - PropertyExceptions( bytes, size ) - { - } + class SectionPropertyExceptions: public PropertyExceptions + { + public: + /// Parses the bytes to retrieve a SectionPropertyExceptions + SectionPropertyExceptions( unsigned char* bytes, int size ): + PropertyExceptions( bytes, size ), isBidi(false) + { + for ( list::iterator iter = this->grpprl->begin(); iter != this->grpprl->end(); iter++ ) + { + SinglePropertyModifier sprm( *iter ); + + if( sprm.OpCode == sprmSFBiDi ) + { + isBidi = true; + } + } + } - virtual ~SectionPropertyExceptions() - { - } - }; + virtual ~SectionPropertyExceptions() + { + } + + bool isBidi; + }; } \ No newline at end of file diff --git a/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp index d57c52e9df..2f16132b65 100644 --- a/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp @@ -120,7 +120,8 @@ namespace DocFileFormat //write paragraph properties if ( (*iter)->papx != NULL ) { - ParagraphPropertiesMapping* ppMappingnew = new ParagraphPropertiesMapping (m_pXmlWriter, _ctx, m_document, NULL, false); + bool isBidi = false; + ParagraphPropertiesMapping* ppMappingnew = new ParagraphPropertiesMapping (m_pXmlWriter, _ctx, m_document, NULL, isBidi, false); (*iter)->papx->Convert( ppMappingnew ); RELEASEOBJECT( ppMappingnew ); } @@ -222,6 +223,15 @@ namespace DocFileFormat m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "w:rFonts" ) ); + + LanguageId langid(this->m_document->FIB->m_FibBase.lid); + wstring langcode = LanguageIdMapping::getLanguageCode( &langid ); + + m_pXmlWriter->WriteNodeBegin( _T( "w:lang" ), TRUE ); + m_pXmlWriter->WriteAttribute( _T( "w:val" ), langcode.c_str() ); + m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); + m_pXmlWriter->WriteNodeEnd( _T( "w:lang" ) ); + m_pXmlWriter->WriteNodeEnd( _T( "w:rPr" ) ); m_pXmlWriter->WriteNodeEnd( _T( "w:rPrDefault" ) ); } diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp index 50720e8fe2..af74f76fd6 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp @@ -9,6 +9,7 @@ namespace DocFileFormat { + static int count_vml_objects = 0; void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const { if ( b != NULL ) @@ -31,15 +32,7 @@ namespace DocFileFormat m_imageData = new XMLTools::XMLElement( _T( "v:imagedata" ) ); - //GUID guid = GUID_NULL; -// wstring guid; -// LPOLESTR guidString = NULL; - -// CoCreateGuid (&guid); -// StringFromCLSID (guid, &guidString); - -// m_ShapeId = std::wstring(guidString); -// CoTaskMemFree(guidString); + m_ShapeId = std::wstring(L"_x0000_i") + FormatUtils::IntToWideString(1024 + (count_vml_objects++)); } VMLPictureMapping::~VMLPictureMapping()