[Libreoffice-commits] core.git: 2 commits - sc/sdi sc/source sw/source

Gulsah Kose gulsah.1004 at gmail.com
Fri Mar 24 07:59:39 UTC 2017


 sc/sdi/formatsh.sdi                  |    4 ++--
 sc/source/ui/view/formatsh.cxx       |   20 ++++++++++++++++++--
 sc/source/ui/view/tabview3.cxx       |    1 +
 sw/source/uibase/inc/drwbassh.hxx    |    2 +-
 sw/source/uibase/shells/drwbassh.cxx |   25 +++++++++++++++++++++++++
 5 files changed, 47 insertions(+), 5 deletions(-)

New commits:
commit 003fd6b95033a2a0d28e04dec2e756e4c67f9d1a
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Mon Mar 6 10:22:14 2017 +0300

    tdf#90856 Hide "Format Area" command for line objects in Writer
    
    Change-Id: Ib90aba380be7eeef3c7418ea85b553079794cf87
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>

diff --git a/sw/source/uibase/inc/drwbassh.hxx b/sw/source/uibase/inc/drwbassh.hxx
index 65565443dd66..78e02bbbc5dd 100644
--- a/sw/source/uibase/inc/drwbassh.hxx
+++ b/sw/source/uibase/inc/drwbassh.hxx
@@ -46,7 +46,7 @@ public:
     void        Execute(SfxRequest &);
     void        GetState(SfxItemSet &);
     void        GetDrawAttrStateForIFBX( SfxItemSet& rSet );
-    void        DisableState(SfxItemSet &rSet)               { Disable(rSet);}
+    void        DisableState(SfxItemSet &rSet);
     bool        Disable(SfxItemSet& rSet, sal_uInt16 nWhich = 0);
 };
 
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index ac8bd590d96e..fa8f4c5383c3 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -745,6 +745,31 @@ bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
     return bDisable;
 }
 
+void SwDrawBaseShell::DisableState( SfxItemSet& rSet )
+{
+    SwWrtShell *pSh = &GetShell();
+    SdrView*    pSdrView = pSh->GetDrawView();
+    const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+
+    if ( rMarkList.GetMarkCount() == 1 )
+    {
+        SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
+        sal_uInt16 nObjType = pObj->GetObjIdentifier();
+
+        // If marked object is 2D, disable format area command.
+        if ( nObjType == OBJ_PLIN     ||
+             nObjType == OBJ_LINE     ||
+             nObjType == OBJ_PATHLINE ||
+             nObjType == OBJ_FREELINE ||
+             nObjType == OBJ_EDGE     ||
+             nObjType == OBJ_CARC )
+            rSet.DisableItem( SID_ATTRIBUTES_AREA );
+    }
+
+    Disable(rSet);
+
+}
+
 // Validate of drawing positions
 
 IMPL_LINK(SwDrawBaseShell, ValidatePosition, SvxSwFrameValidation&, rValidation, void )
commit 63a5e37a45e48b9f0c9ae2b632042e2a2d57dcbf
Author: Gulsah Kose <gulsah.1004 at gmail.com>
Date:   Tue Mar 21 23:26:38 2017 +0300

    tdf#86119 Fix toggle behaviour of SID_NUMBER_TWODEC.
    
    Change-Id: If17935cbb35c1a57fe9ea4cfaca58385ed437842
    Signed-off-by: Gulsah Kose <gulsah.1004 at gmail.com>

diff --git a/sc/sdi/formatsh.sdi b/sc/sdi/formatsh.sdi
index 740e0024bdfd..0acabdc56999 100644
--- a/sc/sdi/formatsh.sdi
+++ b/sc/sdi/formatsh.sdi
@@ -106,8 +106,8 @@ interface FormatForSelection
     SID_CTLFONT_STATE               [ StateMethod = GetTextDirectionState ; Export = FALSE; ]
 
     SID_ATTR_NUMBERFORMAT_VALUE       [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState;]
-    SID_NUMBER_FORMAT       [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState;]
-    SID_NUMBER_TWODEC       [ ExecMethod = ExecuteNumFormat;]
+    SID_NUMBER_FORMAT       [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
+    SID_NUMBER_TWODEC       [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
     SID_NUMBER_SCIENTIFIC   [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
     SID_NUMBER_DATE         [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
     SID_NUMBER_CURRENCY     [ ExecMethod = ExecuteNumFormat; StateMethod = GetNumFormatState; ]
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index d68d801f8034..db32a2bcbe82 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1036,9 +1036,18 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq )
     switch ( nSlot )
     {
         case SID_NUMBER_TWODEC:
-            pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER, 4 );       // Standard+4 = #.##0,00
+        {
+            const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
+            sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
+
+            if ((nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4)
+                pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
+            else
+                pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER, 4 );
+            rBindings.Invalidate( nSlot );
             rReq.Done();
-            break;
+        }
+        break;
         case SID_NUMBER_SCIENTIFIC:
             if ((nType & css::util::NumberFormat::SCIENTIFIC))
                 pTabViewShell->SetNumberFormat( css::util::NumberFormat::NUMBER );
@@ -2597,6 +2606,13 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet )
             case SID_NUMBER_TIME:
                 rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::TIME)) );
                 break;
+            case SID_NUMBER_TWODEC:
+                {
+                    const SfxItemSet& rAttrSet = pTabViewShell->GetSelectionPattern()->GetItemSet();
+                    sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item&>(rAttrSet.Get(ATTR_VALUE_FORMAT)).GetValue();
+                    rSet.Put( SfxBoolItem(nWhich, (nType & css::util::NumberFormat::NUMBER) && nNumberFormat == 4 ) );
+                }
+                break;
         }
         nWhich = aIter.NextWhich();
     }
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index abbd807a1ade..9c63bdb7d242 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -319,6 +319,7 @@ void ScTabView::InvalidateAttribs()
     rBindings.Invalidate( SID_NUMBER_DATE );
     rBindings.Invalidate( SID_NUMBER_CURRENCY );
     rBindings.Invalidate( SID_NUMBER_PERCENT );
+    rBindings.Invalidate( SID_NUMBER_TWODEC );
     rBindings.Invalidate( SID_NUMBER_TIME );
 }
 


More information about the Libreoffice-commits mailing list