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/XServiceInfo.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/beans/XPropertyState.hpp>
28 #include <com/sun/star/beans/XMultiPropertySet.hpp>
29 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
30 #include <com/sun/star/container/XEnumerationAccess.hpp>
31 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
32 #include <com/sun/star/text/XTextContent.hpp>
33 #include <com/sun/star/text/XTextRange.hpp>
35 #include <cppuhelper/implbase.hxx>
37 #include <sfx2/Metadatable.hxx>
39 #include "unobaseclass.hxx"
47 class SwXTextPortionEnumeration
;
49 typedef ::cppu::ImplInheritanceHelper
50 < ::sfx2::MetadatableMixin
51 , css::lang::XServiceInfo
52 , css::beans::XPropertySet
53 , css::beans::XPropertyState
54 , css::beans::XMultiPropertySet
55 , css::beans::XTolerantMultiPropertySet
56 , css::container::XEnumerationAccess
57 , css::container::XContentEnumerationAccess
58 , css::text::XTextContent
59 , css::text::XTextRange
62 class SwXParagraph final
63 : public SwXParagraph_Base
69 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
71 virtual ~SwXParagraph() override
;
73 SwXParagraph(css::uno::Reference
< css::text::XText
> const & xParent
,
74 SwTextNode
& rTextNode
,
75 const sal_Int32 nSelStart
, const sal_Int32 nSelEnd
);
82 static rtl::Reference
<SwXParagraph
>
83 CreateXParagraph(SwDoc
& rDoc
, SwTextNode
* pTextNode
,
84 css::uno::Reference
< css::text::XText
>
85 const& xParentText
= nullptr,
86 const sal_Int32 nSelStart
= -1, const sal_Int32 nSelEnd
= - 1);
88 const SwTextNode
* GetTextNode() const;
89 bool IsDescriptor() const;
90 /// make rPaM select the paragraph
91 bool SelectPaM(SwPaM
& rPaM
);
93 void attachToText(SwXText
& rParent
, SwTextNode
& rTextNode
);
96 virtual ::sfx2::Metadatable
* GetCoreObject() override
;
97 virtual css::uno::Reference
< css::frame::XModel
>
101 virtual OUString SAL_CALL
getImplementationName() override
;
102 virtual sal_Bool SAL_CALL
supportsService(
103 const OUString
& rServiceName
) override
;
104 virtual css::uno::Sequence
< OUString
> SAL_CALL
105 getSupportedServiceNames() override
;
108 virtual void SAL_CALL
dispose() override
;
109 virtual void SAL_CALL
addEventListener(
110 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
111 virtual void SAL_CALL
removeEventListener(
112 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
115 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
116 getPropertySetInfo() override
;
117 virtual void SAL_CALL
setPropertyValue(
118 const OUString
& rPropertyName
,
119 const css::uno::Any
& rValue
) override
;
120 virtual css::uno::Any SAL_CALL
getPropertyValue(
121 const OUString
& rPropertyName
) override
;
122 virtual void SAL_CALL
addPropertyChangeListener(
123 const OUString
& rPropertyName
,
124 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
125 virtual void SAL_CALL
removePropertyChangeListener(
126 const OUString
& rPropertyName
,
127 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
128 virtual void SAL_CALL
addVetoableChangeListener(
129 const OUString
& rPropertyName
,
130 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
131 virtual void SAL_CALL
removeVetoableChangeListener(
132 const OUString
& rPropertyName
,
133 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
136 virtual css::beans::PropertyState SAL_CALL
137 getPropertyState(const OUString
& rPropertyName
) override
;
138 virtual css::uno::Sequence
< css::beans::PropertyState
> SAL_CALL
140 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
141 virtual void SAL_CALL
setPropertyToDefault(
142 const OUString
& rPropertyName
) override
;
143 virtual css::uno::Any SAL_CALL
getPropertyDefault(
144 const OUString
& rPropertyName
) override
;
147 virtual void SAL_CALL
setPropertyValues(
148 const css::uno::Sequence
< OUString
>& rPropertyNames
,
149 const css::uno::Sequence
< css::uno::Any
>& rValues
) override
;
150 virtual css::uno::Sequence
< css::uno::Any
>
151 SAL_CALL
getPropertyValues(
152 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
153 virtual void SAL_CALL
addPropertiesChangeListener(
154 const css::uno::Sequence
< OUString
>& rPropertyNames
,
155 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
156 virtual void SAL_CALL
removePropertiesChangeListener(
157 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
158 virtual void SAL_CALL
firePropertiesChangeEvent(
159 const css::uno::Sequence
< OUString
>& rPropertyNames
,
160 const css::uno::Reference
< css::beans::XPropertiesChangeListener
>& xListener
) override
;
162 // XTolerantMultiPropertySet
163 virtual css::uno::Sequence
< css::beans::SetPropertyTolerantFailed
> SAL_CALL
164 setPropertyValuesTolerant(
165 const css::uno::Sequence
< OUString
>& rPropertyNames
,
166 const css::uno::Sequence
< css::uno::Any
>& rValues
) override
;
167 virtual css::uno::Sequence
< css::beans::GetPropertyTolerantResult
> SAL_CALL
168 getPropertyValuesTolerant(
169 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
170 virtual css::uno::Sequence
<
171 css::beans::GetDirectPropertyTolerantResult
> SAL_CALL
172 getDirectPropertyValuesTolerant(
173 const css::uno::Sequence
< OUString
>& rPropertyNames
) override
;
176 virtual css::uno::Type SAL_CALL
getElementType() override
;
177 virtual sal_Bool SAL_CALL
hasElements() override
;
179 // XEnumerationAccess
180 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
181 createEnumeration() override
;
183 // XContentEnumerationAccess
184 virtual css::uno::Reference
< css::container::XEnumeration
> SAL_CALL
185 createContentEnumeration(const OUString
& rServiceName
) override
;
186 virtual css::uno::Sequence
< OUString
> SAL_CALL
187 getAvailableServiceNames() override
;
190 virtual void SAL_CALL
attach(
191 const css::uno::Reference
< css::text::XTextRange
> & xTextRange
) override
;
192 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getAnchor() override
;
195 virtual css::uno::Reference
< css::text::XText
>
196 SAL_CALL
getText() override
;
197 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getStart() override
;
198 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getEnd() override
;
199 virtual OUString SAL_CALL
getString() override
;
200 virtual void SAL_CALL
setString(const OUString
& rString
) override
;
202 /// tries to return less data, but may return more than just text fields
203 rtl::Reference
<SwXTextPortionEnumeration
> createTextFieldsEnumeration();
207 struct SwXParagraphEnumeration
208 : public SwSimpleEnumeration_Base
210 static rtl::Reference
<SwXParagraphEnumeration
> Create(
211 css::uno::Reference
< css::text::XText
> const & xParent
,
212 const std::shared_ptr
<SwUnoCursor
>& pCursor
,
213 const CursorType eType
,
214 /// only for CursorType::TableText
215 SwTableBox
const*const pTableBox
= nullptr);
218 #endif // INCLUDED_SW_INC_UNOPARAGRAPH_HXX
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */