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 throw (::com::sun::star::lang::IllegalArgumentException, 80 ::com::sun::star::uno::RuntimeException); 81 82 protected: 83 84 bool IsValid() const; 85 void Invalidate(); 86 void SetDoc(SwDoc *const pDoc); 87 88 virtual ~SwXText(); 89 90 public: /*not protected because C++ is retarded*/ 91 virtual const SwStartNode *GetStartNode() const; 92 93 public: 94 95 SwXText(SwDoc *const pDoc, const enum CursorType eType); 96 97 const SwDoc* GetDoc() const; 98 SwDoc* GetDoc(); 99 100 virtual ::com::sun::star::uno::Reference< 101 ::com::sun::star::text::XTextCursor > 102 CreateCursor() 103 throw (::com::sun::star::uno::RuntimeException); 104 105 106 // XInterface 107 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 108 const ::com::sun::star::uno::Type& rType) 109 throw (::com::sun::star::uno::RuntimeException); 110 111 // XTypeProvider 112 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > 113 SAL_CALL getTypes() 114 throw (::com::sun::star::uno::RuntimeException); 115 116 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 117 118 // XUnoTunnel 119 virtual sal_Int64 SAL_CALL getSomething( 120 const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier) 121 throw (::com::sun::star::uno::RuntimeException); 122 123 // XPropertySet 124 virtual ::com::sun::star::uno::Reference< 125 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 126 getPropertySetInfo() 127 throw (::com::sun::star::uno::RuntimeException); 128 virtual void SAL_CALL setPropertyValue( 129 const ::rtl::OUString& rPropertyName, 130 const ::com::sun::star::uno::Any& rValue) 131 throw (::com::sun::star::beans::UnknownPropertyException, 132 ::com::sun::star::beans::PropertyVetoException, 133 ::com::sun::star::lang::IllegalArgumentException, 134 ::com::sun::star::lang::WrappedTargetException, 135 ::com::sun::star::uno::RuntimeException); 136 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 137 const ::rtl::OUString& rPropertyName) 138 throw (::com::sun::star::beans::UnknownPropertyException, 139 ::com::sun::star::lang::WrappedTargetException, 140 ::com::sun::star::uno::RuntimeException); 141 virtual void SAL_CALL addPropertyChangeListener( 142 const ::rtl::OUString& rPropertyName, 143 const ::com::sun::star::uno::Reference< 144 ::com::sun::star::beans::XPropertyChangeListener >& xListener) 145 throw (::com::sun::star::beans::UnknownPropertyException, 146 ::com::sun::star::lang::WrappedTargetException, 147 ::com::sun::star::uno::RuntimeException); 148 virtual void SAL_CALL removePropertyChangeListener( 149 const ::rtl::OUString& rPropertyName, 150 const ::com::sun::star::uno::Reference< 151 ::com::sun::star::beans::XPropertyChangeListener >& xListener) 152 throw (::com::sun::star::beans::UnknownPropertyException, 153 ::com::sun::star::lang::WrappedTargetException, 154 ::com::sun::star::uno::RuntimeException); 155 virtual void SAL_CALL addVetoableChangeListener( 156 const ::rtl::OUString& rPropertyName, 157 const ::com::sun::star::uno::Reference< 158 ::com::sun::star::beans::XVetoableChangeListener >& xListener) 159 throw (::com::sun::star::beans::UnknownPropertyException, 160 ::com::sun::star::lang::WrappedTargetException, 161 ::com::sun::star::uno::RuntimeException); 162 virtual void SAL_CALL removeVetoableChangeListener( 163 const ::rtl::OUString& rPropertyName, 164 const ::com::sun::star::uno::Reference< 165 ::com::sun::star::beans::XVetoableChangeListener >& xListener) 166 throw (::com::sun::star::beans::UnknownPropertyException, 167 ::com::sun::star::lang::WrappedTargetException, 168 ::com::sun::star::uno::RuntimeException); 169 170 // XTextRange 171 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > 172 SAL_CALL getText() 173 throw (::com::sun::star::uno::RuntimeException); 174 virtual ::com::sun::star::uno::Reference< 175 ::com::sun::star::text::XTextRange > SAL_CALL getStart() 176 throw (::com::sun::star::uno::RuntimeException); 177 virtual ::com::sun::star::uno::Reference< 178 ::com::sun::star::text::XTextRange > SAL_CALL getEnd() 179 throw (::com::sun::star::uno::RuntimeException); 180 virtual ::rtl::OUString SAL_CALL getString() 181 throw (::com::sun::star::uno::RuntimeException); 182 virtual void SAL_CALL setString(const ::rtl::OUString& rString) 183 throw (::com::sun::star::uno::RuntimeException); 184 185 // XSimpleText 186 virtual void SAL_CALL insertString( 187 const ::com::sun::star::uno::Reference< 188 ::com::sun::star::text::XTextRange > & xRange, 189 const ::rtl::OUString& aString, sal_Bool bAbsorb) 190 throw (::com::sun::star::uno::RuntimeException); 191 virtual void SAL_CALL insertControlCharacter( 192 const ::com::sun::star::uno::Reference< 193 ::com::sun::star::text::XTextRange > & xRange, 194 sal_Int16 nControlCharacter, sal_Bool bAbsorb) 195 throw (::com::sun::star::lang::IllegalArgumentException, 196 ::com::sun::star::uno::RuntimeException); 197 198 // XText 199 virtual void SAL_CALL insertTextContent( 200 const ::com::sun::star::uno::Reference< 201 ::com::sun::star::text::XTextRange > & xRange, 202 const ::com::sun::star::uno::Reference< 203 ::com::sun::star::text::XTextContent > & xContent, 204 sal_Bool bAbsorb) 205 throw (::com::sun::star::lang::IllegalArgumentException, 206 ::com::sun::star::uno::RuntimeException); 207 virtual void SAL_CALL removeTextContent( 208 const ::com::sun::star::uno::Reference< 209 ::com::sun::star::text::XTextContent > & xContent) 210 throw (::com::sun::star::container::NoSuchElementException, 211 ::com::sun::star::uno::RuntimeException); 212 213 // XParagraphAppend 214 virtual ::com::sun::star::uno::Reference< 215 ::com::sun::star::text::XTextRange > SAL_CALL 216 appendParagraph( 217 const ::com::sun::star::uno::Sequence< 218 ::com::sun::star::beans::PropertyValue >& 219 rCharacterAndParagraphProperties) 220 throw (::com::sun::star::lang::IllegalArgumentException, 221 ::com::sun::star::uno::RuntimeException); 222 virtual ::com::sun::star::uno::Reference< 223 ::com::sun::star::text::XTextRange > SAL_CALL 224 finishParagraph( 225 const ::com::sun::star::uno::Sequence< 226 ::com::sun::star::beans::PropertyValue >& 227 rCharacterAndParagraphProperties) 228 throw (::com::sun::star::lang::IllegalArgumentException, 229 ::com::sun::star::uno::RuntimeException); 230 231 // XTextPortionAppend 232 virtual ::com::sun::star::uno::Reference< 233 ::com::sun::star::text::XTextRange > SAL_CALL 234 appendTextPortion( 235 const ::rtl::OUString& rText, 236 const ::com::sun::star::uno::Sequence< 237 ::com::sun::star::beans::PropertyValue >& 238 rCharacterAndParagraphProperties) 239 throw (::com::sun::star::lang::IllegalArgumentException, 240 ::com::sun::star::uno::RuntimeException); 241 242 // XTextContentAppend 243 virtual ::com::sun::star::uno::Reference< 244 ::com::sun::star::text::XTextRange > SAL_CALL 245 appendTextContent( 246 const ::com::sun::star::uno::Reference< 247 ::com::sun::star::text::XTextContent >& xTextContent, 248 const ::com::sun::star::uno::Sequence< 249 ::com::sun::star::beans::PropertyValue >& 250 rCharacterAndParagraphProperties) 251 throw (::com::sun::star::lang::IllegalArgumentException, 252 ::com::sun::star::uno::RuntimeException); 253 254 // XTextConvert 255 virtual ::com::sun::star::uno::Reference< 256 ::com::sun::star::text::XTextContent > SAL_CALL 257 convertToTextFrame( 258 const ::com::sun::star::uno::Reference< 259 ::com::sun::star::text::XTextRange >& xStart, 260 const ::com::sun::star::uno::Reference< 261 ::com::sun::star::text::XTextRange >& xEnd, 262 const ::com::sun::star::uno::Sequence< 263 ::com::sun::star::beans::PropertyValue >& xFrameProperties) 264 throw (::com::sun::star::lang::IllegalArgumentException, 265 ::com::sun::star::uno::RuntimeException); 266 virtual ::com::sun::star::uno::Reference< 267 ::com::sun::star::text::XTextTable > SAL_CALL 268 convertToTable( 269 ::com::sun::star::uno::Sequence< 270 ::com::sun::star::uno::Sequence< 271 ::com::sun::star::uno::Sequence< 272 ::com::sun::star::uno::Reference< 273 ::com::sun::star::text::XTextRange > > > > const& 274 rTableRanges, 275 ::com::sun::star::uno::Sequence< 276 ::com::sun::star::uno::Sequence< 277 ::com::sun::star::uno::Sequence< 278 ::com::sun::star::beans::PropertyValue > > > const& 279 rCellProperties, 280 ::com::sun::star::uno::Sequence< 281 ::com::sun::star::uno::Sequence< 282 ::com::sun::star::beans::PropertyValue > > const& 283 rRowProperties, 284 ::com::sun::star::uno::Sequence< 285 ::com::sun::star::beans::PropertyValue > const& 286 rTableProperties) 287 throw (::com::sun::star::lang::IllegalArgumentException, 288 ::com::sun::star::uno::RuntimeException); 289 290 // XTextCopy 291 virtual void SAL_CALL copyText( 292 const ::com::sun::star::uno::Reference< 293 ::com::sun::star::text::XTextCopy >& xSource ) 294 throw (::com::sun::star::uno::RuntimeException); 295 296 // XTextRangeCompare 297 sal_Int16 SAL_CALL compareRegionStarts( 298 const ::com::sun::star::uno::Reference< 299 ::com::sun::star::text::XTextRange >& xR1, 300 const ::com::sun::star::uno::Reference< 301 ::com::sun::star::text::XTextRange >& xR2) 302 throw (::com::sun::star::lang::IllegalArgumentException, 303 ::com::sun::star::uno::RuntimeException); 304 sal_Int16 SAL_CALL compareRegionEnds( 305 const ::com::sun::star::uno::Reference< 306 ::com::sun::star::text::XTextRange >& xR1, 307 const ::com::sun::star::uno::Reference< 308 ::com::sun::star::text::XTextRange >& xR2) 309 throw (::com::sun::star::lang::IllegalArgumentException, 310 ::com::sun::star::uno::RuntimeException); 311 312 // XRelativeTextContentInsert 313 virtual void SAL_CALL insertTextContentBefore( 314 const ::com::sun::star::uno::Reference< 315 ::com::sun::star::text::XTextContent>& xNewContent, 316 const ::com::sun::star::uno::Reference< 317 ::com::sun::star::text::XTextContent>& xSuccessor) 318 throw (::com::sun::star::lang::IllegalArgumentException, 319 ::com::sun::star::uno::RuntimeException); 320 virtual void SAL_CALL insertTextContentAfter( 321 const ::com::sun::star::uno::Reference< 322 ::com::sun::star::text::XTextContent>& xNewContent, 323 const ::com::sun::star::uno::Reference< 324 ::com::sun::star::text::XTextContent>& xPredecessor) 325 throw (::com::sun::star::lang::IllegalArgumentException, 326 ::com::sun::star::uno::RuntimeException); 327 328 // XRelativeTextContentRemove 329 virtual void SAL_CALL removeTextContentBefore( 330 const ::com::sun::star::uno::Reference< 331 ::com::sun::star::text::XTextContent>& xSuccessor) 332 throw (::com::sun::star::lang::IllegalArgumentException, 333 ::com::sun::star::uno::RuntimeException); 334 virtual void SAL_CALL removeTextContentAfter( 335 const ::com::sun::star::uno::Reference< 336 ::com::sun::star::text::XTextContent>& xPredecessor) 337 throw (::com::sun::star::lang::IllegalArgumentException, 338 ::com::sun::star::uno::RuntimeException); 339 }; 340 341 #endif // SW_UNOTEXT_HXX 342 343