kbrown / rpms / libreoffice

Forked from rpms/libreoffice 2 years ago
Clone
2ceb93
From 952553d3998a1d6fbb0d197f81b769438a48a372 Mon Sep 17 00:00:00 2001
2ceb93
From: Stephan Bergmann <sbergman@redhat.com>
2ceb93
Date: Fri, 7 Jun 2019 09:28:12 +0200
2ceb93
Subject: [PATCH] More uses of referer URL with SvxBrushItem
2ceb93
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/73643
2ceb93
Tested-by: Jenkins
2ceb93
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2ceb93
(cherry picked from commit b518882de8213ef71a8003f95fbdf7689069c06d)
2ceb93
Conflicts:
2ceb93
	sw/source/core/text/porfld.cxx
2ceb93
	sw/source/core/unocore/unosett.cxx
2ceb93
2ceb93
Change-Id: I04b524784df4ef453d8b1feec13b62f183a17e23
2ceb93
Reviewed-on: https://gerrit.libreoffice.org/73860
2ceb93
Tested-by: Jenkins
2ceb93
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2ceb93
---
2ceb93
 sw/inc/unosett.hxx                                |  2 +-
2ceb93
 sw/source/core/text/porfld.cxx                    |  4 ++--
2ceb93
 sw/source/core/text/porfld.hxx                    |  1 +
2ceb93
 sw/source/core/text/txtfld.cxx                    | 12 +++++++++++-
2ceb93
 sw/source/core/unocore/unosett.cxx                | 15 ++++++++++++---
2ceb93
 .../uibase/config/StoredChapterNumbering.cxx      |  2 +-
2ceb93
 6 files changed, 28 insertions(+), 8 deletions(-)
2ceb93
2ceb93
diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx
2ceb93
index 295eb06..185b5bc 100644
2ceb93
--- a/sw/inc/unosett.hxx
2ceb93
+++ b/sw/inc/unosett.hxx
2ceb93
@@ -210,7 +210,7 @@ public:
2ceb93
 
