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
{ namespace sun
{ namespace star
{ namespace 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 css::uno::Sequence
< OUString
> ScDocument_getSupportedServiceNames() throw();
49 OUString
ScDocument_getImplementationName() throw();
50 /// @throws css::uno::Exception
51 css::uno::Reference
< css::uno::XInterface
> ScDocument_createInstance(
52 const css::uno::Reference
< css::lang::XMultiServiceFactory
> & rSMgr
, SfxModelFlags _nCreationFlags
);
55 css::uno::Sequence
< OUString
> ScXMLImport_getSupportedServiceNames() throw();
56 OUString
ScXMLImport_getImplementationName() throw();
57 /// @throws css::uno::Exception
58 css::uno::Reference
< css::uno::XInterface
> ScXMLImport_createInstance(
59 const css::uno::Reference
< css::lang::XMultiServiceFactory
> & rSMgr
);
60 css::uno::Sequence
< OUString
> ScXMLImport_Meta_getSupportedServiceNames() throw();
61 OUString
ScXMLImport_Meta_getImplementationName() throw();
62 /// @throws css::uno::Exception
63 css::uno::Reference
< css::uno::XInterface
> ScXMLImport_Meta_createInstance(
64 const css::uno::Reference
< css::lang::XMultiServiceFactory
> & rSMgr
);
65 css::uno::Sequence
< OUString
> ScXMLImport_Styles_getSupportedServiceNames() throw();
66 OUString
ScXMLImport_Styles_getImplementationName() throw();
67 /// @throws css::uno::Exception
68 css::uno::Reference
< css::uno::XInterface
> ScXMLImport_Styles_createInstance(
69 const css::uno::Reference
< css::lang::XMultiServiceFactory
> & rSMgr
);
70 css::uno::Sequence
< OUString
> ScXMLImport_Content_getSupportedServiceNames() throw();
71 OUString
ScXMLImport_Content_getImplementationName() throw();
72 /// @throws css::uno::Exception
73 css::uno::Reference
< css::uno::XInterface
> ScXMLImport_Content_createInstance(
74 const css::uno::Reference
< css::lang::XMultiServiceFactory
> & rSMgr
);
75 css::uno::Sequence
< OUString
> ScXMLImport_Settings_getSupportedServiceNames() throw();
76 OUString
ScXMLImport_Settings_getImplementationName() throw();
77 /// @throws css::uno::Exception
78 css::uno::Reference
< css::uno::XInterface
> ScXMLImport_Settings_createInstance(
79 const css::uno::Reference
< css::lang::XMultiServiceFactory
> & rSMgr
);
81 class ScSpreadsheetSettings final
: public cppu::WeakImplHelper
<
82 css::sheet::XGlobalSheetSettings
,
83 css::beans::XPropertySet
,
84 css::lang::XServiceInfo
>
87 SfxItemPropertySet
const aPropSet
;
89 /// @throws css::uno::RuntimeException
90 bool getPropertyBool(const OUString
& aPropertyName
);
91 /// @throws css::uno::RuntimeException
92 sal_Int16
getPropertyInt16(const OUString
& aPropertyName
);
93 /// @throws css::uno::RuntimeException
94 void setProperty(const OUString
& aPropertyName
, bool p1
)
95 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
96 /// @throws css::uno::RuntimeException
97 void setProperty(const OUString
& aPropertyName
, sal_Int16 p1
)
98 { setPropertyValue( aPropertyName
, css::uno::Any(p1
) ); }
100 ScSpreadsheetSettings();
101 virtual ~ScSpreadsheetSettings() override
;
103 static OUString
getImplementationName_Static();
104 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
106 // XGlobalSheetSettings
107 virtual sal_Bool SAL_CALL
getMoveSelection() override
108 { return getPropertyBool("MoveSelection"); }
109 virtual void SAL_CALL
setMoveSelection(sal_Bool p1
) override
110 { setProperty("MoveSelection", static_cast<bool>(p1
)); }
111 virtual sal_Int16 SAL_CALL
getMoveDirection() override
112 { return getPropertyInt16("MoveDirection"); }
113 virtual void SAL_CALL
setMoveDirection(sal_Int16 p1
) override
114 { setProperty("MoveDirection", p1
); }
115 virtual sal_Bool SAL_CALL
getEnterEdit() override
116 { return getPropertyBool("EnterEdit"); }
117 virtual void SAL_CALL
setEnterEdit(sal_Bool p1
) override
118 { setProperty("EnterEdit", static_cast<bool>(p1
)); }
119 virtual sal_Bool SAL_CALL
getExtendFormat() override
120 { return getPropertyBool("ExtendFormat"); }
121 virtual void SAL_CALL
setExtendFormat(sal_Bool p1
) override
122 { setProperty("ExtendFormat", static_cast<bool>(p1
)); }
123 virtual sal_Bool SAL_CALL
getRangeFinder() override
124 { return getPropertyBool("RangeFinder"); }
125 virtual void SAL_CALL
setRangeFinder(sal_Bool p1
) override
126 { setProperty("RangeFinder", static_cast<bool>(p1
)); }
127 virtual sal_Bool SAL_CALL
getExpandReferences() override
128 { return getPropertyBool("ExpandReferences"); }
129 virtual void SAL_CALL
setExpandReferences(sal_Bool p1
) override
130 { setProperty("ExpandReferences", static_cast<bool>(p1
)); }
131 virtual sal_Bool SAL_CALL
getMarkHeader() override
132 { return getPropertyBool("MarkHeader"); }
133 virtual void SAL_CALL
setMarkHeader(sal_Bool p1
) override
134 { setProperty("MarkHeader", static_cast<bool>(p1
)); }
135 virtual sal_Bool SAL_CALL
getUseTabCol() override
136 { return getPropertyBool("UseTabCol"); }
137 virtual void SAL_CALL
setUseTabCol(sal_Bool p1
) override
138 { setProperty("UseTabCol", static_cast<bool>(p1
)); }
139 virtual sal_Int16 SAL_CALL
getMetric() override
140 { return getPropertyInt16("Metric"); }
141 virtual void SAL_CALL
setMetric(sal_Int16 p1
) override
142 { setProperty("Metric", p1
); }
143 virtual sal_Int16 SAL_CALL
getScale() override
144 { return getPropertyInt16("Scale"); }
145 virtual void SAL_CALL
setScale(sal_Int16 p1
) override
146 { setProperty("Scale", p1
); }
147 virtual sal_Bool SAL_CALL
getDoAutoComplete() override
148 { return getPropertyBool("DoAutoComplete"); }
149 virtual void SAL_CALL
setDoAutoComplete(sal_Bool p1
) override
150 { setProperty("DoAutoComplete", static_cast<bool>(p1
)); }
151 virtual sal_Int16 SAL_CALL
getStatusBarFunction() override
152 { return getPropertyInt16("StatusBarFunction"); }
153 virtual void SAL_CALL
setStatusBarFunction(sal_Int16 p1
) override
154 { setProperty("StatusBarFunction", p1
); }
155 virtual css::uno::Sequence
<OUString
> SAL_CALL
getUserLists() override
157 css::uno::Any any
= getPropertyValue("UserLists");
158 css::uno::Sequence
<OUString
> b
;
162 virtual void SAL_CALL
setUserLists(const css::uno::Sequence
<OUString
>& p1
) override
163 { setPropertyValue( "UserLists", css::uno::Any(p1
) ); }
164 virtual sal_Int16 SAL_CALL
getLinkUpdateMode() override
165 { return getPropertyInt16("LinkUpdateMode"); }
166 virtual void SAL_CALL
setLinkUpdateMode(sal_Int16 p1
) override
167 { setProperty("LinkUpdateMode", p1
); }
168 virtual sal_Bool SAL_CALL
getPrintAllSheets() override
169 { return getPropertyBool("PrintAllSheets"); }
170 virtual void SAL_CALL
setPrintAllSheets(sal_Bool p1
) override
171 { setProperty("PrintAllSheets", static_cast<bool>(p1
)); }
172 virtual sal_Bool SAL_CALL
getPrintEmptyPages() override
173 { return getPropertyBool("PrintEmptyPages"); }
174 virtual void SAL_CALL
setPrintEmptyPages(sal_Bool p1
) override
175 { setProperty("PrintEmptyPages", static_cast<bool>(p1
)); }
176 virtual sal_Bool SAL_CALL
getUsePrinterMetrics() override
177 { return getPropertyBool("UsePrinterMetrics"); }
178 virtual void SAL_CALL
setUsePrinterMetrics(sal_Bool p1
) override
179 { setProperty("UsePrinterMetrics", static_cast<bool>(p1
)); }
180 virtual sal_Bool SAL_CALL
getReplaceCellsWarning() override
181 { return getPropertyBool("ReplaceCellsWarning"); }
182 virtual void SAL_CALL
setReplaceCellsWarning(sal_Bool p1
) override
183 { setProperty("ReplaceCellsWarning", static_cast<bool>(p1
)); }
186 virtual css::uno::Reference
< css::beans::XPropertySetInfo
>
187 SAL_CALL
getPropertySetInfo() override
;
188 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
,
189 const css::uno::Any
& aValue
) override
;
190 virtual css::uno::Any SAL_CALL
getPropertyValue(
191 const OUString
& PropertyName
) override
;
192 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
,
193 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
194 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
,
195 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
196 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
,
197 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
198 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
,
199 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
202 virtual OUString SAL_CALL
getImplementationName() override
;
203 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
204 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
207 class ScRecentFunctionsObj final
: public cppu::WeakImplHelper
<
208 css::sheet::XRecentFunctions
,
209 css::lang::XServiceInfo
>
212 ScRecentFunctionsObj();
213 virtual ~ScRecentFunctionsObj() override
;
216 virtual css::uno::Sequence
< sal_Int32
> SAL_CALL
getRecentFunctionIds() override
;
217 virtual void SAL_CALL
setRecentFunctionIds( const css::uno::Sequence
< sal_Int32
>& aRecentFunctionIds
) override
;
218 virtual sal_Int32 SAL_CALL
getMaxRecentFunctions() override
;
221 virtual OUString SAL_CALL
getImplementationName() override
;
222 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
223 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
226 class ScFunctionListObj final
: public cppu::WeakImplHelper
<
227 css::sheet::XFunctionDescriptions
,
228 css::container::XEnumerationAccess
,
229 css::container::XNameAccess
,
230 css::lang::XServiceInfo
>
234 virtual ~ScFunctionListObj() override
;
236 // XFunctionDescriptions
237 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
238 getById( sal_Int32 nId
) override
;
241 virtual css::uno::Any SAL_CALL
getByName( const OUString
& aName
) override
;
242 virtual css::uno::Sequence
< OUString
> SAL_CALL
getElementNames() override
;
243 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) override
;
246 virtual sal_Int32 SAL_CALL
getCount() override
;
247 virtual css::uno::Any SAL_CALL
getByIndex( sal_Int32 Index
) override
;
249 // XEnumerationAccess
250 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
251 createEnumeration() override
;
254 virtual css::uno::Type SAL_CALL
getElementType() override
;
255 virtual sal_Bool SAL_CALL
hasElements() override
;
258 virtual OUString SAL_CALL
getImplementationName() override
;
259 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
260 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */