summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/unoobj/appluno.cxx15
-rw-r--r--sc/source/ui/unoobj/confuno.cxx15
2 files changed, 28 insertions, 2 deletions
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index fd7edfd739da..d814831647ec 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -36,6 +36,7 @@
#include "sc.hrc"
#include "unonames.hxx"
#include "funcdesc.hxx"
+#include <com/sun/star/document/LinkUpdateModes.hpp>
#include <com/sun/star/sheet/FunctionArgument.hpp>
#include "ScPanelFactory.hxx"
#include <boost/scoped_array.hpp>
@@ -395,7 +396,19 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
}
else if (aString == SC_UNONAME_LINKUPD)
{
- aAppOpt.SetLinkMode( (ScLkUpdMode) ScUnoHelpFunctions::GetInt16FromAny( aValue ) );
+ sal_Int16 n;
+ if (!(aValue >>= n) || n < css::document::LinkUpdateModes::NEVER
+ || n > css::document::LinkUpdateModes::GLOBAL_SETTING)
+ {
+ throw css::lang::IllegalArgumentException(
+ ("LinkUpdateMode property value must be a SHORT with a value in"
+ " the range of the css.document.LinkUpdateModes constants"),
+ css::uno::Reference<css::uno::XInterface>(), -1);
+ }
+ //TODO: ScLkUpdMode (LM_ALWAYS=0, LM_NEVER=1, LM_ON_DEMAND=2,
+ // LM_UNKNOWN=3) does not match css.document.LinkUpdateModes (NEVER=0,
+ // MANUAL=1, AUTO=2, GLOBAL_SETTINGS=3):
+ aAppOpt.SetLinkMode( static_cast<ScLkUpdMode>(n) );
bSaveApp = true;
}
else if (aString == SC_UNONAME_MARKHDR)
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index ed59eebd832d..6cd3204f2ad5 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -156,7 +156,20 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if ( aPropertyName == SC_UNONAME_LINKUPD )
- rDoc.SetLinkMode( static_cast<ScLkUpdMode> ( ScUnoHelpFunctions::GetInt16FromAny( aValue ) ) );
+ {
+ sal_Int16 n;
+ //TODO: css.sheet.XGlobalSheetSettings LinkUpdateMode property is
+ // documented to take values in the range 0--2 (always, never, on
+ // demaned), but appears to be routinely set to 3 here,
+ // corresponding to ScLkUpdMode LM_UNKNOWN:
+ if (!(aValue >>= n) || n < 0 || n > 3) {
+ throw css::lang::IllegalArgumentException(
+ ("LinkUpdateMode property value must be a SHORT in the"
+ " range 0--3"),
+ css::uno::Reference<css::uno::XInterface>(), -1);
+ }
+ rDoc.SetLinkMode( static_cast<ScLkUpdMode>(n) );
+ }
else if ( aPropertyName == SC_UNO_COLROWHDR )
aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if ( aPropertyName == SC_UNO_SHEETTABS )