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

Miklos Vajna vmiklos at suse.cz
Sat Jun 15 01:44:01 PDT 2013


 include/oox/export/vmlexport.hxx             |    7 ++
 oox/source/export/vmlexport.cxx              |   69 +++++++++++++++++++++------
 sw/source/filter/ww8/docxattributeoutput.cxx |    7 +-
 3 files changed, 66 insertions(+), 17 deletions(-)

New commits:
commit 43b057760472c0131a83227cf4d35db2bca2d0e4
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Jun 15 10:41:08 2013 +0200

    fdo#58819 VML export of ESCHER_Prop_fillOpacity
    
    Change-Id: Ic50be88b484e5bfba60c5bd8dafb7e6da0b33c9e

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 325f87e..710fe93 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -516,6 +516,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
             case ESCHER_Prop_fillBackColor: // 387
             case ESCHER_Prop_fillBlip: // 390
             case ESCHER_Prop_fNoFillHitTest: // 447
+            case ESCHER_Prop_fillOpacity: // 386
                 {
                     sal_uInt32 nValue;
                     sax_fastparser::FastAttributeList *pAttrList = m_pSerializer->createAttrList();
@@ -567,6 +568,10 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                     if ( rProps.GetOpt( ESCHER_Prop_fNoFillHitTest, nValue ) )
                         impl_AddBool( pAttrList, XML_detectmouseclick, nValue );
 
+                    if (rProps.GetOpt(ESCHER_Prop_fillOpacity, nValue))
+                        // Partly undo the transformation at the end of EscherPropertyContainer::CreateFillProperties(): VML opacity is 0..1.
+                        pAttrList->add(XML_opacity, OString::number(double((nValue * 100) >> 16) / 100));
+
                     m_pSerializer->singleElementNS( XML_v, XML_fill, XFastAttributeListRef( pAttrList ) );
                 }
                 bAlreadyWritten[ ESCHER_Prop_fillType ] = true;
@@ -574,6 +579,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                 bAlreadyWritten[ ESCHER_Prop_fillBackColor ] = true;
                 bAlreadyWritten[ ESCHER_Prop_fillBlip ] = true;
                 bAlreadyWritten[ ESCHER_Prop_fNoFillHitTest ] = true;
+                bAlreadyWritten[ ESCHER_Prop_fillOpacity ] = true;
                 break;
 
             case ESCHER_Prop_lineColor: // 448
commit 98f90fdecc030b3789c0811cff8603709e5fec30
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 14 18:04:55 2013 +0200

    fdo#58819 VML export of ESCHER_Prop_gtextFont
    
    Change-Id: Id0404405b41d5137e726670a959d5e314eb8f2ec

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index f37bdf8..325f87e 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -708,23 +708,41 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                 }
                 break;
             case ESCHER_Prop_gtextUNICODE:
+            case ESCHER_Prop_gtextFont:
                 {
-                    SvMemoryStream aStream;
-                    aStream.Write(it->pBuf, it->nPropSize);
-                    aStream.Seek(0);
-                    OUString aTextPathString = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true);
+                    EscherPropSortStruct aUnicode;
+                    if (rProps.GetOpt(ESCHER_Prop_gtextUNICODE, aUnicode))
+                    {
+                        SvMemoryStream aStream;
+                        aStream.Write(it->pBuf, it->nPropSize);
+                        aStream.Seek(0);
+                        OUString aTextPathString = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true);
+                        aStream.Seek(0);
 
-                    m_pSerializer->singleElementNS( XML_v, XML_path,
-                            XML_textpathok, "t",
-                            FSEND );
+                        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 );
+                        sax_fastparser::FastAttributeList* pAttrList = m_pSerializer->createAttrList();
+                        pAttrList->add(XML_on, "t");
+                        pAttrList->add(XML_fitshape, "t");
+                        pAttrList->add(XML_string, OUStringToOString(aTextPathString, RTL_TEXTENCODING_UTF8));
+                        EscherPropSortStruct aFont;
+                        OUString aStyle;
+                        if (rProps.GetOpt(ESCHER_Prop_gtextFont, aFont))
+                        {
+                            aStream.Write(aFont.pBuf, aFont.nPropSize);
+                            aStream.Seek(0);
+                            OUString aTextPathFont = SvxMSDffManager::MSDFFReadZString(aStream, aFont.nPropSize, true);
+                            aStyle += "font-family:\"" + aTextPathFont + "\"";
+                        }
+                        if (!aStyle.isEmpty())
+                            pAttrList->add(XML_style, OUStringToOString(aStyle, RTL_TEXTENCODING_UTF8));
+                        m_pSerializer->singleElementNS(XML_v, XML_textpath, XFastAttributeListRef(pAttrList));
+                    }
 
                     bAlreadyWritten[ESCHER_Prop_gtextUNICODE] = true;
+                    bAlreadyWritten[ESCHER_Prop_gtextFont] = true;
                 }
                 break;
             case ESCHER_Prop_Rotation:
