diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2015-05-03 18:01:52 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-05-06 17:54:06 +0000 |
commit | feb336a2a286ff1fc4f584c1ee4ab2148ac596ad (patch) | |
tree | 21561d46872b1ca8e63b2ba43c1d0b79a351f8fa /sc | |
parent | 824854997ea293f12a17ec8b91c25924d8db6b75 (diff) |
tdf#90258 Sidebar: toggle Thousand/Engineering
Continue https://gerrit.libreoffice.org/15606/
5a8c7fd551522bdfe935f4138bde0df376464608
Rebase of https://gerrit.libreoffice.org/15233/
Update with more robust tests.
Update create NumberFormatPropertyPanel.[hs]rc
Change-Id: I36bd95cbaee160f96e7e7369096b5c8fb0aa8a4d
Reviewed-on: https://gerrit.libreoffice.org/15609
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/AllLangResTarget_sc.mk | 1 | ||||
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc | 25 | ||||
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/sidebar/NumberFormatPropertyPanel.src | 32 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 11 |
6 files changed, 79 insertions, 0 deletions
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index d41a13fbee6d..e959dc058806 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -54,6 +54,7 @@ $(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 953c318d115e..f3c492f38855 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -21,6 +21,7 @@ #include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/ControlFactory.hxx> #include "NumberFormatPropertyPanel.hxx" +#include <NumberFormatPropertyPanel.hrc> #include "sc.hrc" #include "scresid.hxx" #include <sfx2/bindings.hxx> @@ -50,6 +51,8 @@ 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), @@ -247,6 +250,10 @@ void NumberFormatPropertyPanel::NotifyItemUpdate( mpEdDecimals->Disable(); mpEdLeadZeroes->Disable(); } + if( nVal == 6 ) // For scientific, Thousand separator is replaced by Engineering notation + mpBtnThousand->SetText( maEngineeringNotation ); + else + mpBtnThousand->SetText( maThousandSeparator ); } else { diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc new file mode 100644 index 000000000000..3c2a63217c59 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc @@ -0,0 +1,25 @@ +/* -*- 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 64e1a8d14ede..5c61709899af 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx @@ -72,6 +72,9 @@ private: VclPtr<CheckBox> mpBtnNegRed; VclPtr<CheckBox> mpBtnThousand; + OUString maThousandSeparator; + OUString maEngineeringNotation; + ::sfx2::sidebar::ControllerItem maNumFormatControl; ::sfx2::sidebar::ControllerItem maFormatControl; diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.src b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src new file mode 100644 index 000000000000..35f15e3d87d9 --- /dev/null +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.src @@ -0,0 +1,32 @@ +/* -*- 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/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index a0fb39694450..b987c53e2684 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -2422,6 +2422,17 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) sal_uInt16 nLeadZeroes(0); pFormatter->GetFormatSpecialInfo(nNumberFormat,bThousand, bNegRed, nPrecision, nLeadZeroes); + + const SvNumberformat* pFormatEntry = pFormatter->GetEntry( nNumberFormat ); + if (pFormatEntry && (pFormatEntry->GetType() & css::util::NumberFormat::SCIENTIFIC)) + { + // if scientific, bThousand is used for engineering notation + const sal_uInt16 nIntegerDigits = pFormatEntry->GetFormatIntegerDigits(); + if (nIntegerDigits > 0 && ((nIntegerDigits % 3) == 0)) + bThousand = true; + else + bThousand = false; + } OUString aFormat; static OUString sBreak = ","; const OUString sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); |