[Libreoffice-commits] .: sw/source
Lubos Lunak
llunak at kemper.freedesktop.org
Mon Jun 27 07:21:06 PDT 2011
sw/source/filter/ww8/docxattributeoutput.cxx | 27 +++++++++++++++++++++++++--
sw/source/filter/ww8/docxattributeoutput.hxx | 9 +++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
New commits:
commit a2d0c4a6ad7c266dc0295df275d27bfd91de7157
Author: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Date: Mon Jun 27 16:20:16 2011 +0200
make sure w:drawing is not written inside of w:rPr (fdo#38110)
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a70d5fe..6086213 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -870,6 +870,9 @@ void DocxAttributeOutput::StartRunProperties()
m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
InitCollectedRunProperties();
+
+ OSL_ASSERT( m_postponedGraphic == NULL );
+ m_postponedGraphic = new std::list< PostponedGraphic >;
}
void DocxAttributeOutput::InitCollectedRunProperties()
@@ -974,11 +977,23 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*
// write footnotes/endnotes if we have any
FootnoteEndnoteReference();
+ WritePostponedGraphic();
+
// merge the properties _before_ the run text (strictly speaking, just
// after the start of the run)
m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
}
+void DocxAttributeOutput::WritePostponedGraphic()
+{
+ for( std::list< PostponedGraphic >::const_iterator it = m_postponedGraphic->begin();
+ it != m_postponedGraphic->end();
+ ++it )
+ FlyFrameGraphic( *( it->grfNode ), it->size );
+ delete m_postponedGraphic;
+ m_postponedGraphic = NULL;
+}
+
void DocxAttributeOutput::FootnoteEndnoteRefTag()
{
if( m_footnoteEndnoteRefTag == 0 )
@@ -2270,7 +2285,14 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
const SwNode *pNode = rFrame.GetContent();
const SwGrfNode *pGrfNode = pNode ? pNode->GetGrfNode() : 0;
if ( pGrfNode )
- FlyFrameGraphic( *pGrfNode, rFrame.GetLayoutSize() );
+ {
+ if( m_postponedGraphic == NULL )
+ FlyFrameGraphic( *pGrfNode, rFrame.GetLayoutSize() );
+ else // we are writting out attributes, but w:drawing should not be inside w:rPr,
+ { // so write it out later
+ m_postponedGraphic->push_back( PostponedGraphic( pGrfNode, rFrame.GetLayoutSize()));
+ }
+ }
}
break;
case sw::Frame::eDrawing:
@@ -4260,7 +4282,8 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
m_bParagraphOpened( false ),
m_nColBreakStatus( COLBRK_NONE ),
m_pParentFrame( NULL ),
- m_nCloseHyperlinkStatus( Undetected )
+ m_nCloseHyperlinkStatus( Undetected ),
+ m_postponedGraphic( NULL )
{
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index ef8360b..884563d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -525,6 +525,7 @@ protected:
private:
void DoWriteBookmarks( );
+ void WritePostponedGraphic();
void StartField_Impl( FieldInfos& rInfos, sal_Bool bWriteRun = sal_False );
void DoWriteCmd( String& rCmd );
@@ -591,6 +592,14 @@ private:
};
HyperLinkCloseState m_nCloseHyperlinkStatus;
+ struct PostponedGraphic
+ {
+ PostponedGraphic( const SwGrfNode* n, Size s ) : grfNode( n ), size( s ) {};
+ const SwGrfNode* grfNode;
+ Size size;
+ };
+ std::list< PostponedGraphic >* m_postponedGraphic;
+
public:
DocxAttributeOutput( DocxExport &rExport, ::sax_fastparser::FSHelperPtr pSerializer, oox::drawingml::DrawingML* pDrawingML );
More information about the Libreoffice-commits
mailing list