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_UNOMETA_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNOMETA_HXX
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>
34 #include <cppuhelper/implbase.hxx>
36 #include <sfx2/Metadatable.hxx>
38 #include <unobaseclass.hxx>
41 css::uno::Reference
< css::text::XTextRange
> >
51 typedef ::cppu::ImplInheritanceHelper
52 < ::sfx2::MetadatableMixin
53 , css::lang::XUnoTunnel
54 , css::lang::XServiceInfo
55 , css::container::XChild
56 , css::container::XEnumerationAccess
57 , css::text::XTextContent
71 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
73 /// @throws css::lang::IllegalArgumentException
74 /// @throws css::uno::RuntimeException
76 const css::uno::Reference
< css::text::XTextRange
> & xTextRange
,
77 const sal_uInt16 nWhich
);
79 virtual ~SwXMeta() override
;
81 SwXMeta(SwXMeta
const&) = delete;
82 SwXMeta
& operator=(SwXMeta
const&) = delete;
84 /// @param pDoc and pMeta != 0, but not & because of ImplInheritanceHelper
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
);
89 SwXMeta(SwDoc
*const pDoc
);
93 static css::uno::Reference
< css::rdf::XMetadatable
>
96 css::uno::Reference
< css::text::XText
> const& xParentText
= nullptr,
97 std::unique_ptr
<TextRangeList_t
const> && pPortions
= std::unique_ptr
<TextRangeList_t
const>());
99 static css::uno::Reference
<css::rdf::XMetadatable
>
100 CreateXMeta(SwDoc
& rDoc
, bool isField
);
102 /// init params with position of the attribute content (w/out CH_TXTATR)
103 bool SetContentRange( SwTextNode
*& rpNode
, sal_Int32
& rStart
, sal_Int32
& rEnd
) const;
104 css::uno::Reference
< css::text::XText
> const & GetParentText() const;
106 /// @throws css::lang::IllegalArgumentException
107 /// @throws css::uno::RuntimeException
108 bool CheckForOwnMemberMeta(const SwPaM
& rPam
, const bool bAbsorb
);
111 virtual ::sfx2::Metadatable
* GetCoreObject() override
;
112 virtual css::uno::Reference
< css::frame::XModel
>
115 static const css::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
118 virtual sal_Int64 SAL_CALL
getSomething(
119 const css::uno::Sequence
< sal_Int8
>& Identifier
) override
;
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
;
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
;
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
;
142 virtual css::uno::Type SAL_CALL
getElementType() override
;
143 virtual sal_Bool SAL_CALL
hasElements() override
;
145 // XEnumerationAccess
146 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
147 createEnumeration() override
;
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
;
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
;
165 virtual css::uno::Reference
< css::text::XTextCursor
> SAL_CALL
166 createTextCursor() override
;
167 virtual css::uno::Reference
< css::text::XTextCursor
> SAL_CALL
168 createTextCursorByRange(
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
;
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
;
187 typedef ::cppu::ImplInheritanceHelper
189 , css::beans::XPropertySet
190 , css::text::XTextField
194 : public SwXMetaField_Base
199 virtual ~SwXMetaField() override
;
201 friend css::uno::Reference
< css::rdf::XMetadatable
>
202 SwXMeta::CreateXMeta(::sw::Meta
&,
203 css::uno::Reference
< css::text::XText
> const&,
204 std::unique_ptr
<TextRangeList_t
const> && pPortions
);
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
);
210 friend css::uno::Reference
<css::rdf::XMetadatable
>
211 SwXMeta::CreateXMeta(SwDoc
&, bool);
213 SwXMetaField(SwDoc
*const pDoc
);
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
;
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
;
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
;
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
;
258 virtual OUString SAL_CALL
getPresentation(sal_Bool bShowCommand
) override
;
262 /// get prefix/suffix from the RDF repository. @throws RuntimeException
263 void getPrefixAndSuffix(
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
);
268 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNOMETA_HXX
270 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */