summaryrefslogtreecommitdiff
path: root/sc/source/ui/optdlg
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2012-01-06 12:43:20 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2012-01-06 12:45:56 -0500
commita687d554774eba1c4bf5a4825e8730cb0114bd3c (patch)
tree7da1779262fd513a36d5d3e57083425d4d01ee6a /sc/source/ui/optdlg
parent53faaceac6916d0d35386b7cedd75b8d2171e6ef (diff)
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.
Diffstat (limited to 'sc/source/ui/optdlg')
-rw-r--r--sc/source/ui/optdlg/tpdefaults.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index ae88b2e3b987..bd1cc6847d18 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -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: */