diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-02-21 14:36:04 +0100 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-02-24 13:26:40 +0100 |
commit | 1428ec6f4e2bfe0d8654a9ccc713e274e08c6423 (patch) | |
tree | ef84f22ab4203fa3b13195b4ebeb35ba0a4f5d3d /sw/source/filter/ww8/docxattributeoutput.hxx | |
parent | ad7fdc4e0f8b0777513c10d44026544093b85df4 (diff) |
sw: Preserve embedded spreadsheets in docx
Embedded spreadsheets consist on two files:
* The spreadsheet found in word/embeddings/ directory.
* A preview image found in word/media/ directory.
This patch saves these two files and writes the proper XML to the
document. It looks like this:
<w:object>
<v:shape id="ole_rId2"
style="width:362.55pt;height:145.7pt" o:ole="">
<v:imagedata r:id="rId3" />
</v:shape>
<o:OLEObject Type="Embed" ProgID="Excel.Sheet.12"
ShapeID="ole_rId2" DrawAspect="Content"
ObjectID="_227653443" r:id="rId2" />
</w:object>
Some simplifications were done in comparison with the XML generated
by Word; the lines above seem to be the minimum working code.
Similarly to drawings, charts, etc. our code postpones the actual
process of the OLE objects until the rPr tag is closed.
TODO:
* Unit tests.
* Add information about xlsx extension to [Content_Types].xml
* Without that, Word doesn't detect the OLE as an spreadsheet.
Change-Id: Ia0c797b72cd6e99ca9ad7fa11897b62ab3867a5e
Diffstat (limited to 'sw/source/filter/ww8/docxattributeoutput.hxx')
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.hxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 30474f17b35c..de98b3c8b64c 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -393,6 +393,7 @@ private: void WriteOLE2Obj( const SdrObject* pSdrObj, SwOLENode& rNode, const Size& rSize, const SwFlyFrmFmt* pFlyFrmFmt); bool WriteOLEChart( const SdrObject* pSdrObj, const Size& rSize ); bool WriteOLEMath( const SdrObject* pSdrObj, const SwOLENode& rNode, const Size& rSize ); + bool PostponeOLE( const SdrObject* pSdrObj, SwOLENode& rNode, const Size& rSize, const SwFlyFrmFmt* pFlyFrmFmt ); /// checks whether the current component is a diagram bool IsDiagram (const SdrObject* sdrObject); @@ -668,6 +669,7 @@ private: void WritePostponedFormControl(const SdrObject* pObject); void WritePostponedDiagram(); void WritePostponedChart(); + void WritePostponedOLE(); void WritePostponedVMLDrawing(); void WritePostponedDMLDrawing(); @@ -786,6 +788,15 @@ private: std::list< PostponedDrawing >* m_postponedVMLDrawing; std::list< PostponedDrawing >* m_postponedDMLDrawing; + struct PostponedOLE + { + PostponedOLE( SwOLENode* rObject, const Size rSize, const SwFlyFrmFmt* rFrame ) : object( rObject ), size( rSize ), frame( rFrame ) {}; + SwOLENode* object; + const Size size; + const SwFlyFrmFmt* frame; + }; + std::list< PostponedOLE >* m_postponedOLE; + const SwOLENode* m_postponedMath; const SdrObject* m_postponedChart; Size m_postponedChartSize; |