commit 12322f5fd2a67e3f21029ac3511aa54d96fc1cab
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 14 17:39:50 2013 +0200

    fdo#58819 VML export of ESCHER_Prop_fNoLineDrawDash
    
    With this, the bugdoc is (correctly) no longer stroked.
    
    Change-Id: Iaf00e17f2535ece2be09dc8ec0d383f2218a6050

diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 8806553..f37bdf8 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -734,6 +734,13 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
                     bAlreadyWritten[ESCHER_Prop_Rotation] = true;
                 }
                 break;
+            case ESCHER_Prop_fNoLineDrawDash:
+                {
+                    // See DffPropertyReader::ApplyLineAttributes().
+                    impl_AddBool( m_pShapeAttrList, XML_stroked, it->nPropValue & 8 );
+                    bAlreadyWritten[ESCHER_Prop_fNoLineDrawDash] = true;
+                }
+                break;
             default:
 #if OSL_DEBUG_LEVEL > 0
                 fprintf( stderr, "TODO VMLExport::Commit(), unimplemented id: %d, value: %" SAL_PRIuUINT32 ", data: [%" SAL_PRIuUINT32 ", %p]\n",
commit 559d194d80a20b17ba6aa6f94a7749bcc59c871e
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 14 11:23:13 2013 +0200

    fdo#58819 DOCX VML export: fix shape size for rotated shapes
    
    The problem is that we wrote the size of the shape itself, while VML wants the
    bounding box here. The WW8 export ignores the rectangle given in
    EscherEx::Commit(), uses SdrObject::GetSnapRect() instead and later refines the
    position by using the point got in WW8AttributeOutput::OutputFlyFrame_Impl(),
    see PlcDrawObj::WritePlc().
    
    Do the same in the VML export, i.e. ignore the Rectangle we get in
    VMLExport::Commit() and use SdrObject::GetSnapRect() + the point given
    in DocxAttributeOutput::OutputFlyFrame_Impl() instead.
    
    Change-Id: I5adbdf205792c87f92c1ddf1cf674f87e11eb54e

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 31f5241..57f8889 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -53,6 +53,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
     /// Anchoring.
     sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel;
 
+    /// Parent position.
+    const Point* m_pNdTopLeft;
+
     /// The object we're exporting.
     const SdrObject* m_pSdrObject;
 
@@ -83,7 +86,9 @@ public:
     /// Export the sdr object as VML.
     ///
     /// Call this when you need to export the object as VML.
-    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 );
+    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, const Point* pNdTopLeft = 0 );
 
 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 63f27a3..8806553 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -48,6 +48,7 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport*
     , m_eVOri( 0 )
     , m_eHRel( 0 )
     , m_eVRel( 0 )
+    , m_pNdTopLeft( 0 )
     , m_pSdrObject( 0 )
     , m_pShapeAttrList( NULL )
     , m_nShapeType( ESCHER_ShpInst_Nil )
@@ -324,7 +325,15 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
     if ( m_nShapeType == ESCHER_ShpInst_Line )
         AddLineDimensions( rRect );
     else
-        AddRectangleDimensions( *m_pShapeStyle, rRect );
+    {
+        Rectangle aRect(rRect);
+        if (m_pNdTopLeft)
+        {
+            aRect = m_pSdrObject->GetSnapRect();
+            aRect -= *m_pNdTopLeft;
+        }
+        AddRectangleDimensions( *m_pShapeStyle, aRect );
+    }
 
     // properties
     bool bAlreadyWritten[ 0xFFF ];
@@ -1000,13 +1009,14 @@ void VMLExport::EndShape( sal_Int32 nShapeElement )
     }
 }
 
-sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj, const sal_Int16 eHOri, const sal_Int16 eVOri, const sal_Int16 eHRel, const sal_Int16 eVRel )
+sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj, const sal_Int16 eHOri, const sal_Int16 eVOri, const sal_Int16 eHRel, const sal_Int16 eVRel, const Point* pNdTopLeft )
 {
     m_pSdrObject = &rObj;
     m_eHOri = eHOri;
     m_eVOri = eVOri;
     m_eHRel = eHRel;
     m_eVRel = eVRel;
+    m_pNdTopLeft = pNdTopLeft;
     return EscherEx::AddSdrObject(rObj);
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b2aa7f3..d2049fc 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2689,7 +2689,7 @@ void DocxAttributeOutput::WritePostponedMath()
     m_postponedMath = NULL;
 }
 
-void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Point& /*rNdTopLeft*/ )
+void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Point& rNdTopLeft )
 {
     m_pSerializer->mark();
 
@@ -2735,7 +2735,10 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                     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_rExport.VMLExporter().AddSdrObject( *pSdrObj,
+                            rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(),
+                            rHoriOri.GetRelationOrient(),
+                            rVertOri.GetRelationOrient(), &rNdTopLeft );
 
                     m_pSerializer->endElementNS( XML_w, XML_pict );
 


More information about the Libreoffice-commits mailing list