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

Oliver-Rainer Wittmann orw at apache.org
Tue May 14 12:46:23 PDT 2013


 svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx |   33 +---
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx      |  118 +++++++---------
 svx/source/sidebar/possize/PosSizePropertyPanel.cxx     |    7 
 3 files changed, 69 insertions(+), 89 deletions(-)

New commits:
commit 8f430d9ca3360c46125718b79193130dd00d8ab2
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Tue May 14 13:37:28 2013 +0000

    correct context switch handling in paragraph property panel...
    
    and position and size property panel
    
    (cherry picked from commit de52e4d0e544f6a6c2ab51631870d682885c30cd)
    
    Change-Id: I9330bcb21103da65b00251786340076c8b1a4346

diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
index e2fc093..4e42921 100644
--- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
+++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx
@@ -470,24 +470,19 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe
 
     aLineDist.SaveValue();
 
-    sal_uInt16 uCount = aLineDist.GetEntryCount();
+    const sal_uInt16 uCount = aLineDist.GetEntryCount();
     if( uCount == LLINESPACE_FIX + 1 )
     {
-        switch (currentContext.GetCombinedContext())
+        switch (currentContext.GetCombinedContext_DI())
         {
-            case CombinedEnumContext(Application_Impress, Context_Table):
-                case CombinedEnumContext(Application_Draw, Context_Table):
-            case CombinedEnumContext(Application_Writer, Context_DrawText):
-            case CombinedEnumContext(Application_Calc, Context_DrawText):
-            case CombinedEnumContext(Application_Draw, Context_DrawText):
-                case CombinedEnumContext(Application_Impress, Context_DrawText):
-            case CombinedEnumContext(Application_Writer, Context_Annotation):
-            case CombinedEnumContext(Application_Draw, Context_Draw):
-                case CombinedEnumContext(Application_Draw, Context_TextObject):
-                case CombinedEnumContext(Application_Draw, Context_Graphic):
-                case CombinedEnumContext(Application_Impress, Context_Draw):
-                case CombinedEnumContext(Application_Impress, Context_TextObject):
-                case CombinedEnumContext(Application_Impress, Context_Graphic):
+        case CombinedEnumContext(Application_DrawImpress, Context_Table):
+        case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
+        case CombinedEnumContext(Application_DrawImpress, Context_Draw):
+        case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
+        case CombinedEnumContext(Application_Calc, Context_DrawText):
+        case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
+        case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
             {
                 aLineDist.RemoveEntry(LLINESPACE_FIX);
             }
@@ -495,11 +490,11 @@ void ParaLineSpacingControl::Rearrange(SfxItemState currSPState,FieldUnit currMe
     }
     else if( uCount == LLINESPACE_FIX)
     {
-        switch (currentContext.GetCombinedContext())
+        switch (currentContext.GetCombinedContext_DI())
         {
-            case CombinedEnumContext(Application_Writer, Context_Default):
-            case CombinedEnumContext(Application_Writer, Context_Text):
-            case CombinedEnumContext(Application_Writer, Context_Table):
+            case CombinedEnumContext(Application_WriterVariants, Context_Default):
+            case CombinedEnumContext(Application_WriterVariants, Context_Text):
+            case CombinedEnumContext(Application_WriterVariants, Context_Table):
             {
                 aLineDist.InsertEntry(OUString("Fixed"), LLINESPACE_FIX);
             }
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 7fab7bf..7eff617 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -820,20 +820,20 @@ IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
 {
     switch (pControl->GetCurItemId())
     {
-        case INDENT_INCREMENT:
+    case INDENT_INCREMENT:
         {
-            switch (maContext.GetCombinedContext())
+            switch (maContext.GetCombinedContext_DI())
             {
-                case CombinedEnumContext(Application_Writer, Context_Default):
-                case CombinedEnumContext(Application_Writer, Context_Text):
-                case CombinedEnumContext(Application_Writer, Context_Table):
+            case CombinedEnumContext(Application_WriterVariants, Context_Default):
+            case CombinedEnumContext(Application_WriterVariants, Context_Text):
+            case CombinedEnumContext(Application_WriterVariants, Context_Table):
                 {
                     SfxBoolItem aMargin( SID_INC_INDENT, sal_True );
                     GetBindings()->GetDispatcher()->Execute(
                         SID_INC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
                 }
                 break;
-                default:
+            default:
                 {
                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
 
@@ -850,20 +850,20 @@ IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
             }
         }
         break;
-        case INDENT_DECREMENT:
+    case INDENT_DECREMENT:
         {
-            switch (maContext.GetCombinedContext())
+            switch (maContext.GetCombinedContext_DI())
             {
-                case CombinedEnumContext(Application_Writer, Context_Default):
-                case CombinedEnumContext(Application_Writer, Context_Text):
-                case CombinedEnumContext(Application_Writer, Context_Table):
+            case CombinedEnumContext(Application_WriterVariants, Context_Default):
+            case CombinedEnumContext(Application_WriterVariants, Context_Text):
+            case CombinedEnumContext(Application_WriterVariants, Context_Table):
                 {
                     SfxBoolItem aMargin( SID_DEC_INDENT, sal_True );
                     GetBindings()->GetDispatcher()->Execute(
                         SID_DEC_INDENT, SFX_CALLMODE_RECORD, &aMargin, 0L);
                 }
                 break;
-                default:
+            default:
                 {
                     if((maTxtLeft - INDENT_STEP) < 0)
                         maTxtLeft = DEFAULT_VALUE;
@@ -885,7 +885,7 @@ IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl)
             }
         }
         break;
-        case ID_HANGING_INDENT:
+    case ID_HANGING_INDENT:
         {
             SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
             aMargin.SetTxtLeft( (const long)GetCoreValue( *maLeftIndent.get(), m_eLRSpaceUnit ) + (const short)GetCoreValue( *maFLineIndent.get(), m_eLRSpaceUnit ) );
@@ -1157,12 +1157,12 @@ void ParaPropertyPanel::StateChangedAlignmentImpl( sal_uInt16 nSID, SfxItemState
 
 void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
-    switch (maContext.GetCombinedContext())
+    switch (maContext.GetCombinedContext_DI())
     {
 
-        case CombinedEnumContext(Application_Writer, Context_DrawText):
-        case CombinedEnumContext(Application_Calc, Context_DrawText):
-        case CombinedEnumContext(Application_Writer, Context_Annotation):
+    case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
+    case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
+    case CombinedEnumContext(Application_Calc, Context_DrawText):
         {
             maLeftIndent->SetMin( DEFAULT_VALUE );
             maRightIndent->SetMin( DEFAULT_VALUE );
@@ -1171,16 +1171,11 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
             maTbxProDemote->Hide();
         }
         break;
-        case CombinedEnumContext(Application_Draw, Context_DrawText):
-            case CombinedEnumContext(Application_Impress, Context_DrawText):
-        case CombinedEnumContext(Application_Draw, Context_Draw):
-        case CombinedEnumContext(Application_Draw, Context_TextObject):
-        case CombinedEnumContext(Application_Draw, Context_Graphic):
-        case CombinedEnumContext(Application_Impress, Context_Draw):
-        case CombinedEnumContext(Application_Impress, Context_TextObject):
-        case CombinedEnumContext(Application_Impress, Context_Graphic):
-        case CombinedEnumContext(Application_Impress, Context_Table):
-            case CombinedEnumContext(Application_Draw, Context_Table):
+    case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
+    case CombinedEnumContext(Application_DrawImpress, Context_Draw):
+    case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
+    case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
+    case CombinedEnumContext(Application_DrawImpress, Context_Table):
         {
             maLeftIndent->SetMin( DEFAULT_VALUE );
             maRightIndent->SetMin( DEFAULT_VALUE );
@@ -1189,9 +1184,9 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
             maTbxProDemote->Show();
         }
         break;
-        case CombinedEnumContext(Application_Writer, Context_Default):
-        case CombinedEnumContext(Application_Writer, Context_Text):
-        case CombinedEnumContext(Application_Writer, Context_Table):
+    case CombinedEnumContext(Application_WriterVariants, Context_Default):
+    case CombinedEnumContext(Application_WriterVariants, Context_Text):
+    case CombinedEnumContext(Application_WriterVariants, Context_Table):
         {
             maLeftIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
             maRightIndent->SetMin( NEGA_MAXVALUE, FUNIT_100TH_MM );
@@ -1221,9 +1216,9 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
         nVal = (long)maLeftIndent->Normalize( (long)nVal );
         maLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
 
-        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_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
+             && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
+             && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table))
         {
             maFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
         }
@@ -1236,29 +1231,24 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
         nfVal = (long)maFLineIndent->Normalize( (long)nfVal );
         maFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
 
-        switch (maContext.GetCombinedContext())
+        switch (maContext.GetCombinedContext_DI())
         {
-            case CombinedEnumContext(Application_Writer, Context_DrawText):
-            case CombinedEnumContext(Application_Writer, Context_Text):
-            case CombinedEnumContext(Application_Writer, Context_Default):
-            case CombinedEnumContext(Application_Writer, Context_Table):
-            case CombinedEnumContext(Application_Writer, Context_Annotation):
+        case CombinedEnumContext(Application_WriterVariants, Context_DrawText):
+        case CombinedEnumContext(Application_WriterVariants, Context_Text):
+        case CombinedEnumContext(Application_WriterVariants, Context_Default):
+        case CombinedEnumContext(Application_WriterVariants, Context_Table):
+        case CombinedEnumContext(Application_WriterVariants, Context_Annotation):
             {
                 maLeftIndent->SetMax( MAX_SW - nrVal, FUNIT_100TH_MM );
                 maRightIndent->SetMax( MAX_SW - nVal, FUNIT_100TH_MM );
                 maFLineIndent->SetMax( MAX_SW - nVal - nrVal, FUNIT_100TH_MM );
             }
             break;
-            case CombinedEnumContext(Application_Draw, Context_DrawText):
-            case CombinedEnumContext(Application_Draw, Context_Draw):
-                case CombinedEnumContext(Application_Draw, Context_Table):
-            case CombinedEnumContext(Application_Draw, Context_TextObject):
-            case CombinedEnumContext(Application_Draw, Context_Graphic):
-            case CombinedEnumContext(Application_Impress, Context_TextObject):
-                case CombinedEnumContext(Application_Impress, Context_DrawText):
-            case CombinedEnumContext(Application_Impress, Context_Table):
-            case CombinedEnumContext(Application_Impress, Context_Draw):
-            case CombinedEnumContext(Application_Impress, Context_Graphic):
+        case CombinedEnumContext(Application_DrawImpress, Context_DrawText):
+        case CombinedEnumContext(Application_DrawImpress, Context_Draw):
+        case CombinedEnumContext(Application_DrawImpress, Context_Table):
+        case CombinedEnumContext(Application_DrawImpress, Context_TextObject):
+        case CombinedEnumContext(Application_DrawImpress, Context_Graphic):
             {
                 maLeftIndent->SetMax( MAX_SC_SD - nrVal, FUNIT_100TH_MM );
                 maRightIndent->SetMax( MAX_SC_SD - nVal, FUNIT_100TH_MM );
@@ -1268,17 +1258,14 @@ 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_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)
+             && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default)
+             && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Table) )
         {
             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_INC, sal_True);
             maTbxIndent_IncDec->EnableItem(BT_TBX_INDENT_DEC, sal_True);
         }
 
-//      maTbxProDemote->Enable();
-//      if( !mbOutLineRight && !mbOutLineLeft )
-//          maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
         maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_True);
     }
     else if( eState == SFX_ITEM_DISABLED )
@@ -1287,14 +1274,14 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
         maRightIndent->Disable();
         maFLineIndent->Disable();
         maTbxIndent_IncDec->Disable();
-        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_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)  &&
+            maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
+            maContext.GetCombinedContext_DI() !=  CombinedEnumContext(Application_WriterVariants, Context_Table) )
             maTbxIndent_IncDec->Disable();
         else
             maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
 
-//      maTbxProDemote->Disable();
+        //      maTbxProDemote->Disable();
         maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
     }
     else
@@ -1302,13 +1289,12 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
         maLeftIndent->SetEmptyFieldValue();
         maRightIndent->SetEmptyFieldValue();
         maFLineIndent->SetEmptyFieldValue();
-        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_DI() != CombinedEnumContext(Application_WriterVariants, Context_Text)  &&
+            maContext.GetCombinedContext_DI() != CombinedEnumContext(Application_WriterVariants, Context_Default) &&
+            maContext.GetCombinedContext_DI() !=  CombinedEnumContext(Application_WriterVariants, Context_Table) )
             maTbxIndent_IncDec->Disable();
         else
             maTbxIndent_IncDec->EnableItem(ID_HANGING_INDENT, sal_False);
-//      maTbxProDemote->Disable();
         maTbxProDemote->EnableItem(SD_HANGING_INDENT, sal_False);
     }
 }
