[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - cui/source include/editeng sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 14 07:30:29 UTC 2019


 cui/source/tabpages/border.cxx    |    2 +-
 include/editeng/editids.hrc       |    1 +
 sw/source/core/bastyp/init.cxx    |    2 +-
 sw/source/uibase/utlui/uitool.cxx |   21 ++++++++++++++++-----
 4 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit 1b9d52949239f0dd2e982ae986dcb812085eee03
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Aug 5 14:36:19 2019 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Aug 14 09:29:43 2019 +0200

    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 at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit 30d03b495f437e9b2edbb0f8ceebe3020ba7459c)
    Reviewed-on: https://gerrit.libreoffice.org/77016
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

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 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 );
 }


More information about the Libreoffice-commits mailing list