[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/source

Miklos Vajna vmiklos at suse.cz
Thu Jun 13 08:14:35 PDT 2013


 include/oox/export/vmlexport.hxx             |    5 -
 oox/source/export/vmlexport.cxx              |  109 ++++++++++++++++++++++++++-
 sw/source/filter/ww8/docxattributeoutput.cxx |    6 +
 3 files changed, 116 insertions(+), 4 deletions(-)

New commits:
commit 175d28d564ff552cd3d73c3b087216bc82a763a1
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 13 17:02:11 2013 +0200

    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

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 4e790c5..31f5241 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 e2df5cf..a93bdb5 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 7e4f49c..b2aa7f3 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 );
 
commit 1f2e2563a60bfc3a4c5b81b99beb8eef674d13f2
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jun 13 14:13:49 2013 +0200

    fdo#58819 initial VML export of ESCHER_Prop_gtextUNICODE
    
    Change-Id: I67b5dc102fc264d0a643620bbdc5796bdaa46d82

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index ca5e625..e2df5cf 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -27,6 +27,7 @@
 #include <tools/stream.hxx>
 #include <svx/svdotext.hxx>
 #include <vcl/cvtgrf.hxx>
+#include <filter/msfilter/msdffimp.hxx>
 
 #include <cstdio>
 
@@ -688,6 +689,26 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                     }
                 }
                 break;
+            case ESCHER_Prop_gtextUNICODE:
+                {
+                    SvMemoryStream aStream;
+                    aStream.Write(it->pBuf, it->nPropSize);
+                    aStream.Seek(0);
+                    OUString aTextPathString = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true);
+
+                    m_pSerializer->singleElementNS( XML_v, XML_path,
+                            XML_textpathok, "t",
+                            FSEND );
+
+                    m_pSerializer->singleElementNS( XML_v, XML_textpath,
+                            XML_on, "t",
+                            XML_fitshape, "t",
+                            XML_string, OUStringToOString(aTextPathString, RTL_TEXTENCODING_UTF8),
+                            FSEND );
+
+                    bAlreadyWritten[ESCHER_Prop_gtextUNICODE] = true;
+                }
+                break;
             default:
 #if OSL_DEBUG_LEVEL > 0
                 fprintf( stderr, "TODO VMLExport::Commit(), unimplemented id: %d, value: %" SAL_PRIuUINT32 ", data: [%" SAL_PRIuUINT32 ", %p]\n",
@@ -851,7 +872,7 @@ sal_Int32 VMLExport::StartShape()
 
     // now check if we have some text and we have a text exporter registered
     const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
-    if (pTxtObj && m_pTextExport)
+    if (pTxtObj && m_pTextExport && m_nShapeType != ESCHER_ShpInst_TextPlainText)
     {
         const OutlinerParaObject* pParaObj = 0;
         bool bOwnParaObj = false;


More information about the Libreoffice-commits mailing list