@@ -1395,9 +1381,9 @@ void ParaPropertyPanel::StateChangeOutLineImpl( sal_uInt16 nSID, SfxItemState eS
 
 void ParaPropertyPanel::StateChangeIncDecImpl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
 {
-    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_DI() == CombinedEnumContext(Application_WriterVariants, Context_Text)
+           || maContext.GetCombinedContext_DI() == CombinedEnumContext(Application_WriterVariants, Context_Default)
+           || maContext.GetCombinedContext_DI() ==  CombinedEnumContext(Application_WriterVariants, Context_Table) )
          && ( nSID == SID_INC_INDENT || nSID == SID_DEC_INDENT ) )
     {
         // Writer's text shell is the only one which provides reasonable states for Slots SID_INC_INDENT and SID_DEC_INDENT
diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
index 0471caf..a3aafaa 100644
--- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
+++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx
@@ -1039,12 +1039,11 @@ void PosSizePropertyPanel::executeSize()
         SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth);
         SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight);
         SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)meRP);
-        const sal_Int32 nCombinedContext(maContext.GetCombinedContext());
+        const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI());
 
-        if( nCombinedContext == CombinedEnumContext(Application_Writer, Context_Graphic) // mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC
-            || nCombinedContext == CombinedEnumContext(Application_Writer, Context_OLE) //mnContextId == PROPERTY_CONTEXT_SW_OLE
+        if( nCombinedContext == CombinedEnumContext(Application_WriterVariants, Context_Graphic)
+            || nCombinedContext == CombinedEnumContext(Application_WriterVariants, Context_OLE)
             )
-        // if( mnContextId == PROPERTY_CONTEXT_SW_GRAPHIC || mnContextId == PROPERTY_CONTEXT_SW_OLE )
         {
             GetBindings()->GetDispatcher()->Execute(SID_ATTR_TRANSFORM, SFX_CALLMODE_RECORD, &aWidthItem, &aHeightItem, &aPointItem, 0L );
         }


More information about the Libreoffice-commits mailing list