[Libreoffice-commits] core.git: include/svx svx/source sw/source

Maxim Monastirsky momonasmon at gmail.com
Tue May 23 23:07:12 UTC 2017


 include/svx/nbdtmg.hxx             |    5 +++--
 svx/source/sidebar/nbdtmg.cxx      |   19 ++++++++++---------
 sw/source/uibase/shells/txtnum.cxx |   15 ++++++++++++---
 3 files changed, 25 insertions(+), 14 deletions(-)

New commits:
commit 687c3b49976ef0eb079853f7bffd63d25bff05c7
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Tue May 23 20:49:48 2017 +0300

    tdf#107008 Pass char style names to NBOTypeMgrBase
    
    Change-Id: I26db31b8f9db968aa33b92a4abe917ac20cd5844
    Reviewed-on: https://gerrit.libreoffice.org/37963
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Maxim Monastirsky <momonasmon at gmail.com>

diff --git a/include/svx/nbdtmg.hxx b/include/svx/nbdtmg.hxx
index aeb4ae6651fb..004fecd7b777 100644
--- a/include/svx/nbdtmg.hxx
+++ b/include/svx/nbdtmg.hxx
@@ -122,6 +122,7 @@ class SVX_DLLPUBLIC NBOTypeMgrBase
         const SfxItemSet*   pSet;
         MapUnit         eCoreUnit;
         // store the attributes passed from pSet
+        OUString        aBulletCharFmtName;
         OUString        aNumCharFmtName;
         NBOTypeMgrBase(const NBOTypeMgrBase&) = delete;
 
@@ -129,7 +130,6 @@ class SVX_DLLPUBLIC NBOTypeMgrBase
         NBOTypeMgrBase()
             : pSet(nullptr)
             , eCoreUnit(MapUnit::MapTwip)
-            , aNumCharFmtName(OUString())
             , bIsLoading(false)
         {}
         virtual ~NBOTypeMgrBase() {}
@@ -143,7 +143,8 @@ class SVX_DLLPUBLIC NBOTypeMgrBase
         // store the attributes passed from pSet
         void SetItems(const SfxItemSet* pArg);
     protected:
