[Libreoffice-commits] core.git: drawinglayer/source filter/source oox/source sd/source svx/source

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Sun Feb 18 07:57:30 UTC 2018


 drawinglayer/source/dumper/XShapeDumper.cxx |   13 -------------
 filter/source/msfilter/escherex.cxx         |    8 ++------
 oox/source/export/drawingml.cxx             |   27 ++++++++++++++++++++-------
 sd/source/ui/unoidl/unopback.cxx            |    9 ++++-----
 svx/source/xoutdev/xattrbmp.cxx             |   13 +++----------
 5 files changed, 29 insertions(+), 41 deletions(-)

New commits:
commit cea0ceff755d57ad3feaffda9cff82f742ea7b82
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Sat Feb 17 17:25:50 2018 +0900

    remove use of FillBitmapURL and use FillBitmap as the alternative
    
    This is under the ongoing work to get rit of all usage of
    GraphicObject URLs
    
    Change-Id: I900e435ac36a4012ec36a2f0c1d909982c82660a
    Reviewed-on: https://gerrit.libreoffice.org/49895
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index cade10e0d5c8..e610d9b2d77d 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -50,7 +50,6 @@ void dumpFillGradientAsElement(const css::awt::Gradient& rGradient, xmlTextWrite
 void dumpFillHatchAsElement(const css::drawing::Hatch& rHatch, xmlTextWriterPtr xmlWriter);
 void dumpFillBackgroundAsAttribute(bool bBackground, xmlTextWriterPtr xmlWriter);
 void dumpFillBitmapAsElement(const css::uno::Reference<css::awt::XBitmap>& xBitmap, xmlTextWriterPtr xmlWriter);
-void dumpFillBitmapURLAsAttribute(const OUString& sBitmapURL, xmlTextWriterPtr xmlWriter);
 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter);
 void dumpFillBitmapPositionOffsetYAsAttribute(sal_Int32 aBitmapPositionOffsetY, xmlTextWriterPtr xmlWriter);
 void dumpFillBitmapOffsetXAsAttribute(sal_Int32 aBitmapOffsetX, xmlTextWriterPtr xmlWriter);
@@ -317,12 +316,6 @@ void dumpFillBitmapAsElement(const uno::Reference<awt::XBitmap>& xBitmap, xmlTex
     xmlTextWriterEndElement( xmlWriter );
 }
 
-void dumpFillBitmapURLAsAttribute(const OUString& sBitmapURL, xmlTextWriterPtr xmlWriter)
-{
-    xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapURL"), "%s",
-        OUStringToOString(sBitmapURL, RTL_TEXTENCODING_UTF8).getStr());
-}
-
 void dumpFillBitmapPositionOffsetXAsAttribute(sal_Int32 aBitmapPositionOffsetX, xmlTextWriterPtr xmlWriter)
 {
     xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("fillBitmapPositionOffsetX"), "%" SAL_PRIdINT32, aBitmapPositionOffsetX);
@@ -1451,12 +1444,6 @@ void dumpFillPropertiesService(const uno::Reference< beans::XPropertySet >& xPro
             dumpFillBitmapAsElement(xBitmap, xmlWriter);
     }
     {
-        uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapURL");
-        OUString sBitmapURL;
-        if(anotherAny >>= sBitmapURL)
-            dumpFillBitmapURLAsAttribute(sBitmapURL, xmlWriter);
-    }
-    {
         uno::Any anotherAny = xPropSet->getPropertyValue("FillBitmapPositionOffsetX");
         sal_Int32 aBitmapPositionOffsetX = sal_Int32();
         if(anotherAny >>= aBitmapPositionOffsetX)
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index 8d4b055f6a24..e585b787b866 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -587,7 +587,7 @@ void EscherPropertyContainer::CreateFillProperties(
 
             case drawing::FillStyle_BITMAP :
             {
-                CreateGraphicProperties( rXPropSet, "FillBitmapURL", true );
+                CreateGraphicProperties(rXPropSet, "FillBitmap", true);
                 AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
                 AddOpt( ESCHER_Prop_fillBackColor, nFillBackColor  );
             }
@@ -1445,7 +1445,7 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
                 }
             }
         }
-        else if ( rSource == "Bitmap" )
+        else if (rSource == "Bitmap" || rSource == "FillBitmap")
         {
             uno::Reference<awt::XBitmap> xBitmap(aAny, uno::UNO_QUERY);
             if (xBitmap.is())
@@ -1461,10 +1461,6 @@ bool EscherPropertyContainer::CreateGraphicProperties(const uno::Reference<beans
                 }
             }
         }
-        else if ( rSource == "FillBitmapURL" )
-        {
-            aGraphicUrl = *o3tl::doAccess<OUString>(aAny);
-        }
         else if ( rSource == "GraphicURL" )
         {
             aGraphicUrl = *o3tl::doAccess<OUString>(aAny);
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 52807f28be3d..f71e0879effb 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1220,12 +1220,25 @@ void DrawingML::WriteBlipFill( const Reference< XPropertySet >& rXPropSet, const
 {
     if ( GetProperty( rXPropSet, sURLPropName ) )
     {
-        OUString aURL;
-        mAny >>= aURL;
-        bool bWriteMode = false;
-        if( sURLPropName == "FillBitmapURL" || sURLPropName == "BackGraphicURL")
-            bWriteMode = true;
-        WriteBlipFill( rXPropSet, aURL, nXmlNamespace, bWriteMode );
+        if (mAny.has<uno::Reference<awt::XBitmap>>())
+        {
+            uno::Reference<awt::XBitmap> xBitmap;
+            xBitmap = mAny.get<uno::Reference<awt::XBitmap>>();
+            uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
+            if (xBitmap.is() && xGraphic.is())
+            {
+                WriteXGraphicBlipFill(rXPropSet, xGraphic, nXmlNamespace, true);
+            }
+        }
+        else
+        {
+            OUString aURL;
+            mAny >>= aURL;
+            bool bWriteMode = false;
+            if( sURLPropName == "FillBitmapURL" || sURLPropName == "BackGraphicURL")
+                bWriteMode = true;
+            WriteBlipFill( rXPropSet, aURL, nXmlNamespace, bWriteMode );
+        }
     }
 }
 
@@ -3135,7 +3148,7 @@ void DrawingML::WriteFill( const Reference< XPropertySet >& xPropSet )
         WriteGradientFill( xPropSet );
         break;
     case FillStyle_BITMAP :
-        WriteBlipFill( xPropSet, "FillBitmapURL" );
+        WriteBlipFill( xPropSet, "FillBitmap" );
         break;
     case FillStyle_HATCH :
         WritePattFill( xPropSet );
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 97f6c5e984f7..0c7f82daaa2d 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -146,14 +146,13 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet )
                         break;
                         case XATTR_FILLBITMAP :
                         {
-                            if ( ( ( pAny->getValueType() == cppu::UnoType<css::awt::XBitmap>::get()) ||
-                                    ( pAny->getValueType() == cppu::UnoType<css::graphic::XGraphic>::get()) ) &&
-                                    ( aIt->nMemberId == MID_BITMAP ) )
+                            if (aIt->nMemberId == MID_BITMAP &&
+                                (pAny->getValueType() == cppu::UnoType<css::awt::XBitmap>::get() ||
+                                 pAny->getValueType() == cppu::UnoType<css::graphic::XGraphic>::get()))
                             {
                                 setPropertyValue( aPropertyName, *pAny );
                             }
-                            else if ( ( pAny->getValueType() == ::cppu::UnoType<OUString>::get() ) &&
-                                        ( ( aIt->nMemberId == MID_NAME ) || ( aIt->nMemberId == MID_GRAFURL ) ) )
+                            else if (pAny->getValueType() == ::cppu::UnoType<OUString>::get() && aIt->nMemberId == MID_NAME)
                             {
                                 setPropertyValue( aPropertyName, *pAny );
                             }
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index 6bb58e9707bb..8e6e5afb18a8 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -274,8 +274,7 @@ bool XFillBitmapItem::QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId) const
         aInternalName = GetName();
     }
 
-    if( nMemberId == MID_GRAFURL ||
-        nMemberId == 0 )
+    if (nMemberId == MID_GRAFURL)
     {
         aURL = UNO_NAME_GRAPHOBJ_URLPREFIX;
         aURL += OStringToOUString(
@@ -302,10 +301,8 @@ bool XFillBitmapItem::QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId) const
 
         aPropSeq[0].Name  = "Name";
         aPropSeq[0].Value <<= aInternalName;
-        aPropSeq[1].Name  = "FillBitmapURL";
-        aPropSeq[1].Value <<= aURL;
-        aPropSeq[2].Name  = "Bitmap";
-        aPropSeq[2].Value <<= xBmp;
+        aPropSeq[1].Name  = "Bitmap";
+        aPropSeq[1].Value <<= xBmp;
 
         rVal <<= aPropSeq;
     }
@@ -328,8 +325,6 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
 
     if( nMemberId == MID_NAME )
         bSetName = (rVal >>= aName);
-    else if( nMemberId == MID_GRAFURL )
-        bSetURL = (rVal >>= aURL);
     else if( nMemberId == MID_BITMAP )
     {
         bSetBitmap = (rVal >>= xBmp);
@@ -346,8 +341,6 @@ bool XFillBitmapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
             {
                 if ( aPropSeq[n].Name == "Name" )
                     bSetName = (aPropSeq[n].Value >>= aName);
-                else if ( aPropSeq[n].Name == "FillBitmapURL" )
-                    bSetURL = (aPropSeq[n].Value >>= aURL);
                 else if ( aPropSeq[n].Name == "Bitmap" )
                     bSetBitmap = (aPropSeq[n].Value >>= xBmp);
             }


More information about the Libreoffice-commits mailing list