Kaydet (Commit) feb336a2 authored tarafından Laurent Balland-Poirier's avatar Laurent Balland-Poirier Kaydeden (comit) Eike Rathke

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/15609Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst 82485499
......@@ -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)
......
......@@ -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 \
))
......
......@@ -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
{
......
/* -*- 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: */
......@@ -72,6 +72,9 @@ private:
VclPtr<CheckBox> mpBtnNegRed;
VclPtr<CheckBox> mpBtnThousand;
OUString maThousandSeparator;
OUString maEngineeringNotation;
::sfx2::sidebar::ControllerItem maNumFormatControl;
::sfx2::sidebar::ControllerItem maFormatControl;
......
/* -*- 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: */
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment