LibreOffice Module sw (master)  1
unofield.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_SW_SOURCE_CORE_INC_UNOFIELD_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX
22 
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/container/XEnumeration.hpp>
26 #include <com/sun/star/util/XUpdatable.hpp>
27 #include <com/sun/star/text/XDependentTextField.hpp>
28 
29 #include <cppuhelper/implbase.hxx>
30 
31 #include <unobaseclass.hxx>
32 #include <unocoll.hxx>
33 #include <fldbas.hxx>
34 
35 class SwDoc;
36 class SwFormatField;
38 
39 typedef ::cppu::WeakImplHelper
40 < css::beans::XPropertySet
41 , css::lang::XServiceInfo
42 , css::lang::XUnoTunnel
43 , css::lang::XComponent
45 
47  : public SwXFieldMaster_Base
48 {
49 
50 private:
51  class Impl;
53 
54  virtual ~SwXFieldMaster() override;
55 
56  SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc);
57 
59  SwXFieldMaster(SwDoc* pDoc, SwFieldIds nResId);
60 
61 public:
62 
63  static css::uno::Reference<css::beans::XPropertySet>
64  CreateXFieldMaster(SwDoc * pDoc, SwFieldType * pType,
66 
67  static OUString GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc);
68  static OUString LocalizeFormula(const SwSetExpField& rField, const OUString& rFormula, bool bQuery);
69 
70  SwFieldType* GetFieldType(bool bDontCreate = false) const;
71 
72  static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
73 
74  // XUnoTunnel
75  virtual sal_Int64 SAL_CALL getSomething(
76  const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
77 
78  // XServiceInfo
79  virtual OUString SAL_CALL getImplementationName() override;
80  virtual sal_Bool SAL_CALL supportsService(
81  const OUString& rServiceName) override;
82  virtual css::uno::Sequence< OUString > SAL_CALL
83  getSupportedServiceNames() override;
84 
85  // XComponent
86  virtual void SAL_CALL dispose() override;
87  virtual void SAL_CALL addEventListener(
88  const css::uno::Reference< css::lang::XEventListener > & xListener) override;
89  virtual void SAL_CALL removeEventListener(
90  const css::uno::Reference< css::lang::XEventListener > & xListener) override;
91 
92  // XPropertySet
93  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
94  getPropertySetInfo() override;
95  virtual void SAL_CALL setPropertyValue(
96  const OUString& rPropertyName,
97  const css::uno::Any& rValue) override;
98  virtual css::uno::Any SAL_CALL getPropertyValue(
99  const OUString& rPropertyName) override;
100  virtual void SAL_CALL addPropertyChangeListener(
101  const OUString& rPropertyName,
102  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
103  virtual void SAL_CALL removePropertyChangeListener(
104  const OUString& rPropertyName,
105  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
106  virtual void SAL_CALL addVetoableChangeListener(
107  const OUString& rPropertyName,
108  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
109  virtual void SAL_CALL removeVetoableChangeListener(
110  const OUString& rPropertyName,
111  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
112 
113 };
114 
115 typedef ::cppu::WeakImplHelper
116 < css::text::XDependentTextField
117 , css::lang::XServiceInfo
118 , css::beans::XPropertySet
119 , css::lang::XUnoTunnel
120 , css::util::XUpdatable
122 
124  : public SwXTextField_Base
125 {
126 
127 private:
128  class Impl;
130 
131  virtual ~SwXTextField() override;
132 
133  SwXTextField(SwFormatField& rFormat, SwDoc & rDoc);
134 
136  SwXTextField(SwServiceType nServiceId, SwDoc* pDoc);
137 
138 public:
139  SwServiceType GetServiceId() const;
140 
141  static void TransmuteLeadToInputField(SwSetExpField & rField);
142 
144  static css::uno::Reference< css::text::XTextField>
145  CreateXTextField(SwDoc * pDoc, SwFormatField const* pFormat,
147 
148  static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
149 
150  // XUnoTunnel
151  virtual sal_Int64 SAL_CALL getSomething(
152  const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
153 
154  // XServiceInfo
155  virtual OUString SAL_CALL getImplementationName() override;
156  virtual sal_Bool SAL_CALL supportsService(
157  const OUString& rServiceName) override;
158  virtual css::uno::Sequence< OUString > SAL_CALL
159  getSupportedServiceNames() override;
160 
161  // XComponent
162  virtual void SAL_CALL dispose() override;
163  virtual void SAL_CALL addEventListener(
164  const css::uno::Reference< css::lang::XEventListener > & xListener) override;
165  virtual void SAL_CALL removeEventListener(
166  const css::uno::Reference< css::lang::XEventListener > & xListener) override;
167 
168  // XPropertySet
169  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
170  getPropertySetInfo() override;
171  virtual void SAL_CALL setPropertyValue(
172  const OUString& rPropertyName,
173  const css::uno::Any& rValue) override;
174  virtual css::uno::Any SAL_CALL getPropertyValue(
175  const OUString& rPropertyName) override;
176  virtual void SAL_CALL addPropertyChangeListener(
177  const OUString& rPropertyName,
178  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
179  virtual void SAL_CALL removePropertyChangeListener(
180  const OUString& rPropertyName,
181  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
182  virtual void SAL_CALL addVetoableChangeListener(
183  const OUString& rPropertyName,
184  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
185  virtual void SAL_CALL removeVetoableChangeListener(
186  const OUString& rPropertyName,
187  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
188 
189  // XUpdatable
190  virtual void SAL_CALL update() override;
191 
192  // XTextContent
193  virtual void SAL_CALL attach(
194  const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
195  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override;
196 
197  // XTextField
198  virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override;
199 
200  // XDependentTextField
201  virtual void SAL_CALL attachTextFieldMaster(
202  const css::uno::Reference< css::beans::XPropertySet > & xFieldMaster) override;
203  virtual css::uno::Reference< css::beans::XPropertySet> SAL_CALL getTextFieldMaster() override;
204 
205 };
206 
207 typedef ::cppu::WeakImplHelper
208 < css::container::XEnumeration
209 , css::lang::XServiceInfo
211 
213  : public SwXFieldEnumeration_Base
214 {
215 
216 private:
217  class Impl;
219 
220  virtual ~SwXFieldEnumeration() override;
221 
222 public:
223  explicit SwXFieldEnumeration(SwDoc & rDoc);
224 
225  // XServiceInfo
226  virtual OUString SAL_CALL getImplementationName() override;
227  virtual sal_Bool SAL_CALL supportsService(
228  const OUString& rServiceName) override;
229  virtual css::uno::Sequence< OUString > SAL_CALL
230  getSupportedServiceNames() override;
231 
232  // XEnumeration
233  virtual sal_Bool SAL_CALL hasMoreElements() override;
234  virtual css::uno::Any SAL_CALL nextElement() override;
235 
236 };
237 
238 #endif
239 
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:233
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:2168
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:968
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unofield.cxx:588
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:128
::cppu::WeakImplHelper< css::container::XEnumeration, css::lang::XServiceInfo > SwXFieldEnumeration_Base
Definition: unofield.hxx:210
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unofield.cxx:2176
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:3005
SwServiceType GetServiceId() const
Definition: unofield.cxx:1283
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unofield.cxx:819
static OUString LocalizeFormula(const SwSetExpField &rField, const OUString &rFormula, bool bQuery)
Definition: unofield.cxx:1055
virtual void SAL_CALL dispose() override
Definition: unofield.cxx:978
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unofield.cxx:484
Definition: doc.hxx:185
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: unofield.cxx:1377
static css::uno::Reference< css::text::XTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1256
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unofield.cxx:579
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:2549
virtual ~SwXFieldEnumeration() override
Definition: unofield.cxx:3045
static void TransmuteLeadToInputField(SwSetExpField &rField)
Convert between SwSetExpField with InputFlag false and InputFlag true.
Definition: unofield.cxx:1300
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:2534
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2633
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unofield.cxx:2350
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:973
SwXFieldEnumeration(SwDoc &rDoc)
Definition: unofield.cxx:3010
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:51
virtual void SAL_CALL dispose() override
Definition: unofield.cxx:2142
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:2539
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unofield.cxx:1212
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2609
::cppu::WeakImplHelper< css::beans::XPropertySet, css::lang::XServiceInfo, css::lang::XUnoTunnel, css::lang::XComponent > SwXFieldMaster_Base
Definition: unofield.hxx:37
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:217
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2994
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:2544
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unofield.cxx:1218
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unofield.cxx:2197
SwFieldIds
Definition: fldbas.hxx:38
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: unofield.cxx:3049
unsigned char sal_Bool
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:958
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unofield.cxx:478
SwXFieldMaster(SwFieldType &rType, SwDoc *pDoc)
Definition: unofield.cxx:543
virtual ~SwXFieldMaster() override
Definition: unofield.cxx:548
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unofield.cxx:2105
SwFieldType * GetFieldType(bool bDontCreate=false) const
Definition: unofield.cxx:793
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unofield.cxx:1389
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:533
SwXTextField(SwFormatField &rFormat, SwDoc &rDoc)
Definition: unofield.cxx:1246
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:1015
::cppu::WeakImplHelper< css::text::XDependentTextField, css::lang::XServiceInfo, css::beans::XPropertySet, css::lang::XUnoTunnel, css::util::XUpdatable > SwXTextField_Base
Definition: unofield.hxx:121
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2999
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:963
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:1008
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:527
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:490
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:2161
virtual ~SwXTextField() override
Definition: unofield.cxx:1251
virtual void SAL_CALL attachTextFieldMaster(const css::uno::Reference< css::beans::XPropertySet > &xFieldMaster) override
Definition: unofield.cxx:1343
virtual css::uno::Any SAL_CALL nextElement() override
Definition: unofield.cxx:3056
static OUString GetProgrammaticName(const SwFieldType &rType, SwDoc &rDoc)
Definition: unofield.cxx:1038
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getTextFieldMaster() override
Definition: unofield.cxx:1367
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2628
SwServiceType
entries in this enum are mapped in an array in unocoll.cxx
Definition: unocoll.hxx:63
virtual void SAL_CALL update() override
Definition: unofield.cxx:2554
static css::uno::Reference< css::beans::XPropertySet > CreateXFieldMaster(SwDoc *pDoc, SwFieldType *pType, SwFieldIds nResId=SwFieldIds::Unknown)
Definition: unofield.cxx:553