sc/AllLangResTarget_sc.mk                          |    1 
 sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx |   59 ++++++++++++---------
 sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc |   25 --------
 sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx |    4 -
 sc/source/ui/sidebar/NumberFormatPropertyPanel.src |   32 -----------
 sc/uiconfig/scalc/ui/sidebarnumberformat.ui        |   20 +++++++
 6 files changed, 57 insertions(+), 84 deletions(-)

New commits:
commit cbae4ec3c9733c16ae69cfc5a23c9a54aadc7fc3
Author: Laurent Balland-Poirier <laurent.balland-poir...@laposte.net>
Date:   Sun Apr 17 16:36:04 2016 +0200

    tdf#99361 Separate checkbox in Sidebar
    
    "Thousands Separator" and "Engineering notation" used the same checkbox,
     so help tips texts were the same.
    This commit creates a second checkbox which is hiden/shown
     according to category selected
    
    Change-Id: I804c2c7b4625497da8e423a952b357fbd8bbfa19
    Reviewed-on: https://gerrit.libreoffice.org/24173
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk
index ee5c63e..9708c7b 100644
--- a/sc/AllLangResTarget_sc.mk
+++ b/sc/AllLangResTarget_sc.mk
@@ -45,7 +45,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
     sc/source/ui/miscdlgs/acredlin.src \
     sc/source/ui/formdlg/dwfunctr.src \
     sc/source/ui/sidebar/CellAppearancePropertyPanel.src \
-    sc/source/ui/sidebar/NumberFormatPropertyPanel.src \
     sc/source/ui/StatisticsDialogs/StatisticsDialogs.src \
     sc/source/core/src/compiler.src \
 ))
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx 
b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
index 49c1ef9..13f0f53 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx
@@ -20,7 +20,6 @@
 #include <sfx2/sidebar/ResourceDefinitions.hrc>
 #include <sfx2/sidebar/ControlFactory.hxx>
 #include "NumberFormatPropertyPanel.hxx"
-#include <NumberFormatPropertyPanel.hrc>
 #include "sc.hrc"
 #include "scresid.hxx"
 #include <sfx2/bindings.hxx>
@@ -43,8 +42,6 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel(
     const css::uno::Reference<css::frame::XFrame>& rxFrame,
     SfxBindings* pBindings)
   : PanelLayout(pParent,"NumberFormatPropertyPanel", 
"modules/scalc/ui/sidebarnumberformat.ui", rxFrame),
-    maThousandSeparator(ScResId(RID_SFX_STR_THOUSAND_SEP)),
-    maEngineeringNotation(ScResId(RID_SFX_STR_ENGINEERING)),
     maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this),
     maFormatControl(SID_NUMBER_FORMAT, *pBindings, *this),
 
@@ -52,12 +49,13 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel(
     maContext(),
     mpBindings(pBindings)
 {
-    get(mpLbCategory,   "category");
-    get(mpTBCategory,   "numberformat");
-    get(mpEdDecimals,   "decimalplaces");
-    get(mpEdLeadZeroes, "leadingzeroes");
-    get(mpBtnNegRed,    "negativenumbersred");
-    get(mpBtnThousand,  "thousandseparator");
+    get(mpLbCategory,     "category");
+    get(mpTBCategory,     "numberformat");
+    get(mpEdDecimals,     "decimalplaces");
+    get(mpEdLeadZeroes,   "leadingzeroes");
+    get(mpBtnNegRed,      "negativenumbersred");
+    get(mpBtnThousand,    "thousandseparator");
+    get(mpBtnEngineering, "engineeringnotation");
 
     Initialize();
 }
@@ -75,6 +73,7 @@ void NumberFormatPropertyPanel::dispose()
     mpEdLeadZeroes.clear();
     mpBtnNegRed.clear();
     mpBtnThousand.clear();
+    mpBtnEngineering.clear();
 
     maNumFormatControl.dispose();
     maFormatControl.dispose();
@@ -98,6 +97,7 @@ void NumberFormatPropertyPanel::Initialize()
 
     mpBtnNegRed->SetClickHdl( LINK(this, NumberFormatPropertyPanel, 
NumFormatValueClickHdl) );
     mpBtnThousand->SetClickHdl( LINK(this, NumberFormatPropertyPanel, 
NumFormatValueClickHdl) );
+    mpBtnEngineering->SetClickHdl( LINK(this, NumberFormatPropertyPanel, 
NumFormatValueClickHdl) );
 
     mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory);
 }
