Kaydet (Commit) 782adaed authored tarafından Prashant Pandey's avatar Prashant Pandey Kaydeden (comit) Jan Holesovsky

sidebar: Conversion to .ui for NumberFormatPropertyPanel

Change-Id: I25891c0acda620621f0af868914cbc58776d0f53
üst 8055945b
...@@ -85,7 +85,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\ ...@@ -85,7 +85,6 @@ $(eval $(call gb_SrsTarget_add_files,sc/res,\
sc/source/ui/formdlg/formdlgs.src \ sc/source/ui/formdlg/formdlgs.src \
sc/source/ui/formdlg/dwfunctr.src \ sc/source/ui/formdlg/dwfunctr.src \
sc/source/ui/sidebar/CellAppearancePropertyPanel.src \ sc/source/ui/sidebar/CellAppearancePropertyPanel.src \
sc/source/ui/sidebar/NumberFormatPropertyPanel.src \
sc/source/core/src/compiler.src \ sc/source/core/src/compiler.src \
)) ))
......
...@@ -97,6 +97,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ ...@@ -97,6 +97,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/sharedfooterdialog \ sc/uiconfig/scalc/ui/sharedfooterdialog \
sc/uiconfig/scalc/ui/sharedheaderdialog \ sc/uiconfig/scalc/ui/sharedheaderdialog \
sc/uiconfig/scalc/ui/sidebaralignment \ sc/uiconfig/scalc/ui/sidebaralignment \
sc/uiconfig/scalc/ui/sidebarnumberformat \
sc/uiconfig/scalc/ui/solverdlg \ sc/uiconfig/scalc/ui/solverdlg \
sc/uiconfig/scalc/ui/sortcriteriapage \ sc/uiconfig/scalc/ui/sortcriteriapage \
sc/uiconfig/scalc/ui/sortkey \ sc/uiconfig/scalc/ui/sortkey \
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <sfx2/sidebar/Theme.hxx> #include <sfx2/sidebar/Theme.hxx>
#include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/sidebar/ControlFactory.hxx>
#include <NumberFormatPropertyPanel.hxx> #include <NumberFormatPropertyPanel.hxx>
#include <NumberFormatPropertyPanel.hrc>
#include "sc.hrc" #include "sc.hrc"
#include "scresid.hxx" #include "scresid.hxx"
#include <sfx2/bindings.hxx> #include <sfx2/bindings.hxx>
...@@ -37,6 +36,12 @@ using namespace css; ...@@ -37,6 +36,12 @@ using namespace css;
using namespace cssu; using namespace cssu;
using ::sfx2::sidebar::Theme; using ::sfx2::sidebar::Theme;
const char UNO_NUMERICFIELD[] = ".uno:NumericField";
const char UNO_NUMBERFORMATPERCENT[] = ".uno:NumberFormatPercent";
const char UNO_NUMBERFORMATCURRENCY[] = ".uno:NumberFormatCurrency";
const char UNO_NUMBERFORMATDATE[] = ".uno:NumberFormatDate";
const char UNO_INSERTFIXEDTEXT[] = ".uno:InsertFixedText";
#define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString))) #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -50,19 +55,7 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel( ...@@ -50,19 +55,7 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel(
Window* pParent, Window* pParent,
const cssu::Reference<css::frame::XFrame>& rxFrame, const cssu::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings) SfxBindings* pBindings)
: Control( : PanelLayout(pParent,"NumberFormatPropertyPanel", "modules/scalc/ui/sidebarnumberformat.ui", rxFrame),
pParent,
ScResId(RID_PROPERTYPANEL_SC_NUMBERFORMAT)),
mpFtCategory(new FixedText(this, ScResId(FT_CATEGORY))),
mpLbCategory(new ListBox(this, ScResId(LB_CATEGORY))),
mpTBCategoryBackground(sfx2::sidebar::ControlFactory::CreateToolBoxBackground(this)),
mpTBCategory(sfx2::sidebar::ControlFactory::CreateToolBox(mpTBCategoryBackground.get(), ScResId(TBX_CATEGORY))),
mpFtDecimals(new FixedText(this, ScResId(FT_DECIMALS))),
mpEdDecimals(new NumericField(this, ScResId(ED_DECIMALS))),
mpFtLeadZeroes(new FixedText(this, ScResId(FT_LEADZEROES))),
mpEdLeadZeroes(new NumericField(this, ScResId(ED_LEADZEROES))),
mpBtnNegRed(new CheckBox(this, ScResId(BTN_NEGRED))),
mpBtnThousand(new CheckBox(this, ScResId(BTN_THOUSAND))),
maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this), maNumFormatControl(SID_NUMBER_TYPE_FORMAT, *pBindings, *this),
// Caution! SID_NUMBER_FORMAT is reworked in symphony code, may be needed (!) If // Caution! SID_NUMBER_FORMAT is reworked in symphony code, may be needed (!) If
...@@ -74,17 +67,20 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel( ...@@ -74,17 +67,20 @@ NumberFormatPropertyPanel::NumberFormatPropertyPanel(
maContext(), maContext(),
mpBindings(pBindings) mpBindings(pBindings)
{ {
get(mpLbCategory, "category");
get(mpTBCategory, "numberformat");
get(mpEdDecimals, "decimalplaces");
get(mpEdLeadZeroes, "leadingzeroes");
get(mpBtnNegRed, "negativenumbersred");
get(mpBtnThousand, "thousandseperator");
Initialize(); Initialize();
FreeResource();
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
NumberFormatPropertyPanel::~NumberFormatPropertyPanel() NumberFormatPropertyPanel::~NumberFormatPropertyPanel()
{ {
// Destroy the toolboxes, then their background windows.
mpTBCategory.reset();
mpTBCategoryBackground.reset();
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
...@@ -97,28 +93,6 @@ void NumberFormatPropertyPanel::Initialize() ...@@ -97,28 +93,6 @@ void NumberFormatPropertyPanel::Initialize()
mpLbCategory->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Category"))); //wj acc mpLbCategory->SetAccessibleName(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Category"))); //wj acc
mpLbCategory->SetDropDownLineCount(mpLbCategory->GetEntryCount()); mpLbCategory->SetDropDownLineCount(mpLbCategory->GetEntryCount());
// Note that we use icons from UNO commands that are not in every case the commands
// that are really dispatched. They just look right.
mpTBCategory->SetItemImage(
ID_NUMBER,
GetImage(mxFrame, A2S(".uno:NumericField"), sal_False));
mpTBCategory->SetItemImage(
ID_PERCENT,
GetImage(mxFrame, A2S(".uno:NumberFormatPercent"), sal_False));
mpTBCategory->SetItemImage(
ID_CURRENCY,
GetImage(mxFrame, A2S(".uno:NumberFormatCurrency"), sal_False));
mpTBCategory->SetItemImage(
ID_DATE,
GetImage(mxFrame, A2S(".uno:NumberFormatDate"), sal_False));
mpTBCategory->SetItemImage(
ID_TEXT,
GetImage(mxFrame, A2S(".uno:InsertFixedText"), sal_False));
Size aTbxSize( mpTBCategory->CalcWindowSizePixel() );
mpTBCategory->SetOutputSizePixel( aTbxSize );
mpTBCategory->SetBackground(Wallpaper());
mpTBCategory->SetPaintTransparent(true);
aLink = LINK(this, NumberFormatPropertyPanel, NumFormatHdl); aLink = LINK(this, NumberFormatPropertyPanel, NumFormatHdl);
mpTBCategory->SetSelectHdl ( aLink ); mpTBCategory->SetSelectHdl ( aLink );
...@@ -131,38 +105,27 @@ void NumberFormatPropertyPanel::Initialize() ...@@ -131,38 +105,27 @@ void NumberFormatPropertyPanel::Initialize()
mpBtnNegRed->SetClickHdl( aLink ); mpBtnNegRed->SetClickHdl( aLink );
mpBtnThousand->SetClickHdl( aLink ); mpBtnThousand->SetClickHdl( aLink );
mpLbCategory->SetAccessibleRelationLabeledBy(mpFtCategory.get()); mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory);
mpTBCategory->SetAccessibleRelationLabeledBy(mpTBCategory.get());
mpEdDecimals->SetAccessibleRelationLabeledBy(mpFtDecimals.get());
mpEdLeadZeroes->SetAccessibleRelationLabeledBy(mpFtLeadZeroes.get());
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
IMPL_LINK( NumberFormatPropertyPanel, NumFormatHdl, ToolBox*, pBox ) IMPL_LINK( NumberFormatPropertyPanel, NumFormatHdl, ToolBox*, pBox )
{ {
sal_uInt16 nVal = pBox->GetCurItemId(); const OUString aCommand(pBox->GetItemCommand(pBox->GetCurItemId()));
sal_uInt16 nId = 0; sal_uInt16 nId = 0;
switch(nVal)
{ if(aCommand == UNO_NUMERICFIELD)
case ID_NUMBER:
nId = 1; nId = 1;
break; else if(aCommand == UNO_NUMBERFORMATPERCENT)
case ID_PERCENT:
nId = 2; nId = 2;
break; else if(aCommand == UNO_NUMBERFORMATCURRENCY)
case ID_CURRENCY:
nId = 3; nId = 3;
break; else if(aCommand == UNO_NUMBERFORMATDATE)
case ID_DATE:
nId = 4; nId = 4;
break; else if(aCommand == UNO_INSERTFIXEDTEXT)
case ID_TEXT:
nId = 9; nId = 9;
break;
default:
;
}
if( nId != mnCategorySelected ) if( nId != mnCategorySelected )
{ {
SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nId ); SfxUInt16Item aItem( SID_NUMBER_TYPE_FORMAT, nId );
......
/*
* 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 .
*/
#define FT_CATEGORY 1
#define LB_CATEGORY 2
#define FT_DECIMALS 3
#define ED_DECIMALS 4
#define FT_LEADZEROES 5
#define ED_LEADZEROES 6
#define BTN_NEGRED 7
#define BTN_THOUSAND 8
#define TBX_CATEGORY 9
#define ID_NUMBER 10
#define ID_PERCENT 11
#define ID_CURRENCY 12
#define ID_DATE 13
#define ID_TEXT 14
//===============================================================position=============================================
#define MBOX_WIDTH 28
#define NF_TOOLBOX_ITEM_HEIGHT 12
#define CHECKBOX_HEIGHT 10
#define FT_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL
#define FT_CATEGORY_Y SECTIONPAGE_MARGIN_VERTICAL_TOP
#define LB_CATEGORY_X FT_CATEGORY_X
#define LB_CATEGORY_Y FT_CATEGORY_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
#define TBX_CATEGORY_X SECTIONPAGE_MARGIN_HORIZONTAL + 1
#define TBX_CATEGORY_Y LB_CATEGORY_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
#define FT_DECIMALS_X SECTIONPAGE_MARGIN_HORIZONTAL
#define FT_DECIMALS_Y TBX_CATEGORY_Y + NF_TOOLBOX_ITEM_HEIGHT + 4 + CONTROL_SPACING_VERTICAL
#define LB_DECIMALS_X FT_CATEGORY_X
#define LB_DECIMALS_Y FT_DECIMALS_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
#define FT_LEADZEROES_X SECTIONPAGE_MARGIN_HORIZONTAL + MBOX_WIDTH*2 + CONTROL_SPACING_HORIZONTAL
#define FT_LEADZEROES_Y FT_DECIMALS_Y
#define LB_LEADZEROES_X FT_LEADZEROES_X
#define LB_LEADZEROES_Y FT_LEADZEROES_Y + TEXT_HEIGHT + TEXT_CONTROL_SPACING_VERTICAL
#define BTN_NEGRED_X SECTIONPAGE_MARGIN_HORIZONTAL
#define BTN_NEGRED_Y LB_LEADZEROES_Y + MBOX_HEIGHT + CONTROL_SPACING_VERTICAL
#define BTN_THOUSAND_X SECTIONPAGE_MARGIN_HORIZONTAL
#define BTN_THOUSAND_Y BTN_NEGRED_Y + CHECKBOX_HEIGHT + CONTROL_SPACING_VERTICAL - 3
#define PROPERTYPAGE_HEIGHT BTN_THOUSAND_Y + CHECKBOX_HEIGHT + 2
// eof
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <sfx2/sidebar/ControllerItem.hxx> #include <sfx2/sidebar/ControllerItem.hxx>
#include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx>
#include <svx/sidebar/PanelLayout.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
class FixedText; class FixedText;
...@@ -29,7 +30,7 @@ class NumericField; ...@@ -29,7 +30,7 @@ class NumericField;
namespace sc { namespace sidebar { namespace sc { namespace sidebar {
class NumberFormatPropertyPanel class NumberFormatPropertyPanel
: public Control, : public PanelLayout,
public ::sfx2::sidebar::IContextChangeReceiver, public ::sfx2::sidebar::IContextChangeReceiver,
public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
{ {
...@@ -56,16 +57,12 @@ public: ...@@ -56,16 +57,12 @@ public:
private: private:
//ui controls //ui controls
::boost::scoped_ptr< FixedText > mpFtCategory; ListBox* mpLbCategory;
::boost::scoped_ptr< ListBox > mpLbCategory; ToolBox* mpTBCategory;
::boost::scoped_ptr< Window > mpTBCategoryBackground; NumericField* mpEdDecimals;
::boost::scoped_ptr< ToolBox > mpTBCategory; NumericField* mpEdLeadZeroes;
::boost::scoped_ptr< FixedText > mpFtDecimals; CheckBox* mpBtnNegRed;
::boost::scoped_ptr< NumericField > mpEdDecimals; CheckBox* mpBtnThousand;
::boost::scoped_ptr< FixedText > mpFtLeadZeroes;
::boost::scoped_ptr< NumericField > mpEdLeadZeroes;
::boost::scoped_ptr< CheckBox > mpBtnNegRed;
::boost::scoped_ptr< CheckBox > mpBtnThousand;
::sfx2::sidebar::ControllerItem maNumFormatControl; ::sfx2::sidebar::ControllerItem maNumFormatControl;
::sfx2::sidebar::ControllerItem maFormatControl; ::sfx2::sidebar::ControllerItem maFormatControl;
......
/*
* 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"
#include <sfx2/sidebar/ResourceDefinitions.hrc>
#include "sc.hrc"
#include "helpids.h"
Control RID_PROPERTYPANEL_SC_NUMBERFORMAT
{
OutputSize = TRUE;
DialogControl = TRUE;
Border = FALSE;
Size = MAP_APPFONT( PROPERTYPAGE_WIDTH, PROPERTYPAGE_HEIGHT );
HelpID = HID_PROPERTYPANEL_SC_NUM_SECTION ;
Text = "Number Format";
FixedText FT_CATEGORY
{
Pos = MAP_APPFONT ( FT_CATEGORY_X , FT_CATEGORY_Y ) ;
Size = MAP_APPFONT ( MBOX_WIDTH*4 , TEXT_HEIGHT ) ;
Text [ en-US ] = "~Category:" ;
};
ListBox LB_CATEGORY
{
Border = TRUE ;
Pos = MAP_APPFONT ( LB_CATEGORY_X , LB_CATEGORY_Y ) ;
Size = MAP_APPFONT ( MBOX_WIDTH *2 , MBOX_HEIGHT ) ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_LB_CATEGORY;
QuickHelpText [ en-US ] = "Select a category of contents.";
TabStop = TRUE ;
DropDown = TRUE ;
StringList [ en-US ] =
{
< "General" ; Default ; > ;
< "Number" ;> ;
< "Percent" ;> ;
< "Currency" ;> ;
< "Date" ;> ;
< "Time" ;> ;
< "Scientific" ;> ;
< "Fraction" ;> ;
< "Boolean Value" ;> ;
< "Text" ;> ;
};
};
ToolBox TBX_CATEGORY
{
Pos = MAP_APPFONT ( TBX_CATEGORY_X , TBX_CATEGORY_Y );
SVLook = TRUE ;
Border = FALSE ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_TBX_CATEGORY;
Text = "Format";
ItemList =
{
ToolBoxItem
{
Identifier = ID_NUMBER ;
Text [ en-US ] = "Number" ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_NUMBER;
};
ToolBoxItem
{
Identifier = ID_PERCENT ;
Text [ en-US ] = "Percent" ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_PERCENT;
};
ToolBoxItem
{
Identifier = ID_CURRENCY ;
Text [ en-US ] = "Currency" ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_CURRENCY;
};
ToolBoxItem
{
Identifier = ID_DATE ;
Text [ en-US ] = "Date" ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_DATE;
};
ToolBoxItem
{
Identifier = ID_TEXT ;
Text [ en-US ] = "Text" ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ID_TEXT;
};
};
};
FixedText FT_DECIMALS
{
Pos = MAP_APPFONT ( FT_DECIMALS_X , FT_DECIMALS_Y ) ;
Size = MAP_APPFONT ( MBOX_WIDTH *2, TEXT_HEIGHT ) ;
Text [ en-US ] = "~Decimal places:" ;
};
NumericField ED_DECIMALS
{
Border = TRUE ;
Pos = MAP_APPFONT ( LB_DECIMALS_X , LB_DECIMALS_Y ) ;
Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_DECIMALS;
QuickHelpText [ en-US ] = "Enter the number of decimal places that you want to display.";
Spin = TRUE ;
Maximum = 20 ;
Last = 15 ;
First = 0 ;
StrictFormat = TRUE ;
SpinSize = 1 ;
Repeat = TRUE ;
};
FixedText FT_LEADZEROES
{
Pos = MAP_APPFONT ( FT_LEADZEROES_X , FT_LEADZEROES_Y ) ;
Size = MAP_APPFONT (PROPERTYPAGE_WIDTH - MBOX_WIDTH *2 - SECTIONPAGE_MARGIN_HORIZONTAL * 2, TEXT_HEIGHT ) ; //
Text [ en-US ] = "Leading ~zeroes:" ;
};
NumericField ED_LEADZEROES
{
Border = TRUE ;
Pos = MAP_APPFONT ( LB_LEADZEROES_X , LB_LEADZEROES_Y ) ;
Size = MAP_APPFONT ( MBOX_WIDTH , MBOX_HEIGHT ) ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_ED_LEADZEROES;
QuickHelpText [ en-US ] = "Enter the maximum number of zeroes to display before the decimal point.";
Spin = TRUE ;
Maximum = 20 ;
Last = 15 ;
First = 0 ;
StrictFormat = TRUE ;
SpinSize = 1 ;
Repeat = TRUE ;
};
CheckBox BTN_NEGRED
{
Pos = MAP_APPFONT ( BTN_NEGRED_X , BTN_NEGRED_Y ) ;
Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_NEGRED;
QuickHelpText [ en-US ] = "Changes the font color of negative numbers to red.";
Text [ en-US ] = "~Negative numbers red" ;
};
CheckBox BTN_THOUSAND
{
Pos = MAP_APPFONT ( BTN_THOUSAND_X , BTN_THOUSAND_Y ) ;
Size = MAP_APPFONT ( 100 , CHECKBOX_HEIGHT ) ;
HelpID = HID_PROPERTY_PANEL_NUMFMT_BTN_THOUSAND;
QuickHelpText [ en-US ] = "Inserts a separator between thousands.";
Text [ en-US ] = "~Thousands separator" ;
};
};
// eof
This diff is collapsed.
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