summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/sfx.hrc1
-rw-r--r--sc/AllLangResTarget_sc.mk1
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx7
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.hrc25
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.hxx3
-rw-r--r--sc/source/ui/sidebar/NumberFormatPropertyPanel.src32
-rw-r--r--sc/source/ui/view/formatsh.cxx11
7 files changed, 80 insertions, 0 deletions
diff --git a/include/sfx2/sfx.hrc b/include/sfx2/sfx.hrc
index e184a3061303..4f63e5262607 100644
--- a/include/sfx2/sfx.hrc
+++ b/include/sfx2/sfx.hrc
@@ -88,6 +88,7 @@
#define RID_SFX_SFXLOCAL_START (RID_SFX_START + 3082)
#define RID_SFX_VIEW_START (RID_SFX_START + 4096)
#define RID_SFX_SIDEBAR_START (RID_SFX_START + 4150)
+#define RID_SFX_PROPERTYPANEL_START (RID_SFX_START + 4400)
// RID_CNT_START2 (RID_SFX_START + 4500)
// RID_SFX_CHAOSDOC_START (RID_SFX_START + 5120)
// RID_SFX_TPLCOMPONENT_START (RID_SFX_START + 6800)
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));