1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SC_INC_APPLUNO_HXX
21 #define INCLUDED_SC_INC_APPLUNO_HXX
23 #include <svl/itemprop.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <com/sun/star/sheet/XRecentFunctions.hpp>
27 #include <com/sun/star/sheet/XFunctionDescriptions.hpp>
28 #include <com/sun/star/sheet/XGlobalSheetSettings.hpp>
29 #include <com/sun/star/container/XEnumerationAccess.hpp>
30 #include <com/sun/star/container/XNameAccess.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <rtl/ustring.hxx>
33 #include <sfx2/sfxmodelfactory.hxx>
35 namespace com::sun::star::lang
{ class XMultiServiceFactory
; }
37 css::uno::Reference
<css::uno::XInterface
>
38 ScSpreadsheetSettings_CreateInstance(
39 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& rSMgr
);
40 css::uno::Reference
<css::uno::XInterface
> SAL_CALL
41 ScRecentFunctionsObj_CreateInstance(
42 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& rSMgr
);
43 css::uno::Reference
<css::uno::XInterface
> SAL_CALL
44 ScFunctionListObj_CreateInstance(
45 const css::uno::Reference
< css::lang::XMultiServiceFactory
>& rSMgr
);
48 class ScSpreadsheetSettings final
: public cppu::WeakImplHelper
<
49 css::sheet::XGlobalSheetSettings
,
50 css::beans::XPropertySet
,
51 css::lang::XServiceInfo
>
54 SfxItemPropertySet aPropSet
;
56 /// @throws css::uno::RuntimeException
57 bool getPropertyBool(const OUString
& aPropertyName
);
58 /// @throws css::uno::RuntimeException
59 sal_Int16
getPropertyInt16(const OUString
& aPropertyName
);
60 /// @throws css::uno::RuntimeException
61 void setProperty(const OUString
& aPropertyName
, bool p1
)
62 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
63 /// @throws css::uno::RuntimeException
64 void setProperty(const OUString
& aPropertyName
, sal_Int16 p1
)
65 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
67 ScSpreadsheetSettings();
68 virtual ~ScSpreadsheetSettings() override
;
70 // XGlobalSheetSettings
71 virtual sal_Bool SAL_CALL
getMoveSelection() override
72 { return getPropertyBool("MoveSelection"); }
73 virtual void SAL_CALL
setMoveSelection(sal_Bool p1
) override
74 { setProperty("MoveSelection", static_cast<bool>(p1
)); }
75 virtual sal_Int16 SAL_CALL
getMoveDirection() override
76 { return getPropertyInt16("MoveDirection"); }
77 virtual void SAL_CALL
setMoveDirection(sal_Int16 p1
) override
78 { setProperty("MoveDirection", p1
); }
79 virtual sal_Bool SAL_CALL
getEnterEdit() override
80 { return getPropertyBool("EnterEdit"); }
81 virtual void SAL_CALL
setEnterEdit(sal_Bool p1
) override
82 { setProperty("EnterEdit", static_cast<bool>(p1
)); }
83 virtual sal_Bool SAL_CALL
getExtendFormat() override
84 { return getPropertyBool("ExtendFormat"); }
85 virtual void SAL_CALL
setExtendFormat(sal_Bool p1
) override
86 { setProperty("ExtendFormat", static_cast<bool>(p1
)); }
87 virtual sal_Bool SAL_CALL
getRangeFinder() override
88 { return getPropertyBool("RangeFinder"); }
89 virtual void SAL_CALL
setRangeFinder(sal_Bool p1
) override
90 { setProperty("RangeFinder", static_cast<bool>(p1
)); }
91 virtual sal_Bool SAL_CALL
getExpandReferences() override
92 { return getPropertyBool("ExpandReferences"); }
93 virtual void SAL_CALL
setExpandReferences(sal_Bool p1
) override
94 { setProperty("ExpandReferences", static_cast<bool>(p1
)); }
95 virtual sal_Bool SAL_CALL
getMarkHeader() override
96 { return getPropertyBool("MarkHeader"); }
97 virtual void SAL_CALL
setMarkHeader(sal_Bool p1
) override
98 { setProperty("MarkHeader", static_cast<bool>(p1
)); }
99 virtual sal_Bool SAL_CALL
getUseTabCol() override
100 { return getPropertyBool("UseTabCol"); }
101 virtual void SAL_CALL
setUseTabCol(sal_Bool p1
) override
102 { setProperty("UseTabCol", static_cast<bool>(p1
)); }
103 virtual sal_Int16 SAL_CALL
getMetric() override
104 { return getPropertyInt16("Metric"); }
105 virtual void SAL_CALL
setMetric(sal_Int16 p1
) override
106 { setProperty("Metric", p1
); }
107 virtual sal_Int16 SAL_CALL
getScale() override
108 { return getPropertyInt16("Scale"); }
109 virtual void SAL_CALL
setScale(sal_Int16 p1
) override
110 { setProperty("Scale", p1
); }
111 virtual sal_Bool SAL_CALL
getDoAutoComplete() override
112 { return getPropertyBool("DoAutoComplete"); }
113 virtual void SAL_CALL
setDoAutoComplete(sal_Bool p1
) override
114 { setProperty("DoAutoComplete", static_cast<bool>(p1
)); }
115 virtual sal_Int16 SAL_CALL
getStatusBarFunction() override
116 { return getPropertyInt16("StatusBarFunction"); }
117 virtual void SAL_CALL
setStatusBarFunction(sal_Int16 p1
) override
118 { setProperty("StatusBarFunction", p1
); }
119 virtual css::uno::Sequence
<OUString
> SAL_CALL
getUserLists() override
121 css::uno::Any any
= getPropertyValue("UserLists");
122 css::uno::Sequence
<OUString
> b
;
126 virtual void SAL_CALL
setUserLists(const css::uno::Sequence
<OUString
>& p1
) override
127 { setPropertyValue( "UserLists", css::uno::Any(p1
) ); }
128 virtual sal_Int16 SAL_CALL
getLinkUpdateMode() override
129 { return getPropertyInt16("LinkUpdateMode"); }
130 virtual void SAL_CALL
setLinkUpdateMode(sal_Int16 p1
) override
131 { setProperty("LinkUpdateMode", p1
); }
132 virtual sal_Bool SAL_CALL
getPrintAllSheets() override
133 { return getPropertyBool("PrintAllSheets"); }
134 virtual void SAL_CALL
setPrintAllSheets(sal_Bool p1
) override
135 { setProperty("PrintAllSheets", static_cast<bool>(p1
)); }
136 virtual sal_Bool SAL_CALL
getPrintEmptyPages() override
137 { return getPropertyBool("PrintEmptyPages"); }
138 virtual void SAL_CALL
setPrintEmptyPages(sal_Bool p1
) override
139 { setProperty("PrintEmptyPages", static_cast<bool>(p1
)); }
140 virtual sal_Bool SAL_CALL
getUsePrinterMetrics() override
141 { return getPropertyBool("UsePrinterMetrics"); }
142 virtual void SAL_CALL
setUsePrinterMetrics(sal_Bool p1
) override
143 { setProperty("UsePrinterMetrics", static_cast<bool>(p1
)); }
144 virtual sal_Bool SAL_CALL
getReplaceCellsWarning() override
145 { return getPropertyBool("ReplaceCellsWarning"); }
146 virtual void SAL_CALL
setReplaceCellsWarning(sal_Bool p1
) override
147 { setProperty("ReplaceCellsWarning", static_cast<bool>(p1
)); }
150 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
151 SAL_CALL
getPropertySetInfo() override
;
152 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
153 const css::uno::Any
& aValue
) override
;
154 virtual css::uno::Any SAL_CALL
getPropertyValue(
155 const OUString
& PropertyName
) override
;
156 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
157 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
158 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
159 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
160 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
161 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
162 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
163 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
166 virtual OUString SAL_CALL
getImplementationName() override
;
167 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
168 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
171 class ScRecentFunctionsObj final
: public cppu::WeakImplHelper
<
172 css::sheet::XRecentFunctions
,
173 css::lang::XServiceInfo
>
176 ScRecentFunctionsObj();
177 virtual ~ScRecentFunctionsObj() override
;
180 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getRecentFunctionIds() override
;
181 virtual void SAL_CALL
setRecentFunctionIds( const css::uno::Sequence
< sal_Int32
>& aRecentFunctionIds
) override
;
182 virtual sal_Int32 SAL_CALL
getMaxRecentFunctions() override
;
185 virtual OUString SAL_CALL
getImplementationName() override
;
186 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
187 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
190 class ScFunctionListObj final
: public cppu::WeakImplHelper
<
191 css::sheet::XFunctionDescriptions
,
192 css::container::XEnumerationAccess
,
193 css::container::XNameAccess
,
194 css::lang::XServiceInfo
>
198 virtual ~ScFunctionListObj() override
;
200 // XFunctionDescriptions
201 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
202 getById( sal_Int32 nId
) override
;
205 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
206 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
207 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
210 virtual sal_Int32 SAL_CALL
getCount() override
;
211 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
213 // XEnumerationAccess
214 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
215 createEnumeration() override
;
218 virtual css::uno::Type SAL_CALL
getElementType() override
;
219 virtual sal_Bool SAL_CALL
hasElements() override
;
222 virtual OUString SAL_CALL
getImplementationName() override
;
223 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
224 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */