diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-06-13 17:02:11 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-06-13 17:14:06 +0200 |
commit | 175d28d564ff552cd3d73c3b087216bc82a763a1 (patch) | |
tree | 8995b05476bd8dd30357437ed26695b0f7fe8eaa | |
parent | 1f2e2563a60bfc3a4c5b81b99beb8eef674d13f2 (diff) |
fdo#58819 VML export of mso-position-*
mso-position-horizontal, mso-position-horizontal-relative,
mso-position-vertical and mso-position-vertical-relative
With this, the watermark in the bugdoc is almost in place, if you ignore
the missing rotation.
Change-Id: I8d3d834089e734654fcbbb0fb6166b4d7e01f80f
-rw-r--r-- | include/oox/export/vmlexport.hxx | 5 | ||||
-rw-r--r-- | oox/source/export/vmlexport.cxx | 86 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 6 |
3 files changed, 94 insertions, 3 deletions
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index 4e790c55f96d..31f5241b5ab6 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -50,6 +50,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx /// Parent exporter, used for text callback. VMLTextExport* m_pTextExport; + /// Anchoring. + sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel; + /// The object we're exporting. const SdrObject* m_pSdrObject; @@ -80,7 +83,7 @@ public: /// Export the sdr object as VML. /// /// Call this when you need to export the object as VML. - sal_uInt32 AddSdrObject( const SdrObject& rObj ); + sal_uInt32 AddSdrObject( const SdrObject& rObj, const sal_Int16 eHOri = -1, const sal_Int16 eVOri = -1, const sal_Int16 eHRel = -1, const sal_Int16 eVRel = -1 ); protected: /// Add an attribute to the generated <v:shape/> element. diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index e2df5cfb6669..a93bdb5277ad 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -29,16 +29,25 @@ #include <vcl/cvtgrf.hxx> #include <filter/msfilter/msdffimp.hxx> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> + #include <cstdio> using namespace sax_fastparser; using namespace oox::vml; +using namespace com::sun::star; VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport ) : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), 0 ) , m_pSerializer( pSerializer ) , m_pTextExport( pTextExport ) + , m_eHOri( 0 ) + , m_eVOri( 0 ) + , m_eHRel( 0 ) + , m_eVRel( 0 ) , m_pSdrObject( 0 ) , m_pShapeAttrList( NULL ) , m_nShapeType( ESCHER_ShpInst_Nil ) @@ -854,6 +863,77 @@ sal_Int32 VMLExport::StartShape() break; } + // anchoring + switch (m_eHOri) + { + case text::HoriOrientation::LEFT: + m_pShapeStyle->append(";mso-position-horizontal:left"); + break; + case text::HoriOrientation::CENTER: + m_pShapeStyle->append(";mso-position-horizontal:center"); + break; + case text::HoriOrientation::RIGHT: + m_pShapeStyle->append(";mso-position-horizontal:right"); + break; + case text::HoriOrientation::INSIDE: + m_pShapeStyle->append(";mso-position-horizontal:inside"); + break; + case text::HoriOrientation::OUTSIDE: + m_pShapeStyle->append(";mso-position-horizontal:outside"); + break; + default: + case text::HoriOrientation::NONE: + break; + } + switch (m_eHRel) + { + case text::RelOrientation::PAGE_PRINT_AREA: + m_pShapeStyle->append(";mso-position-horizontal-relative:margin"); + break; + case text::RelOrientation::PAGE_FRAME: + case text::RelOrientation::PAGE_LEFT: + case text::RelOrientation::PAGE_RIGHT: + m_pShapeStyle->append(";mso-position-horizontal-relative:page"); + break; + case text::RelOrientation::CHAR: + m_pShapeStyle->append(";mso-position-horizontal-relative:char"); + break; + default: + break; + } + + switch (m_eVOri) + { + case text::VertOrientation::TOP: + case text::VertOrientation::LINE_TOP: + case text::VertOrientation::CHAR_TOP: + m_pShapeStyle->append(";mso-position-vertical:top"); + break; + case text::VertOrientation::CENTER: + case text::VertOrientation::LINE_CENTER: + m_pShapeStyle->append(";mso-position-vertical:center"); + break; + case text::VertOrientation::BOTTOM: + case text::VertOrientation::LINE_BOTTOM: + case text::VertOrientation::CHAR_BOTTOM: + m_pShapeStyle->append(";mso-position-vertical:bottom"); + break; + default: + case text::VertOrientation::NONE: + break; + } + switch (m_eVRel) + { + case text::RelOrientation::PAGE_PRINT_AREA: + m_pShapeStyle->append(";mso-position-vertical-relative:margin"); + break; + case text::RelOrientation::PAGE_FRAME: + m_pShapeStyle->append(";mso-position-vertical-relative:page"); + break; + default: + break; + } + // add style m_pShapeAttrList->add( XML_style, m_pShapeStyle->makeStringAndClear() ); @@ -913,9 +993,13 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) } } -sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj ) +sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj, const sal_Int16 eHOri, const sal_Int16 eVOri, const sal_Int16 eHRel, const sal_Int16 eVRel ) { m_pSdrObject = &rObj; + m_eHOri = eHOri; + m_eVOri = eVOri; + m_eHRel = eHRel; + m_eVRel = eVRel; return EscherEx::AddSdrObject(rObj); } diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7e4f49cd43c5..b2aa7f3ff7ad 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2731,7 +2731,11 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po m_pSerializer->startElementNS( XML_w, XML_pict, FSEND ); - m_rExport.VMLExporter().AddSdrObject( *pSdrObj ); + // See WinwordAnchoring::SetAnchoring(), these are not part of the SdrObject, have to be passed around manually. + const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt(); + SwFmtHoriOrient rHoriOri = rFrmFmt.GetHoriOrient(); + SwFmtVertOrient rVertOri = rFrmFmt.GetVertOrient(); + m_rExport.VMLExporter().AddSdrObject( *pSdrObj, rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), rHoriOri.GetRelationOrient(), rVertOri.GetRelationOrient() ); m_pSerializer->endElementNS( XML_w, XML_pict ); |