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/XServiceInfo.hpp>
24#include <com/sun/star/container/XEnumeration.hpp>
25#include <com/sun/star/util/XUpdatable.hpp>
26#include <com/sun/star/text/XDependentTextField.hpp>
27
29
30#include <unobaseclass.hxx>
31#include <unocoll.hxx>
32#include <fldbas.hxx>
33
34class SwDoc;
35class SwFormatField;
36class SwSetExpField;
37
38typedef ::cppu::WeakImplHelper
39< css::beans::XPropertySet
40, css::lang::XServiceInfo
41, css::lang::XComponent
43
44class SwXFieldMaster final
45 : public SwXFieldMaster_Base
46{
47
48private:
49 class Impl;
51
52 virtual ~SwXFieldMaster() override;
53
54 SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc);
55
57 SwXFieldMaster(SwDoc& rDoc, SwFieldIds nResId);
58
59public:
60
62 CreateXFieldMaster(SwDoc * pDoc, SwFieldType * pType,
64
65 static OUString GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc);
66 static OUString LocalizeFormula(const SwSetExpField& rField, const OUString& rFormula, bool bQuery);
67
68 SwFieldType* GetFieldType(bool bDontCreate = false) const;
69
70 // XServiceInfo
71 virtual OUString SAL_CALL getImplementationName() override;
72 virtual sal_Bool SAL_CALL supportsService(
73 const OUString& rServiceName) override;
74 virtual css::uno::Sequence< OUString > SAL_CALL
75 getSupportedServiceNames() override;
76
77 // XComponent
78 virtual void SAL_CALL dispose() override;
79 virtual void SAL_CALL addEventListener(
80 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
81 virtual void SAL_CALL removeEventListener(
82 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
83
84 // XPropertySet
85 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
86 getPropertySetInfo() override;
87 virtual void SAL_CALL setPropertyValue(
88 const OUString& rPropertyName,
89 const css::uno::Any& rValue) override;
90 virtual css::uno::Any SAL_CALL getPropertyValue(
91 const OUString& rPropertyName) override;
92 virtual void SAL_CALL addPropertyChangeListener(
93 const OUString& rPropertyName,
94 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
95 virtual void SAL_CALL removePropertyChangeListener(
96 const OUString& rPropertyName,
97 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
98 virtual void SAL_CALL addVetoableChangeListener(
99 const OUString& rPropertyName,
100 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
101 virtual void SAL_CALL removeVetoableChangeListener(
102 const OUString& rPropertyName,
103 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
104
105};
106
107typedef ::cppu::WeakImplHelper
108< css::text::XDependentTextField
109, css::lang::XServiceInfo
110, css::beans::XPropertySet
111, css::util::XUpdatable
113
118class SwXTextField final
119 : public SwXTextField_Base
120{
121
122private:
123 class Impl;
125
126 virtual ~SwXTextField() override;
127
128 SwXTextField(SwFormatField& rFormat, SwDoc & rDoc);
129
131 SwXTextField(SwServiceType nServiceId, SwDoc* pDoc);
132
133public:
135
136 static void TransmuteLeadToInputField(SwSetExpField & rField);
137
140 CreateXTextField(SwDoc * pDoc, SwFormatField const* pFormat,
142
143 // XServiceInfo
144 virtual OUString SAL_CALL getImplementationName() override;
145 virtual sal_Bool SAL_CALL supportsService(
146 const OUString& rServiceName) override;
147 virtual css::uno::Sequence< OUString > SAL_CALL
148 getSupportedServiceNames() override;
149
150 // XComponent
151 virtual void SAL_CALL dispose() override;
152 virtual void SAL_CALL addEventListener(
153 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
154 virtual void SAL_CALL removeEventListener(
155 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
156
157 // XPropertySet
158 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
159 getPropertySetInfo() override;
160 virtual void SAL_CALL setPropertyValue(
161 const OUString& rPropertyName,
162 const css::uno::Any& rValue) override;
163 virtual css::uno::Any SAL_CALL getPropertyValue(
164 const OUString& rPropertyName) override;
165 virtual void SAL_CALL addPropertyChangeListener(
166 const OUString& rPropertyName,
167 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
168 virtual void SAL_CALL removePropertyChangeListener(
169 const OUString& rPropertyName,
170 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
171 virtual void SAL_CALL addVetoableChangeListener(
172 const OUString& rPropertyName,
173 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
174 virtual void SAL_CALL removeVetoableChangeListener(
175 const OUString& rPropertyName,
176 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
177
178 // XUpdatable
179 virtual void SAL_CALL update() override;
180
181 // XTextContent
182 virtual void SAL_CALL attach(
183 const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
184 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override;
185
186 // XTextField
187 virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override;
188
189 // XDependentTextField
190 virtual void SAL_CALL attachTextFieldMaster(
191 const css::uno::Reference< css::beans::XPropertySet > & xFieldMaster) override;
192 virtual css::uno::Reference< css::beans::XPropertySet> SAL_CALL getTextFieldMaster() override;
193
194};
195
196typedef ::cppu::WeakImplHelper
197< css::container::XEnumeration
198, css::lang::XServiceInfo
200
203{
204
205private:
206 class Impl;
208
209 virtual ~SwXFieldEnumeration() override;
210
211public:
212 explicit SwXFieldEnumeration(SwDoc & rDoc);
213
214 // XServiceInfo
215 virtual OUString SAL_CALL getImplementationName() override;
216 virtual sal_Bool SAL_CALL supportsService(
217 const OUString& rServiceName) override;
218 virtual css::uno::Sequence< OUString > SAL_CALL
219 getSupportedServiceNames() override;
220
221 // XEnumeration
222 virtual sal_Bool SAL_CALL hasMoreElements() override;
223 virtual css::uno::Any SAL_CALL nextElement() override;
224
225};
226
227#endif
228
229/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:197
Instances of SwFields and those derived from it occur 0 to n times.
Definition: fldbas.hxx:247
virtual ~SwXFieldEnumeration() override
Definition: unofield.cxx:2984
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2948
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: unofield.cxx:2988
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2942
virtual css::uno::Any SAL_CALL nextElement() override
Definition: unofield.cxx:2995
SwXFieldEnumeration(SwDoc &rDoc)
Definition: unofield.cxx:2953
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2937
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:206
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:919
static OUString LocalizeFormula(const SwSetExpField &rField, const OUString &rFormula, bool bQuery)
Definition: unofield.cxx:1005
virtual ~SwXFieldMaster() override
Definition: unofield.cxx:519
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:957
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:498
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:461
static rtl::Reference< SwXFieldMaster > CreateXFieldMaster(SwDoc *pDoc, SwFieldType *pType, SwFieldIds nResId=SwFieldIds::Unknown)
Definition: unofield.cxx:524
SwXFieldMaster(SwFieldType &rType, SwDoc *pDoc)
Definition: unofield.cxx:514
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:964
SwFieldType * GetFieldType(bool bDontCreate=false) const
Definition: unofield.cxx:764
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:49
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unofield.cxx:559
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unofield.cxx:550
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:504
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:914
static OUString GetProgrammaticName(const SwFieldType &rType, SwDoc &rDoc)
Definition: unofield.cxx:988
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unofield.cxx:790
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:924
virtual void SAL_CALL dispose() override
Definition: unofield.cxx:934
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:929
UNO wrapper around an SwFormatField, i.e.
Definition: unofield.hxx:120
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:2095
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: unofield.cxx:1307
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unofield.cxx:2110
virtual void SAL_CALL dispose() override
Definition: unofield.cxx:2076
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:2482
SwServiceType GetServiceId() const
Definition: unofield.cxx:1221
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:2492
virtual void SAL_CALL attachTextFieldMaster(const css::uno::Reference< css::beans::XPropertySet > &xFieldMaster) override
Definition: unofield.cxx:1275
SwXTextField(SwFormatField &rFormat, SwDoc &rDoc)
Definition: unofield.cxx:1184
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unofield.cxx:2571
virtual void SAL_CALL update() override
Definition: unofield.cxx:2497
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unofield.cxx:2477
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unofield.cxx:2289
static rtl::Reference< SwXTextField > CreateXTextField(SwDoc *pDoc, SwFormatField const *pFormat, SwServiceType nServiceId=SwServiceType::Invalid)
Definition: unofield.cxx:1194
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unofield.hxx:123
static void TransmuteLeadToInputField(SwSetExpField &rField)
Convert between SwSetExpField with InputFlag false and InputFlag true.
Definition: unofield.cxx:1238
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unofield.cxx:2102
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unofield.cxx:2576
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getTextFieldMaster() override
Definition: unofield.cxx:1295
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unofield.cxx:2487
virtual ~SwXTextField() override
Definition: unofield.cxx:1189
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unofield.cxx:1319
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unofield.cxx:2131
virtual OUString SAL_CALL getImplementationName() override
Definition: unofield.cxx:2552
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unofield.cxx:2039
SwFieldIds
Definition: fldbas.hxx:49
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
unsigned char sal_Bool
SwServiceType
entries in this enum are mapped in an array in unocoll.cxx
Definition: unocoll.hxx:63
::cppu::WeakImplHelper< css::text::XDependentTextField, css::lang::XServiceInfo, css::beans::XPropertySet, css::util::XUpdatable > SwXTextField_Base
Definition: unofield.hxx:112
::cppu::WeakImplHelper< css::beans::XPropertySet, css::lang::XServiceInfo, css::lang::XComponent > SwXFieldMaster_Base
Definition: unofield.hxx:36
::cppu::WeakImplHelper< css::container::XEnumeration, css::lang::XServiceInfo > SwXFieldEnumeration_Base
Definition: unofield.hxx:199