Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / appluno.hxx
blob36b6e9ac92d3dc5f3acea46d803a06b75013b0c4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/lang/XMultiServiceFactory.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/sheet/XRecentFunctions.hpp>
28 #include <com/sun/star/sheet/XFunctionDescriptions.hpp>
29 #include <com/sun/star/sheet/XGlobalSheetSettings.hpp>
30 #include <com/sun/star/container/XEnumerationAccess.hpp>
31 #include <com/sun/star/container/XNameAccess.hpp>
32 #include <cppuhelper/implbase.hxx>
33 #include <rtl/ustring.hxx>
34 #include <sfx2/sfxmodelfactory.hxx>
36 css::uno::Reference<css::uno::XInterface>
37 ScSpreadsheetSettings_CreateInstance(
38 const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
39 css::uno::Reference<css::uno::XInterface> SAL_CALL
40 ScRecentFunctionsObj_CreateInstance(
41 const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
42 css::uno::Reference<css::uno::XInterface> SAL_CALL
43 ScFunctionListObj_CreateInstance(
44 const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
46 // Calc document
47 css::uno::Sequence< OUString > ScDocument_getSupportedServiceNames() throw();
48 OUString ScDocument_getImplementationName() throw();
49 /// @throws css::uno::Exception
50 css::uno::Reference< css::uno::XInterface > ScDocument_createInstance(
51 const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr, SfxModelFlags _nCreationFlags );
53 // Calc XML import
54 css::uno::Sequence< OUString > ScXMLImport_getSupportedServiceNames() throw();
55 OUString ScXMLImport_getImplementationName() throw();
56 /// @throws css::uno::Exception
57 css::uno::Reference< css::uno::XInterface > ScXMLImport_createInstance(
58 const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
59 css::uno::Sequence< OUString > ScXMLImport_Meta_getSupportedServiceNames() throw();
60 OUString ScXMLImport_Meta_getImplementationName() throw();
61 /// @throws css::uno::Exception
62 css::uno::Reference< css::uno::XInterface > ScXMLImport_Meta_createInstance(
63 const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
64 css::uno::Sequence< OUString > ScXMLImport_Styles_getSupportedServiceNames() throw();
65 OUString ScXMLImport_Styles_getImplementationName() throw();
66 /// @throws css::uno::Exception
67 css::uno::Reference< css::uno::XInterface > ScXMLImport_Styles_createInstance(
68 const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
69 css::uno::Sequence< OUString > ScXMLImport_Content_getSupportedServiceNames() throw();
70 OUString ScXMLImport_Content_getImplementationName() throw();
71 /// @throws css::uno::Exception
72 css::uno::Reference< css::uno::XInterface > ScXMLImport_Content_createInstance(
73 const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
74 css::uno::Sequence< OUString > ScXMLImport_Settings_getSupportedServiceNames() throw();
75 OUString ScXMLImport_Settings_getImplementationName() throw();
76 /// @throws css::uno::Exception
77 css::uno::Reference< css::uno::XInterface > ScXMLImport_Settings_createInstance(
78 const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr );
80 class ScSpreadsheetSettings : public cppu::WeakImplHelper<
81 css::sheet::XGlobalSheetSettings,
82 css::beans::XPropertySet,
83 css::lang::XServiceInfo>
85 private:
86 SfxItemPropertySet aPropSet;
88 /// @throws css::uno::RuntimeException
89 bool getPropertyBool(const OUString& aPropertyName);
90 /// @throws css::uno::RuntimeException
91 sal_Int16 getPropertyInt16(const OUString& aPropertyName);
92 /// @throws css::uno::RuntimeException
93 void setProperty(const OUString& aPropertyName, bool p1)
94 { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
95 /// @throws css::uno::RuntimeException
96 void setProperty(const OUString& aPropertyName, sal_Int16 p1)
97 { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
98 public:
99 ScSpreadsheetSettings();
100 virtual ~ScSpreadsheetSettings() override;
102 static OUString getImplementationName_Static();
103 static css::uno::Sequence< OUString > getSupportedServiceNames_Static();
105 // XGlobalSheetSettings
106 virtual sal_Bool SAL_CALL getMoveSelection() override
107 { return getPropertyBool("MoveSelection"); }
108 virtual void SAL_CALL setMoveSelection(sal_Bool p1) override
109 { setProperty("MoveSelection", static_cast<bool>(p1)); }
110 virtual sal_Int16 SAL_CALL getMoveDirection() override
111 { return getPropertyInt16("MoveDirection"); }
112 virtual void SAL_CALL setMoveDirection(sal_Int16 p1) override
113 { setProperty("MoveDirection", p1); }
114 virtual sal_Bool SAL_CALL getEnterEdit() override
115 { return getPropertyBool("EnterEdit"); }
116 virtual void SAL_CALL setEnterEdit(sal_Bool p1) override
117 { setProperty("EnterEdit", static_cast<bool>(p1)); }
118 virtual sal_Bool SAL_CALL getExtendFormat() override
119 { return getPropertyBool("ExtendFormat"); }
120 virtual void SAL_CALL setExtendFormat(sal_Bool p1) override
121 { setProperty("ExtendFormat", static_cast<bool>(p1)); }
122 virtual sal_Bool SAL_CALL getRangeFinder() override
123 { return getPropertyBool("RangeFinder"); }
124 virtual void SAL_CALL setRangeFinder(sal_Bool p1) override
125 { setProperty("RangeFinder", static_cast<bool>(p1)); }
126 virtual sal_Bool SAL_CALL getExpandReferences() override
127 { return getPropertyBool("ExpandReferences"); }
128 virtual void SAL_CALL setExpandReferences(sal_Bool p1) override
129 { setProperty("ExpandReferences", static_cast<bool>(p1)); }
130 virtual sal_Bool SAL_CALL getMarkHeader() override
131 { return getPropertyBool("MarkHeader"); }
132 virtual void SAL_CALL setMarkHeader(sal_Bool p1) override
133 { setProperty("MarkHeader", static_cast<bool>(p1)); }
134 virtual sal_Bool SAL_CALL getUseTabCol() override
135 { return getPropertyBool("UseTabCol"); }
136 virtual void SAL_CALL setUseTabCol(sal_Bool p1) override
137 { setProperty("UseTabCol", static_cast<bool>(p1)); }
138 virtual sal_Int16 SAL_CALL getMetric() override
139 { return getPropertyInt16("Metric"); }
140 virtual void SAL_CALL setMetric(sal_Int16 p1) override
141 { setProperty("Metric", p1); }
142 virtual sal_Int16 SAL_CALL getScale() override
143 { return getPropertyInt16("Scale"); }
144 virtual void SAL_CALL setScale(sal_Int16 p1) override
145 { setProperty("Scale", p1); }
146 virtual sal_Bool SAL_CALL getDoAutoComplete() override
147 { return getPropertyBool("DoAutoComplete"); }
148 virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) override
149 { setProperty("DoAutoComplete", static_cast<bool>(p1)); }
150 virtual sal_Int16 SAL_CALL getStatusBarFunction() override
151 { return getPropertyInt16("StatusBarFunction"); }
152 virtual void SAL_CALL setStatusBarFunction(sal_Int16 p1) override
153 { setProperty("StatusBarFunction", p1); }
154 virtual css::uno::Sequence<OUString> SAL_CALL getUserLists() override
156 css::uno::Any any = getPropertyValue("UserLists");
157 css::uno::Sequence<OUString> b;
158 any >>= b;
159 return b;
161 virtual void SAL_CALL setUserLists(const css::uno::Sequence<OUString>& p1) override
162 { setPropertyValue( "UserLists", css::uno::Any(p1) ); }
163 virtual sal_Int16 SAL_CALL getLinkUpdateMode() override
164 { return getPropertyInt16("LinkUpdateMode"); }
165 virtual void SAL_CALL setLinkUpdateMode(sal_Int16 p1) override
166 { setProperty("LinkUpdateMode", p1); }
167 virtual sal_Bool SAL_CALL getPrintAllSheets() override
168 { return getPropertyBool("PrintAllSheets"); }
169 virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) override
170 { setProperty("PrintAllSheets", static_cast<bool>(p1)); }
171 virtual sal_Bool SAL_CALL getPrintEmptyPages() override
172 { return getPropertyBool("PrintEmptyPages"); }
173 virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) override
174 { setProperty("PrintEmptyPages", static_cast<bool>(p1)); }
175 virtual sal_Bool SAL_CALL getUsePrinterMetrics() override
176 { return getPropertyBool("UsePrinterMetrics"); }
177 virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) override
178 { setProperty("UsePrinterMetrics", static_cast<bool>(p1)); }
179 virtual sal_Bool SAL_CALL getReplaceCellsWarning() override
180 { return getPropertyBool("ReplaceCellsWarning"); }
181 virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) override
182 { setProperty("ReplaceCellsWarning", static_cast<bool>(p1)); }
184 // XPropertySet
185 virtual css::uno::Reference< css::beans::XPropertySetInfo >
186 SAL_CALL getPropertySetInfo() override;
187 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
188 const css::uno::Any& aValue ) override;
189 virtual css::uno::Any SAL_CALL getPropertyValue(
190 const OUString& PropertyName ) override;
191 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
192 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
193 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
194 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
195 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
196 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
197 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
198 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
200 // XServiceInfo
201 virtual OUString SAL_CALL getImplementationName() override;
202 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
203 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
206 class ScRecentFunctionsObj : public cppu::WeakImplHelper<
207 css::sheet::XRecentFunctions,
208 css::lang::XServiceInfo>
210 public:
211 ScRecentFunctionsObj();
212 virtual ~ScRecentFunctionsObj() override;
214 // XRecentFunctions
215 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds() override;
216 virtual void SAL_CALL setRecentFunctionIds( const css::uno::Sequence< sal_Int32 >& aRecentFunctionIds ) override;
217 virtual sal_Int32 SAL_CALL getMaxRecentFunctions() override;
219 // XServiceInfo
220 virtual OUString SAL_CALL getImplementationName() override;
221 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
222 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
225 class ScFunctionListObj : public cppu::WeakImplHelper<
226 css::sheet::XFunctionDescriptions,
227 css::container::XEnumerationAccess,
228 css::container::XNameAccess,
229 css::lang::XServiceInfo>
231 public:
232 ScFunctionListObj();
233 virtual ~ScFunctionListObj() override;
235 // XFunctionDescriptions
236 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
237 getById( sal_Int32 nId ) override;
239 // XNameAccess
240 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
241 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
242 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
244 // XIndexAccess
245 virtual sal_Int32 SAL_CALL getCount() override;
246 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
248 // XEnumerationAccess
249 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
250 createEnumeration() override;
252 // XElementAccess
253 virtual css::uno::Type SAL_CALL getElementType() override;
254 virtual sal_Bool SAL_CALL hasElements() override;
256 // XServiceInfo
257 virtual OUString SAL_CALL getImplementationName() override;
258 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
259 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
262 #endif
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */