1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNOFIELD_HXX
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>
29 #include <cppuhelper/implbase.hxx>
31 #include <unobaseclass.hxx>
32 #include <unocoll.hxx>
39 typedef ::cppu::WeakImplHelper
40 < css::beans::XPropertySet
41 , css::lang::XServiceInfo
42 , css::lang::XUnoTunnel
43 , css::lang::XComponent
44 > SwXFieldMaster_Base
;
47 : public SwXFieldMaster_Base
52 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
54 virtual ~SwXFieldMaster() override
;
56 SwXFieldMaster(SwFieldType
& rType
, SwDoc
* pDoc
);
59 SwXFieldMaster(SwDoc
* pDoc
, SwFieldIds nResId
);
63 static css::uno::Reference
<css::beans::XPropertySet
>
64 CreateXFieldMaster(SwDoc
* pDoc
, SwFieldType
* pType
,
65 SwFieldIds nResId
= SwFieldIds::Unknown
);
67 static OUString
GetProgrammaticName(const SwFieldType
& rType
, SwDoc
& rDoc
);
68 static OUString
LocalizeFormula(const SwSetExpField
& rField
, const OUString
& rFormula
, bool bQuery
);
70 SwFieldType
* GetFieldType(bool bDontCreate
= false) const;
72 static const css::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
75 virtual sal_Int64 SAL_CALL
getSomething(
76 const css::uno::Sequence
< sal_Int8
>& rIdentifier
) override
;
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
;
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
;
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
;
115 typedef ::cppu::WeakImplHelper
116 < css::text::XDependentTextField
117 , css::lang::XServiceInfo
118 , css::beans::XPropertySet
119 , css::lang::XUnoTunnel
120 , css::util::XUpdatable
124 : public SwXTextField_Base
129 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
131 virtual ~SwXTextField() override
;
133 SwXTextField(SwFormatField
& rFormat
, SwDoc
& rDoc
);
136 SwXTextField(SwServiceType nServiceId
, SwDoc
* pDoc
);
139 SwServiceType
GetServiceId() const;
141 static void TransmuteLeadToInputField(SwSetExpField
& rField
);
143 /// @return an SwXTextField, either an already existing one or a new one
144 static css::uno::Reference
< css::text::XTextField
>
145 CreateXTextField(SwDoc
* pDoc
, SwFormatField
const* pFormat
,
146 SwServiceType nServiceId
= SwServiceType::Invalid
);
148 static const css::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
151 virtual sal_Int64 SAL_CALL
getSomething(
152 const css::uno::Sequence
< sal_Int8
>& rIdentifier
) override
;
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
;
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
;
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
;
190 virtual void SAL_CALL
update() override
;
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
;
198 virtual OUString SAL_CALL
getPresentation(sal_Bool bShowCommand
) override
;
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
;
207 typedef ::cppu::WeakImplHelper
208 < css::container::XEnumeration
209 , css::lang::XServiceInfo
210 > SwXFieldEnumeration_Base
;
212 class SwXFieldEnumeration
213 : public SwXFieldEnumeration_Base
218 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
220 virtual ~SwXFieldEnumeration() override
;
223 explicit SwXFieldEnumeration(SwDoc
& rDoc
);
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
;
233 virtual sal_Bool SAL_CALL
hasMoreElements() override
;
234 virtual css::uno::Any SAL_CALL
nextElement() override
;
240 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */