Branch libreoffice-24-8-3
[LibreOffice.git] / sc / inc / appluno.hxx
blobb05afb09617bf13d46b052d50e467205aa63ec05
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 #pragma once
22 #include <svl/itemprop.hxx>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/sheet/XRecentFunctions.hpp>
26 #include <com/sun/star/sheet/XFunctionDescriptions.hpp>
27 #include <com/sun/star/sheet/XGlobalSheetSettings.hpp>
28 #include <com/sun/star/container/XEnumerationAccess.hpp>
29 #include <com/sun/star/container/XNameAccess.hpp>
30 #include <cppuhelper/implbase.hxx>
31 #include <rtl/ustring.hxx>
32 #include <sfx2/sfxmodelfactory.hxx>
34 namespace com::sun::star::lang { class XMultiServiceFactory; }
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 );
47 class ScSpreadsheetSettings final : public cppu::WeakImplHelper<
48 css::sheet::XGlobalSheetSettings,
49 css::beans::XPropertySet,
50 css::lang::XServiceInfo>
52 private:
53 SfxItemPropertySet aPropSet;
55 /// @throws css::uno::RuntimeException
56 bool getPropertyBool(const OUString& aPropertyName);
57 /// @throws css::uno::RuntimeException
58 sal_Int16 getPropertyInt16(const OUString& aPropertyName);
59 /// @throws css::uno::RuntimeException
60 void setProperty(const OUString& aPropertyName, bool p1)
61 { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
62 /// @throws css::uno::RuntimeException
63 void setProperty(const OUString& aPropertyName, sal_Int16 p1)
64 { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
65 public:
66 ScSpreadsheetSettings();
67 virtual ~ScSpreadsheetSettings() override;
69 // XGlobalSheetSettings
70 virtual sal_Bool SAL_CALL getMoveSelection() override
71 { return getPropertyBool(u"MoveSelection"_ustr); }
72 virtual void SAL_CALL setMoveSelection(sal_Bool p1) override
73 { setProperty(u"MoveSelection"_ustr, static_cast<bool>(p1)); }
74 virtual sal_Int16 SAL_CALL getMoveDirection() override
75 { return getPropertyInt16(u"MoveDirection"_ustr); }
76 virtual void SAL_CALL setMoveDirection(sal_Int16 p1) override
77 { setProperty(u"MoveDirection"_ustr, p1); }
78 virtual sal_Bool SAL_CALL getEnterEdit() override
79 { return getPropertyBool(u"EnterEdit"_ustr); }
80 virtual void SAL_CALL setEnterEdit(sal_Bool p1) override
81 { setProperty(u"EnterEdit"_ustr, static_cast<bool>(p1)); }
82 virtual sal_Bool SAL_CALL getExtendFormat() override
83 { return getPropertyBool(u"ExtendFormat"_ustr); }
84 virtual void SAL_CALL setExtendFormat(sal_Bool p1) override
85 { setProperty(u"ExtendFormat"_ustr, static_cast<bool>(p1)); }
86 virtual sal_Bool SAL_CALL getRangeFinder() override
87 { return getPropertyBool(u"RangeFinder"_ustr); }
88 virtual void SAL_CALL setRangeFinder(sal_Bool p1) override
89 { setProperty(u"RangeFinder"_ustr, static_cast<bool>(p1)); }
90 virtual sal_Bool SAL_CALL getExpandReferences() override
91 { return getPropertyBool(u"ExpandReferences"_ustr); }
92 virtual void SAL_CALL setExpandReferences(sal_Bool p1) override
93 { setProperty(u"ExpandReferences"_ustr, static_cast<bool>(p1)); }
94 virtual sal_Bool SAL_CALL getMarkHeader() override
95 { return getPropertyBool(u"MarkHeader"_ustr); }
96 virtual void SAL_CALL setMarkHeader(sal_Bool p1) override
97 { setProperty(u"MarkHeader"_ustr, static_cast<bool>(p1)); }
98 virtual sal_Bool SAL_CALL getUseTabCol() override
99 { return getPropertyBool(u"UseTabCol"_ustr); }
100 virtual void SAL_CALL setUseTabCol(sal_Bool p1) override
101 { setProperty(u"UseTabCol"_ustr, static_cast<bool>(p1)); }
102 virtual sal_Int16 SAL_CALL getMetric() override
103 { return getPropertyInt16(u"Metric"_ustr); }
104 virtual void SAL_CALL setMetric(sal_Int16 p1) override
105 { setProperty(u"Metric"_ustr, p1); }
106 virtual sal_Int16 SAL_CALL getScale() override
107 { return getPropertyInt16(u"Scale"_ustr); }
108 virtual void SAL_CALL setScale(sal_Int16 p1) override
109 { setProperty(u"Scale"_ustr, p1); }
110 virtual sal_Bool SAL_CALL getDoAutoComplete() override
111 { return getPropertyBool(u"DoAutoComplete"_ustr); }
112 virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) override
113 { setProperty(u"DoAutoComplete"_ustr, static_cast<bool>(p1)); }
114 virtual sal_Int16 SAL_CALL getStatusBarFunction() override
115 { return getPropertyInt16(u"StatusBarFunction"_ustr); }
116 virtual void SAL_CALL setStatusBarFunction(sal_Int16 p1) override
117 { setProperty(u"StatusBarFunction"_ustr, p1); }
118 virtual css::uno::Sequence<OUString> SAL_CALL getUserLists() override
120 css::uno::Any any = getPropertyValue(u"UserLists"_ustr);
121 css::uno::Sequence<OUString> b;
122 any >>= b;
123 return b;
125 virtual void SAL_CALL setUserLists(const css::uno::Sequence<OUString>& p1) override
126 { setPropertyValue( u"UserLists"_ustr, css::uno::Any(p1) ); }
127 virtual sal_Int16 SAL_CALL getLinkUpdateMode() override
128 { return getPropertyInt16(u"LinkUpdateMode"_ustr); }
129 virtual void SAL_CALL setLinkUpdateMode(sal_Int16 p1) override
130 { setProperty(u"LinkUpdateMode"_ustr, p1); }
131 virtual sal_Bool SAL_CALL getPrintAllSheets() override
132 { return getPropertyBool(u"PrintAllSheets"_ustr); }
133 virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) override
134 { setProperty(u"PrintAllSheets"_ustr, static_cast<bool>(p1)); }
135 virtual sal_Bool SAL_CALL getPrintEmptyPages() override
136 { return getPropertyBool(u"PrintEmptyPages"_ustr); }
137 virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) override
138 { setProperty(u"PrintEmptyPages"_ustr, static_cast<bool>(p1)); }
139 virtual sal_Bool SAL_CALL getUsePrinterMetrics() override
140 { return getPropertyBool(u"UsePrinterMetrics"_ustr); }
141 virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) override
142 { setProperty(u"UsePrinterMetrics"_ustr, static_cast<bool>(p1)); }
143 virtual sal_Bool SAL_CALL getReplaceCellsWarning() override
144 { return getPropertyBool(u"ReplaceCellsWarning"_ustr); }
145 virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) override
146 { setProperty(u"ReplaceCellsWarning"_ustr, static_cast<bool>(p1)); }
148 // XPropertySet
149 virtual css::uno::Reference< css::beans::XPropertySetInfo >
150 SAL_CALL getPropertySetInfo() override;
151 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
152 const css::uno::Any& aValue ) override;
153 virtual css::uno::Any SAL_CALL getPropertyValue(
154 const OUString& PropertyName ) override;
155 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
156 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
157 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
158 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
159 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
160 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
161 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
162 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
164 // XServiceInfo
165 virtual OUString SAL_CALL getImplementationName() override;
166 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
167 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
170 class ScRecentFunctionsObj final : public cppu::WeakImplHelper<
171 css::sheet::XRecentFunctions,
172 css::lang::XServiceInfo>
174 public:
175 ScRecentFunctionsObj();
176 virtual ~ScRecentFunctionsObj() override;
178 // XRecentFunctions
179 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds() override;
180 virtual void SAL_CALL setRecentFunctionIds( const css::uno::Sequence< sal_Int32 >& aRecentFunctionIds ) override;
181 virtual sal_Int32 SAL_CALL getMaxRecentFunctions() override;
183 // XServiceInfo
184 virtual OUString SAL_CALL getImplementationName() override;
185 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
186 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
189 class ScFunctionListObj final : public cppu::WeakImplHelper<
190 css::sheet::XFunctionDescriptions,
191 css::container::XEnumerationAccess,
192 css::container::XNameAccess,
193 css::lang::XServiceInfo>
195 public:
196 ScFunctionListObj();
197 virtual ~ScFunctionListObj() override;
199 // XFunctionDescriptions
200 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
201 getById( sal_Int32 nId ) override;
203 // XNameAccess
204 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
205 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
206 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
208 // XIndexAccess
209 virtual sal_Int32 SAL_CALL getCount() override;
210 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
212 // XEnumerationAccess
213 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
214 createEnumeration() override;
216 // XElementAccess
217 virtual css::uno::Type SAL_CALL getElementType() override;
218 virtual sal_Bool SAL_CALL hasElements() override;
220 // XServiceInfo
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 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */