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/beans/XPropertySet.hpp>
28#include <com/sun/star/container/XChild.hpp>
29#include <com/sun/star/container/XEnumerationAccess.hpp>
30#include <com/sun/star/text/XTextContent.hpp>
31#include <com/sun/star/text/XTextField.hpp>
32
34
35#include <sfx2/Metadatable.hxx>
36
37#include <unobaseclass.hxx>
38
39typedef std::deque<
40 css::uno::Reference< css::text::XTextRange > >
42
43class SwPaM;
44class SwTextNode;
45
46namespace sw {
47 class Meta;
48}
49
50typedef ::cppu::ImplInheritanceHelper
52, css::lang::XServiceInfo
53, css::container::XChild
54, css::container::XEnumerationAccess
55, css::text::XTextContent
56, css::text::XText
58
60 : public SwXMeta_Base
61{
62
63public:
64
65 class Impl;
66
67protected:
68
70
73 void AttachImpl(
74 const css::uno::Reference< css::text::XTextRange > & xTextRange,
75 const sal_uInt16 nWhich);
76
77 virtual ~SwXMeta() override;
78
79 SwXMeta(SwXMeta const&) = delete;
80 SwXMeta& operator=(SwXMeta const&) = delete;
81
83 SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
84 css::uno::Reference< css::text::XText> const& xParentText,
85 std::unique_ptr<TextRangeList_t const> pPortions);
86
87 SwXMeta(SwDoc *const pDoc);
88
89public:
90
93 ::sw::Meta & rMeta,
94 css::uno::Reference< css::text::XText> const& xParentText = nullptr,
95 std::unique_ptr<TextRangeList_t const> && pPortions = std::unique_ptr<TextRangeList_t const>());
96
98 CreateXMeta(SwDoc & rDoc, bool isField);
99
101 bool SetContentRange( SwTextNode *& rpNode, sal_Int32 & rStart, sal_Int32 & rEnd) const;
102 css::uno::Reference< css::text::XText > const & GetParentText() const;
103
106 bool CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb);
107
108 // MetadatableMixin
109 virtual ::sfx2::Metadatable * GetCoreObject() override;
110 virtual css::uno::Reference< css::frame::XModel >
111 GetModel() override;
112
113 // XServiceInfo
114 virtual OUString SAL_CALL getImplementationName() override;
115 virtual sal_Bool SAL_CALL supportsService(
116 const OUString& rServiceName) override;
117 virtual css::uno::Sequence< OUString > SAL_CALL
118 getSupportedServiceNames() override;
119
120 // XComponent
121 virtual void SAL_CALL dispose() override;
122 virtual void SAL_CALL addEventListener(
123 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
124 virtual void SAL_CALL removeEventListener(
125 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
126
127 // XChild
128 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
129 getParent() override;
130 virtual void SAL_CALL setParent(
131 css::uno::Reference< css::uno::XInterface> const& xParent) override;
132
133 // XElementAccess
134 virtual css::uno::Type SAL_CALL getElementType() override;
135 virtual sal_Bool SAL_CALL hasElements() override;
136
137 // XEnumerationAccess
138 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
139 createEnumeration() override;
140
141 // XTextContent
142 virtual void SAL_CALL attach(
143 const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
144 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override;
145
146 // XTextRange
147 virtual css::uno::Reference< css::text::XText >
148 SAL_CALL getText() override;
149 virtual css::uno::Reference<
150 css::text::XTextRange > SAL_CALL getStart() override;
151 virtual css::uno::Reference<
152 css::text::XTextRange > SAL_CALL getEnd() override;
153 virtual OUString SAL_CALL getString() override;
154 virtual void SAL_CALL setString(const OUString& rString) override;
155
156 // XSimpleText
157 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
158 createTextCursor() override;
159 virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL
161 const css::uno::Reference< css::text::XTextRange > & xTextPosition) override;
162 virtual void SAL_CALL insertString(
163 const css::uno::Reference< css::text::XTextRange > & xRange,
164 const OUString& aString, sal_Bool bAbsorb) override;
165 virtual void SAL_CALL insertControlCharacter(
166 const css::uno::Reference< css::text::XTextRange > & xRange,
167 sal_Int16 nControlCharacter, sal_Bool bAbsorb) override;
168
169 // XText
170 virtual void SAL_CALL insertTextContent(
171 const css::uno::Reference< css::text::XTextRange > & xRange,
172 const css::uno::Reference< css::text::XTextContent > & xContent,
173 sal_Bool bAbsorb) override;
174 virtual void SAL_CALL removeTextContent(
175 const css::uno::Reference< css::text::XTextContent > & xContent) override;
176
177};
178
179typedef ::cppu::ImplInheritanceHelper
180< SwXMeta
181, css::beans::XPropertySet
182, css::text::XTextField
184
185class SwXMetaField final
186 : public SwXMetaField_Base
187{
188
189private:
190
191 virtual ~SwXMetaField() override;
192
195 css::uno::Reference< css::text::XText> const&,
196 std::unique_ptr<TextRangeList_t const> && pPortions);
197
198 SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
199 css::uno::Reference< css::text::XText> const& xParentText,
200 std::unique_ptr<TextRangeList_t const> pPortions);
201
204
205 SwXMetaField(SwDoc *const pDoc);
206
207public:
208
209 // XServiceInfo
210 virtual OUString SAL_CALL getImplementationName() override;
211 virtual sal_Bool SAL_CALL supportsService(
212 const OUString& ServiceName) override;
213 virtual css::uno::Sequence< OUString > SAL_CALL
214 getSupportedServiceNames( ) override;
215
216 // XComponent
217 virtual void SAL_CALL dispose() override;
218 virtual void SAL_CALL addEventListener(
219 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
220 virtual void SAL_CALL removeEventListener(
221 const css::uno::Reference< css::lang::XEventListener > & xListener) override;
222
223 // XPropertySet
224 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
225 getPropertySetInfo() override;
226 virtual void SAL_CALL setPropertyValue(
227 const OUString& rPropertyName,
228 const css::uno::Any& rValue) override;
229 virtual css::uno::Any SAL_CALL
230 getPropertyValue(const OUString& rPropertyName) override;
231 virtual void SAL_CALL addPropertyChangeListener(
232 const OUString& rPropertyName,
233 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
234 virtual void SAL_CALL removePropertyChangeListener(
235 const OUString& rPropertyName,
236 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
237 virtual void SAL_CALL addVetoableChangeListener(
238 const OUString& rPropertyName,
239 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
240 virtual void SAL_CALL removeVetoableChangeListener(
241 const OUString& rPropertyName,
242 const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
243
244 // XTextContent
245 virtual void SAL_CALL attach(
246 const css::uno::Reference< css::text::XTextRange > & xTextRange) override;
247 virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override;
248
249 // XTextField
250 virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override;
251
252};
253
256 const css::uno::Reference< css::frame::XModel>& xModel,
257 const css::uno::Reference< css::rdf::XMetadatable>& xMetaField,
258 OUString *const o_pPrefix, OUString *const o_pSuffix, OUString *const o_pShadowColor);
259
260#endif // INCLUDED_SW_SOURCE_CORE_INC_UNOMETA_HXX
261
262/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:197
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:112
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:1261
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:1248
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unorefmk.cxx:1279
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:1340
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:1356
virtual ~SwXMetaField() override
Definition: unorefmk.cxx:1205
virtual OUString SAL_CALL getPresentation(sal_Bool bShowCommand) override
Definition: unorefmk.cxx:1456
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unorefmk.cxx:1348
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unorefmk.cxx:1364
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:1223
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: unorefmk.cxx:1217
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:1234
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unorefmk.cxx:1268
virtual OUString SAL_CALL getImplementationName() override
Definition: unorefmk.cxx:1211
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:1255
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:1241
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unorefmk.cxx:1312
the Meta has a cached list of text portions for its contents this list is created by SwXTextPortionEn...
Definition: unorefmk.cxx:582
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unorefmk.cxx:1012
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:1074
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:812
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:749
virtual ~SwXMeta() override
Definition: unorefmk.cxx:659
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1056
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unorefmk.cxx:972
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: unorefmk.cxx:1064
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:834
void AttachImpl(const css::uno::Reference< css::text::XTextRange > &xTextRange, const sal_uInt16 nWhich)
Definition: unorefmk.cxx:886
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unometa.hxx:65
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &xTextPosition) override
Definition: unorefmk.cxx:1048
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unorefmk.cxx:1006
virtual css::uno::Reference< css::frame::XModel > GetModel() override
Definition: unorefmk.cxx:1172
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
Definition: unorefmk.cxx:1091
css::uno::Reference< css::text::XText > const & GetParentText() const
Definition: unorefmk.cxx:642
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: unorefmk.cxx:1082
virtual ::sfx2::Metadatable * GetCoreObject() override
Definition: unorefmk.cxx:1167
virtual void SAL_CALL setParent(css::uno::Reference< css::uno::XInterface > const &xParent) override
Definition: unorefmk.cxx:1110
virtual void SAL_CALL dispose() override
Definition: unorefmk.cxx:852
virtual OUString SAL_CALL getString() override
Definition: unorefmk.cxx:1026
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: unorefmk.cxx:1130
virtual sal_Bool SAL_CALL hasElements() override
Definition: unorefmk.cxx:1122
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unorefmk.cxx:824
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:727
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unorefmk.cxx:1019
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unorefmk.cxx:818
virtual css::uno::Type SAL_CALL getElementType() override
Definition: unorefmk.cxx:1117
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unorefmk.cxx:843
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: unorefmk.cxx:1041
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unorefmk.cxx:966
SwXMeta & operator=(SwXMeta const &)=delete
virtual void SAL_CALL setString(const OUString &rString) override
Definition: unorefmk.cxx:1033
Meta is an annotation on a range of text.
Definition: fmtmeta.hxx:137
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.
::cppu::ImplInheritanceHelper< ::sfx2::MetadatableMixin, css::lang::XServiceInfo, css::container::XChild, css::container::XEnumerationAccess, css::text::XTextContent, css::text::XText > SwXMeta_Base
Definition: unometa.hxx:57
std::deque< css::uno::Reference< css::text::XTextRange > > TextRangeList_t
Definition: unometa.hxx:41
::cppu::ImplInheritanceHelper< SwXMeta, css::beans::XPropertySet, css::text::XTextField > SwXMetaField_Base
Definition: unometa.hxx:183