Commit 3dd4dda2 authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader -ole ...

parent 24dc3554
...@@ -667,31 +667,38 @@ namespace DocFileFormat ...@@ -667,31 +667,38 @@ namespace DocFileFormat
chpxObj->Convert(rPr); chpxObj->Convert(rPr);
RELEASEOBJECT(rPr); RELEASEOBJECT(rPr);
} }
XMLTools::CStringXmlWriter OleWriter; XMLTools::CStringXmlWriter oleWriter;
VMLPictureMapping oVmlMapper (m_context, &OleWriter, true, _caller); XMLTools::CStringXmlWriter oleObjectWriter;
VMLPictureMapping oVmlMapper (m_context, &oleWriter, true, _caller);
if (!m_shapeIdOwner.empty()) //4571833.doc
oVmlMapper.m_shapeId = m_shapeIdOwner;
if (m_document->bOlderVersion) if (m_document->bOlderVersion)
{ {
OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion); OleObject ole ( chpxObj, m_document->GetStorage(), m_document->bOlderVersion);
OleWriter.WriteNodeBegin (_T( "w:object" ), true); oleWriter.WriteNodeBegin (_T( "w:object" ), true);
OleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dxaGoal + ole.pictureDesciptor.dxaOrigin ) ).c_str() );
OleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( ole.pictureDesciptor.dyaGoal + ole.pictureDesciptor.dyaOrigin ) ).c_str() );
OleWriter.WriteNodeEnd( _T( "" ), true, false ); oleWriter.WriteNodeEnd( _T( "" ), true, false );
ole.pictureDesciptor.Convert(&oVmlMapper); ole.pictureDesciptor.Convert(&oVmlMapper);
OleObjectMapping oleObjectMapping( &OleWriter, m_context, &ole.pictureDesciptor, _caller, oVmlMapper.GetShapeId() ); OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &ole.pictureDesciptor, _caller, oVmlMapper.m_shapeId);
ole.Convert( &oleObjectMapping ); ole.Convert( &oleObjectMapping );
_lastOLEObject = oleObjectWriter.GetXmlString();
} }
else else
{ {
PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion); PictureDescriptor pic(chpxObj, m_document->DataStream, 0x7fffffff, m_document->bOlderVersion);
OleWriter.WriteNodeBegin (_T( "w:object" ), true); oleWriter.WriteNodeBegin (_T( "w:object" ), true);
OleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dxaOrig" ), FormatUtils::IntToWideString( ( pic.dxaGoal + pic.dxaOrigin ) ).c_str() );
OleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ).c_str() ); oleWriter.WriteAttribute( _T( "w:dyaOrig" ), FormatUtils::IntToWideString( ( pic.dyaGoal + pic.dyaOrigin ) ).c_str() );
OleWriter.WriteNodeEnd( _T( "" ), true, false ); oleWriter.WriteNodeEnd( _T( "" ), true, false );
pic.Convert(&oVmlMapper); pic.Convert(&oVmlMapper);
RELEASEOBJECT(chpxs); RELEASEOBJECT(chpxs);
...@@ -705,7 +712,7 @@ namespace DocFileFormat ...@@ -705,7 +712,7 @@ namespace DocFileFormat
CharacterPropertyExceptions* chpxSep = chpxs->front(); CharacterPropertyExceptions* chpxSep = chpxs->front();
OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion); OleObject ole ( chpxSep, m_document->GetStorage(), m_document->bOlderVersion);
OleObjectMapping oleObjectMapping( &OleWriter, m_context, &pic, _caller, oVmlMapper.GetShapeId() ); OleObjectMapping oleObjectMapping( &oleObjectWriter, m_context, &pic, _caller, oVmlMapper.m_shapeId );
if (oVmlMapper.m_isEmbedded) if (oVmlMapper.m_isEmbedded)
{ {
...@@ -715,10 +722,13 @@ namespace DocFileFormat ...@@ -715,10 +722,13 @@ namespace DocFileFormat
} }
ole.Convert( &oleObjectMapping ); ole.Convert( &oleObjectMapping );
_lastOLEObject = oleObjectWriter.GetXmlString();
RELEASEOBJECT( chpxs ); RELEASEOBJECT( chpxs );
} }
} }
OleWriter.WriteNodeEnd( _T( "w:object" ) ); oleWriter.WriteString( _lastOLEObject );
oleWriter.WriteNodeEnd( _T( "w:object" ) );
if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation) if (!oVmlMapper.m_isEmbedded && oVmlMapper.m_isEquation)
{ {
...@@ -728,7 +738,7 @@ namespace DocFileFormat ...@@ -728,7 +738,7 @@ namespace DocFileFormat
} }
else else
{ {
m_pXmlWriter->WriteString(OleWriter.GetXmlString()); m_pXmlWriter->WriteString(oleWriter.GetXmlString());
} }
} }
...@@ -808,8 +818,6 @@ namespace DocFileFormat ...@@ -808,8 +818,6 @@ namespace DocFileFormat
if (pShape) if (pShape)
{ {
bool bOLE = pShape->isOLE();
VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller); VMLShapeMapping oVmlWriter (m_context, m_pXmlWriter, pSpa, &pictDiscr, _caller);
m_pXmlWriter->WriteNodeBegin (L"w:pict"); m_pXmlWriter->WriteNodeBegin (L"w:pict");
...@@ -866,7 +874,7 @@ namespace DocFileFormat ...@@ -866,7 +874,7 @@ namespace DocFileFormat
if (oVmlMapper.m_isEmbedded) if (oVmlMapper.m_isEmbedded)
{ {
OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion); OleObject ole ( chpx, m_document->GetStorage(), m_document->bOlderVersion);
OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.GetShapeId() ); OleObjectMapping oleObjectMapping( &pictWriter, m_context, &oPicture, _caller, oVmlMapper.m_shapeId );
ole.isEquation = oVmlMapper.m_isEquation; ole.isEquation = oVmlMapper.m_isEquation;
ole.isEmbedded = oVmlMapper.m_isEmbedded; ole.isEmbedded = oVmlMapper.m_isEmbedded;
......
...@@ -70,68 +70,70 @@ namespace DocFileFormat ...@@ -70,68 +70,70 @@ namespace DocFileFormat
public: public:
DocumentMapping(ConversionContext* context, IMapping* caller); DocumentMapping(ConversionContext* context, IMapping* caller);
DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller); DocumentMapping(ConversionContext* context, XMLTools::CStringXmlWriter* writer, IMapping* caller);
virtual ~DocumentMapping(); virtual ~DocumentMapping();
virtual void Apply( IVisitable* visited ) = 0; virtual void Apply( IVisitable* visited ) = 0;
//--------------------------------- 4571833.doc
std::wstring m_shapeIdOwner;
std::wstring getOLEObject() { return _lastOLEObject; }
protected: protected:
/// Looks into the section table to find out if this CP is the current of a section // Looks into the section table to find out if this CP is the current of a section
int getCurrentSection(int cp); int getCurrentSection(int cp);
/// 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 of a section
bool isSectionEnd( int cp ); bool isSectionEnd( int cp );
/// Writes a Paragraph that starts at the given cp and // Writes a Paragraph that starts at the given cp and
/// ends at the next paragraph end mark or section end mark // ends at the next paragraph end mark or section end mark
int writeParagraph( int cp ); int writeParagraph( int cp );
/// Writes a Paragraph that starts at the given cpStart and // Writes a Paragraph that starts at the given cpStart and
/// ends at the given cpEnd // ends at the given cpEnd
int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false ); int writeParagraph( int initialCp, int cpEnd, bool sectionEnd, bool lastBad = false );
/// Writes a Paragraph RSID // Writes a Paragraph RSID
void writeParagraphRsid( const ParagraphPropertyExceptions* papx ); void writeParagraphRsid( const ParagraphPropertyExceptions* papx );
/// Writes a run with the given characters and CHPX // Writes a run with the given characters and CHPX
int writeRun( std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp ); int writeRun( std::vector<wchar_t>* chars, CharacterPropertyExceptions* chpx, int initialCp );
/// Writes the given text to the document // Writes the given text to the document
int writeText( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText ); int writeText( std::vector<wchar_t>* chars, int initialCp, CharacterPropertyExceptions* chpx, bool writeDeletedText );
void writeTextElement( const std::wstring& text, const std::wstring& textType ); void writeTextElement( const std::wstring& text, const std::wstring& textType );
void writeTextStart( const std::wstring& textType, bool preserve_space); void writeTextStart( const std::wstring& textType, bool preserve_space);
void writeTextEnd( const std::wstring& textType ); void writeTextEnd( const std::wstring& textType );
/// Searches for bookmarks in the list of characters. // Searches for bookmarks in the list of characters.
std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp ); std::vector<int> searchBookmarks( std::vector<wchar_t>* chars, int initialCp );
ParagraphPropertyExceptions* findValidPapx( int fc ); ParagraphPropertyExceptions* findValidPapx( int fc );
/// Splits a list of characters into several lists // Splits a list of characters into several lists
std::list<std::vector<wchar_t> >* splitCharList( std::vector<wchar_t>* chars, std::vector<int>* splitIndices ); std::list<std::vector<wchar_t> >* splitCharList( std::vector<wchar_t>* chars, std::vector<int>* splitIndices );
/// Writes the table starts at the given cp value // Writes the table starts at the given cp value
int writeTable( int initialCp, unsigned int nestingLevel ); int writeTable( int initialCp, unsigned int nestingLevel );
/// Builds a list that contains the width of the several columns of the table. // Builds a list that contains the width of the several columns of the table.
std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel ); std::vector<short>* buildTableGrid( int initialCp, unsigned int nestingLevel );
/// Finds the FC of the next row end mark. // Finds the FC of the next row end mark.
int findRowEndFc( int initialCp, int& rowEndCp, unsigned int nestingLevel ); int findRowEndFc( int initialCp, int& rowEndCp, unsigned int nestingLevel );
/// Finds the FC of the next row end mark. // Finds the FC of the next row end mark.
int findRowEndFc( int initialCp, unsigned int nestingLevel ); int findRowEndFc( int initialCp, unsigned int nestingLevel );
/// Writes the table row that starts at the given cp value and ends at the next row end mark // Writes the table row that starts at the given cp value and ends at the next row end mark
int writeTableRow( int initialCp, std::vector<short>* grid, unsigned int nestingLevel ); int writeTableRow( int initialCp, std::vector<short>* grid, unsigned int nestingLevel );
/// Writes the table cell that starts at the given cp value and ends at the next cell end mark // Writes the table cell that starts at the given cp value and ends at the next cell end mark
int writeTableCell( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel ); int writeTableCell( int initialCp, TablePropertyExceptions* tapx, std::vector<short>* grid, int& gridIndex, int cellIndex, unsigned int nestingLevel );
int findCellEndCp( int initialCp, unsigned int nestingLevel ); int findCellEndCp( int initialCp, unsigned int nestingLevel );
bool writeBookmarks( int cp ); bool writeBookmarks( int cp );
bool writeBookmarkStart( short id ); bool writeBookmarkStart( short id );
bool writeBookmarkEnd( short id ); bool writeBookmarkEnd( short id );
/// Checks if the CHPX is special // Checks if the CHPX is special
bool isSpecial( CharacterPropertyExceptions* chpx ); bool isSpecial( CharacterPropertyExceptions* chpx );
/// Finds the SEPX that is valid for the given CP. // Finds the SEPX that is valid for the given CP.
SectionPropertyExceptions* findValidSepx( int cp ); SectionPropertyExceptions* findValidSepx( int cp );
/// Searches the given vector for the next FieldEnd character. // Searches the given vector for the next FieldEnd character.
int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark ); int searchNextTextMark( std::vector<wchar_t>* chars, int initialCp, wchar_t mark );
private:
Symbol getSymbol ( const CharacterPropertyExceptions* chpx ); Symbol getSymbol ( const CharacterPropertyExceptions* chpx );
//----------------------------------------------------------------------------------------------------------------------
bool m_bInternalXmlWriter; bool m_bInternalXmlWriter;
protected:
WordDocument* m_document; WordDocument* m_document;
ConversionContext* m_context; ConversionContext* m_context;
IMapping* _caller; IMapping* _caller;
ParagraphPropertyExceptions* _lastValidPapx; ParagraphPropertyExceptions* _lastValidPapx;
...@@ -149,5 +151,6 @@ namespace DocFileFormat ...@@ -149,5 +151,6 @@ namespace DocFileFormat
bool _writeWebHidden; bool _writeWebHidden;
unsigned int _fldCharCounter; unsigned int _fldCharCounter;
std::wstring _writeAfterRun; std::wstring _writeAfterRun;
std::wstring _lastOLEObject;
}; };
} }
...@@ -67,7 +67,7 @@ namespace DocFileFormat ...@@ -67,7 +67,7 @@ namespace DocFileFormat
virtual ~Shape() virtual ~Shape()
{ {
RELEASEOBJECT( this->shapeType ); RELEASEOBJECT( shapeType );
} }
Shape( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ): Shape( IBinaryReader* _reader, unsigned int size, unsigned int typeCode, unsigned int version, unsigned int instance ):
...@@ -107,12 +107,12 @@ namespace DocFileFormat ...@@ -107,12 +107,12 @@ namespace DocFileFormat
inline int GetShapeID() const inline int GetShapeID() const
{ {
return this->spid; return spid;
} }
inline ShapeType* GetShapeType() const inline ShapeType* GetShapeType() const
{ {
return this->shapeType; return shapeType;
} }
template<class T> bool is() const template<class T> bool is() const
......
...@@ -67,7 +67,6 @@ namespace DocFileFormat ...@@ -67,7 +67,6 @@ namespace DocFileFormat
} }
m_pXmlWriter->WriteNodeBegin( _T( "o:OLEObject" ), TRUE ); m_pXmlWriter->WriteNodeBegin( _T( "o:OLEObject" ), TRUE );
//type
if ( ole->bLinked ) if ( ole->bLinked )
{ {
int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link); int relID = m_context->_docx->RegisterExternalOLEObject(_caller, ole->ClipboardFormat, ole->Link);
...@@ -88,22 +87,13 @@ namespace DocFileFormat ...@@ -88,22 +87,13 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() ); m_pXmlWriter->WriteAttribute( _T( "r:id" ), ( std::wstring( _T( "rId" ) ) + FormatUtils::IntToWideString( relID ) ).c_str() );
m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Embed" ) ); m_pXmlWriter->WriteAttribute( _T( "Type" ), _T( "Embed" ) );
//copy the object
copyEmbeddedObject( ole ); copyEmbeddedObject( ole );
} }
//ProgID
m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ProgID" ), ole->Program.c_str() );
//ShapeId
m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), _shapeId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ShapeID" ), _shapeId.c_str() );
//DrawAspect
m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) ); m_pXmlWriter->WriteAttribute( _T( "DrawAspect" ), _T( "Content" ) );
//ObjectID
m_pXmlWriter->WriteAttribute( _T( "ObjectID" ), ole->ObjectId.c_str() ); m_pXmlWriter->WriteAttribute( _T( "ObjectID" ), ole->ObjectId.c_str() );
m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE ); m_pXmlWriter->WriteNodeEnd( _T( "" ), TRUE, FALSE );
m_pXmlWriter->WriteNodeEnd( _T( "o:OLEObject" ) ); m_pXmlWriter->WriteNodeEnd( _T( "o:OLEObject" ) );
...@@ -165,20 +155,15 @@ namespace DocFileFormat ...@@ -165,20 +155,15 @@ namespace DocFileFormat
} }
private: private:
// Writes the embedded OLE object from the ObjectPool of the binary file to the OpenXml Package.
inline void copyEmbeddedObject( const OleObject* ole ) inline void copyEmbeddedObject( const OleObject* ole )
{ {
if ( ole != NULL ) if ( ole != NULL )
{ {
//!!!TODO: There is issue with some Office OLE Objects. Word can't open *.xls object (Excel.Chart) with set CLSID and
//some Power Point Presentations, and Word Documents. Open Office CAN start this objects!!!
std::wstring clsid; std::wstring clsid;
std::wstring exelChart = _T( "Excel.Chart" ); std::wstring exelChart = _T( "Excel.Chart" );
if ( std::search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() ) if ( std::search( ole->Program.begin(), ole->Program.end(), exelChart.begin(), exelChart.end() ) == ole->Program.end() )
{//?? {
clsid = ole->ClassId; clsid = ole->ClassId;
} }
OleObjectFileStructure object_descr(OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid); OleObjectFileStructure object_descr(OleObjectMapping::GetTargetExt( ole->ClipboardFormat ), ole->ObjectId, clsid);
......
...@@ -50,7 +50,6 @@ namespace DocFileFormat ...@@ -50,7 +50,6 @@ namespace DocFileFormat
void SetTextboxStyle(const std::wstring & style); void SetTextboxStyle(const std::wstring & style);
private: private:
static int TextboxCount; static int TextboxCount;
int m_nTBIndex; int m_nTBIndex;
......
...@@ -189,7 +189,6 @@ namespace DocFileFormat ...@@ -189,7 +189,6 @@ namespace DocFileFormat
return res; return res;
} }
//--------------------------------------------------------------- //---------------------------------------------------------------
static int count_vml_objects = 0;
void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const void VMLPictureMapping::appendStyleProperty(std::wstring* b, const std::wstring& propName, const std::wstring& propValue) const
{ {
if ( b != NULL ) if ( b != NULL )
...@@ -215,8 +214,6 @@ namespace DocFileFormat ...@@ -215,8 +214,6 @@ namespace DocFileFormat
m_isEmbedded = false; m_isEmbedded = false;
m_imageData = new XMLTools::XMLElement<wchar_t>( _T( "v:imagedata" ) ); m_imageData = new XMLTools::XMLElement<wchar_t>( _T( "v:imagedata" ) );
m_ShapeId = std::wstring(L"_x0000_i") + FormatUtils::IntToWideString(1024 + (count_vml_objects++));
} }
VMLPictureMapping::~VMLPictureMapping() VMLPictureMapping::~VMLPictureMapping()
...@@ -263,7 +260,12 @@ namespace DocFileFormat ...@@ -263,7 +260,12 @@ namespace DocFileFormat
m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str()); m_pXmlWriter->WriteAttribute( _T( "type" ), std::wstring( _T( "#" ) + VMLShapeTypeMapping::GenerateTypeId(&type)).c_str());
m_pXmlWriter->WriteAttribute( _T( "id" ), m_ShapeId.c_str() ); count_vml_objects++;
if (m_shapeId.empty())
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
m_pXmlWriter->WriteAttribute( _T( "id" ), m_shapeId.c_str() );
if (m_isOlePreview) if (m_isOlePreview)
{ {
...@@ -426,11 +428,6 @@ namespace DocFileFormat ...@@ -426,11 +428,6 @@ namespace DocFileFormat
m_pXmlWriter->WriteNodeEnd( _T( "v:shape" ) ); m_pXmlWriter->WriteNodeEnd( _T( "v:shape" ) );
} }
std::wstring VMLPictureMapping::GetShapeId () const
{
return m_ShapeId;
}
void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc ) void VMLPictureMapping::writePictureBorder( const std::wstring & name, const BorderCode* brc )
{ {
if (!brc || name.empty()) return; if (!brc || name.empty()) return;
......
...@@ -54,8 +54,6 @@ namespace DocFileFormat ...@@ -54,8 +54,6 @@ namespace DocFileFormat
VMLPictureMapping( ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false ); VMLPictureMapping( ConversionContext* ctx, XMLTools::CStringXmlWriter* writer, bool olePreview, IMapping* caller, bool isInlinePicture = false );
virtual ~VMLPictureMapping(); virtual ~VMLPictureMapping();
virtual void Apply( IVisitable* visited ); virtual void Apply( IVisitable* visited );
std::wstring GetShapeId() const;
private: private:
/// Writes a border element /// Writes a border element
void writePictureBorder (const std::wstring & name, const BorderCode* brc); void writePictureBorder (const std::wstring & name, const BorderCode* brc);
...@@ -75,12 +73,13 @@ namespace DocFileFormat ...@@ -75,12 +73,13 @@ namespace DocFileFormat
bool m_isEmbedded; bool m_isEmbedded;
std::string m_embeddedData; std::string m_embeddedData;
std::wstring m_equationXml; std::wstring m_equationXml;
std::wstring m_shapeId;
private: private:
ConversionContext* m_ctx; ConversionContext* m_ctx;
IMapping* m_caller; IMapping* m_caller;
int m_nImageId; int m_nImageId;
std::wstring m_ShapeId;
bool m_isOlePreview; bool m_isOlePreview;
bool m_isInlinePicture; bool m_isInlinePicture;
......
...@@ -146,8 +146,10 @@ namespace DocFileFormat ...@@ -146,8 +146,10 @@ namespace DocFileFormat
std::list<OptionEntry> options = groupShape->ExtractOptions(); std::list<OptionEntry> options = groupShape->ExtractOptions();
ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>(); ChildAnchor* anchor = groupShape->FirstChildWithType<ChildAnchor>();
m_shapeId = GetShapeID(shape);
m_pXmlWriter->WriteNodeBegin( L"v:group", true ); m_pXmlWriter->WriteNodeBegin( L"v:group", true );
m_pXmlWriter->WriteAttribute( L"id", GetShapeID(shape).c_str()); m_pXmlWriter->WriteAttribute( L"id", m_shapeId .c_str());
m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(shape, anchor, options, container->Index)).c_str() ); m_pXmlWriter->WriteAttribute( L"style", FormatUtils::XmlEncode(buildStyle(shape, anchor, options, container->Index)).c_str() );
m_pXmlWriter->WriteAttribute( L"coordorigin", ( FormatUtils::IntToWideString(gsr->rcgBounds.topLeftAngle.x) + L"," + FormatUtils::IntToWideString( gsr->rcgBounds.topLeftAngle.y)).c_str() ); m_pXmlWriter->WriteAttribute( L"coordorigin", ( FormatUtils::IntToWideString(gsr->rcgBounds.topLeftAngle.x) + L"," + FormatUtils::IntToWideString( gsr->rcgBounds.topLeftAngle.y)).c_str() );
m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)).c_str() ); m_pXmlWriter->WriteAttribute( L"coordsize", ( FormatUtils::IntToWideString(gsr->rcgBounds.size.cx) + L"," + FormatUtils::IntToWideString(gsr->rcgBounds.size.cy)).c_str() );
...@@ -230,8 +232,14 @@ namespace DocFileFormat ...@@ -230,8 +232,14 @@ namespace DocFileFormat
WriteBeginShapeNode (pShape); WriteBeginShapeNode (pShape);
sShapeId = GetShapeID(pShape); m_shapeId = GetShapeID(pShape);
m_pXmlWriter->WriteAttribute ( L"id", sShapeId );
count_vml_objects++;
if (m_shapeId.empty())
m_shapeId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
m_pXmlWriter->WriteAttribute ( L"id", m_shapeId );
if ( !pShape->fBackground ) if ( !pShape->fBackground )
{ {
...@@ -1021,14 +1029,21 @@ namespace DocFileFormat ...@@ -1021,14 +1029,21 @@ namespace DocFileFormat
m_context->_doc->Convert(&textboxMapping); m_context->_doc->Convert(&textboxMapping);
} }
} }
WriteEndShapeNode(pShape);
// OLE // OLE
if (indexOLE >= 0 && pShape->fOleShape) if (indexOLE >= 0 && pShape->fOleShape) //4571833.doc
{ {
TextboxMapping textboxMapping(m_context, 0, m_pXmlWriter, m_pCaller); XMLTools::CStringXmlWriter txtBoxWrapper;
TextboxMapping textboxMapping(m_context, (indexOLE >> 16) - 1, &txtBoxWrapper, m_pCaller);
textboxMapping.m_shapeIdOwner = m_shapeId;
m_context->_doc->Convert(&textboxMapping); m_context->_doc->Convert(&textboxMapping);
m_pXmlWriter->WriteString(textboxMapping.getOLEObject());
} }
WriteEndShapeNode(pShape);
//ShapeType //ShapeType
if (NULL != pShape->GetShapeType() /* && !m_isInlineShape*/) //bullete only??? if (NULL != pShape->GetShapeType() /* && !m_isInlineShape*/) //bullete only???
{ {
...@@ -1905,7 +1920,6 @@ namespace DocFileFormat ...@@ -1905,7 +1920,6 @@ namespace DocFileFormat
return rectangles; return rectangles;
} }
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------
static int count_vml_objects = 0;
void VMLShapeMapping::ApplyPrimitives(DrawingPrimitives * primitives) void VMLShapeMapping::ApplyPrimitives(DrawingPrimitives * primitives)
{ {
...@@ -1992,7 +2006,9 @@ namespace DocFileFormat ...@@ -1992,7 +2006,9 @@ namespace DocFileFormat
TwipsValue w( primitive->dxa ); TwipsValue w( primitive->dxa );
TwipsValue h( primitive->dya ); TwipsValue h( primitive->dya );
std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + (count_vml_objects++)); std::wstring strId = std::wstring(L"_x0000_s") + FormatUtils::IntToWideString(1024 + count_vml_objects);
count_vml_objects++;
//m_pXmlWriter->WriteAttribute ( L"id") , strId.c_str()); //m_pXmlWriter->WriteAttribute ( L"id") , strId.c_str());
m_pXmlWriter->WriteAttribute ( L"o:spid", strId.c_str()); m_pXmlWriter->WriteAttribute ( L"o:spid", strId.c_str());
......
...@@ -69,6 +69,7 @@ namespace DocFileFormat ...@@ -69,6 +69,7 @@ namespace DocFileFormat
static std::wstring mapHorizontalPositionRelative(int hRel ); static std::wstring mapHorizontalPositionRelative(int hRel );
bool m_isBullete; bool m_isBullete;
std::wstring m_shapeId;
private: private:
void ApplyPrimitives (DrawingPrimitives * primitives ); void ApplyPrimitives (DrawingPrimitives * primitives );
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
namespace DocFileFormat namespace DocFileFormat
{ {
static int count_vml_objects = 0;
class VMLShapeTypeMapping: public PropertiesMapping, public IMapping class VMLShapeTypeMapping: public PropertiesMapping, public IMapping
{ {
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment