Kaydet (Commit) 0cdba4ca authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX export: write mc:AlternateContent around drawingml shapes

Change-Id: Ie4cacea61f84aa1e24df9fc39b9467d08f9ca4f0
üst 326eb941
...@@ -3321,7 +3321,7 @@ void DocxAttributeOutput::WritePostponedDMLDrawing() ...@@ -3321,7 +3321,7 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
it != m_postponedDMLDrawing->end(); it != m_postponedDMLDrawing->end();
++it ) ++it )
{ {
WriteDMLDrawing(it->object, it->frame); WriteDMLAndVMLDrawing(it->object, *(it->frame), *(it->point));
} }
delete m_postponedDMLDrawing; delete m_postponedDMLDrawing;
m_postponedDMLDrawing = NULL; m_postponedDMLDrawing = NULL;
...@@ -3354,6 +3354,23 @@ void DocxAttributeOutput::WriteDMLDrawing( const SdrObject* pSdrObject, const Sw ...@@ -3354,6 +3354,23 @@ void DocxAttributeOutput::WriteDMLDrawing( const SdrObject* pSdrObject, const Sw
lcl_endDMLAnchorInline(m_pSerializer, pFrmFmt); lcl_endDMLAnchorInline(m_pSerializer, pFrmFmt);
} }
void DocxAttributeOutput::WriteDMLAndVMLDrawing(const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft)
{
m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND);
m_pSerializer->startElementNS(XML_mc, XML_Choice,
XML_Requires, "wps",
FSEND);
WriteDMLDrawing(sdrObj, &rFrmFmt);
m_pSerializer->endElementNS(XML_mc, XML_Choice);
m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND);
WriteVMLDrawing(sdrObj, rFrmFmt, rNdTopLeft);
m_pSerializer->endElementNS(XML_mc, XML_Fallback);
m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
}
void DocxAttributeOutput::WriteVMLDrawing( const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft ) void DocxAttributeOutput::WriteVMLDrawing( const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft )
{ {
bool bSwapInPage = false; bool bSwapInPage = false;
...@@ -3427,7 +3444,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po ...@@ -3427,7 +3444,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
if (aMiscOptions.IsExperimentalMode()) if (aMiscOptions.IsExperimentalMode())
{ {
if ( m_postponedDMLDrawing == NULL ) if ( m_postponedDMLDrawing == NULL )
WriteDMLDrawing( pSdrObj, &rFrame.GetFrmFmt()); WriteDMLAndVMLDrawing( pSdrObj, rFrame.GetFrmFmt(), rNdTopLeft);
else else
// we are writing out attributes, but w:drawing should not be inside w:rPr, so write it out later // we are writing out attributes, but w:drawing should not be inside w:rPr, so write it out later
m_postponedDMLDrawing->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft)); m_postponedDMLDrawing->push_back(PostponedDrawing(pSdrObj, &(rFrame.GetFrmFmt()), &rNdTopLeft));
......
...@@ -376,6 +376,9 @@ private: ...@@ -376,6 +376,9 @@ private:
void WriteVMLDrawing( const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft ); void WriteVMLDrawing( const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft );
/// Writes wp wrapper code around an SdrObject, which itself is written using drawingML syntax. /// Writes wp wrapper code around an SdrObject, which itself is written using drawingML syntax.
void WriteDMLDrawing( const SdrObject* pSdrObj, const SwFrmFmt* pFrmFmt ); void WriteDMLDrawing( const SdrObject* pSdrObj, const SwFrmFmt* pFrmFmt );
/// Writes shape in both DML and VML format.
void WriteDMLAndVMLDrawing( const SdrObject* sdrObj, const SwFrmFmt& rFrmFmt,const Point& rNdTopLeft );
void InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); void InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
void StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); void StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
void StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); void StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner );
......
...@@ -1023,6 +1023,7 @@ XFastAttributeListRef DocxExport::MainXmlNamespaces( FSHelperPtr serializer ) ...@@ -1023,6 +1023,7 @@ XFastAttributeListRef DocxExport::MainXmlNamespaces( FSHelperPtr serializer )
pAttr->add( FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word" ); pAttr->add( FSNS( XML_xmlns, XML_w10 ), "urn:schemas-microsoft-com:office:word" );
pAttr->add( FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" ); pAttr->add( FSNS( XML_xmlns, XML_wp ), "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" );
pAttr->add( FSNS( XML_xmlns, XML_wps ), "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" ); pAttr->add( FSNS( XML_xmlns, XML_wps ), "http://schemas.microsoft.com/office/word/2010/wordprocessingShape" );
pAttr->add( FSNS( XML_xmlns, XML_mc ), "http://schemas.openxmlformats.org/markup-compatibility/2006" );
return XFastAttributeListRef( pAttr ); return XFastAttributeListRef( pAttr );
} }
......
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