diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-05 14:36:19 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-08-05 18:13:11 +0200 |
commit | 30d03b495f437e9b2edbb0f8ceebe3020ba7459c (patch) | |
tree | 8b1546bc472de6682b4d22a26fb14bc0cfdbe193 | |
parent | 3166209cca8c8c76d4605eead12431fed2f1e306 (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>
-rw-r--r-- | cui/source/tabpages/border.cxx | 2 | ||||
-rw-r--r-- | include/editeng/editids.hrc | 1 | ||||
-rw-r--r-- | sw/source/core/bastyp/init.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/utlui/uitool.cxx | 21 |
4 files changed, 19 insertions, 7 deletions
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index a0449ef7379c..5777a0e3c1cc 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -489,7 +489,7 @@ SvxBorderTabPage::SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCor FillLineListBox_Impl(); // connections - if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_CHAR_GRABBAG), &pItem)) + if (rCoreAttrs.HasItem(GetWhich(SID_ATTR_PARA_GRABBAG), &pItem)) { const SfxGrabBagItem* pGrabBag = static_cast<const SfxGrabBagItem*>(pItem); auto it = pGrabBag->GetGrabBag().find("DialogUseCharAttr"); diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc index 0afd36701129..129afc52234e 100644 --- a/include/editeng/editids.hrc +++ b/include/editeng/editids.hrc @@ -135,6 +135,7 @@ #define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_EDIT_START + 75 ) #define SID_ATTR_CHAR_BOX ( SID_EDIT_START + 76 ) #define SID_ATTR_CHAR_SHADOW ( SID_EDIT_START + 77 ) +#define SID_ATTR_PARA_GRABBAG ( SID_EDIT_START + 78 ) #if 95 > (SID_EDIT_END-SID_EDIT_START) diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 3cabe316e5c3..f32d37f5d41d 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -359,7 +359,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 ); } |