summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-01-26 17:51:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-01-27 16:47:05 +0000
commit739353bcb420c18df6116cd645cc2226782e13cc (patch)
treea06a95c5b8b96ea86925b0003a5ebb50c5d14b52 /sc/source/ui
parentea525e91338a164bbc76954869295f1e939095ae (diff)
dissolve LinkUpdateMode confusion, document::Settings vs XGlobalSheetSettings
This is a combination of 3 commits. this is css::sheet::XGlobalSheetSettings attribute LinkUpdateMode ... and not css::document::Settings property LinkUpdateMode. It directly maps to ScLkUpdMode, LM_UNKNOWN isn't documented as a valid input value. (cherry picked from commit 109cff60a3a18b20b2e0efefd0d49f6eab9b52fd) remove now unused header file (cherry picked from commit d03cacfb7b9b126e375dfeaeed2fcd74d4fa48fb) this is the css::document::Settings property LinkUpdateMode ... not the css::sheet::XGlobalSheetSettings attribute LinkUpdateMode. (cherry picked from commit 32d90e643e4d9285366169301af4342d871c0d94) 7a9696f07c1a6e1deec342f224343bd938078c2c 039c8d39e89e693de1c5a1a4218c2fca70a6de9f Change-Id: I062a1fd32ad6a98db4f8e78de4724be1c8190407 Reviewed-on: https://gerrit.libreoffice.org/33600 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/unoobj/appluno.cxx14
-rw-r--r--sc/source/ui/unoobj/confuno.cxx56
2 files changed, 53 insertions, 17 deletions
diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx
index 2845341982c1..989e45d64290 100644
--- a/sc/source/ui/unoobj/appluno.cxx
+++ b/sc/source/ui/unoobj/appluno.cxx
@@ -36,7 +36,6 @@
#include "sc.hrc"
#include "unonames.hxx"
#include "funcdesc.hxx"
-#include <com/sun/star/document/LinkUpdateModes.hpp>
#include <com/sun/star/sheet/FunctionArgument.hpp>
#include <memory>
@@ -263,18 +262,17 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue(
}
else if (aPropertyName == SC_UNONAME_LINKUPD)
{
+ // XXX NOTE: this is not css::document::Settings property
+ // LinkUpdateMode but css::sheet::XGlobalSheetSettings attribute
+ // LinkUpdateMode.
sal_Int16 n;
- if (!(aValue >>= n) || n < css::document::LinkUpdateModes::NEVER
- || n > css::document::LinkUpdateModes::GLOBAL_SETTING)
+ if (!(aValue >>= n) || n < 0 || n >= ScLkUpdMode::LM_UNKNOWN)
{
throw css::lang::IllegalArgumentException(
- ("LinkUpdateMode property value must be a SHORT with a value in"
- " the range of the css.document.LinkUpdateModes constants"),
+ ("LinkUpdateMode property value must be a SHORT with a value in the range of 0--2"
+ " as documented for css::sheet::XGlobalSheetSettings attribute LinkUpdateMode"),
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;
}
diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx
index 7377860b7a73..b7f0c32ff35f 100644
--- a/sc/source/ui/unoobj/confuno.cxx
+++ b/sc/source/ui/unoobj/confuno.cxx
@@ -30,6 +30,7 @@
#include "sc.hrc"
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/document/LinkUpdateModes.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <formula/grammar.hxx>
#include <sfx2/printer.hxx>
@@ -158,18 +159,36 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
aViewOpt.SetOption(VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
else if ( aPropertyName == SC_UNONAME_LINKUPD )
{
+ // XXX NOTE: this is the css::document::Settings property
+ // LinkUpdateMode, not the css::sheet::XGlobalSheetSettings
+ // attribute LinkUpdateMode.
sal_Int16 n;
- //TODO: css.sheet.XGlobalSheetSettings LinkUpdateMode property is
- // documented to take values in the range 0--2 (always, never, on
- // demand), but appears to be routinely set to 3 here,
- // corresponding to ScLkUpdMode LM_UNKNOWN:
- if (!(aValue >>= n) || n < 0 || n > 3) {
+ 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 in the"
- " range 0--3"),
+ ("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);
}
- rDoc.SetLinkMode( static_cast<ScLkUpdMode>(n) );
+ ScLkUpdMode eMode;
+ switch (n)
+ {
+ case css::document::LinkUpdateModes::NEVER:
+ eMode = LM_NEVER;
+ break;
+ case css::document::LinkUpdateModes::MANUAL:
+ eMode = LM_ON_DEMAND;
+ break;
+ case css::document::LinkUpdateModes::AUTO:
+ eMode = LM_ALWAYS;
+ break;
+ case css::document::LinkUpdateModes::GLOBAL_SETTING:
+ default:
+ eMode = SC_MOD()->GetAppOptions().GetLinkMode();
+ break;
+ }
+ rDoc.SetLinkMode( eMode );
}
else if ( aPropertyName == SC_UNO_COLROWHDR )
aViewOpt.SetOption(VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( aValue ) );
@@ -391,7 +410,26 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
else if ( aPropertyName == SC_UNO_SHOWPAGEBR )
aRet <<= aViewOpt.GetOption( VOPT_PAGEBREAKS );
else if ( aPropertyName == SC_UNONAME_LINKUPD )
- aRet <<= static_cast<sal_Int16> ( rDoc.GetLinkMode() );
+ {
+ sal_Int16 nLUM;
+ switch (rDoc.GetLinkMode())
+ {
+ case LM_ALWAYS:
+ nLUM = css::document::LinkUpdateModes::AUTO;
+ break;
+ case LM_NEVER:
+ nLUM = css::document::LinkUpdateModes::NEVER;
+ break;
+ case LM_ON_DEMAND:
+ nLUM = css::document::LinkUpdateModes::MANUAL;
+ break;
+ case LM_UNKNOWN:
+ default:
+ nLUM = css::document::LinkUpdateModes::GLOBAL_SETTING;
+ break;
+ }
+ aRet <<= nLUM;
+ }
else if ( aPropertyName == SC_UNO_COLROWHDR )
aRet <<= aViewOpt.GetOption( VOPT_HEADER );
else if ( aPropertyName == SC_UNO_SHEETTABS )