LibreOffice Module sw (master)  1
unoparagraph.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_INC_UNOPARAGRAPH_HXX
21 #define INCLUDED_SW_INC_UNOPARAGRAPH_HXX
22 
23 #include <memory>
24 
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>
35 
36 #include <cppuhelper/implbase.hxx>
37 
38 #include <sfx2/Metadatable.hxx>
39 
40 #include "unobaseclass.hxx"
41 
42 class SwPaM;
43 class SwUnoCursor;
44 class SwStartNode;
45 class SwTextNode;
46 class SwTable;
47 class SwXText;
48 
49 typedef ::cppu::ImplInheritanceHelper
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
62 
64  : public SwXParagraph_Base
65 {
66 
67 private:
68 
69  class Impl;
71 
72  virtual ~SwXParagraph() override;
73 
74  SwXParagraph(css::uno::Reference< css::text::XText > const & xParent,
75  SwTextNode & rTextNode,
76  const sal_Int32 nSelStart, const sal_Int32 nSelEnd);
77 
79  SwXParagraph();
80 
81 public:
82 
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);
88 
89  const SwTextNode * GetTextNode() const;
90  bool IsDescriptor() const;
92  bool SelectPaM(SwPaM & rPaM);
94  void attachToText(SwXText & rParent, SwTextNode & rTextNode);
95 
96  // MetadatableMixin
97  virtual ::sfx2::Metadatable* GetCoreObject() override;
98  virtual css::uno::Reference< css::frame::XModel >
99  GetModel() override;
100 
101  static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
102 
103  // XUnoTunnel
104  virtual sal_Int64 SAL_CALL getSomething(
105  const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
106 
107  // XServiceInfo
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;
113 
114  // XComponent
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;
120 
121  // XPropertySet
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;
141 
142  // XPropertyState
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;
152 
153  // XMultiPropertySet
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;
168 
169  // XTolerantMultiPropertySet
170  virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL
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
176  const css::uno::Sequence< OUString >& rPropertyNames) override;
177  virtual css::uno::Sequence<
178  css::beans::GetDirectPropertyTolerantResult > SAL_CALL
180  const css::uno::Sequence< OUString >& rPropertyNames) override;
181 
182  // XElementAccess
183  virtual css::uno::Type SAL_CALL getElementType() override;
184  virtual sal_Bool SAL_CALL hasElements() override;
185 
186  // XEnumerationAccess
187  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
188  createEnumeration() override;
189 
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;
195 
196  // XTextContent
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;
200 
201  // XTextRange
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;
208 
209 };
210 
211 
213  : public SwSimpleEnumeration_Base
214 {
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);
221 };
222 
223 #endif // INCLUDED_SW_INC_UNOPARAGRAPH_HXX
224 
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Starts a section of nodes in the document model.
Definition: node.hxx:303
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &rPropertyNames) override
void attachToText(SwXText &rParent, SwTextNode &rTextNode)
for SwXText
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
CursorType
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
static css::uno::Reference< css::text::XTextContent > CreateXParagraph(SwDoc &rDoc, SwTextNode *pTextNode, css::uno::Reference< css::text::XText > const &xParentText=nullptr, const sal_Int32 nSelStart=-1, const sal_Int32 nSelEnd=-1)
virtual css::uno::Sequence< css::beans::GetPropertyTolerantResult > SAL_CALL getPropertyValuesTolerant(const css::uno::Sequence< OUString > &rPropertyNames) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createContentEnumeration(const OUString &rServiceName) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: doc.hxx:185
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &rPropertyName) override
virtual css::uno::Sequence< css::beans::GetDirectPropertyTolerantResult > SAL_CALL getDirectPropertyValuesTolerant(const css::uno::Sequence< OUString > &rPropertyNames) override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
bool SelectPaM(SwPaM &rPaM)
make rPaM select the paragraph
::cppu::ImplInheritanceHelper< ::sfx2::MetadatableMixin, css::lang::XUnoTunnel, css::lang::XServiceInfo, css::beans::XPropertySet, css::beans::XPropertyState, css::beans::XMultiPropertySet, css::beans::XTolerantMultiPropertySet, css::container::XEnumerationAccess, css::container::XContentEnumerationAccess, css::text::XTextContent, css::text::XTextRange > SwXParagraph_Base
virtual css::uno::Reference< css::frame::XModel > GetModel() override
virtual OUString SAL_CALL getString() override
virtual ::sfx2::Metadatable * GetCoreObject() override
::sw::UnoImplPtr< Impl > m_pImpl
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
virtual css::uno::Sequence< css::beans::SetPropertyTolerantFailed > SAL_CALL setPropertyValuesTolerant(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rValues) override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
virtual void SAL_CALL setString(const OUString &rString) override
static SwXParagraphEnumeration * Create(css::uno::Reference< css::text::XText > const &xParent, const std::shared_ptr< SwUnoCursor > &pCursor, const CursorType eType, SwStartNode const *const pStartNode=nullptr, SwTable const *const pTable=nullptr)
Definition: unoobj2.cxx:507
virtual ~SwXParagraph() override
unsigned char sal_Bool
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::container::XEnumeration > SwSimpleEnumeration_Base
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rValues) override
virtual OUString SAL_CALL getImplementationName() override
DocumentType const eType
virtual void SAL_CALL dispose() override
SwTable is one table in the document model, containing rows (which contain cells).
Definition: swtable.hxx:110
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
SwXParagraph()
descriptor
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
bool IsDescriptor() const
const SwTextNode * GetTextNode() const
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &rPropertyNames) override
virtual void SAL_CALL setPropertyToDefault(const OUString &rPropertyName) override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &rPropertyName) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override