[Libreoffice-commits] core.git: Branch 'feature/sidebar' - svx/source

Oliver-Rainer Wittmann orw at apache.org
Thu May 9 10:12:09 PDT 2013


 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx |   35 ++++++++-------------
 1 file changed, 14 insertions(+), 21 deletions(-)

New commits:
commit 30f032d716374272a091efc641d195e6ad0305c1
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Wed Apr 24 14:24:02 2013 +0000

    Resolves: #i122074# paragraph property panel
    
    correct enable/disable of indentation increase/decrease controls
    
    (cherry picked from commit cc9eaeaaa2ab279db0bf9a8fa63034333dbdaae3)
    
    Change-Id: Ia7c676435859027f0526d6253db771e2359bb7cc

diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index e4d7141..5716de9 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -1280,9 +1280,9 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
 
         maTbxIndent_IncDec->Enable();
         maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_True);
-        if(maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)
-            && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default)
-            && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table))
+        if ( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)
+             && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default)
+             && maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Table) )
         {
             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
@@ -1407,27 +1407,20 @@ void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eS
 
 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
 {
-    if (nSID==SID_INC_INDENT)
+    if ( ( maContext.GetCombinedContext() == CombinedEnumContext(Application_Writer, Context_Text)
+           || maContext.GetCombinedContext() == CombinedEnumContext(Application_Writer, Context_Default)
+           || maContext.GetCombinedContext() ==  CombinedEnumContext(Application_Writer, Context_Table) )
+         && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) )
     {
-        if( pState && eState == SFX_ITEM_UNKNOWN )
-            maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
-        else
-            if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
-                maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
-            maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
-                maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_False);
-    }
-    if (nSID==SID_DEC_INDENT)
-    {
-        if( pState && eState == SFX_ITEM_UNKNOWN )
-            maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
-        else
-            if( maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Text)  &&
-                maContext.GetCombinedContext() != CombinedEnumContext(Application_Writer, Context_Default) &&
-            maContext.GetCombinedContext() !=  CombinedEnumContext(Application_Writer, Context_Table) )
-                maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_False);
+        // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT
+        // - namely SFX_ITEM_UNKNOWN and SFX_ITEM_DISABLED
+        maTbxIndent_IncDec->EnableItem(
+            nSID == SID_INC_INDENT ? BT_TBX_INDENT_INC : BT_TBX_INDENT_DEC,
+            ( pState && eState == SFX_ITEM_UNKNOWN ) ? sal_True : sal_False );
     }
 }
+
+
 // Add toggle state for numbering and bullet icons
 void ParaPropertyPanel::StateChangeBulletNumImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
 {


More information about the Libreoffice-commits mailing list