@@ -120,16 +120,15 @@ IMPL_LINK_NOARG_TYPED( NumberFormatPropertyPanel, 
NumFormatValueClickHdl, Button
 }
 IMPL_LINK_NOARG_TYPED( NumberFormatPropertyPanel, NumFormatValueHdl, Edit&, 
void )
 {
-    OUString      aFormat;
-    OUString      sBreak = ",";
-    bool          bThousand     =    mpBtnThousand->IsEnabled()
-        && mpBtnThousand->IsChecked();
-    bool          bNegRed       =    mpBtnNegRed->IsEnabled()
-        && mpBtnNegRed->IsChecked();
-    sal_uInt16        nPrecision    = (mpEdDecimals->IsEnabled())
+    OUString    aFormat;
+    OUString    sBreak = ",";
+    bool        bThousand   = ( mpBtnThousand->IsVisible() && 
mpBtnThousand->IsEnabled() && mpBtnThousand->IsChecked() )
+                           || ( mpBtnEngineering->IsVisible() && 
mpBtnEngineering->IsEnabled() && mpBtnEngineering->IsChecked() );
+    bool        bNegRed     =  mpBtnNegRed->IsEnabled() && 
mpBtnNegRed->IsChecked();
+    sal_uInt16  nPrecision  = (mpEdDecimals->IsEnabled())
         ? (sal_uInt16)mpEdDecimals->GetValue()
         : (sal_uInt16)0;
-    sal_uInt16        nLeadZeroes   = (mpEdLeadZeroes->IsEnabled())
+    sal_uInt16  nLeadZeroes = (mpEdLeadZeroes->IsEnabled())
         ? (sal_uInt16)mpEdLeadZeroes->GetValue()
         : (sal_uInt16)0;
 
@@ -207,25 +206,36 @@ void NumberFormatPropertyPanel::NotifyItemUpdate(
                 if( nVal < 4 ||  // General, Number, Percent and Currency
                     nVal == 6 )  // scientific also
                 {
-                    mpBtnThousand->Enable();
+                    if ( nVal == 6 ) // scientific
+                    {  // For scientific, Thousand separator is replaced by 
Engineering notation
+                        mpBtnThousand->Hide();
+                        mpBtnEngineering->Show();
+                        mpBtnEngineering->Enable();
+                    }
+                    else
+                    {
+                        mpBtnEngineering->Hide();
+                        mpBtnThousand->Show();
+                        mpBtnThousand->Enable();
+                    }
                     mpBtnNegRed->Enable();
                     mpEdDecimals->Enable();
                     mpEdLeadZeroes->Enable();
                 }
                 else
                 {
+                    mpBtnEngineering->Hide();
+                    mpBtnThousand->Show();
                     mpBtnThousand->Disable();
                     mpBtnNegRed->Disable();
                     mpEdDecimals->Disable();
                     mpEdLeadZeroes->Disable();
                 }
-                if( nVal == 6 ) // For scientific, Thousand separator is 
replaced by Engineering notation
-                    mpBtnThousand->SetText( maEngineeringNotation );
-                else
-                    mpBtnThousand->SetText( maThousandSeparator );
             }
             else
             {
+                mpBtnEngineering->Hide();
+                mpBtnThousand->Show();
                 mpLbCategory->SetNoSelection();
                 mnCategorySelected = 0;
                 mpBtnThousand->Disable();
@@ -265,7 +275,10 @@ void NumberFormatPropertyPanel::NotifyItemUpdate(
                 nPrecision  =    0;
                 nLeadZeroes =    1;
             }
-            mpBtnThousand->Check(bThousand);
+            if ( mpBtnThousand->IsVisible() )
+                mpBtnThousand->Check(bThousand);
+            else if ( mpBtnEngineering->IsVisible() )
+                mpBtnEngineering->Check(bThousand);
             mpBtnNegRed->Check(bNegRed);
             if ( mpLbCategory->GetSelectEntryPos() == 0 )
                 mpEdDecimals->SetText(""); // tdf#44399
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc 
b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc
deleted file mode 100644
index 3c2a632..0000000
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <sfx2/sfx.hrc>
-
-#define RID_SFX_STR_THOUSAND_SEP            ( RID_SFX_PROPERTYPANEL_START + 1 )
-#define RID_SFX_STR_ENGINEERING             ( RID_SFX_PROPERTYPANEL_START + 2 )
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx 
b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
index c984f27..c6b2c82 100644
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx
@@ -71,9 +71,7 @@ private:
     VclPtr<NumericField>                           mpEdLeadZeroes;
     VclPtr<CheckBox>                               mpBtnNegRed;
     VclPtr<CheckBox>                               mpBtnThousand;
-
-    OUString                                maThousandSeparator;
-    OUString                                maEngineeringNotation;
+    VclPtr<CheckBox>                               mpBtnEngineering;
 
     ::sfx2::sidebar::ControllerItem         maNumFormatControl;
     ::sfx2::sidebar::ControllerItem         maFormatControl;
diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.src 
b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src
deleted file mode 100644
index 35f15e3..0000000
--- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.src
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-#include "NumberFormatPropertyPanel.hrc"
-
-
-String RID_SFX_STR_THOUSAND_SEP
-{
-    Text [ en-US ] = "Thousands separator";
-};
-
-String RID_SFX_STR_ENGINEERING
-{
-    Text [ en-US ] = "Engineering notation";
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/uiconfig/scalc/ui/sidebarnumberformat.ui 
b/sc/uiconfig/scalc/ui/sidebarnumberformat.ui
index 1251181..57bb762a 100644
--- a/sc/uiconfig/scalc/ui/sidebarnumberformat.ui
+++ b/sc/uiconfig/scalc/ui/sidebarnumberformat.ui
@@ -240,6 +240,26 @@
             <property name="position">5</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkCheckButton" id="engineeringnotation">
+            <property name="label" translatable="yes">_Engineering 
notation</property>
+            <property name="use_action_appearance">False</property>
+            <property name="visible">False</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="has_tooltip">True</property>
+            <property name="tooltip_markup" translatable="yes">Ensures that 
exponent is a multiple of 3.</property>
+            <property name="tooltip_text" translatable="yes">Ensures that 
exponent is a multiple of 3.</property>
+            <property name="use_underline">True</property>
+            <property name="xalign">0</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">5</property>
+          </packing>
+        </child>
       </object>
       <packing>
         <property name="left_attach">0</property>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to