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 #pragma once
21 
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>
33 
34 namespace com::sun::star::lang { class XMultiServiceFactory; }
35 
36 css::uno::Reference<css::uno::XInterface>
38  const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
39 css::uno::Reference<css::uno::XInterface> SAL_CALL
41  const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
42 css::uno::Reference<css::uno::XInterface> SAL_CALL
44  const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMgr );
45 
46 
47 class ScSpreadsheetSettings final : public cppu::WeakImplHelper<
48  css::sheet::XGlobalSheetSettings,
49  css::beans::XPropertySet,
50  css::lang::XServiceInfo>
51 {
52 private:
54 
56  bool getPropertyBool(const OUString& aPropertyName);
58  sal_Int16 getPropertyInt16(const OUString& aPropertyName);
60  void setProperty(const OUString& aPropertyName, bool p1)
61  { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
63  void setProperty(const OUString& aPropertyName, sal_Int16 p1)
64  { setPropertyValue( aPropertyName, css::uno::Any(p1) ); }
65 public:
67  virtual ~ScSpreadsheetSettings() override;
68 
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
119  {
120  css::uno::Any any = getPropertyValue("UserLists");
121  css::uno::Sequence<OUString> b;
122  any >>= b;
123  return b;
124  }
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)); }
147 
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;
163 
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;
168 };
169 
170 class ScRecentFunctionsObj final : public cppu::WeakImplHelper<
171  css::sheet::XRecentFunctions,
172  css::lang::XServiceInfo>
173 {
174 public:
176  virtual ~ScRecentFunctionsObj() override;
177 
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;
182 
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;
187 };
188 
189 class ScFunctionListObj final : public cppu::WeakImplHelper<
190  css::sheet::XFunctionDescriptions,
191  css::container::XEnumerationAccess,
192  css::container::XNameAccess,
193  css::lang::XServiceInfo>
194 {
195 public:
197  virtual ~ScFunctionListObj() override;
198 
199  // XFunctionDescriptions
200  virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL
201  getById( sal_Int32 nId ) override;
202 
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;
207 
208  // XIndexAccess
209  virtual sal_Int32 SAL_CALL getCount() override;
210  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
211 
212  // XEnumerationAccess
213  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
214  createEnumeration() override;
215 
216  // XElementAccess
217  virtual css::uno::Type SAL_CALL getElementType() override;
218  virtual sal_Bool SAL_CALL hasElements() override;
219 
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;
224 };
225 
226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setRecentFunctionIds(const css::uno::Sequence< sal_Int32 > &aRecentFunctionIds) override
Definition: appluno.cxx:388
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:530
virtual ~ScSpreadsheetSettings() override
Definition: appluno.cxx:95
virtual sal_Bool SAL_CALL getUsePrinterMetrics() override
Definition: appluno.hxx:139
virtual sal_Int16 SAL_CALL getMetric() override
Definition: appluno.hxx:102
virtual void SAL_CALL setEnterEdit(sal_Bool p1) override
Definition: appluno.hxx:80
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: appluno.cxx:287
virtual sal_Int16 SAL_CALL getScale() override
Definition: appluno.hxx:106
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:118
virtual sal_Bool SAL_CALL getMoveSelection() override
Definition: appluno.hxx:70
virtual sal_Bool SAL_CALL getMarkHeader() override
Definition: appluno.hxx:94
sal_Int16 nId
virtual sal_Bool SAL_CALL getDoAutoComplete() override
Definition: appluno.hxx:110
virtual ~ScFunctionListObj() override
Definition: appluno.cxx:414
virtual void SAL_CALL setPrintEmptyPages(sal_Bool p1) override
Definition: appluno.hxx:137
virtual sal_Int16 SAL_CALL getStatusBarFunction() override
Definition: appluno.hxx:114
virtual void SAL_CALL setScale(sal_Int16 p1) override
Definition: appluno.hxx:108
virtual sal_Int32 SAL_CALL getMaxRecentFunctions() override
Definition: appluno.cxx:405
virtual css::uno::Type SAL_CALL getElementType() override
Definition: appluno.cxx:571
virtual sal_Bool SAL_CALL getRangeFinder() override
Definition: appluno.hxx:86
virtual void SAL_CALL setMetric(sal_Int16 p1) override
Definition: appluno.hxx:104
void setProperty(const OUString &aPropertyName, sal_Int16 p1)
Definition: appluno.hxx:63
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: appluno.cxx:563
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: appluno.cxx:603
virtual void SAL_CALL setUseTabCol(sal_Bool p1) override
Definition: appluno.hxx:100
virtual sal_Bool SAL_CALL getUseTabCol() override
Definition: appluno.hxx:98
SfxItemPropertySet aPropSet
Definition: appluno.hxx:53
virtual sal_Bool SAL_CALL hasElements() override
Definition: appluno.cxx:577
virtual ~ScRecentFunctionsObj() override
Definition: appluno.cxx:357
virtual sal_Bool SAL_CALL getExpandReferences() override
Definition: appluno.hxx:90
void setProperty(const OUString &aPropertyName, bool p1)
Definition: appluno.hxx:60
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:135
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: appluno.cxx:135
virtual sal_Bool SAL_CALL getReplaceCellsWarning() override
Definition: appluno.hxx:143
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:117
unsigned char sal_Bool
virtual sal_Int16 SAL_CALL getMoveDirection() override
Definition: appluno.hxx:74
virtual void SAL_CALL setUserLists(const css::uno::Sequence< OUString > &p1) override
Definition: appluno.hxx:125
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int16 SAL_CALL getLinkUpdateMode() override
Definition: appluno.hxx:127
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:371
virtual void SAL_CALL setReplaceCellsWarning(sal_Bool p1) override
Definition: appluno.hxx:145
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getById(sal_Int32 nId) override
Definition: appluno.cxx:481
virtual void SAL_CALL setUsePrinterMetrics(sal_Bool p1) override
Definition: appluno.hxx:141
virtual void SAL_CALL setExtendFormat(sal_Bool p1) override
Definition: appluno.hxx:84
bool getPropertyBool(const OUString &aPropertyName)
Definition: appluno.cxx:109
virtual sal_Bool SAL_CALL getPrintAllSheets() override
Definition: appluno.hxx:131
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: appluno.cxx:505
virtual void SAL_CALL setMoveSelection(sal_Bool p1) override
Definition: appluno.hxx:72
OUString aName
virtual sal_Bool SAL_CALL getExtendFormat() override
Definition: appluno.hxx:82
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: appluno.cxx:127
virtual void SAL_CALL setRangeFinder(sal_Bool p1) override
Definition: appluno.hxx:88
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:583
virtual void SAL_CALL setMoveDirection(sal_Int16 p1) override
Definition: appluno.hxx:76
virtual void SAL_CALL setPrintAllSheets(sal_Bool p1) override
Definition: appluno.hxx:133
virtual void SAL_CALL setDoAutoComplete(sal_Bool p1) override
Definition: appluno.hxx:112
virtual sal_Bool SAL_CALL getEnterEdit() override
Definition: appluno.hxx:78
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:129
virtual void SAL_CALL setMarkHeader(sal_Bool p1) override
Definition: appluno.hxx:96
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:116
virtual void SAL_CALL setExpandReferences(sal_Bool p1) override
Definition: appluno.hxx:92
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: appluno.cxx:540