diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-05 14:36:19 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-08-14 09:29:43 +0200 |
commit | 1b9d52949239f0dd2e982ae986dcb812085eee03 (patch) | |
tree | b1263bc0555c24135dacb64bf5c94f1cce8f3b4d /sw | |
parent | f6c78ee996e87c8f7f0d162e06bc2ce6c7633481 (diff) |
tdf#126684: store "DialogUseCharAttr" in RES_PARATR_GRABBAG
... because RES_CHRATR_GRABBAG value may be later reset by initial
value read from char format, when it's present there.
OTOH, RES_PARATR_GRABBAG shouldn't be present in character format,
so it should be safe to pass the grabbag item there.
Regression after commit 074fc4a1499aac6eb67cd0b2dca00a51071cff0e.
Change-Id: Iebbee04929714d6a3fb72274a211699b2a80b3d2
Reviewed-on: https://gerrit.libreoffice.org/76981
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
(cherry picked from commit 30d03b495f437e9b2edbb0f8ceebe3020ba7459c)
Reviewed-on: https://gerrit.libreoffice.org/77016
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 21 |
2 files changed, 17 insertions, 6 deletions
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 4245a2284878..e900d1d9f4e8 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -348,7 +348,7 @@ SfxItemInfo aSlotTab[] = { SID_ATTR_PARA_OUTLINE_LEVEL, true }, // RES_PARATR_OUTLINELEVEL //#outline level { 0, true }, // RES_PARATR_RSID - { 0, true }, // RES_PARATR_GRABBAG + { SID_ATTR_PARA_GRABBAG, true }, // RES_PARATR_GRABBAG { 0, true }, // RES_PARATR_LIST_ID { 0, true }, // RES_PARATR_LIST_LEVEL { 0, true }, // RES_PARATR_LIST_ISRESTART diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 92fe3bf3bc3a..c3581e6df888 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -143,12 +143,14 @@ void ConvertAttrCharToGen(SfxItemSet& rSet) } // Tell dialogs to use character-specific slots/whichIds + // tdf#126684: We use RES_PARATR_GRABBAG, because RES_CHRATR_GRABBAG may be overwritten later in + // SwDocStyleSheet::GetItemSet when applying attributes from char format std::unique_ptr<SfxGrabBagItem> pGrabBag; const SfxPoolItem *pTmpItem; - if (SfxItemState::SET == rSet.GetItemState(RES_CHRATR_GRABBAG, false, &pTmpItem)) + if (SfxItemState::SET == rSet.GetItemState(RES_PARATR_GRABBAG, false, &pTmpItem)) pGrabBag.reset(static_cast<SfxGrabBagItem*>(pTmpItem->Clone())); else - pGrabBag.reset(new SfxGrabBagItem(RES_CHRATR_GRABBAG)); + pGrabBag.reset(new SfxGrabBagItem(RES_PARATR_GRABBAG)); pGrabBag->GetGrabBag()["DialogUseCharAttr"] <<= true; rSet.Put(std::move(pGrabBag)); } @@ -164,7 +166,7 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet) rSet.Put( SvxBrushItem(RES_CHRATR_HIGHLIGHT) ); // Remove shading marker - if( SfxItemState::SET == rOrigSet.GetItemState( RES_CHRATR_GRABBAG, false, &pTmpItem ) ) + if (SfxItemState::SET == rOrigSet.GetItemState(RES_CHRATR_GRABBAG, false, &pTmpItem)) { SfxGrabBagItem aGrabBag(*static_cast<const SfxGrabBagItem*>(pTmpItem)); std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); @@ -173,10 +175,19 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet) { aIterator->second <<= false; } - // Remove temporary GrabBag entry before writing to destination set - rMap.erase("DialogUseCharAttr"); rSet.Put( aGrabBag ); } + if (SfxItemState::SET == rOrigSet.GetItemState(RES_PARATR_GRABBAG, false, &pTmpItem)) + { + SfxGrabBagItem aGrabBag(*static_cast<const SfxGrabBagItem*>(pTmpItem)); + std::map<OUString, css::uno::Any>& rMap = aGrabBag.GetGrabBag(); + // Remove temporary GrabBag entry + rMap.erase("DialogUseCharAttr"); + if (rMap.empty()) + rSet.ClearItem(RES_PARATR_GRABBAG); + else + rSet.Put(aGrabBag); + } } rSet.ClearItem( RES_BACKGROUND ); } |