LibreOffice Module sw (master)  1
unotext.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_UNOTEXT_HXX
21 #define INCLUDED_SW_INC_UNOTEXT_HXX
22 
23 #include <com/sun/star/lang/XUnoTunnel.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <com/sun/star/text/XTextCopy.hpp>
26 #include <com/sun/star/text/XTextRangeCompare.hpp>
27 #include <com/sun/star/text/XRelativeTextContentInsert.hpp>
28 #include <com/sun/star/text/XRelativeTextContentRemove.hpp>
29 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
30 
31 #include "unobaseclass.hxx"
32 
33 namespace com { namespace sun { namespace star {
34  namespace text {
35  class XTextContent;
36  class XText;
37  }
38 } } }
39 
40 class SwDoc;
41 class SwStartNode;
42 class SwPaM;
43 
44 class SwXText
45  : public css::lang::XTypeProvider
46  , public css::lang::XUnoTunnel
47  , public css::beans::XPropertySet
48  , public css::text::XTextAppendAndConvert
49  , public css::text::XTextCopy
50  , public css::text::XTextRangeCompare
51  , public css::text::XRelativeTextContentInsert
52  , public css::text::XRelativeTextContentRemove
53 {
54 
55 private:
56 
57  class Impl;
59 
60  virtual void PrepareForAttach(
61  css::uno::Reference< css::text::XTextRange > & xRange,
62  SwPaM const & rPam);
65  virtual bool CheckForOwnMemberMeta(
66  const SwPaM & rPam, const bool bAbsorb);
67 
68 protected:
69 
70  bool IsValid() const;
71  void Invalidate();
72  void SetDoc(SwDoc *const pDoc);
73 
74  virtual ~SwXText();
75 
76 public: /*not protected because C++ is retarded*/
77  virtual const SwStartNode *GetStartNode() const;
78 
79 public:
80 
81  SwXText(SwDoc *const pDoc, const CursorType eType);
82 
83  const SwDoc* GetDoc() const;
84  SwDoc* GetDoc();
85 
87  virtual css::uno::Reference< css::text::XTextCursor >
88  CreateCursor();
89 
90  // XInterface
91  virtual css::uno::Any SAL_CALL queryInterface(
92  const css::uno::Type& rType) override;
93 
94  // XTypeProvider
95  virtual css::uno::Sequence< css::uno::Type >
96  SAL_CALL getTypes() override;
97 
98  static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
99 
100  // XUnoTunnel
101  virtual sal_Int64 SAL_CALL getSomething(
102  const css::uno::Sequence< sal_Int8 >& rIdentifier) override;
103 
104  // XPropertySet
105  virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
106  getPropertySetInfo() override;
107  virtual void SAL_CALL setPropertyValue(
108  const OUString& rPropertyName,
109  const css::uno::Any& rValue) override;
110  virtual css::uno::Any SAL_CALL getPropertyValue(
111  const OUString& rPropertyName) override;
112  virtual void SAL_CALL addPropertyChangeListener(
113  const OUString& rPropertyName,
114  const css::uno::Reference<
115  css::beans::XPropertyChangeListener >& xListener) override;
116  virtual void SAL_CALL removePropertyChangeListener(
117  const OUString& rPropertyName,
118  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override;
119  virtual void SAL_CALL addVetoableChangeListener(
120  const OUString& rPropertyName,
121  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
122  virtual void SAL_CALL removeVetoableChangeListener(
123  const OUString& rPropertyName,
124  const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override;
125 
126  // XTextRange
127  virtual css::uno::Reference< css::text::XText >
128  SAL_CALL getText() override;
129  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override;
130  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override;
131  virtual OUString SAL_CALL getString() override;
132  virtual void SAL_CALL setString(const OUString& rString) override;
133 
134  // XSimpleText
135  virtual void SAL_CALL insertString(
136  const css::uno::Reference< css::text::XTextRange > & xRange,
137  const OUString& aString, sal_Bool bAbsorb) override;
138  virtual void SAL_CALL insertControlCharacter(
139  const css::uno::Reference< css::text::XTextRange > & xRange,
140  sal_Int16 nControlCharacter, sal_Bool bAbsorb) override;
141 
142  // XText
143  virtual void SAL_CALL insertTextContent(
144  const css::uno::Reference< css::text::XTextRange > & xRange,
145  const css::uno::Reference< css::text::XTextContent > & xContent,
146  sal_Bool bAbsorb) override;
147  virtual void SAL_CALL removeTextContent(
148  const css::uno::Reference< css::text::XTextContent > & xContent) override;
149 
150  // XParagraphAppend
151  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
153  const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
154  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
156  const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
157  const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override;
158 
159  // XTextPortionAppend
160  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
162  const OUString& rText,
163  const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
164 
165  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
167  const OUString& rText,
168  const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
169  const css::uno::Reference< css::text::XTextRange >& rTextRange) override;
170 
171  // XTextContentAppend
172  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
174  const css::uno::Reference< css::text::XTextContent >& xTextContent,
175  const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties) override;
176  virtual css::uno::Reference< css::text::XTextRange > SAL_CALL
178  const css::uno::Reference< css::text::XTextContent >& xTextContent,
179  const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties,
180  const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override;
181 
182  // XTextConvert
183  virtual css::uno::Reference< css::text::XTextContent > SAL_CALL
185  const css::uno::Reference< css::text::XTextRange >& xStart,
186  const css::uno::Reference< css::text::XTextRange >& xEnd,
187  const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override;
188  virtual css::uno::Reference<
189  css::text::XTextTable > SAL_CALL
191  css::uno::Sequence<
192  css::uno::Sequence<
193  css::uno::Sequence<
194  css::uno::Reference<
195  css::text::XTextRange > > > > const&
196  rTableRanges,
197  css::uno::Sequence<
198  css::uno::Sequence<
199  css::uno::Sequence<
200  css::beans::PropertyValue > > > const&
201  rCellProperties,
202  css::uno::Sequence<
203  css::uno::Sequence<
204  css::beans::PropertyValue > > const&
205  rRowProperties,
206  css::uno::Sequence<
207  css::beans::PropertyValue > const&
208  rTableProperties) override;
209 
210  // XTextCopy
211  virtual void SAL_CALL copyText(
212  const css::uno::Reference< css::text::XTextCopy >& xSource ) override;
213 
214  // XTextRangeCompare
215  sal_Int16 SAL_CALL compareRegionStarts(
216  const css::uno::Reference< css::text::XTextRange >& xR1,
217  const css::uno::Reference< css::text::XTextRange >& xR2) override;
218  sal_Int16 SAL_CALL compareRegionEnds(
219  const css::uno::Reference< css::text::XTextRange >& xR1,
220  const css::uno::Reference< css::text::XTextRange >& xR2) override;
221 
222  // XRelativeTextContentInsert
223  virtual void SAL_CALL insertTextContentBefore(
224  const css::uno::Reference< css::text::XTextContent>& xNewContent,
225  const css::uno::Reference< css::text::XTextContent>& xSuccessor) override;
226  virtual void SAL_CALL insertTextContentAfter(
227  const css::uno::Reference< css::text::XTextContent>& xNewContent,
228  const css::uno::Reference< css::text::XTextContent>& xPredecessor) override;
229 
230  // XRelativeTextContentRemove
231  virtual void SAL_CALL removeTextContentBefore(
232  const css::uno::Reference< css::text::XTextContent>& xSuccessor) override;
233  virtual void SAL_CALL removeTextContentAfter(
234  const css::uno::Reference< css::text::XTextContent>& xPredecessor) override;
235 };
236 
237 #endif // INCLUDED_SW_INC_UNOTEXT_HXX
238 
239 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Starts a section of nodes in the document model.
Definition: node.hxx:303
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: unotext.cxx:856
void SetDoc(SwDoc *const pDoc)
Definition: unotext.cxx:154
virtual ~SwXText()
Definition: unotext.cxx:131
CursorType
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unotext.cxx:1097
void Invalidate()
Definition: unotext.cxx:149
Definition: doc.hxx:185
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraphInsert(const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange > &xInsertPosition) override
Definition: unotext.cxx:1224
sal_Int16 SAL_CALL compareRegionEnds(const css::uno::Reference< css::text::XTextRange > &xR1, const css::uno::Reference< css::text::XTextRange > &xR2) override
Definition: unotext.cxx:1080
bool IsValid() const
Definition: unotext.cxx:144
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: unotext.cxx:882
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unotext.cxx:1203
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: unotext.cxx:265
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unotext.cxx:1183
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unotext.hxx:57
sal_Int16 SAL_CALL compareRegionStarts(const css::uno::Reference< css::text::XTextRange > &xR1, const css::uno::Reference< css::text::XTextRange > &xR2) override
Definition: unotext.cxx:1063
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unotext.cxx:1191
virtual css::uno::Reference< css::text::XTextTable > SAL_CALL convertToTable(css::uno::Sequence< css::uno::Sequence< css::uno::Sequence< css::uno::Reference< css::text::XTextRange > > > > const &rTableRanges, css::uno::Sequence< css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > > const &rCellProperties, css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > const &rRowProperties, css::uno::Sequence< css::beans::PropertyValue > const &rTableProperties) override
Definition: unotext.cxx:2072
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: unotext.cxx:392
virtual const SwStartNode * GetStartNode() const
Definition: unotext.cxx:173
std::unique_ptr< T, UnoImplPtrDeleter< T > > UnoImplPtr
Smart pointer class ensuring that the pointed object is deleted with a locked SolarMutex.
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL appendTextContent(const css::uno::Reference< css::text::XTextContent > &xTextContent, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties) override
Definition: unotext.cxx:1472
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
virtual OUString SAL_CALL getString() override
Definition: unotext.cxx:897
virtual void SAL_CALL copyText(const css::uno::Reference< css::text::XTextCopy > &xSource) override
Definition: unotext.cxx:2197
virtual void SAL_CALL insertTextContentAfter(const css::uno::Reference< css::text::XTextContent > &xNewContent, const css::uno::Reference< css::text::XTextContent > &xPredecessor) override
Definition: unotext.cxx:682
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unotext.cxx:1209
virtual void PrepareForAttach(css::uno::Reference< css::text::XTextRange > &xRange, SwPaM const &rPam)
Definition: unotext.cxx:163
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: unotext.cxx:194
unsigned char sal_Bool
virtual css::uno::Reference< css::text::XTextCursor > CreateCursor()
Definition: unotext.cxx:179
virtual void SAL_CALL removeTextContentAfter(const css::uno::Reference< css::text::XTextContent > &xPredecessor) override
Definition: unotext.cxx:789
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotext.cxx:1175
virtual bool CheckForOwnMemberMeta(const SwPaM &rPam, const bool bAbsorb)
Definition: unotext.cxx:167
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL appendTextPortion(const OUString &rText, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties) override
Definition: unotext.cxx:1410
const SwDoc * GetDoc() const
Definition: unotext.cxx:135
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraph(const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties) override
Definition: unotext.cxx:1215
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: unotext.cxx:866
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: unotext.cxx:842
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: unotext.cxx:286
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unotext.cxx:1107
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unotext.cxx:1167
SwXText(SwDoc *const pDoc, const CursorType eType)
Definition: unotext.cxx:126
def text(shape, st)
virtual void SAL_CALL removeTextContentBefore(const css::uno::Reference< css::text::XTextContent > &xSuccessor) override
Definition: unotext.cxx:737
virtual css::uno::Reference< css::text::XTextContent > SAL_CALL convertToTextFrame(const css::uno::Reference< css::text::XTextRange > &xStart, const css::uno::Reference< css::text::XTextRange > &xEnd, const css::uno::Sequence< css::beans::PropertyValue > &xFrameProperties) override
Definition: unotext.cxx:1500
virtual void SAL_CALL setString(const OUString &rString) override
Definition: unotext.cxx:912
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL insertTextContentWithProperties(const css::uno::Reference< css::text::XTextContent > &xTextContent, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange > &xInsertPosition) override
Definition: unotext.cxx:1424
virtual void SAL_CALL insertTextContentBefore(const css::uno::Reference< css::text::XTextContent > &xNewContent, const css::uno::Reference< css::text::XTextContent > &xSuccessor) override
Definition: unotext.cxx:624
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: unotext.cxx:503
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unotext.cxx:1114
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL insertTextPortion(const OUString &rText, const css::uno::Sequence< css::beans::PropertyValue > &rCharacterAndParagraphProperties, const css::uno::Reference< css::text::XTextRange > &rTextRange) override
Definition: unotext.cxx:1328