xref: /trunk/main/sw/inc/unotext.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_UNOTEXT_HXX
25 #define SW_UNOTEXT_HXX
26 
27 #include <com/sun/star/lang/XUnoTunnel.hpp>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/text/XText.hpp>
30 #include <com/sun/star/text/XTextCopy.hpp>
31 #include <com/sun/star/text/XTextRangeCompare.hpp>
32 #include <com/sun/star/text/XRelativeTextContentInsert.hpp>
33 #include <com/sun/star/text/XRelativeTextContentRemove.hpp>
34 #include <com/sun/star/text/XTextAppendAndConvert.hpp>
35 
36 #include <unobaseclass.hxx>
37 
38 
39 namespace com { namespace sun { namespace star {
40     namespace text {
41         class XTextContent;
42     }
43 } } }
44 
45 class SfxItemPropertySet;
46 class SwDoc;
47 class SwStartNode;
48 class SwPaM;
49 class OTextCursorHelper;
50 class SwXTextRange;
51 
52 
53 /* -----------------03.12.98 12:22-------------------
54  *
55  * --------------------------------------------------*/
56 
57 class SwXText
58     : public ::com::sun::star::lang::XTypeProvider
59     , public ::com::sun::star::lang::XUnoTunnel
60     , public ::com::sun::star::beans::XPropertySet
61     , public ::com::sun::star::text::XTextAppendAndConvert
62     , public ::com::sun::star::text::XTextCopy
63     , public ::com::sun::star::text::XTextRangeCompare
64     , public ::com::sun::star::text::XRelativeTextContentInsert
65     , public ::com::sun::star::text::XRelativeTextContentRemove
66 {
67 
68 private:
69 
70     class Impl;
71     ::sw::UnoImplPtr<Impl> m_pImpl;
72 
73     virtual void PrepareForAttach(
74             ::com::sun::star::uno::Reference<
75                 ::com::sun::star::text::XTextRange > & xRange,
76             SwPaM const & rPam);
77     virtual bool CheckForOwnMemberMeta(
78             const SwPaM & rPam, const bool bAbsorb);
79 
80 protected:
81 
82     bool            IsValid() const;
83     void            Invalidate();
84     void            SetDoc(SwDoc *const pDoc);
85 
86     virtual ~SwXText();
87 
88 public: /*not protected because C++ is retarded*/
89     virtual const SwStartNode *GetStartNode() const;
90 
91 public:
92 
93     SwXText(SwDoc *const pDoc, const enum CursorType eType);
94 
95     const SwDoc*    GetDoc() const;
96           SwDoc*    GetDoc();
97 
98     virtual ::com::sun::star::uno::Reference<
99                 ::com::sun::star::text::XTextCursor >
100         CreateCursor();
101 
102 
103     // XInterface
104     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
105             const ::com::sun::star::uno::Type& rType);
106 
107     // XTypeProvider
108     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
109         SAL_CALL getTypes();
110 
111     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
112 
113     // XUnoTunnel
114     virtual sal_Int64 SAL_CALL getSomething(
115             const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier);
116 
117     // XPropertySet
118     virtual ::com::sun::star::uno::Reference<
119                 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
120         getPropertySetInfo();
121     virtual void SAL_CALL setPropertyValue(
122             const ::rtl::OUString& rPropertyName,
123             const ::com::sun::star::uno::Any& rValue);
124     virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
125             const ::rtl::OUString& rPropertyName);
126     virtual void SAL_CALL addPropertyChangeListener(
127             const ::rtl::OUString& rPropertyName,
128             const ::com::sun::star::uno::Reference<
129                 ::com::sun::star::beans::XPropertyChangeListener >& xListener);
130     virtual void SAL_CALL removePropertyChangeListener(
131             const ::rtl::OUString& rPropertyName,
132             const ::com::sun::star::uno::Reference<
133                 ::com::sun::star::beans::XPropertyChangeListener >& xListener);
134     virtual void SAL_CALL addVetoableChangeListener(
135             const ::rtl::OUString& rPropertyName,
136             const ::com::sun::star::uno::Reference<
137                 ::com::sun::star::beans::XVetoableChangeListener >& xListener);
138     virtual void SAL_CALL removeVetoableChangeListener(
139             const ::rtl::OUString& rPropertyName,
140             const ::com::sun::star::uno::Reference<
141                 ::com::sun::star::beans::XVetoableChangeListener >& xListener);
142 
143     // XTextRange
144     virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
145         SAL_CALL getText();
146     virtual ::com::sun::star::uno::Reference<
147                 ::com::sun::star::text::XTextRange > SAL_CALL getStart();
148     virtual ::com::sun::star::uno::Reference<
149                 ::com::sun::star::text::XTextRange > SAL_CALL getEnd();
150     virtual ::rtl::OUString SAL_CALL getString();
151     virtual void SAL_CALL setString(const ::rtl::OUString& rString);
152 
153     // XSimpleText
154     virtual void SAL_CALL insertString(
155             const ::com::sun::star::uno::Reference<
156                 ::com::sun::star::text::XTextRange > & xRange,
157             const ::rtl::OUString& aString, sal_Bool bAbsorb);
158     virtual void SAL_CALL insertControlCharacter(
159             const ::com::sun::star::uno::Reference<
160                 ::com::sun::star::text::XTextRange > & xRange,
161             sal_Int16 nControlCharacter, sal_Bool bAbsorb);
162 
163     // XText
164     virtual void SAL_CALL insertTextContent(
165             const ::com::sun::star::uno::Reference<
166                 ::com::sun::star::text::XTextRange > & xRange,
167             const ::com::sun::star::uno::Reference<
168                 ::com::sun::star::text::XTextContent > & xContent,
169             sal_Bool bAbsorb);
170     virtual void SAL_CALL removeTextContent(
171             const ::com::sun::star::uno::Reference<
172                 ::com::sun::star::text::XTextContent > & xContent);
173 
174     // XParagraphAppend
175     virtual ::com::sun::star::uno::Reference<
176                 ::com::sun::star::text::XTextRange > SAL_CALL
177         appendParagraph(
178             const ::com::sun::star::uno::Sequence<
179                     ::com::sun::star::beans::PropertyValue >&
180                 rCharacterAndParagraphProperties);
181     virtual ::com::sun::star::uno::Reference<
182                 ::com::sun::star::text::XTextRange > SAL_CALL
183         finishParagraph(
184             const ::com::sun::star::uno::Sequence<
185                     ::com::sun::star::beans::PropertyValue >&
186                 rCharacterAndParagraphProperties);
187 
188     // XTextPortionAppend
189     virtual ::com::sun::star::uno::Reference<
190                 ::com::sun::star::text::XTextRange > SAL_CALL
191         appendTextPortion(
192             const ::rtl::OUString& rText,
193             const ::com::sun::star::uno::Sequence<
194                     ::com::sun::star::beans::PropertyValue >&
195                 rCharacterAndParagraphProperties);
196 
197     // XTextContentAppend
198     virtual ::com::sun::star::uno::Reference<
199                 ::com::sun::star::text::XTextRange > SAL_CALL
200         appendTextContent(
201             const ::com::sun::star::uno::Reference<
202                 ::com::sun::star::text::XTextContent >& xTextContent,
203             const ::com::sun::star::uno::Sequence<
204                     ::com::sun::star::beans::PropertyValue >&
205                 rCharacterAndParagraphProperties);
206 
207     // XTextConvert
208     virtual ::com::sun::star::uno::Reference<
209                 ::com::sun::star::text::XTextContent > SAL_CALL
210         convertToTextFrame(
211             const ::com::sun::star::uno::Reference<
212                 ::com::sun::star::text::XTextRange >& xStart,
213             const ::com::sun::star::uno::Reference<
214                 ::com::sun::star::text::XTextRange >& xEnd,
215             const ::com::sun::star::uno::Sequence<
216                 ::com::sun::star::beans::PropertyValue >& xFrameProperties);
217     virtual ::com::sun::star::uno::Reference<
218                 ::com::sun::star::text::XTextTable > SAL_CALL
219         convertToTable(
220             ::com::sun::star::uno::Sequence<
221                 ::com::sun::star::uno::Sequence<
222                     ::com::sun::star::uno::Sequence<
223                         ::com::sun::star::uno::Reference<
224                             ::com::sun::star::text::XTextRange > > > > const&
225                 rTableRanges,
226            ::com::sun::star::uno::Sequence<
227                 ::com::sun::star::uno::Sequence<
228                     ::com::sun::star::uno::Sequence<
229                         ::com::sun::star::beans::PropertyValue > > > const&
230                 rCellProperties,
231            ::com::sun::star::uno::Sequence<
232                 ::com::sun::star::uno::Sequence<
233                     ::com::sun::star::beans::PropertyValue > > const&
234                 rRowProperties,
235            ::com::sun::star::uno::Sequence<
236                 ::com::sun::star::beans::PropertyValue > const&
237                 rTableProperties);
238 
239     // XTextCopy
240     virtual void SAL_CALL copyText(
241             const ::com::sun::star::uno::Reference<
242                 ::com::sun::star::text::XTextCopy >& xSource );
243 
244     // XTextRangeCompare
245     sal_Int16 SAL_CALL compareRegionStarts(
246             const ::com::sun::star::uno::Reference<
247                 ::com::sun::star::text::XTextRange >& xR1,
248             const ::com::sun::star::uno::Reference<
249                 ::com::sun::star::text::XTextRange >& xR2);
250     sal_Int16 SAL_CALL compareRegionEnds(
251             const ::com::sun::star::uno::Reference<
252                 ::com::sun::star::text::XTextRange >& xR1,
253             const ::com::sun::star::uno::Reference<
254                 ::com::sun::star::text::XTextRange >& xR2);
255 
256     // XRelativeTextContentInsert
257     virtual void SAL_CALL insertTextContentBefore(
258             const ::com::sun::star::uno::Reference<
259                 ::com::sun::star::text::XTextContent>& xNewContent,
260             const ::com::sun::star::uno::Reference<
261                 ::com::sun::star::text::XTextContent>& xSuccessor);
262     virtual void SAL_CALL insertTextContentAfter(
263             const ::com::sun::star::uno::Reference<
264                 ::com::sun::star::text::XTextContent>& xNewContent,
265             const ::com::sun::star::uno::Reference<
266                 ::com::sun::star::text::XTextContent>& xPredecessor);
267 
268     // XRelativeTextContentRemove
269     virtual void SAL_CALL removeTextContentBefore(
270             const ::com::sun::star::uno::Reference<
271                 ::com::sun::star::text::XTextContent>& xSuccessor);
272     virtual void SAL_CALL removeTextContentAfter(
273             const ::com::sun::star::uno::Reference<
274                 ::com::sun::star::text::XTextContent>& xPredecessor);
275 };
276 
277 #endif // SW_UNOTEXT_HXX
278