22 #include <osl/diagnose.h>
32 #include <printopt.hxx>
35 #include <unonames.hxx>
37 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
38 #include <com/sun/star/sheet/FunctionArgument.hpp>
45 #define SC_ZOOMVAL_OPTIMAL (-1)
46 #define SC_ZOOMVAL_WHOLEPAGE (-2)
47 #define SC_ZOOMVAL_PAGEWIDTH (-3)
50 #define SC_FUNCDESC_PROPCOUNT 5
76 {
u"", 0, css::uno::Type(), 0, 0 }
78 return aSettingsPropertyMap_Impl;
90 ScSpreadsheetSettings::ScSpreadsheetSettings() :
99 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
101 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
130 static uno::Reference<beans::XPropertySetInfo> aRef(
136 const OUString& aPropertyName,
const uno::Any& aValue )
143 bool bSaveApp =
false;
144 bool bSaveInp =
false;
175 throw css::lang::IllegalArgumentException(
176 (
"LinkUpdateMode property value must be a SHORT with a value in the range of 0--2"
177 " as documented for css::sheet::XGlobalSheetSettings attribute LinkUpdateMode"),
178 css::uno::Reference<css::uno::XInterface>(), -1);
180 aAppOpt.SetLinkMode( static_cast<ScLkUpdMode>(n) );
235 aAppOpt.SetZoomType( eType );
239 aAppOpt.SetZoom( nVal );
240 aAppOpt.SetZoomType( SvxZoomType::PERCENT );
252 uno::Sequence<OUString>
aSeq;
253 if ( pUserList && ( aValue >>= aSeq ) )
259 for (
const OUString& aEntry : std::as_const(aSeq))
313 sal_Int16 nZoomVal = 0;
316 case SvxZoomType::PERCENT: nZoomVal = aAppOpt.
GetZoom();
break;
333 uno::Sequence<OUString>
aSeq(nCount);
334 OUString* pAry = aSeq.getArray();
335 for (
size_t i=0;
i<nCount; ++
i)
361 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
379 uno::Sequence<sal_Int32>
aSeq(nCount);
380 sal_Int32* pAry = aSeq.getArray();
381 for (sal_uInt16
i=0;
i<nCount;
i++)
389 const uno::Sequence<sal_Int32>& aRecentFunctionIds )
392 sal_uInt16
nCount =
static_cast<sal_uInt16
>(std::min( aRecentFunctionIds.getLength(), sal_Int32(
LRU_MAX) ));
393 const sal_Int32* pAry = aRecentFunctionIds.getConstArray();
395 std::unique_ptr<sal_uInt16[]> pFuncs(nCount ?
new sal_uInt16[nCount] :
nullptr);
396 for (sal_uInt16
i=0;
i<nCount;
i++)
397 pFuncs[
i] = static_cast<sal_uInt16>(pAry[
i]);
418 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
432 beans::PropertyValue* pArray = rSequence.getArray();
435 pArray[0].Value <<=
static_cast<sal_Int32
>(rDesc.
nFIndex);
438 pArray[1].Value <<=
static_cast<sal_Int32
>(rDesc.
nCategory);
466 uno::Sequence<sheet::FunctionArgument> aArgSeq(nSeqCount);
467 sheet::FunctionArgument* pArgAry = aArgSeq.getArray();
468 for (sal_uInt16
i=0, j=0;
i<nCount;
i++)
470 sheet::FunctionArgument aArgument;
474 pArgAry[j++] = aArgument;
476 pArray[4].Value <<= aArgSeq;
486 throw uno::RuntimeException();
488 sal_uInt16
nCount =
static_cast<sal_uInt16
>(pFuncList->
GetCount());
492 if ( pDesc && pDesc->
nFIndex == nId )
500 throw lang::IllegalArgumentException();
510 throw uno::RuntimeException();
512 sal_uInt16
nCount =
static_cast<sal_uInt16
>(pFuncList->
GetCount());
525 throw container::NoSuchElementException();
536 nCount =
static_cast<sal_Int32
>(pFuncList->
GetCount());
545 throw uno::RuntimeException();
547 if ( nIndex >= 0 && nIndex < static_cast<sal_Int32>(pFuncList->
GetCount()) )
558 throw lang::IndexOutOfBoundsException();
566 return new ScIndexEnumeration(
this,
"com.sun.star.sheet.FunctionDescriptionEnumeration");
580 return ( getCount() > 0 );
590 uno::Sequence<OUString>
aSeq(nCount);
591 OUString* pAry = aSeq.getArray();
virtual void SAL_CALL setRecentFunctionIds(const css::uno::Sequence< sal_Int32 > &aRecentFunctionIds) override
#define SC_UNONAME_METRIC
List of spreadsheet functions.
#define SC_UNONAME_PRALLSH
#define SC_UNONAME_PREMPTY
Collection of user-defined sort lists.
virtual sal_Int32 SAL_CALL getCount() override
static const SfxItemPropertyMapEntry * lcl_GetSettingsPropertyMap()
bool GetAutoComplete() const
virtual ~ScSpreadsheetSettings() override
sal_uInt16 GetSuppressedArgCount() const
Returns the number of non-suppressed arguments.
bool bOptional
Parameter is optional.
#define SC_UNONAME_PRMETRICS
static void lcl_FillSequence(uno::Sequence< beans::PropertyValue > &rSequence, const ScFuncDesc &rDesc)
ScLkUpdMode GetLinkMode() const
#define SC_UNONAME_STBFUNC
#define SC_UNONAME_MOVEDIR
std::unique_ptr< sal_Int32[]> pData
sal_uInt16 GetLRUFuncListCount() const
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
void SetLRUFuncList(const sal_uInt16 *pList, const sal_uInt16 nCount)
#define SC_UNONAME_MARKHDR
#define SC_ZOOMVAL_PAGEWIDTH
#define SC_FUNCDESC_PROPCOUNT
virtual ~ScFunctionListObj() override
SvxZoomType GetZoomType() const
virtual sal_Int32 SAL_CALL getMaxRecentFunctions() override
#define SC_UNONAME_CATEGORY
virtual css::uno::Type SAL_CALL getElementType() override
#define SC_UNONAME_MOVESEL
SfxApplication * SfxGetpApp()
OUString GetString(int nId)
FieldUnit GetAppMetric() const
void push_back(ScUserListData *p)
Stores individual user-defined sort list.
#define SC_UNONAME_EXPREF
#define SC_UNONAME_RANGEFIN
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
sal_uInt16 GetZoom() const
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
sal_uInt16 * GetLRUFuncList() const
virtual sal_Bool SAL_CALL hasElements() override
virtual ~ScRecentFunctionsObj() override
ParameterFlags * pDefArgFlags
Flags for each parameter.
#define SC_UNONAME_USETABCOL
SC_DLLPUBLIC void SetInputOptions(const ScInputOptions &rOpt)
SC_DLLPUBLIC void SetAppOptions(const ScAppOptions &rOpt)
sal_uInt16 nCategory
Function category.
#define SC_UNONAME_DESCRIPTION
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
void SetAllSheets(bool bVal)
SC_DLLPUBLIC const ScPrintOptions & GetPrintOptions()
std::vector< OUString > maDefArgDescs
Description(s) of parameter(s)
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
void SetPrintOptions(const ScPrintOptions &rOpt)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ScRecentFunctionsObj_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
sal_Int16 getPropertyInt16(const OUString &aPropertyName)
SC_DLLPUBLIC const ScAppOptions & GetAppOptions()
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * ScFunctionListObj_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
#define SC_UNONAME_ULISTS
static SC_DLLPUBLIC ScUserList * GetUserList()
std::optional< OUString > mxFuncDesc
Description of function.
css::uno::Type const & get()
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
constexpr OUStringLiteral SCFUNCTIONLISTOBJ_SERVICE
const ScFuncDesc * GetFunction(sal_uInt32 nIndex) const
static sal_Int16 GetInt16FromAny(const css::uno::Any &aAny)
#define SC_IMPL_DUMMY_PROPERTY_LISTENER(ClassName)
static ScFunctionList * GetStarCalcFunctionList()
constexpr OUStringLiteral SCSPREADSHEETSETTINGS_SERVICE
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_ScSpreadsheetSettings_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
#define SC_ZOOMVAL_OPTIMAL
somewhere central
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds() override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getById(sal_Int32 nId) override
bool getPropertyBool(const OUString &aPropertyName)
std::optional< OUString > mxFuncName
Function name.
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
#define SC_UNONAME_DOAUTOCP
bool GetAllSheets() const
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void initArgumentInfo() const override
Requests function data from AddInCollection.
SC_DLLPUBLIC const ScInputOptions & GetInputOptions()
Sequence< sal_Int8 > aSeq
sal_uInt16 nFIndex
Unique function index.
#define SC_ZOOMVAL_WHOLEPAGE
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
sal_uInt32 GetCount() const
constexpr OUStringLiteral SCRECENTFUNCTIONSOBJ_SERVICE
void SetSkipEmpty(bool bVal)
#define SC_UNONAME_EXTFMT
#define SC_UNONAME_ENTERED
sal_uInt32 GetStatusFunc() const
#define SC_UNONAME_ARGUMENTS
std::vector< OUString > maDefArgNames
Parameter name(s)
bool GetSkipEmpty() const
#define SC_UNONAME_LINKUPD
static bool GetBoolFromAny(const css::uno::Any &aAny)
#define SC_UNONAME_REPLWARN
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
sal_uInt16 nArgCount
All parameter count, suppressed and unsuppressed.
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override