diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-06-07 09:28:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-06-12 09:03:54 +0200 |
commit | b518882de8213ef71a8003f95fbdf7689069c06d (patch) | |
tree | 1a341f924ab2a333db2d655704b45f00772abccc | |
parent | 86138007287e1d47fe436142c26345ea7a9986a9 (diff) |
More uses of referer URL with SvxBrushItem
Change-Id: I04b524784df4ef453d8b1feec13b62f183a17e23
Reviewed-on: https://gerrit.libreoffice.org/73643
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sw/inc/unosett.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/text/porfld.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/text/porfld.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/text/txtfld.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unosett.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/config/StoredChapterNumbering.cxx | 2 |
6 files changed, 28 insertions, 8 deletions
diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx index 768a351b2da5..7414645d9b54 100644 --- a/sw/inc/unosett.hxx +++ b/sw/inc/unosett.hxx @@ -210,7 +210,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, diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 5249d904da8e..bc671fad230d 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -753,7 +753,7 @@ SwBulletPortion::SwBulletPortion( const sal_Unicode cBullet, SwGrfNumPortion::SwGrfNumPortion( 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 ) : @@ -767,7 +767,7 @@ SwGrfNumPortion::SwGrfNumPortion( if( pGrfBrush ) { pBrush.reset(static_cast<SvxBrushItem*>(pGrfBrush->Clone())); - const Graphic* pGraph = pGrfBrush->GetGraphic(); + const Graphic* pGraph = pGrfBrush->GetGraphic(referer); if( pGraph ) SetAnimated( pGraph->IsAnimated() ); else diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 5436cc9f01a1..2508fa899fdd 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -162,6 +162,7 @@ class SwGrfNumPortion : public SwNumberPortion public: SwGrfNumPortion( const OUString& rGraphicFollowedBy, const SvxBrushItem* pGrfBrush, + OUString const & referer, const SwFormatVertOrient* pGrfOrient, const Size& rGrfSize, const bool bLeft, diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index a568c2554523..440916cb001e 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -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 const *pFrame ) @@ -505,8 +506,17 @@ 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( pTextNd->GetLabelFollowedBy(), - rNumFormat.GetBrush(), + rNumFormat.GetBrush(), referer, rNumFormat.GetGraphicOrientation(), rNumFormat.GetGraphicSize(), bLeft, bCenter, nMinDist, diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 5c4a3f5623b1..54cac96775b1 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -62,6 +62,7 @@ #include <vcl/metric.hxx> #include <vcl/graph.hxx> #include <vcl/GraphicLoader.hxx> +#include <sfx2/docfile.hxx> #include <svtools/ctrltool.hxx> #include <vcl/svapp.hxx> #include <editeng/unofdesc.hxx> @@ -1303,13 +1304,21 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetNumberingRuleByIndex( SwStyleNameMapper::FillProgName(sValue, aUString, SwGetPoolIdFromName::TxtColl); } - return GetPropertiesForNumFormat(rFormat, CharStyleName, m_pDocShell ? & aUString : nullptr); + OUString referer; + if (m_pDoc != nullptr) { + auto const sh = m_pDoc->GetPersist(); + if (sh != nullptr && sh->HasName()) { + referer = sh->GetMedium()->GetName(); + } + } + return GetPropertiesForNumFormat( + rFormat, CharStyleName, m_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; @@ -1431,7 +1440,7 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat if (SVX_NUM_BITMAP == rFormat.GetNumberingType()) { const SvxBrushItem* pBrush = rFormat.GetBrush(); - const Graphic* pGraphic = pBrush ? pBrush->GetGraphic() : nullptr; + const Graphic* pGraphic = pBrush ? pBrush->GetGraphic(referer) : nullptr; if (pGraphic) { //GraphicBitmap diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index 940ffb32d845..7be6460e036d 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -130,7 +130,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); } |