Kaydet (Commit) a687d554 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Limit the number of initial sheets to 1 to 1024 in the UI.

Note that you can still have more than 1024 sheets afterwards.  This
only applies to new and empty documents.
üst 53faacea
......@@ -52,6 +52,10 @@ private:
explicit ScTpDefaultsOptions(Window* pParent, const SfxItemSet& rCoreAttrs);
virtual ~ScTpDefaultsOptions();
void CheckNumSheets();
DECL_LINK( NumModifiedHdl, NumericField* );
private:
FixedLine aFLInitSpreadSheet;
FixedText aFtNSheets;
......
......@@ -35,6 +35,9 @@
#include "scmod.hxx"
#include "docoptio.hxx"
#define INIT_SHEETS_MIN 1
#define INIT_SHEETS_MAX 1024
ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCoreAttrs) :
SfxTabPage(pParent, ScResId(RID_SCPAGE_DEFAULTS), rCoreAttrs),
aFLInitSpreadSheet ( this, ScResId( FL_INIT_SPREADSHEET ) ),
......@@ -46,6 +49,8 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCor
const ScTpCalcItem& rItem = static_cast<const ScTpCalcItem&>(
rCoreAttrs.Get(GetWhich(SID_SCDOCOPTIONS)));
mpLocalOptions.reset(new ScDocOptions(rItem.GetDocOptions()));
aEdNSheets.SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
}
ScTpDefaultsOptions::~ScTpDefaultsOptions()
......@@ -75,6 +80,7 @@ sal_Bool ScTpDefaultsOptions::FillItemSet(SfxItemSet &rCoreAttrs)
void ScTpDefaultsOptions::Reset(const SfxItemSet& /*rCoreAttrs*/)
{
aEdNSheets.SetValue( static_cast<sal_uInt16>(mpLocalOptions->GetInitTabCount()) );
CheckNumSheets();
}
int ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
......@@ -82,4 +88,19 @@ int ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/)
return KEEP_PAGE;
}
void ScTpDefaultsOptions::CheckNumSheets()
{
sal_Int64 nVal = aEdNSheets.GetValue();
if (nVal > INIT_SHEETS_MAX)
aEdNSheets.SetValue(INIT_SHEETS_MAX);
if (nVal < INIT_SHEETS_MIN)
aEdNSheets.SetValue(INIT_SHEETS_MIN);
}
IMPL_LINK( ScTpDefaultsOptions, NumModifiedHdl, NumericField*, EMPTYARG )
{
CheckNumSheets();
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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