-        const OUString& GetBulCharFmtName() { return aNumCharFmtName;}
+        const OUString& GetBulletCharFmtName() { return aBulletCharFmtName;}
+        const OUString& GetNumCharFmtName() { return aNumCharFmtName;}
         MapUnit GetMapUnit() { return eCoreUnit;}
     protected:
         bool    bIsLoading;
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index 686fcf2c6510..7dac15f83f22 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -147,12 +147,14 @@ void NBOTypeMgrBase::SetItems(const SfxItemSet* pArg) {
     if ( pSet )
     {
         SfxAllItemSet aSet(*pSet);
+
         const SfxStringItem* pBulletCharFmt = aSet.GetItem<SfxStringItem>(SID_BULLET_CHAR_FMT, false);
+        if (pBulletCharFmt)
+            aBulletCharFmtName = pBulletCharFmt->GetValue();
 
-        if ( pBulletCharFmt )
-        {
-            aNumCharFmtName =  pBulletCharFmt->GetValue();
-        }
+        const SfxStringItem* pNumCharFmt = aSet.GetItem<SfxStringItem>(SID_NUM_CHAR_FMT, false);
+        if (pNumCharFmt)
+            aNumCharFmtName = pNumCharFmt->GetValue();
 
         const SfxPoolItem* pItem;
         SfxItemState eState = pSet->GetItemState(SID_ATTR_NUMBERING_RULE, false, &pItem);
@@ -380,7 +382,7 @@ void BulletsTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
     const vcl::Font& rActBulletFont = pActualBullets[nIndex]->aFont;
 
     sal_uInt16 nMask = 1;
-    OUString sBulletCharFormatName = GetBulCharFmtName();
+    OUString sBulletCharFormatName = GetBulletCharFmtName();
     for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)
     {
         if(mLevel & nMask)
@@ -557,7 +559,7 @@ void NumberingTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uIn
     SvxNumType eNewType = _pSet->pNumSetting->nNumberType;
 
     sal_uInt16 nMask = 1;
-    OUString sNumCharFmtName = GetBulCharFmtName();
+    OUString sNumCharFmtName = GetNumCharFmtName();
     for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)
     {
         if(mLevel & nMask)
@@ -824,7 +826,6 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
     NumSettingsArr_Impl *pNumSettingsArr=pItemArr->pNumSettingsArr;
 
     NumSettings_Impl* pLevelSettings = nullptr;
-    OUString sBulletCharFormatName = GetBulCharFmtName();
     for(sal_uInt16 i = 0; i < aNum.GetLevelCount(); i++)
     {
         if(pNumSettingsArr->size() > i)
@@ -886,7 +887,7 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
             }
 
             aFmt.SetBulletChar(cChar);
-            aFmt.SetCharFormatName( sBulletCharFormatName );
+            aFmt.SetCharFormatName( GetBulletCharFmtName() );
             if (isResetSize) aFmt.SetBulletRelSize(45);
         }else if ((aFmt.GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP ) {
             if (pLevelSettings->pBrushItem) {
@@ -905,7 +906,7 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
         } else
         {
             aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? aNum.GetLevelCount() : 0));
-            aFmt.SetCharFormatName(sBulletCharFormatName);
+            aFmt.SetCharFormatName(GetNumCharFmtName());
                 if (isResetSize) aFmt.SetBulletRelSize(100);
         }
         if(pNumSettingsArr->size() > i) {
diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx
index 2ba5ff26dfd3..2e19f7816ac7 100644
--- a/sw/source/uibase/shells/txtnum.cxx
+++ b/sw/source/uibase/shells/txtnum.cxx
@@ -31,9 +31,11 @@
 #include "view.hxx"
 #include "viewopt.hxx"
 #include "wdocsh.hxx"
+#include "poolfmt.hxx"
 #include "textsh.hxx"
 #include "uiitems.hxx"
 #include "swabstdlg.hxx"
+#include "SwStyleNameMapper.hxx"
 #include <globals.hrc>
 #include <sfx2/tabdlg.hxx>
 #include <svx/nbdtmg.hxx>
@@ -278,9 +280,16 @@ void SwTextShell::ExecSetNumber(SfxRequest &rReq)
                     SvxNumRule aNewSvxNumRule = pNumRuleAtCurrentSelection != nullptr
                                                     ? pNumRuleAtCurrentSelection->MakeSvxNumRule()
                                                     : aNewNumRule.MakeSvxNumRule();
-                    // set unit attribute to NB Manager
-                    SfxItemSet aSet( GetPool(), SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL, 0 );
-                    aSet.Put( SvxNumBulletItem( aNewSvxNumRule ) );
+
+                    OUString aNumCharFormat, aBulletCharFormat;
+                    SwStyleNameMapper::FillUIName( RES_POOLCHR_NUM_LEVEL, aNumCharFormat );
+                    SwStyleNameMapper::FillUIName( RES_POOLCHR_BUL_LEVEL, aBulletCharFormat );
+
+                    SfxAllItemSet aSet( GetPool() );
+                    aSet.Put( SfxStringItem( SID_NUM_CHAR_FMT, aNumCharFormat ) );
+                    aSet.Put( SfxStringItem( SID_BULLET_CHAR_FMT, aBulletCharFormat ) );
+                    aSet.Put( SvxNumBulletItem( aNewSvxNumRule, SID_ATTR_NUMBERING_RULE ) );
+
                     pNBOTypeMgr->SetItems( &aSet );
                     pNBOTypeMgr->ApplyNumRule( aNewSvxNumRule, nChoosenItemIdx - 1, nActNumLvl );
 


More information about the Libreoffice-commits mailing list