LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / sc / inc / appluno.hxx
blobc1dcc4b5fb827e3f70206db07cadc7e984d5ef65
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("MoveSelection"); }
72 virtual void SAL_CALL setMoveSelection(sal_Bool p1) override
73 { setProperty("MoveSelection", static_cast<bool>(p1)); }
74 virtual sal_Int16 SAL_CALL getMoveDirection() override
75 { return getPropertyInt16("MoveDirection"); }
76 virtual void SAL_CALL setMoveDirection(sal_Int16 p1) override
77 { setProperty("MoveDirection", p1); }
78 virtual sal_Bool SAL_CALL getEnterEdit() override
79 { return getPropertyBool("EnterEdit"); }
80 virtual void SAL_CALL setEnterEdit(sal_Bool p1) override
81 { setProperty("EnterEdit", static_cast<bool>(p1)); }
82 virtual sal_Bool SAL_CALL getExtendFormat() override
83 { return getPropertyBool("ExtendFormat"); }
84 virtual void SAL_CALL setExtendFormat(sal_Bool p1) override
85 { setProperty("ExtendFormat", static_cast<bool>(p1)); }
86 virtual sal_Bool SAL_CALL getRangeFinder() override
87 { return getPropertyBool("RangeFinder"); }
88 virtual void SAL_CALL setRangeFinder(sal_Bool p1) override
89 { setProperty("RangeFinder", static_cast<bool>(p1)); }
90 virtual sal_Bool SAL_CALL getExpandReferences() override
91 { return getPropertyBool("ExpandReferences"); }
92 virtual void SAL_CALL setExpandReferences(sal_Bool p1) override
93 { setProperty("ExpandReferences", static_cast<bool>(p1)); }
94 virtual sal_Bool SAL_CALL getMarkHeader() override
95 { return getPropertyBool("MarkHeader"); }
96 virtual void SAL_CALL setMarkHeader(sal_Bool p1) override
97 { setProperty("MarkHeader", static_cast<bool>(p1)); }
98 virtual sal_Bool SAL_CALL getUseTabCol() override
99 { return getPropertyBool("UseTabCol"); }
100 virtual void SAL_CALL setUseTabCol(sal_Bool p1) override
101 { setProperty("UseTabCol", static_cast<bool>(p1)); }
102 virtual sal_Int16 SAL_CALL getMetric() override
103 { return getPropertyInt16("Metric"); }
104 virtual void SAL_CALL setMetric(sal_Int16 p1) override
105 { setProperty("Metric", p1); }
106 virtual sal_Int16 SAL_CALL getScale() override
107 { return getPropertyInt16("Scale"); }
108 virtual void SAL_CALL setScale(sal_Int16 p1) override
109 { setProperty("Scale", p1); }
110 virtual sal_Bool SAL_CALL getDoAutoComplete() override
111 { return getPropertyBool("DoAutoComplete"); }
112 virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) override
113 { setProperty("DoAutoComplete", static_cast<bool>(p1)); }
114 virtual sal_Int16 SAL_CALL getStatusBarFunction() override
115 { return getPropertyInt16("StatusBarFunction"); }
116 virtual void SAL_CALL setStatusBarFunction(sal_Int16 p1) override
117 { setProperty("StatusBarFunction", p1); }
118 virtual css::uno::Sequence<OUString> SAL_CALL getUserLists() override
120 css::uno::Any any = getPropertyValue("UserLists");
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( "UserLists", css::uno::Any(p1) ); }
127 virtual sal_Int16 SAL_CALL getLinkUpdateMode() override
128 { return getPropertyInt16("LinkUpdateMode"); }
129 virtual void SAL_CALL setLinkUpdateMode(sal_Int16 p1) override
130 { setProperty("LinkUpdateMode", p1); }
131 virtual sal_Bool SAL_CALL getPrintAllSheets() override
132 { return getPropertyBool("PrintAllSheets"); }
133 virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) override
134 { setProperty("PrintAllSheets", static_cast<bool>(p1)); }
135 virtual sal_Bool SAL_CALL getPrintEmptyPages() override
136 { return getPropertyBool("PrintEmptyPages"); }
137 virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) override
138 { setProperty("PrintEmptyPages", static_cast<bool>(p1)); }
139 virtual sal_Bool SAL_CALL getUsePrinterMetrics() override
140 { return getPropertyBool("UsePrinterMetrics"); }
141 virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) override
142 { setProperty("UsePrinterMetrics", static_cast<bool>(p1)); }
143 virtual sal_Bool SAL_CALL getReplaceCellsWarning() override
144 { return getPropertyBool("ReplaceCellsWarning"); }
145 virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) override
146 { setProperty("ReplaceCellsWarning", 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: */