Kaydet (Commit) a20b8dce authored tarafından Faisal M. Al-Otaibi's avatar Faisal M. Al-Otaibi Kaydeden (comit) Caolán McNamara

conversion the calc default option page to .ui

Change-Id: I09d8b012633e7fce916b54eee6b1b0d9db50ac23
Reviewed-on: https://gerrit.libreoffice.org/4092Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0181f258
......@@ -80,6 +80,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/leftheaderdialog \
sc/uiconfig/scalc/ui/managenamesdialog \
sc/uiconfig/scalc/ui/optcalculatepage \
sc/uiconfig/scalc/ui/optdefaultpage \
sc/uiconfig/scalc/ui/printeroptions \
sc/uiconfig/scalc/ui/protectsheetdlg \
sc/uiconfig/scalc/ui/sheetprintpage \
......
......@@ -65,7 +65,6 @@
#define HID_SCPAGE_AREAS "SC_HID_SCPAGE_AREAS"
#define HID_SCPAGE_COMPATIBILITY "SC_HID_SCPAGE_COMPATIBILITY"
#define HID_SCPAGE_PRINT "SC_HID_SCPAGE_PRINT"
#define HID_SCPAGE_DEFAULTS "SC_HID_SCPAGE_DEFAULTS"
#define HID_SCPAGE_SUBT_GROUP1 "SC_HID_SCPAGE_SUBT_GROUP1"
#define HID_SCPAGE_SUBT_GROUP2 "SC_HID_SCPAGE_SUBT_GROUP2"
#define HID_SCPAGE_SUBT_GROUP3 "SC_HID_SCPAGE_SUBT_GROUP3"
......
......@@ -156,11 +156,4 @@
#define FT_KEY_BINDINGS 2
#define LB_KEY_BINDINGS 3
// TP_DEFAULTS
#define FL_INIT_SPREADSHEET 1
#define FT_NSHEETS 2
#define ED_NSHEETS 3
#define FT_SHEETPREFIX 4
#define ED_SHEETPREFIX 5
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -38,11 +38,10 @@ private:
DECL_LINK( PrefixEditOnFocusHdl, Edit* );
private:
FixedLine aFLInitSpreadSheet;
FixedText aFtNSheets;
NumericField aEdNSheets;
FixedText aFtSheetPrefix;
Edit aEdSheetPrefix;
FixedText* m_pFtNSheets;
NumericField* m_pEdNSheets;
FixedText* m_pFtSheetPrefix;
Edit* m_pEdSheetPrefix;
// Stores old Sheet Prefix
OUString maOldPrefixValue;
......
......@@ -19,36 +19,35 @@
ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCoreSet) :
SfxTabPage(pParent, ScResId(RID_SCPAGE_DEFAULTS), rCoreSet),
aFLInitSpreadSheet ( this, ScResId( FL_INIT_SPREADSHEET ) ),
aFtNSheets ( this, ScResId( FT_NSHEETS ) ),
aEdNSheets ( this, ScResId( ED_NSHEETS ) ),
aFtSheetPrefix ( this, ScResId( FT_SHEETPREFIX ) ),
aEdSheetPrefix ( this, ScResId( ED_SHEETPREFIX ) )
SfxTabPage(pParent, "OptDefaultPage", "modules/scalc/ui/optdefaultpage.ui", rCoreSet)
{
FreeResource();
get( m_pFtNSheets, "textsheetsnumber");
get( m_pEdNSheets, "sheetsnumber");
get( m_pFtSheetPrefix, "textsheetprefix");
get( m_pEdSheetPrefix, "sheetprefix");
// the following computation must be modified accordingly if a third line is added to this dialog
long nTxtW1 = aFtNSheets.GetCtrlTextWidth( aFtNSheets.GetText() );
long nCtrlW1 = aFtNSheets.GetSizePixel().Width();
long nTxtW2 = aFtSheetPrefix.GetCtrlTextWidth(aFtSheetPrefix.GetText() );
long nCtrlW2 = aFtSheetPrefix.GetSizePixel().Width();
long nTxtW1 = m_pFtNSheets->GetCtrlTextWidth( m_pFtNSheets->GetText() );
long nCtrlW1 = m_pFtNSheets->GetSizePixel().Width();
long nTxtW2 = m_pFtSheetPrefix->GetCtrlTextWidth(m_pFtSheetPrefix->GetText() );
long nCtrlW2 = m_pFtSheetPrefix->GetSizePixel().Width();
if ( nTxtW1 >= nCtrlW1 || nTxtW2 >= nCtrlW2)
{
long nTxtW = std::max(nTxtW1,nTxtW2);
Size aNewSize = aFtNSheets.GetSizePixel();
Size aNewSize = m_pFtNSheets->GetSizePixel();
aNewSize.Width() = nTxtW;
aFtNSheets.SetSizePixel( aNewSize );
aFtSheetPrefix.SetSizePixel( aNewSize );
Point aNewPoint = aEdNSheets.GetPosPixel();
m_pFtNSheets->SetSizePixel( aNewSize );
m_pFtSheetPrefix->SetSizePixel( aNewSize );
Point aNewPoint = m_pEdNSheets->GetPosPixel();
aNewPoint.X() += (nTxtW - nCtrlW1);
aEdNSheets.SetPosPixel( aNewPoint );
aNewPoint.Y() = aEdSheetPrefix.GetPosPixel().Y();
aEdSheetPrefix.SetPosPixel( aNewPoint );
m_pEdNSheets->SetPosPixel( aNewPoint );
aNewPoint.Y() = m_pEdSheetPrefix->GetPosPixel().Y();
m_pEdSheetPrefix->SetPosPixel( aNewPoint );
}
aEdNSheets.SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
aEdSheetPrefix.SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );
aEdSheetPrefix.SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) );
m_pEdNSheets->SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
m_pEdSheetPrefix->SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );
m_pEdSheetPrefix->SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) );
}
ScTpDefaultsOptions::~ScTpDefaultsOptions()
......@@ -65,12 +64,12 @@ sal_Bool ScTpDefaultsOptions::FillItemSet(SfxItemSet &rCoreSet)
sal_Bool bRet = false;
ScDefaultsOptions aOpt;
SCTAB nTabCount = static_cast<SCTAB>(aEdNSheets.GetValue());
OUString aSheetPrefix = aEdSheetPrefix.GetText();
SCTAB nTabCount = static_cast<SCTAB>(m_pEdNSheets->GetValue());
OUString aSheetPrefix = m_pEdSheetPrefix->GetText();
if ( aEdNSheets.GetSavedValue() != aEdNSheets.GetText()
|| aEdSheetPrefix.GetSavedValue() != aSheetPrefix )
if ( m_pEdNSheets->GetSavedValue() != m_pEdNSheets->GetText()
|| m_pEdSheetPrefix->GetSavedValue() != aSheetPrefix )
{
aOpt.SetInitTabCount( nTabCount );
aOpt.SetInitTabPrefix( aSheetPrefix );
......@@ -89,10 +88,10 @@ void ScTpDefaultsOptions::Reset(const SfxItemSet& rCoreSet)
if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCDEFAULTSOPTIONS, false , &pItem))
aOpt = ((const ScTpDefaultsItem*)pItem)->GetDefaultsOptions();
aEdNSheets.SetValue( static_cast<sal_uInt16>( aOpt.GetInitTabCount()) );
aEdSheetPrefix.SetText( aOpt.GetInitTabPrefix() );
aEdNSheets.SaveValue();
aEdSheetPrefix.SaveValue();
m_pEdNSheets->SetValue( static_cast<sal_uInt16>( aOpt.GetInitTabCount()) );
m_pEdSheetPrefix->SetText( aOpt.GetInitTabPrefix() );
m_pEdNSheets->SaveValue();
m_pEdSheetPrefix->SaveValue();
}
int ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
......@@ -102,11 +101,11 @@ int ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
void ScTpDefaultsOptions::CheckNumSheets()
{
sal_Int64 nVal = aEdNSheets.GetValue();
sal_Int64 nVal = m_pEdNSheets->GetValue();
if (nVal > MAXINITTAB)
aEdNSheets.SetValue(MAXINITTAB);
m_pEdNSheets->SetValue(MAXINITTAB);
if (nVal < MININITTAB)
aEdNSheets.SetValue(MININITTAB);
m_pEdNSheets->SetValue(MININITTAB);
}
void ScTpDefaultsOptions::CheckPrefix(Edit* pEdit)
......
......@@ -790,49 +790,4 @@ TabPage RID_SCPAGE_PRINT
};
};
TabPage RID_SCPAGE_DEFAULTS
{
HelpId = HID_SCPAGE_DEFAULTS ;
SVLook = TRUE ;
Hide = TRUE ;
Pos = MAP_APPFONT ( 0 , 0 ) ;
Size = MAP_APPFONT ( TP_WIDTH , TP_HEIGHT ) ;
FixedLine FL_INIT_SPREADSHEET
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 248 , 8 ) ;
Text [ en-US ] = "New Spreadsheet";
};
FixedText FT_NSHEETS
{
Pos = MAP_APPFONT ( 12 , 16 ) ;
Size = MAP_APPFONT ( 110 , 8 ) ;
Text [ en-US ] = "Number of worksheets in new document";
};
NumericField ED_NSHEETS
{
HelpID = "sc:NumericField:RID_SCPAGE_CALC:ED_NSHEETS";
Border = TRUE ;
Pos = MAP_APPFONT ( 130 , 14 ) ;
Size = MAP_APPFONT ( 25 , 12 ) ;
Minimum = 1 ;
Maximum = 32000 ;
Spin = TRUE ;
Repeat = TRUE ;
};
FixedText FT_SHEETPREFIX
{
Pos = MAP_APPFONT ( 12 , 32 ) ;
Size = MAP_APPFONT ( 110 , 8 ) ;
Text [ en-US ] = "Prefix name for new worksheet";
};
Edit ED_SHEETPREFIX
{
HelpID = "sc:Edit:RID_SCPAGE_CALC:ED_SHEETPREFIX";
Border = TRUE ;
Pos = MAP_APPFONT ( 130 , 30 ) ;
Size = MAP_APPFONT ( 60 , 12 ) ;
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkBox" id="OptDefaultPage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<object class="GtkLabel" id="textsheetsnumber">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Number of worksheets in new document</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">sheetsnumber</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="textsheetprefix">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Prefix name for new worksheet</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">sheetprefix</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="sheetprefix">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="sheetsnumber">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char"></property>
<property name="invisible_char_set">True</property>
<property name="climb_rate">1</property>
<property name="update_policy">if-valid</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">New Spreadsheet</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</interface>
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