include/editeng/unoprnms.hxx                |    2 ++
 include/svl/solar.hrc                       |    2 +-
 include/svx/unoshprp.hxx                    |    4 +++-
 sd/source/ui/inc/unoprnms.hxx               |    2 +-
 sd/source/ui/unoidl/unoobj.cxx              |    2 +-
 svx/source/unodraw/unoshap2.cxx             |   23 +++++++++++++++++++++++
 writerfilter/source/rtftok/rtfsdrimport.cxx |    4 ++++
 7 files changed, 35 insertions(+), 4 deletions(-)

New commits:
commit aba13d6b4b2d586b356e7b98a23a7796e30c37ec
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Wed Mar 13 07:35:09 2024 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Mar 13 22:11:40 2024 +0100

    tdf#152878 switch off replacment image in picture frame
    
    RTF documents may contain shapes of the type "Picture frame"
    ({\sn shapeType}{\sv 75}) that are imported as SdrGraphObj
    This change prevents the display of a replacement picture
    if there is no picture set.
    
    Change-Id: Ia3a576ddcb2a3bbffae859102d274d4ecd214f6c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164755
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
index 7f742f549833..947cfb0d1ca3 100644
--- a/include/editeng/unoprnms.hxx
+++ b/include/editeng/unoprnms.hxx
@@ -370,4 +370,6 @@ inline constexpr OUString UNO_NAME_GRAPHIC_TRANSPARENCY = 
u"Transparency"_ustr;
 inline constexpr OUString UNO_NAME_GRAPHIC_COLOR_MODE = 
u"GraphicColorMode"_ustr;
 inline constexpr OUString UNO_NAME_GRAPHIC_GRAPHICCROP = u"GraphicCrop"_ustr;
 
+inline constexpr OUString UNO_NAME_OBJ_ISEMPTYPRESOBJ = 
u"IsEmptyPresentationObject"_ustr;
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
index f1ec1a456829..a3a0ecd0ac0d 100644
--- a/include/svl/solar.hrc
+++ b/include/svl/solar.hrc
@@ -23,7 +23,7 @@
 // defines ------------------------------------------------------------------
 
 #define OWN_ATTR_VALUE_START                    3900
-#define OWN_ATTR_VALUE_END                      4008
+#define OWN_ATTR_VALUE_END                      4009
 
 #define RID_LIB_START               10000
 #define RID_LIB_END                 19999
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 0bf49b7a3e8c..9244f719a684 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -197,7 +197,8 @@
 #define OWN_ATTR_TEXTCOLUMNS                    (OWN_ATTR_VALUE_START+106)
 #define OWN_ATTR_HYPERLINK                      (OWN_ATTR_VALUE_START+107)
 #define OWN_ATTR_MISC_OBJ_DECORATIVE            (OWN_ATTR_VALUE_START+108)
-// ATTENTION: current maximum is OWN_ATTR_VALUE_START+108 svx; when adding 
values, update
+#define OWN_ATTR_OBJ_ISEMPTYPRESOBJ             (OWN_ATTR_VALUE_START+109)
+// ATTENTION: current maximum is OWN_ATTR_VALUE_START+109 svx; when adding 
values, update
 // OWN_ATTR_VALUE_END in include/svl/solar.hrc accordingly
 
 // #FontWork#
@@ -477,6 +478,7 @@
     { UNO_NAME_GRAPHOBJ_SIGNATURELINE_CAN_ADD_COMMENT, 
OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT, cppu::UnoType<bool>::get(), 0, 0}, \
     { UNO_NAME_GRAPHOBJ_SIGNATURELINE_UNSIGNED_IMAGE, 
OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE, 
cppu::UnoType<css::graphic::XGraphic>::get(), 0, 0}, \
     { UNO_NAME_GRAPHOBJ_SIGNATURELINE_IS_SIGNED,     
OWN_ATTR_SIGNATURELINE_IS_SIGNED   , cppu::UnoType<bool>::get(), 0, 0}, \
+    { UNO_NAME_OBJ_ISEMPTYPRESOBJ,            OWN_ATTR_OBJ_ISEMPTYPRESOBJ , 
cppu::UnoType<bool>::get(), 0, 0}, \
     { UNO_NAME_GRAPHOBJ_QRCODE,               OWN_ATTR_QRCODE            , 
cppu::UnoType<css::drawing::BarCode>::get(), 0, 0},
 
 #define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \
diff --git a/sd/source/ui/inc/unoprnms.hxx b/sd/source/ui/inc/unoprnms.hxx
index 1d3a9055257b..9753c1a2871a 100644
--- a/sd/source/ui/inc/unoprnms.hxx
+++ b/sd/source/ui/inc/unoprnms.hxx
@@ -44,7 +44,7 @@
 #define UNO_NAME_OBJ_DIMHIDE            "DimHide"
 #define UNO_NAME_OBJ_DIMPREV            "DimPrevious"
 #define UNO_NAME_OBJ_EFFECT             "Effect"