2ceb93
     static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat(
2ceb93
             const SwNumFormat& rFormat, OUString const& rCharFormatName,
2ceb93
-            OUString const* pHeadingStyleName);
2ceb93
+            OUString const* pHeadingStyleName, OUString const & referer);
2ceb93
     static void SetPropertiesToNumFormat(
2ceb93
             SwNumFormat & aFormat,
2ceb93
             OUString & rCharStyleName,
2ceb93
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
2ceb93
index 7771658..b29cee3 100644
2ceb93
--- a/sw/source/core/text/porfld.cxx
2ceb93
+++ b/sw/source/core/text/porfld.cxx
2ceb93
@@ -755,7 +755,7 @@ SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet,
2ceb93
 
2ceb93
 SwGrfNumPortion::SwGrfNumPortion(
2ceb93
         const OUString& rGraphicFollowedBy,
2ceb93
-        const SvxBrushItem* pGrfBrush,
2ceb93
+        const SvxBrushItem* pGrfBrush, OUString const & referer,
2ceb93
         const SwFormatVertOrient* pGrfOrient, const Size& rGrfSize,
2ceb93
         const bool bLft, const bool bCntr, const sal_uInt16 nMinDst,
2ceb93
         const bool bLabelAlignmentPosAndSpaceModeActive ) :
2ceb93
@@ -769,7 +769,7 @@ SwGrfNumPortion::SwGrfNumPortion(
2ceb93
     if( pGrfBrush )
2ceb93
     {
2ceb93
         *pBrush = *pGrfBrush;
2ceb93
-        const Graphic* pGraph = pGrfBrush->GetGraphic();
2ceb93
+        const Graphic* pGraph = pGrfBrush->GetGraphic(referer);
2ceb93
         if( pGraph )
2ceb93
             SetAnimated( pGraph->IsAnimated() );
2ceb93
         else
2ceb93
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
2ceb93
index 38fc089..4ecf25e 100644
2ceb93
--- a/sw/source/core/text/porfld.hxx
2ceb93
+++ b/sw/source/core/text/porfld.hxx
2ceb93
@@ -168,6 +168,7 @@ class SwGrfNumPortion : public SwNumberPortion
2ceb93
 public:
2ceb93
     SwGrfNumPortion( const OUString& rGraphicFollowedBy,
2ceb93
                      const SvxBrushItem* pGrfBrush,
2ceb93
+                     OUString const & referer,
2ceb93
                      const SwFormatVertOrient* pGrfOrient,
2ceb93
                      const Size& rGrfSize,
2ceb93
                      const bool bLeft,
2ceb93
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
2ceb93
index 6b2b938..14e3968 100644
2ceb93
--- a/sw/source/core/text/txtfld.cxx
2ceb93
+++ b/sw/source/core/text/txtfld.cxx
2ceb93
@@ -52,6 +52,7 @@
2ceb93
 #include <flddat.hxx>
2ceb93
 #include <fmtautofmt.hxx>
2ceb93
 #include <IDocumentSettingAccess.hxx>
2ceb93
+#include <sfx2/docfile.hxx>
2ceb93
 #include <svl/itemiter.hxx>
2ceb93
 
2ceb93
 static bool lcl_IsInBody( SwFrame const *pFrame )
2ceb93
@@ -478,8 +479,17 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
2ceb93
 
2ceb93
         if( SVX_NUM_BITMAP == rNumFormat.GetNumberingType() )
2ceb93
         {
2ceb93
+            OUString referer;
2ceb93
+            if (auto const sh1 = rInf.GetVsh()) {
2ceb93
+                if (auto const doc = sh1->GetDoc()) {
2ceb93
+                    auto const sh2 = doc->GetPersist();
2ceb93
+                    if (sh2 != nullptr && sh2->HasName()) {
2ceb93
+                        referer = sh2->GetMedium()->GetName();
2ceb93
+                    }
2ceb93
+                }
2ceb93
+            }
2ceb93
             pRet = new SwGrfNumPortion( pTextNd->GetLabelFollowedBy(),
2ceb93
-                                        rNumFormat.GetBrush(),
2ceb93
+                                        rNumFormat.GetBrush(), referer,
2ceb93
                                         rNumFormat.GetGraphicOrientation(),
2ceb93
                                         rNumFormat.GetGraphicSize(),
2ceb93
                                         bLeft, bCenter, nMinDist,
2ceb93
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
2ceb93
index f7376b9..44cd118 100644
2ceb93
--- a/sw/source/core/unocore/unosett.cxx
2ceb93
+++ b/sw/source/core/unocore/unosett.cxx
2ceb93
@@ -55,6 +55,7 @@
2ceb93
 #include <o3tl/any.hxx>
2ceb93
 #include <o3tl/enumarray.hxx>
2ceb93
 #include <vcl/font.hxx>
2ceb93
+#include <sfx2/docfile.hxx>
2ceb93
 #include <editeng/flstitem.hxx>
2ceb93
 #include <vcl/metric.hxx>
2ceb93
 #include <svtools/ctrltool.hxx>
2ceb93
@@ -1316,13 +1317,21 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex(
2ceb93
         SwStyleNameMapper::FillProgName(sValue, aUString, SwGetPoolIdFromName::TxtColl);
2ceb93
     }
2ceb93
 
2ceb93
-    return GetPropertiesForNumFormat(rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr);
2ceb93
+    OUString referer;
2ceb93
+    if (pDoc != nullptr) {
2ceb93
+        auto const sh = pDoc->GetPersist();
2ceb93
+        if (sh != nullptr && sh->HasName()) {
2ceb93
+            referer = sh->GetMedium()->GetName();
2ceb93
+        }
2ceb93
+    }
2ceb93
+    return GetPropertiesForNumFormat(
2ceb93
+        rFormat, CharStyleName, (pDocShell) ? & aUString : nullptr, referer);
2ceb93
 
2ceb93
 }
2ceb93
 
2ceb93
 uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat(
2ceb93
         const SwNumFormat& rFormat, OUString const& rCharFormatName,
2ceb93
-        OUString const*const pHeadingStyleName)
2ceb93
+        OUString const*const pHeadingStyleName, OUString const & referer)
2ceb93
 {
2ceb93
     bool bChapterNum = pHeadingStyleName != nullptr;
2ceb93
 
2ceb93
@@ -1454,7 +1463,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
2ceb93
             //graphicbitmap
2ceb93
             const Graphic* pGraphic = nullptr;
2ceb93
             if(pBrush )
2ceb93
-                pGraphic = pBrush->GetGraphic();
2ceb93
+                pGraphic = pBrush->GetGraphic(referer);
2ceb93
             if(pGraphic)
2ceb93
             {
2ceb93
                 uno::Reference<awt::XBitmap> xBmp = VCLUnoHelper::CreateBitmap( pGraphic->GetBitmapEx() );
2ceb93
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
2ceb93
index c575863..b972ec5 100644
2ceb93
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
2ceb93
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
2ceb93
@@ -129,7 +129,7 @@ public:
2ceb93
         OUString dummy; // pass in empty HeadingStyleName - can't import anyway
2ceb93
         uno::Sequence<beans::PropertyValue> const ret(
2ceb93
             SwXNumberingRules::GetPropertiesForNumFormat(
2ceb93
-                *pNumFormat, *pCharStyleName, &dummy));
2ceb93
+                *pNumFormat, *pCharStyleName, &dummy, ""));
2ceb93
         return uno::makeAny(ret);
2ceb93
     }
2ceb93
 
2ceb93
-- 
2ceb93
2.20.1
2ceb93