More-uses-of-referer-URL-with-SvxBrushItem
authorDebian LibreOffice Maintainers <debian-openoffice@lists.debian.org>
Tue, 6 Aug 2019 18:20:01 +0000 (19:20 +0100)
committerRene Engelhard <rene@debian.org>
Tue, 6 Aug 2019 18:20:01 +0000 (19:20 +0100)
Gbp-Pq: Name More-uses-of-referer-URL-with-SvxBrushItem.diff

sw/inc/unosett.hxx
sw/source/core/text/porfld.cxx
sw/source/core/text/porfld.hxx
sw/source/core/text/txtfld.cxx
sw/source/core/unocore/unosett.cxx
sw/source/uibase/config/StoredChapterNumbering.cxx

index dff4f1f8aee0bfc909e365663d790a2d0e5de593..0aa6daefce3613a2bfcec71d7efaab6647588845 100644 (file)
@@ -208,7 +208,7 @@ public:
 
     static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat(
             const SwNumFormat& rFormat, OUString const& rCharFormatName,
-            OUString const* pHeadingStyleName);
+            OUString const* pHeadingStyleName, OUString const & referer);
     static void SetPropertiesToNumFormat(
             SwNumFormat & aFormat,
             OUString & rCharStyleName,
index 8c489de68590056053939bcbc0f43158f0242cb0..c3de3a25128e8315c0e5d5bc18badc2d82fad583 100644 (file)
@@ -756,7 +756,7 @@ SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet,
 SwGrfNumPortion::SwGrfNumPortion(
         SwFrame*,
         const OUString& rGraphicFollowedBy,
-        const SvxBrushItem* pGrfBrush,
+        const SvxBrushItem* pGrfBrush, OUString const & referer,
         const SwFormatVertOrient* pGrfOrient, const Size& rGrfSize,
         const bool bLft, const bool bCntr, const sal_uInt16 nMinDst,
         const bool bLabelAlignmentPosAndSpaceModeActive ) :
@@ -770,7 +770,7 @@ SwGrfNumPortion::SwGrfNumPortion(
     if( pGrfBrush )
     {
         *pBrush = *pGrfBrush;
-        const Graphic* pGraph = pGrfBrush->GetGraphic();
+        const Graphic* pGraph = pGrfBrush->GetGraphic(referer);
         if( pGraph )
             SetAnimated( pGraph->IsAnimated() );
         else
index cc5e350dbefa72e05299a6b5b69db7a3247fa50d..a4f94d5147a11ff3d5eefff3d12264e8ee918c1d 100644 (file)
@@ -172,6 +172,7 @@ public:
     SwGrfNumPortion( SwFrame *pFrame,
                      const OUString& rGraphicFollowedBy,
                      const SvxBrushItem* pGrfBrush,
+                     OUString const & referer,
                      const SwFormatVertOrient* pGrfOrient,
                      const Size& rGrfSize,
                      const bool bLeft,
index d024e556ea431c8b31b406013b4f0b07ec4964f2..26725e1cba3a35979b32bbf6dae70eb36a3afadf 100644 (file)
@@ -52,6 +52,7 @@
 #include "flddat.hxx"
 #include "fmtautofmt.hxx"
 #include <IDocumentSettingAccess.hxx>
+#include <sfx2/docfile.hxx>
 #include <svl/itemiter.hxx>
 
 static bool lcl_IsInBody( SwFrame *pFrame )
@@ -478,9 +479,18 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
 
         if( SVX_NUM_BITMAP == rNumFormat.GetNumberingType() )
         {
+            OUString referer;
+            if (auto const sh1 = rInf.GetVsh()) {
+                if (auto const doc = sh1->GetDoc()) {
+                    auto const sh2 = doc->GetPersist();
+                    if (sh2 != nullptr && sh2->HasName()) {
+                        referer = sh2->GetMedium()->GetName();
+                    }
+                }
+            }
             pRet = new SwGrfNumPortion( const_cast<SwTextFrame*>(GetTextFrame()),
                                         pTextNd->GetLabelFollowedBy(),
-                                        rNumFormat.GetBrush(),
+                                        rNumFormat.GetBrush(), referer,
                                         rNumFormat.GetGraphicOrientation(),
                                         rNumFormat.GetGraphicSize(),
                                         bLeft, bCenter, nMinDist,
index 81fd65d30a05e56aa6118e215d5a5f222b5ab5b5..afbee31d03407d84d3febb85dbba1af6ade7f3eb 100644 (file)
@@ -54,6 +54,7 @@
 #include <vcl/font.hxx>
 #include <editeng/flstitem.hxx>
 #include <vcl/metric.hxx>
+#include <sfx2/docfile.hxx>
 #include <svtools/ctrltool.hxx>
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
@@ -1341,13 +1342,21 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
         SwStyleNameMapper::FillProgName(sValue, aUString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, true);
     }
 
-    return GetPropertiesForNumFormat(rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr);
+    OUString referer;
+    if (pDoc != nullptr) {
+        auto const sh = pDoc->GetPersist();
+        if (sh != nullptr && sh->HasName()) {
+            referer = sh->GetMedium()->GetName();
+        }
+    }
+    return GetPropertiesForNumFormat(
+        rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr, referer);
 
 }
 
 uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat(
         const SwNumFormat& rFormat, OUString const& rCharFormatName,
-        OUString const*const pHeadingStyleName)
+        OUString const*const pHeadingStyleName, OUString const & referer)
 {
     bool bChapterNum = pHeadingStyleName != nullptr;
 
@@ -1479,7 +1488,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
             //graphicbitmap
             const Graphic* pGraphic = nullptr;
             if(pBrush )
-                pGraphic = pBrush->GetGraphic();
+                pGraphic = pBrush->GetGraphic(referer);
             if(pGraphic)
             {
                 uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
index 75b49a22a085b4f06422f20083aaaa9893972633..793c13719c5f5228d6c2148bcca05b2d499b42a5 100644 (file)
@@ -135,7 +135,7 @@ public:
         OUString dummy; // pass in empty HeadingStyleName - can't import anyway
         uno::Sequence<beans::PropertyValue> const ret(
             SwXNumberingRules::GetPropertiesForNumFormat(
-                *pNumFormat, *pCharStyleName, &dummy));
+                *pNumFormat, *pCharStyleName, &dummy, ""));
         return uno::makeAny(ret);
     }