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_INC_UNOPARAGRAPH_HXX
21 #define INCLUDED_SW_INC_UNOPARAGRAPH_HXX
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 #include <com/sun/star/beans/XMultiPropertySet.hpp>
30 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
31 #include <com/sun/star/container/XEnumerationAccess.hpp>
32 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
33 #include <com/sun/star/text/XTextContent.hpp>
34 #include <com/sun/star/text/XTextRange.hpp>
36 #include <cppuhelper/implbase.hxx>
38 #include <sfx2/Metadatable.hxx>
40 #include "unobaseclass.hxx"
49 typedef ::cppu::ImplInheritanceHelper
50 < ::sfx2::MetadatableMixin
51 , css::lang::XUnoTunnel
52 , css::lang::XServiceInfo
53 , css::beans::XPropertySet
54 , css::beans::XPropertyState
55 , css::beans::XMultiPropertySet
56 , css::beans::XTolerantMultiPropertySet
57 , css::container::XEnumerationAccess
58 , css::container::XContentEnumerationAccess
59 , css::text::XTextContent
60 , css::text::XTextRange
63 class SwXParagraph final
64 : public SwXParagraph_Base
70 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
72 virtual ~SwXParagraph() override
;
74 SwXParagraph(css::uno::Reference
< css::text::XText
> const & xParent
,
75 SwTextNode
& rTextNode
,
76 const sal_Int32 nSelStart
, const sal_Int32 nSelEnd
);
83 static css::uno::Reference
<css::text::XTextContent
>
84 CreateXParagraph(SwDoc
& rDoc
, SwTextNode
* pTextNode
,
85 css::uno::Reference
< css::text::XText
>
86 const& xParentText
= nullptr,
87 const sal_Int32 nSelStart
= -1, const sal_Int32 nSelEnd
= - 1);
89 const SwTextNode
* GetTextNode() const;
90 bool IsDescriptor() const;
91 /// make rPaM select the paragraph
92 bool SelectPaM(SwPaM
& rPaM
);
94 void attachToText(SwXText
& rParent
, SwTextNode
& rTextNode
);
97 virtual ::sfx2::Metadatable
* GetCoreObject() override
;
98 virtual css::uno::Reference
< css::frame::XModel
>
101 static const css::uno::Sequence
< sal_Int8
>& getUnoTunnelId();
104 virtual sal_Int64 SAL_CALL
getSomething(
105 const css::uno::Sequence
< sal_Int8
>& rIdentifier
) override
;
108 virtual OUString SAL_CALL
getImplementationName() override
;
109 virtual sal_Bool SAL_CALL
supportsService(
110 const OUString
& rServiceName
) override
;
111 virtual css::uno::Sequence
< OUString
> SAL_CALL
112 getSupportedServiceNames() override
;
115 virtual void SAL_CALL
dispose() override
;
116 virtual void SAL_CALL
addEventListener(
117 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
118 virtual void SAL_CALL
removeEventListener(
119 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
122 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
123 getPropertySetInfo() override
;
124 virtual void SAL_CALL
setPropertyValue(
125 const OUString
& rPropertyName
,
126 const css::uno::Any
& rValue
) override
;
127 virtual css::uno::Any SAL_CALL
getPropertyValue(
128 const OUString
& rPropertyName
) override
;
129 virtual void SAL_CALL
addPropertyChangeListener(
130 const OUString
& rPropertyName
,
131 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
132 virtual void SAL_CALL
removePropertyChangeListener(
133 const OUString
& rPropertyName
,
134 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
135 virtual void SAL_CALL
addVetoableChangeListener(
136 const OUString
& rPropertyName
,
137 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
138 virtual void SAL_CALL
removeVetoableChangeListener(
139 const OUString
& rPropertyName
,
140 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
143 virtual css::beans::PropertyState SAL_CALL
144 getPropertyState(const OUString
& rPropertyName
) override
;
145 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
147 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
148 virtual void SAL_CALL
setPropertyToDefault(
149 const OUString
& rPropertyName
) override
;
150 virtual css::uno::Any SAL_CALL
getPropertyDefault(
151 const OUString
& rPropertyName
) override
;
154 virtual void SAL_CALL
setPropertyValues(
155 const css::uno::Sequence
< OUString
>& rPropertyNames
,
156 const css::uno::Sequence
< css::uno::Any
>& rValues
) override
;
157 virtual css::uno::Sequence
< css::uno::Any
>
158 SAL_CALL
getPropertyValues(
159 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
160 virtual void SAL_CALL
addPropertiesChangeListener(
161 const css::uno::Sequence
< OUString
>& rPropertyNames
,
162 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
163 virtual void SAL_CALL
removePropertiesChangeListener(
164 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
165 virtual void SAL_CALL
firePropertiesChangeEvent(
166 const css::uno::Sequence
< OUString
>& rPropertyNames
,
167 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
169 // XTolerantMultiPropertySet
170 virtual css::uno::Sequence
< css::beans::SetPropertyTolerantFailed
> SAL_CALL
171 setPropertyValuesTolerant(
172 const css::uno::Sequence
< OUString
>& rPropertyNames
,
173 const css::uno::Sequence
< css::uno::Any
>& rValues
) override
;
174 virtual css::uno::Sequence
< css::beans::GetPropertyTolerantResult
> SAL_CALL
175 getPropertyValuesTolerant(
176 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
177 virtual css::uno::Sequence
<
178 css::beans::GetDirectPropertyTolerantResult
> SAL_CALL
179 getDirectPropertyValuesTolerant(
180 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
183 virtual css::uno::Type SAL_CALL
getElementType() override
;
184 virtual sal_Bool SAL_CALL
hasElements() override
;
186 // XEnumerationAccess
187 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
188 createEnumeration() override
;
190 // XContentEnumerationAccess
191 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
192 createContentEnumeration(const OUString
& rServiceName
) override
;
193 virtual css::uno::Sequence
< OUString
> SAL_CALL
194 getAvailableServiceNames() override
;
197 virtual void SAL_CALL
attach(
198 const css::uno::Reference
< css::text::XTextRange
> & xTextRange
) override
;
199 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getAnchor() override
;
202 virtual css::uno::Reference
< css::text::XText
>
203 SAL_CALL
getText() override
;
204 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getStart() override
;
205 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getEnd() override
;
206 virtual OUString SAL_CALL
getString() override
;
207 virtual void SAL_CALL
setString(const OUString
& rString
) override
;
212 struct SwXParagraphEnumeration
213 : public SwSimpleEnumeration_Base
215 static SwXParagraphEnumeration
* Create(
216 css::uno::Reference
< css::text::XText
> const & xParent
,
217 const std::shared_ptr
<SwUnoCursor
>& pCursor
,
218 const CursorType eType
,
219 SwStartNode
const*const pStartNode
= nullptr,
220 SwTable
const*const pTable
= nullptr);
223 #endif // INCLUDED_SW_INC_UNOPARAGRAPH_HXX
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */