LibreOffice Module sw (master) 1
unometa.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_UNOMETA_HXX
21#define INCLUDED_SW_SOURCE_CORE_INC_UNOMETA_HXX
22
23#include <memory>
24#include <deque>
25
26#include <com/sun/star/lang/XServiceInfo.hpp>
27#include <com/sun/star/lang/XUnoTunnel.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/container/XChild.hpp>
30#include <com/sun/star/container/XEnumerationAccess.hpp>
31#include <com/sun/star/text/XTextContent.hpp>
32#include <com/sun/star/text/XTextField.hpp>
33
35
36#include <sfx2/Metadatable.hxx>
37
38#include <unobaseclass.hxx>
39
40typedef std::deque<
41 css::uno::Reference< css::text::XTextRange > >
43
44class SwPaM;
45class SwTextNode;
46
47namespace sw {
48 class Meta;
49}
50
51typedef ::cppu::ImplInheritanceHelper
53, css::lang::XUnoTunnel
54, css::lang::XServiceInfo
55, css::container::XChild
56, css::container::XEnumerationAccess
57, css::text::XTextContent
58, css::text::XText
60
62 : public SwXMeta_Base
63{
64
65public:
66
67 class Impl;
68
69protected:
70
72
75 void AttachImpl(
76 const css::uno::Reference< css::text::XTextRange > & xTextRange,
77 const sal_uInt16 nWhich);
78
79 virtual ~SwXMeta() override;
80
81 SwXMeta(SwXMeta const&) = delete;
82 SwXMeta& operator=(SwXMeta const&) = delete;
83
85 SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
86 css::uno::Reference< css::text::XText> const& xParentText,
87 std::unique_ptr<TextRangeList_t const> pPortions);
88
89 SwXMeta(SwDoc *const pDoc);
90
91public:
92
95 ::sw::Meta & rMeta,
96 css::uno::Reference< css::text::XText> const& xParentText = nullptr,
97 std::unique_ptr<TextRangeList_t const> && pPortions = std::unique_ptr<TextRangeList_t const>());
98
100 CreateXMeta(SwDoc & rDoc, bool isField);
101
103 bool SetContentRange( SwTextNode *& rpNode, sal_Int32 & rStart, sal_Int32 & rEnd) const;
104 css::uno::Reference< css::text::XText > const & GetParentText() const;
105
108 bool CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb);
109
110 // MetadatableMixin
111 virtual ::sfx2::Metadatable * GetCoreObject() override;
112 virtual css::uno::Reference< css::frame::XModel >
113 GetModel() override;
114
115 static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId();
116
117 // XUnoTunnel
118 virtual sal_Int64 SAL_CALL getSomething(
119 const css::uno::Sequence< sal_Int8 >& Identifier ) override;
120
121 // XServiceInfo
122 virtual OUString SAL_CALL getImplementationName() override;
123 virtual sal_Bool SAL_CALL supportsService(
124 const OUString& rServiceName) override;
125 virtual css::uno::Sequence< OUString > SAL_CALL
126 getSupportedServiceNames() override;
127
128 // XComponent
129 virtual void SAL_CALL dispose() override;
130 virtual void SAL_CALL addEventListener(
131 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
132 virtual void SAL_CALL removeEventListener(
133 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
134
135 // XChild
136 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
137 getParent() override;
138 virtual void SAL_CALL setParent(
139 css::uno::Reference< css::uno::XInterface> const& xParent) override;
140
141 // XElementAccess
142 virtual css::uno::Type SAL_CALL getElementType() override;
143 virtual sal_Bool SAL_CALL hasElements() override;
144
145 // XEnumerationAccess
146 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
147 createEnumeration() override;
148
149 // XTextContent
150 virtual void SAL_CALL attach(
151 const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
152 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override;
153
154 // XTextRange
155 virtual css::uno::Reference< css::text::XText >
156 SAL_CALL getText() override;
157 virtual css::uno::Reference<
158 css::text::XTextRange > SAL_CALL getStart() override;
159 virtual css::uno::Reference<
160 css::text::XTextRange > SAL_CALL getEnd() override;
161 virtual OUString SAL_CALL getString() override;
162 virtual void SAL_CALL setString(const OUString& rString) override;
163
164 // XSimpleText
165 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
166 createTextCursor() override;
167 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
169 const css::uno::Reference< css::text::XTextRange > & xTextPosition) override;
170 virtual void SAL_CALL insertString(
171 const css::uno::Reference< css::text::XTextRange > & xRange,
172 const OUString& aString, sal_Bool bAbsorb) override;
173 virtual void SAL_CALL insertControlCharacter(
174 const css::uno::Reference< css::text::XTextRange > & xRange,
175 sal_Int16 nControlCharacter, sal_Bool bAbsorb) override;
176
177 // XText
178 virtual void SAL_CALL insertTextContent(
179 const css::uno::Reference< css::text::XTextRange > & xRange,
180 const css::uno::Reference< css::text::XTextContent > & xContent,
181 sal_Bool bAbsorb) override;
182 virtual void SAL_CALL removeTextContent(
183 const css::uno::Reference< css::text::XTextContent > & xContent) override;
184
185};
186
187typedef ::cppu::ImplInheritanceHelper
188< SwXMeta
189, css::beans::XPropertySet
190, css::text::XTextField
192
193class SwXMetaField final
194 : public SwXMetaField_Base
195{
196
197private:
198
199 virtual ~SwXMetaField() override;
200
203 css::uno::Reference< css::text::XText> const&,
204 std::unique_ptr<TextRangeList_t const> && pPortions);
205
206 SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
207 css::uno::Reference< css::text::XText> const& xParentText,
208 std::unique_ptr<TextRangeList_t const> pPortions);
209
212
213 SwXMetaField(SwDoc *const pDoc);
214
215public:
216
217 // XServiceInfo
218 virtual OUString SAL_CALL getImplementationName() override;
219 virtual sal_Bool SAL_CALL supportsService(
220 const OUString& ServiceName) override;
221 virtual css::uno::Sequence< OUString > SAL_CALL
222 getSupportedServiceNames( ) override;
223
224 // XComponent
225 virtual void SAL_CALL dispose() override;
226 virtual void SAL_CALL addEventListener(
227 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
228 virtual void SAL_CALL removeEventListener(
229 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
230
231 // XPropertySet
232 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
233 getPropertySetInfo() override;
234 virtual void SAL_CALL setPropertyValue(
235 const OUString& rPropertyName,
236 const css::uno::Any& rValue) override;
237 virtual css::uno::Any SAL_CALL
238 getPropertyValue(const OUString& rPropertyName) override;
239 virtual void SAL_CALL addPropertyChangeListener(
240 const OUString& rPropertyName,
241 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
242 virtual void SAL_CALL removePropertyChangeListener(
243 const OUString& rPropertyName,
244 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
245 virtual void SAL_CALL addVetoableChangeListener(
246 const OUString& rPropertyName,
247 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
248 virtual void SAL_CALL removeVetoableChangeListener(
249 const OUString& rPropertyName,
250 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
251
252 // XTextContent
253 virtual void SAL_CALL attach(
254 const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
255 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override;
256
257 // XTextField
258 virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override;
259
260};
261
264 const css::uno::Reference< css::frame::XModel>& xModel,
265 const css::uno::Reference< css::rdf::XMetadatable>& xMetaField,
266 OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadowColor);
267
268#endif // INCLUDED_SW_SOURCE_CORE_INC_UNOMETA_HXX
269
270/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:194
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:1307
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:1294
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unorefmk.cxx:1325
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:1386
SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta, css::uno::Reference< css::text::XText > const &xParentText, std::unique_ptr< TextRangeList_t const > pPortions)
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:1402
virtual ~SwXMetaField() override
Definition: unorefmk.cxx:1251
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: unorefmk.cxx:1502
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:1394
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:1410
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:1269
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unorefmk.cxx:1263
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:1280
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unorefmk.cxx:1314
virtual OUString SAL_CALL getImplementationName() override
Definition: unorefmk.cxx:1257
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:1301
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:1287
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unorefmk.cxx:1358
the Meta has a cached list of text portions for its contents this list is created by SwXTextPortionEn...
Definition: unorefmk.cxx:606
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unorefmk.cxx:1058
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1120
static rtl::Reference< SwXMeta > CreateXMeta(::sw::Meta &rMeta, css::uno::Reference< css::text::XText > const &xParentText=nullptr, std::unique_ptr< TextRangeList_t const > &&pPortions=std::unique_ptr< TextRangeList_t const >())
virtual OUString SAL_CALL getImplementationName() override
Definition: unorefmk.cxx:849
SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta, css::uno::Reference< css::text::XText > const &xParentText, std::unique_ptr< TextRangeList_t const > pPortions)
SwXMeta(SwXMeta const &)=delete
bool CheckForOwnMemberMeta(const SwPaM &rPam, const bool bAbsorb)
Definition: unorefmk.cxx:773
virtual ~SwXMeta() override
Definition: unorefmk.cxx:683
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1102
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:1018
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1110
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:871
void AttachImpl(const css::uno::Reference< css::text::XTextRange > &xTextRange, const sal_uInt16 nWhich)
Definition: unorefmk.cxx:923
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unometa.hxx:67
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &xTextPosition) override
Definition: unorefmk.cxx:1094
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unorefmk.cxx:1052
virtual css::uno::Reference< css::frame::XModel > GetModel() override
Definition: unorefmk.cxx:1218
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: unorefmk.cxx:1137
css::uno::Reference< css::text::XText > const & GetParentText() const
Definition: unorefmk.cxx:666
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: unorefmk.cxx:1128
virtual ::sfx2::Metadatable * GetCoreObject() override
Definition: unorefmk.cxx:1213
virtual void SAL_CALL setParent(css::uno::Reference< css::uno::XInterface > const &xParent) override
Definition: unorefmk.cxx:1156
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:889
virtual OUString SAL_CALL getString() override
Definition: unorefmk.cxx:1072
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &Identifier) override
Definition: unorefmk.cxx:842
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unorefmk.cxx:1176
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unorefmk.cxx:834
virtual sal_Bool SAL_CALL hasElements() override
Definition: unorefmk.cxx:1168
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:861
bool SetContentRange(SwTextNode *&rpNode, sal_Int32 &rStart, sal_Int32 &rEnd) const
init params with position of the attribute content (w/out CH_TXTATR)
Definition: unorefmk.cxx:751
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unorefmk.cxx:1065
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unorefmk.cxx:855
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unorefmk.cxx:1163
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:880
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unorefmk.cxx:1087
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:1012
SwXMeta & operator=(SwXMeta const &)=delete
virtual void SAL_CALL setString(const OUString &rString) override
Definition: unorefmk.cxx:1079
Dialog to specify the properties of date form field.
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
void getPrefixAndSuffix(const css::uno::Reference< css::frame::XModel > &xModel, const css::uno::Reference< css::rdf::XMetadatable > &xMetaField, OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadowColor)
get prefix/suffix from the RDF repository.
std::deque< css::uno::Reference< css::text::XTextRange > > TextRangeList_t
Definition: unometa.hxx:42
::cppu::ImplInheritanceHelper< ::sfx2::MetadatableMixin, css::lang::XUnoTunnel, css::lang::XServiceInfo, css::container::XChild, css::container::XEnumerationAccess, css::text::XTextContent, css::text::XText > SwXMeta_Base
Definition: unometa.hxx:59
::cppu::ImplInheritanceHelper< SwXMeta, css::beans::XPropertySet, css::text::XTextField > SwXMetaField_Base
Definition: unometa.hxx:191