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

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Wed Mar 7 02:23:11 UTC 2018


 oox/source/drawingml/shapepropertymap.cxx |    2 -
 oox/source/export/drawingml.cxx           |   34 ++++++------------------------
 oox/source/export/shapes.cxx              |   31 ++++++++++++---------------
 oox/source/token/properties.txt           |    3 --
 sc/source/filter/inc/pagesettings.hxx     |    2 -
 sc/source/filter/oox/pagesettings.cxx     |   14 +++++++-----
 6 files changed, 31 insertions(+), 55 deletions(-)

New commits:
commit e030fbbf67a2490c4e734583d9f987c27506179e
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Mar 6 18:29:40 2018 +0900

    oox: remove property FillBitmapURL, BackGraphicURL and GraphicURL
    
    Change-Id: I1f75b1775fec4b47ad78a32724785333a90d3baf
    Reviewed-on: https://gerrit.libreoffice.org/50809
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/oox/source/drawingml/shapepropertymap.cxx b/oox/source/drawingml/shapepropertymap.cxx
index c0704381b19c..6d487f51c2ed 100644
--- a/oox/source/drawingml/shapepropertymap.cxx
+++ b/oox/source/drawingml/shapepropertymap.cxx
@@ -43,7 +43,7 @@ static const ShapePropertyIds spnDefaultShapeIds =
     PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineJoint,
     PROP_LineStartName, PROP_LineStartWidth, PROP_LineStartCenter, PROP_LineEndName, PROP_LineEndWidth, PROP_LineEndCenter,
     PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillTransparenceGradientName, PROP_FillGradient,
-    PROP_FillBitmapURL, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
+    PROP_FillBitmap, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
     PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
     PROP_FillHatch,
     PROP_ShadowXDistance,
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index d3ccf3d81223..ca7c303acd6e 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1220,39 +1220,25 @@ void DrawingML::WriteBlipFill( const Reference< XPropertySet >& rXPropSet, const
 {
     if ( GetProperty( rXPropSet, sURLPropName ) )
     {
+        uno::Reference<graphic::XGraphic> xGraphic;
         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())
-            {
-                bool bWriteMode = false;
-                if (sURLPropName == "FillBitmap" || sURLPropName == "BackGraphic")
-                    bWriteMode = true;
-                WriteXGraphicBlipFill(rXPropSet, xGraphic, nXmlNamespace, bWriteMode);
-            }
+            if (xBitmap.is())
+                xGraphic.set(xBitmap, uno::UNO_QUERY);
         }
         else if (mAny.has<uno::Reference<graphic::XGraphic>>())
         {
-            uno::Reference<graphic::XGraphic> xGraphic;
             xGraphic = mAny.get<uno::Reference<graphic::XGraphic>>();
-            if (xGraphic.is())
-            {
-                bool bWriteMode = false;
-                if (sURLPropName == "FillBitmap" || sURLPropName == "BackGraphic")
-                    bWriteMode = true;
-                WriteXGraphicBlipFill(rXPropSet, xGraphic, nXmlNamespace, bWriteMode);
-            }
         }
-        else
+
+        if (xGraphic.is())
         {
-            OUString aURL;
-            mAny >>= aURL;
             bool bWriteMode = false;
-            if( sURLPropName == "FillBitmapURL" || sURLPropName == "BackGraphicURL")
+            if (sURLPropName == "FillBitmap" || sURLPropName == "BackGraphic")
                 bWriteMode = true;
-            WriteBlipFill( rXPropSet, aURL, nXmlNamespace, bWriteMode );
+            WriteXGraphicBlipFill(rXPropSet, xGraphic, nXmlNamespace, bWriteMode);
         }
     }
 }
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 6754ee58558c..86dd843d12b7 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -22,7 +22,6 @@ BackColor
 BackColorTransparency
 BackGraphicLocation
 BackGraphic
-BackGraphicURL
 Background
 BackgroundColor
 BasicLibraries
@@ -167,7 +166,6 @@ FillBitmapPositionOffsetY
 FillBitmapRectanglePoint
 FillBitmapSizeX
 FillBitmapSizeY
-FillBitmapURL
 FillBitmap
 FillColor
 FillGradient
@@ -209,7 +207,6 @@ GraphicBitmap
 GraphicColorMode
 GraphicCrop
 GraphicSize
-GraphicURL
 GridColor
 GroupInfo
 GroupName
diff --git a/sc/source/filter/inc/pagesettings.hxx b/sc/source/filter/inc/pagesettings.hxx
index 03a0c8d32e36..2868d8eac4ad 100644
--- a/sc/source/filter/inc/pagesettings.hxx
+++ b/sc/source/filter/inc/pagesettings.hxx
@@ -34,7 +34,7 @@ class HeaderFooterParser;
 /** Holds page style data for a single sheet. */
 struct PageSettingsModel
 {
-    OUString     maGraphicUrl;           /// URL of the graphic object.
+    css::uno::Reference<css::graphic::XGraphic> mxGraphic; /// Background Graphic
     OUString     maBinSettPath;          /// Relation identifier of binary printer settings.
     OUString     maOddHeader;            /// Header string for odd pages.
     OUString     maOddFooter;            /// Footer string for odd pages.
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index 19aad8e64093..7dee9ab6d944 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -334,9 +334,11 @@ void PageSettings::finalizeImport()
 
 void PageSettings::importPictureData( const Relations& rRelations, const OUString& rRelId )
 {
-    OUString aPicturePath = rRelations.getFragmentPathFromRelId( rRelId );
-    if( !aPicturePath.isEmpty() )
-        maModel.maGraphicUrl = getBaseFilter().getGraphicHelper().importEmbeddedGraphicObject( aPicturePath );
+    OUString aPicturePath = rRelations.getFragmentPathFromRelId(rRelId);
+    if (!aPicturePath.isEmpty())
+    {
+        maModel.mxGraphic = getBaseFilter().getGraphicHelper().importEmbeddedGraphic(aPicturePath);
+    }
 }
 
 enum HFPortionId
@@ -979,10 +981,10 @@ void PageSettingsConverter::writePageSettingsProperties(
     aPropMap.setProperty( PROP_FooterHeight, maFooterData.mnHeight);
     aPropMap.setProperty( PROP_FooterBodyDistance, maFooterData.mnBodyDist);
     // background image
-    if( !rModel.maGraphicUrl.isEmpty() )
+    if (rModel.mxGraphic.is())
     {
-        aPropMap.setProperty( PROP_BackGraphicURL, rModel.maGraphicUrl);
-        aPropMap.setProperty( PROP_BackGraphicLocation, css::style::GraphicLocation_TILED);
+        aPropMap.setProperty(PROP_BackGraphic, rModel.mxGraphic);
+        aPropMap.setProperty(PROP_BackGraphicLocation, css::style::GraphicLocation_TILED);
     }
 
     rPropSet.setProperties( aPropMap );
commit d55a7fca9c1bb1989d5a70d2d9098a9156c82ac4
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Mar 6 16:48:24 2018 +0900

    oox: remove use of "GraphicURL" property
    
    Change-Id: I9e65eecf9a1065015ab0872734a41afdd04abb8d
    Reviewed-on: https://gerrit.libreoffice.org/50792
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 469420e0d616..d3ccf3d81223 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2089,7 +2089,6 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
     sal_Unicode aBulletChar = 0x2022; // a bullet
     awt::FontDescriptor aFontDesc;
     bool bHasFontDesc = false;
-    OUString aGraphicURL;
     uno::Reference<graphic::XGraphic> xGraphic;
     sal_Int16 nBulletRelSize = 0;
     sal_Int16 nStartWith = 1;
@@ -2153,11 +2152,6 @@ void DrawingML::WriteParagraphNumbering(const Reference< XPropertySet >& rXPropS
             auto xBitmap = pPropValue[i].Value.get<uno::Reference<awt::XBitmap>>();
             xGraphic.set(xBitmap, uno::UNO_QUERY);
         }
-        else if ( aPropName == "GraphicURL" )
-        {
-            aGraphicURL = *o3tl::doAccess<OUString>(pPropValue[i].Value);
-            SAL_INFO("oox.shape", "graphic url: " << aGraphicURL);
-        }
         else if ( aPropName == "GraphicSize" )
         {
             aGraphicSize = *o3tl::doAccess<awt::Size>(pPropValue[i].Value);
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 21ceaa11440c..6a2706693611 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1097,21 +1097,23 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape
 
     SAL_INFO("oox.shape", "graphicObject without text");
 
-    OUString sGraphicURL;
     uno::Reference<graphic::XGraphic> xGraphic;
     OUString sMediaURL;
 
     Reference< XPropertySet > xShapeProps( xShape, UNO_QUERY );
 
-    bool bHasGraphicURL = xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName("GraphicURL") && (xShapeProps->getPropertyValue("GraphicURL") >>= sGraphicURL);
-
-    if (xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName("Graphic"))
+    if (pGraphic)
+    {
+        xGraphic.set(pGraphic->GetXGraphic());
+    }
+    else if (xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName("Graphic"))
+    {
         xShapeProps->getPropertyValue("Graphic") >>= xGraphic;
+    }
 
-    bool bHasAnyGraphic = bHasGraphicURL || xGraphic.is();
     bool bHasMediaURL = xShapeProps.is() && xShapeProps->getPropertySetInfo()->hasPropertyByName("MediaURL") && (xShapeProps->getPropertyValue("MediaURL") >>= sMediaURL);
 
-    if (!pGraphic && !bHasAnyGraphic && !bHasMediaURL)
+    if (!xGraphic.is() && !bHasMediaURL)
     {
         SAL_INFO("oox.shape", "no graphic or media URL found");
         return;
@@ -1169,24 +1171,19 @@ void ShapeExport::WriteGraphicObjectShapePart( const Reference< XShape >& xShape
     {
         WriteXGraphicBlip(xShapeProps, xGraphic, false);
     }
-    else if (pGraphic || bHasGraphicURL)
-    {
-        WriteBlip(xShapeProps, sGraphicURL, false, pGraphic);
-    }
     else if (bHasMediaURL)
     {
-        Reference<graphic::XGraphic> rGraphic;
+        Reference<graphic::XGraphic> xFallbackGraphic;
         if (xShapeProps->getPropertySetInfo()->hasPropertyByName("FallbackGraphic"))
-            xShapeProps->getPropertyValue("FallbackGraphic") >>= rGraphic;
+            xShapeProps->getPropertyValue("FallbackGraphic") >>= xFallbackGraphic;
 
-        Graphic aGraphic(rGraphic);
-        WriteBlip(xShapeProps, sMediaURL, false, &aGraphic);
+        WriteXGraphicBlip(xShapeProps, xFallbackGraphic, false);
     }
 
-    if (bHasGraphicURL)
-        WriteSrcRect(xShapeProps, sGraphicURL);
-    else if (xGraphic.is())
+    if (xGraphic.is())
+    {
         WriteSrcRectXGraphic(xShapeProps, xGraphic);
+    }
 
     // now we stretch always when we get pGraphic (when changing that
     // behavior, test n#780830 for regression, where the OLE sheet might get tiled


More information about the Libreoffice-commits mailing list