LibreOffice Module sc (master)  1
appluno.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SC_INC_APPLUNO_HXX
21 #define INCLUDED_SC_INC_APPLUNO_HXX
22 
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>
34 
35 namespace com::sun::star::lang { class XMultiServiceFactory; }
36 
37 css::uno::Reference<css::uno::XInterface>
39  const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
40 css::uno::Reference<css::uno::XInterface> SAL_CALL
42  const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
43 css::uno::Reference<css::uno::XInterface> SAL_CALL
45  const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
46 
47 
48 class ScSpreadsheetSettings final : public cppu::WeakImplHelper<
49  css::sheet::XGlobalSheetSettings,
50  css::beans::XPropertySet,
51  css::lang::XServiceInfo>
52 {
53 private:
55 
57  bool getPropertyBool(const OUString& aPropertyName);
59  sal_Int16 getPropertyInt16(const OUString& aPropertyName);
61  void setProperty(const OUString& aPropertyName, bool p1)
62  { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
64  void setProperty(const OUString& aPropertyName, sal_Int16 p1)
65  { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
66 public:
68  virtual ~ScSpreadsheetSettings() override;
69 
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
120  {
121  css::uno::Any any = getPropertyValue("UserLists");
122  css::uno::Sequence<OUString> b;
123  any >>= b;
124  return b;
125  }
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)); }
148 
149  // XPropertySet
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;
164 
165  // XServiceInfo
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;
169 };
170 
171 class ScRecentFunctionsObj final : public cppu::WeakImplHelper<
172  css::sheet::XRecentFunctions,
173  css::lang::XServiceInfo>
174 {
175 public:
177  virtual ~ScRecentFunctionsObj() override;
178 
179  // XRecentFunctions
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;
183 
184  // XServiceInfo
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;
188 };
189 
190 class ScFunctionListObj final : public cppu::WeakImplHelper<
191  css::sheet::XFunctionDescriptions,
192  css::container::XEnumerationAccess,
193  css::container::XNameAccess,
194  css::lang::XServiceInfo>
195 {
196 public:
198  virtual ~ScFunctionListObj() override;
199 
200  // XFunctionDescriptions
201  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
202  getById( sal_Int32 nId ) override;
203 
204  // XNameAccess
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;
208 
209  // XIndexAccess
210  virtual sal_Int32 SAL_CALL getCount() override;
211  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
212 
213  // XEnumerationAccess
214  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
215  createEnumeration() override;
216 
217  // XElementAccess
218  virtual css::uno::Type SAL_CALL getElementType() override;
219  virtual sal_Bool SAL_CALL hasElements() override;
220 
221  // XServiceInfo
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;
225 };
226 
227 #endif
228 
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setRecentFunctionIds(const css::uno::Sequence< sal_Int32 > &aRecentFunctionIds) override
Definition: appluno.cxx:390
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Int32 SAL_CALL getCount() override
Definition: appluno.cxx:532
virtual ~ScSpreadsheetSettings() override
Definition: appluno.cxx:97
virtual sal_Bool SAL_CALL getUsePrinterMetrics() override
Definition: appluno.hxx:140
virtual sal_Int16 SAL_CALL getMetric() override
Definition: appluno.hxx:103
virtual void SAL_CALL setEnterEdit(sal_Bool p1) override
Definition: appluno.hxx:81
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: appluno.cxx:289
virtual sal_Int16 SAL_CALL getScale() override
Definition: appluno.hxx:107
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getUserLists() override
Definition: appluno.hxx:119
virtual sal_Bool SAL_CALL getMoveSelection() override
Definition: appluno.hxx:71
virtual sal_Bool SAL_CALL getMarkHeader() override
Definition: appluno.hxx:95
sal_Int16 nId
virtual sal_Bool SAL_CALL getDoAutoComplete() override
Definition: appluno.hxx:111
virtual ~ScFunctionListObj() override
Definition: appluno.cxx:416
virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) override
Definition: appluno.hxx:138
virtual sal_Int16 SAL_CALL getStatusBarFunction() override
Definition: appluno.hxx:115
virtual void SAL_CALL setScale(sal_Int16 p1) override
Definition: appluno.hxx:109
virtual sal_Int32 SAL_CALL getMaxRecentFunctions() override
Definition: appluno.cxx:407
virtual css::uno::Type SAL_CALL getElementType() override
Definition: appluno.cxx:573
virtual sal_Bool SAL_CALL getRangeFinder() override
Definition: appluno.hxx:87
virtual void SAL_CALL setMetric(sal_Int16 p1) override
Definition: appluno.hxx:105
void setProperty(const OUString &aPropertyName, sal_Int16 p1)
Definition: appluno.hxx:64
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: appluno.cxx:565
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: appluno.cxx:605
virtual void SAL_CALL setUseTabCol(sal_Bool p1) override
Definition: appluno.hxx:101
virtual sal_Bool SAL_CALL getUseTabCol() override
Definition: appluno.hxx:99
SfxItemPropertySet aPropSet
Definition: appluno.hxx:54
virtual sal_Bool SAL_CALL hasElements() override
Definition: appluno.cxx:579
virtual ~ScRecentFunctionsObj() override
Definition: appluno.cxx:359
virtual sal_Bool SAL_CALL getExpandReferences() override
Definition: appluno.hxx:91
void setProperty(const OUString &aPropertyName, bool p1)
Definition: appluno.hxx:61
css::uno::Reference< css::uno::XInterface > SAL_CALL ScRecentFunctionsObj_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &rSMgr)
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Bool SAL_CALL getPrintEmptyPages() override
Definition: appluno.hxx:136
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: appluno.cxx:137
virtual sal_Bool SAL_CALL getReplaceCellsWarning() override
Definition: appluno.hxx:144
css::uno::Reference< css::uno::XInterface > ScSpreadsheetSettings_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &rSMgr)
virtual OUString SAL_CALL getImplementationName() override
const Any & any
sal_Int16 getPropertyInt16(const OUString &aPropertyName)
Definition: appluno.cxx:119
unsigned char sal_Bool
virtual sal_Int16 SAL_CALL getMoveDirection() override
Definition: appluno.hxx:75
virtual void SAL_CALL setUserLists(const css::uno::Sequence< OUString > &p1) override
Definition: appluno.hxx:126
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int16 SAL_CALL getLinkUpdateMode() override
Definition: appluno.hxx:128
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds() override
Definition: appluno.cxx:373
virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) override
Definition: appluno.hxx:146
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getById(sal_Int32 nId) override
Definition: appluno.cxx:483
virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) override
Definition: appluno.hxx:142
virtual void SAL_CALL setExtendFormat(sal_Bool p1) override
Definition: appluno.hxx:85
bool getPropertyBool(const OUString &aPropertyName)
Definition: appluno.cxx:111
virtual sal_Bool SAL_CALL getPrintAllSheets() override
Definition: appluno.hxx:132
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: appluno.cxx:507
virtual void SAL_CALL setMoveSelection(sal_Bool p1) override
Definition: appluno.hxx:73
OUString aName
virtual sal_Bool SAL_CALL getExtendFormat() override
Definition: appluno.hxx:83
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: appluno.cxx:129
virtual void SAL_CALL setRangeFinder(sal_Bool p1) override
Definition: appluno.hxx:89
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: appluno.cxx:585
virtual void SAL_CALL setMoveDirection(sal_Int16 p1) override
Definition: appluno.hxx:77
virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) override
Definition: appluno.hxx:134
virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) override
Definition: appluno.hxx:113
virtual sal_Bool SAL_CALL getEnterEdit() override
Definition: appluno.hxx:79
css::uno::Reference< css::uno::XInterface > SAL_CALL ScFunctionListObj_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > &rSMgr)
struct _ADOIndex Index
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL setLinkUpdateMode(sal_Int16 p1) override
Definition: appluno.hxx:130
virtual void SAL_CALL setMarkHeader(sal_Bool p1) override
Definition: appluno.hxx:97
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL setStatusBarFunction(sal_Int16 p1) override
Definition: appluno.hxx:117
virtual void SAL_CALL setExpandReferences(sal_Bool p1) override
Definition: appluno.hxx:93
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: appluno.cxx:542