-#define UNO_NAME_OBJ_ISEMPTYPRESOBJ     "IsEmptyPresentationObject"
+#define UNO_NAME_OBJ_ISEMPTYPRESOBJ_SD     "IsEmptyPresentationObject"
 #define UNO_NAME_OBJ_ISPRESOBJ          "IsPresentationObject"
 #define UNO_NAME_OBJ_CLICKACTION        "OnClick"
 #define UNO_NAME_OBJ_PLAYFULL           "PlayFull"
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 1822bafe9155..07415ce3304e 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -112,7 +112,7 @@ using ::com::sun::star::drawing::XShape;
         { u"" UNO_NAME_OBJ_DIMHIDE ""_ustr, WID_DIMHIDE,       
cppu::UnoType<bool>::get(),                            0, 0},\
         { u"" UNO_NAME_OBJ_DIMPREV ""_ustr, WID_DIMPREV,       
cppu::UnoType<bool>::get(),                            0, 0},\
         { u"" UNO_NAME_OBJ_EFFECT ""_ustr, WID_EFFECT,         
cppu::UnoType<presentation::AnimationEffect>::get(),   0, 0},\
-        { u"" UNO_NAME_OBJ_ISEMPTYPRESOBJ ""_ustr,WID_ISEMPTYPRESOBJ, 
cppu::UnoType<bool>::get(),                            0, 0},\
+        { u"" UNO_NAME_OBJ_ISEMPTYPRESOBJ_SD ""_ustr,WID_ISEMPTYPRESOBJ, 
cppu::UnoType<bool>::get(),                            0, 0},\
         { u"" UNO_NAME_OBJ_ISPRESOBJ ""_ustr, WID_ISPRESOBJ,   
cppu::UnoType<bool>::get(),                            
css::beans::PropertyAttribute::READONLY, 0},\
         { u"" UNO_NAME_OBJ_MASTERDEPENDENT ""_ustr,WID_MASTERDEPEND, 
cppu::UnoType<bool>::get(),                            0, 0},\
         { u"" UNO_NAME_OBJ_CLICKACTION ""_ustr, WID_CLICKACTION, 
cppu::UnoType<presentation::ClickAction>::get(),       0, 0},\
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index c583bbb7111c..1c286966c2ef 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -1217,6 +1217,8 @@ bool SvxGraphicObject::setPropertyValueImpl( const 
OUString& rName, const SfxIte
                 bOk = true;
             }
         }
+        if (bOk)
+            GetSdrObject()->SetEmptyPresObj(false);
         break;
     }
 
@@ -1232,6 +1234,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const 
OUString& rName, const SfxIte
             if( HasSdrObject() )
             {
                 static_cast<SdrGrafObj*>(GetSdrObject())->SetGrafStreamURL( 
aStreamURL );
+                GetSdrObject()->SetEmptyPresObj(false);
             }
             bOk = true;
         }
@@ -1264,6 +1267,8 @@ bool SvxGraphicObject::setPropertyValueImpl( const 
OUString& rName, const SfxIte
                 }
             }
         }
+        if (bOk)
+            GetSdrObject()->SetEmptyPresObj(false);
         break;
     }
 
@@ -1273,6 +1278,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const 
OUString& rName, const SfxIte
         if( xGraphic.is() )
         {
             static_cast< SdrGrafObj*>( GetSdrObject() )->SetGraphic( xGraphic 
);
+            GetSdrObject()->SetEmptyPresObj(false);
             bOk = true;
         }
         break;
@@ -1377,6 +1383,17 @@ bool SvxGraphicObject::setPropertyValueImpl( const 
OUString& rName, const SfxIte
         break;
     }
 
+    case OWN_ATTR_OBJ_ISEMPTYPRESOBJ:
+    {
+        bool bIsEmptyPresObj;
+        if (rValue >>= bIsEmptyPresObj)
+        {
+            GetSdrObject()->SetEmptyPresObj(bIsEmptyPresObj);
+            bOk = true;
+        }
+        break;
+    }
+
     case OWN_ATTR_SIGNATURELINE_IS_SIGNED:
     {
         bool bIsSigned;
@@ -1542,6 +1559,12 @@ bool SvxGraphicObject::getPropertyValueImpl( const 
OUString& rName, const SfxIte
         break;
     }
 
+    case OWN_ATTR_OBJ_ISEMPTYPRESOBJ:
+    {
+        rValue <<= GetSdrObject()->IsEmptyPresObj();
+        break;
+    }
+
     case OWN_ATTR_QRCODE:
     {
         css::drawing::BarCode* ptr = 
static_cast<SdrGrafObj*>(GetSdrObject())->getQrCode();
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx 
b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 812a8e69f318..d9c57be4a8a8 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -402,6 +402,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, 
ShapeOrPict const shap
 
     bool bCustom(false);
     int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, 
shapeOrPict);
+    if (nType == ESCHER_ShpInst_PictureFrame && xPropertySet.is())
+    {
+        xPropertySet->setPropertyValue("IsEmptyPresentationObject", 
uno::Any(true));
+    }
 
     for (auto& rProperty : rShape.getProperties())
     {

Reply via email to