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_UNOTEXTCURSOR_HXX 25 #define SW_UNOTEXTCURSOR_HXX 26 27 #include <com/sun/star/lang/XUnoTunnel.hpp> 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/beans/XPropertySet.hpp> 30 #include <com/sun/star/beans/XPropertyState.hpp> 31 #include <com/sun/star/beans/XMultiPropertyStates.hpp> 32 #include <com/sun/star/container/XEnumerationAccess.hpp> 33 #include <com/sun/star/container/XContentEnumerationAccess.hpp> 34 #include <com/sun/star/util/XSortable.hpp> 35 #include <com/sun/star/document/XDocumentInsertable.hpp> 36 #include <com/sun/star/text/XSentenceCursor.hpp> 37 #include <com/sun/star/text/XWordCursor.hpp> 38 #include <com/sun/star/text/XParagraphCursor.hpp> 39 #include <com/sun/star/text/XRedline.hpp> 40 #include <com/sun/star/text/XMarkingAccess.hpp> 41 42 #include <cppuhelper/implbase12.hxx> 43 44 #include <comphelper/uno3.hxx> 45 46 #if ! defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13) 47 #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13 48 #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13 49 #include <comphelper/implbase_var.hxx> 50 #endif 51 52 #include <unobaseclass.hxx> 53 #include <TextCursorHelper.hxx> 54 55 56 class SwDoc; 57 struct SwPosition; 58 class SwUnoCrsr; 59 60 typedef ::comphelper::WeakImplHelper13 61 < ::com::sun::star::lang::XServiceInfo 62 , ::com::sun::star::beans::XPropertySet 63 , ::com::sun::star::beans::XPropertyState 64 , ::com::sun::star::beans::XMultiPropertyStates 65 , ::com::sun::star::container::XEnumerationAccess 66 , ::com::sun::star::container::XContentEnumerationAccess 67 , ::com::sun::star::util::XSortable 68 , ::com::sun::star::document::XDocumentInsertable 69 , ::com::sun::star::text::XSentenceCursor 70 , ::com::sun::star::text::XWordCursor 71 , ::com::sun::star::text::XParagraphCursor 72 , ::com::sun::star::text::XRedline 73 , ::com::sun::star::text::XMarkingAccess 74 > SwXTextCursor_Base; 75 76 class SwXTextCursor 77 : public SwXTextCursor_Base 78 , public OTextCursorHelper 79 { 80 81 private: 82 83 class Impl; 84 ::sw::UnoImplPtr<Impl> m_pImpl; 85 86 virtual ~SwXTextCursor(); 87 88 public: 89 90 SwXTextCursor( 91 SwDoc & rDoc, 92 ::com::sun::star::uno::Reference< 93 ::com::sun::star::text::XText > const& xParent, 94 const enum CursorType eType, 95 SwPosition const& rPos, 96 SwPosition const*const pMark = 0); 97 SwXTextCursor( 98 ::com::sun::star::uno::Reference< 99 ::com::sun::star::text::XText > const& xParent, 100 SwPaM const& rSourceCursor, 101 const enum CursorType eType = CURSOR_ALL); 102 103 SwUnoCrsr * GetCursor(); 104 const SwUnoCrsr * GetCursor() const; 105 106 bool IsAtEndOfMeta() const; 107 108 void DeleteAndInsert(::rtl::OUString const& rText, 109 const bool bForceExpandHints); 110 111 // OTextCursorHelper 112 virtual const SwPaM* GetPaM() const; 113 virtual SwPaM* GetPaM(); 114 virtual const SwDoc* GetDoc() const; 115 virtual SwDoc* GetDoc(); 116 117 DECLARE_XINTERFACE() 118 119 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 120 121 // XUnoTunnel 122 virtual sal_Int64 SAL_CALL getSomething( 123 const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier) 124 throw (::com::sun::star::uno::RuntimeException); 125 126 // XServiceInfo 127 virtual ::rtl::OUString SAL_CALL getImplementationName() 128 throw (::com::sun::star::uno::RuntimeException); 129 virtual sal_Bool SAL_CALL supportsService( 130 const ::rtl::OUString& rServiceName) 131 throw (::com::sun::star::uno::RuntimeException); 132 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 133 getSupportedServiceNames() 134 throw (::com::sun::star::uno::RuntimeException); 135 136 // XPropertySet 137 virtual ::com::sun::star::uno::Reference< 138 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 139 getPropertySetInfo() 140 throw (::com::sun::star::uno::RuntimeException); 141 virtual void SAL_CALL setPropertyValue( 142 const ::rtl::OUString& rPropertyName, 143 const ::com::sun::star::uno::Any& rValue) 144 throw (::com::sun::star::beans::UnknownPropertyException, 145 ::com::sun::star::beans::PropertyVetoException, 146 ::com::sun::star::lang::IllegalArgumentException, 147 ::com::sun::star::lang::WrappedTargetException, 148 ::com::sun::star::uno::RuntimeException); 149 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 150 const ::rtl::OUString& rPropertyName) 151 throw (::com::sun::star::beans::UnknownPropertyException, 152 ::com::sun::star::lang::WrappedTargetException, 153 ::com::sun::star::uno::RuntimeException); 154 virtual void SAL_CALL addPropertyChangeListener( 155 const ::rtl::OUString& rPropertyName, 156 const ::com::sun::star::uno::Reference< 157 ::com::sun::star::beans::XPropertyChangeListener >& xListener) 158 throw (::com::sun::star::beans::UnknownPropertyException, 159 ::com::sun::star::lang::WrappedTargetException, 160 ::com::sun::star::uno::RuntimeException); 161 virtual void SAL_CALL removePropertyChangeListener( 162 const ::rtl::OUString& rPropertyName, 163 const ::com::sun::star::uno::Reference< 164 ::com::sun::star::beans::XPropertyChangeListener >& xListener) 165 throw (::com::sun::star::beans::UnknownPropertyException, 166 ::com::sun::star::lang::WrappedTargetException, 167 ::com::sun::star::uno::RuntimeException); 168 virtual void SAL_CALL addVetoableChangeListener( 169 const ::rtl::OUString& rPropertyName, 170 const ::com::sun::star::uno::Reference< 171 ::com::sun::star::beans::XVetoableChangeListener >& xListener) 172 throw (::com::sun::star::beans::UnknownPropertyException, 173 ::com::sun::star::lang::WrappedTargetException, 174 ::com::sun::star::uno::RuntimeException); 175 virtual void SAL_CALL removeVetoableChangeListener( 176 const ::rtl::OUString& rPropertyName, 177 const ::com::sun::star::uno::Reference< 178 ::com::sun::star::beans::XVetoableChangeListener >& xListener) 179 throw (::com::sun::star::beans::UnknownPropertyException, 180 ::com::sun::star::lang::WrappedTargetException, 181 ::com::sun::star::uno::RuntimeException); 182 183 // XPropertyState 184 virtual ::com::sun::star::beans::PropertyState SAL_CALL 185 getPropertyState(const ::rtl::OUString& rPropertyName) 186 throw (::com::sun::star::beans::UnknownPropertyException, 187 ::com::sun::star::uno::RuntimeException); 188 virtual ::com::sun::star::uno::Sequence< 189 ::com::sun::star::beans::PropertyState > SAL_CALL 190 getPropertyStates( 191 const ::com::sun::star::uno::Sequence< 192 ::rtl::OUString >& rPropertyNames) 193 throw (::com::sun::star::beans::UnknownPropertyException, 194 ::com::sun::star::uno::RuntimeException); 195 virtual void SAL_CALL setPropertyToDefault( 196 const ::rtl::OUString& rPropertyName) 197 throw (::com::sun::star::beans::UnknownPropertyException, 198 ::com::sun::star::uno::RuntimeException); 199 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( 200 const ::rtl::OUString& rPropertyName) 201 throw (::com::sun::star::beans::UnknownPropertyException, 202 ::com::sun::star::lang::WrappedTargetException, 203 ::com::sun::star::uno::RuntimeException); 204 205 // XMultiPropertyStates 206 virtual void SAL_CALL setAllPropertiesToDefault() 207 throw (::com::sun::star::uno::RuntimeException); 208 virtual void SAL_CALL setPropertiesToDefault( 209 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 210 rPropertyNames) 211 throw (::com::sun::star::beans::UnknownPropertyException, 212 ::com::sun::star::uno::RuntimeException); 213 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 214 SAL_CALL getPropertyDefaults( 215 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 216 rPropertyNames) 217 throw (::com::sun::star::beans::UnknownPropertyException, 218 ::com::sun::star::lang::WrappedTargetException, 219 ::com::sun::star::uno::RuntimeException); 220 221 // XElementAccess 222 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() 223 throw (::com::sun::star::uno::RuntimeException); 224 virtual sal_Bool SAL_CALL hasElements() 225 throw (::com::sun::star::uno::RuntimeException); 226 227 // XEnumerationAccess 228 virtual ::com::sun::star::uno::Reference< 229 ::com::sun::star::container::XEnumeration > SAL_CALL 230 createEnumeration() 231 throw (::com::sun::star::uno::RuntimeException); 232 233 // XContentEnumerationAccess 234 virtual ::com::sun::star::uno::Reference< 235 ::com::sun::star::container::XEnumeration > SAL_CALL 236 createContentEnumeration(const ::rtl::OUString& rServiceName) 237 throw (::com::sun::star::uno::RuntimeException); 238 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 239 getAvailableServiceNames() 240 throw (::com::sun::star::uno::RuntimeException); 241 242 // XSortable 243 virtual ::com::sun::star::uno::Sequence< 244 ::com::sun::star::beans::PropertyValue > SAL_CALL 245 createSortDescriptor() 246 throw (::com::sun::star::uno::RuntimeException); 247 virtual void SAL_CALL sort( 248 const ::com::sun::star::uno::Sequence< 249 ::com::sun::star::beans::PropertyValue >& xDescriptor) 250 throw (::com::sun::star::uno::RuntimeException); 251 252 // XDocumentInsertable 253 virtual void SAL_CALL insertDocumentFromURL( 254 const ::rtl::OUString& rURL, 255 const ::com::sun::star::uno::Sequence< 256 ::com::sun::star::beans::PropertyValue >& rOptions) 257 throw (::com::sun::star::lang::IllegalArgumentException, 258 ::com::sun::star::io::IOException, 259 ::com::sun::star::uno::RuntimeException); 260 261 // XTextRange 262 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > 263 SAL_CALL getText() 264 throw (::com::sun::star::uno::RuntimeException); 265 virtual ::com::sun::star::uno::Reference< 266 ::com::sun::star::text::XTextRange > SAL_CALL getStart() 267 throw (::com::sun::star::uno::RuntimeException); 268 virtual ::com::sun::star::uno::Reference< 269 ::com::sun::star::text::XTextRange > SAL_CALL getEnd() 270 throw (::com::sun::star::uno::RuntimeException); 271 virtual ::rtl::OUString SAL_CALL getString() 272 throw (::com::sun::star::uno::RuntimeException); 273 virtual void SAL_CALL setString(const ::rtl::OUString& rString) 274 throw (::com::sun::star::uno::RuntimeException); 275 276 // XTextCursor 277 virtual void SAL_CALL collapseToStart() 278 throw (::com::sun::star::uno::RuntimeException); 279 virtual void SAL_CALL collapseToEnd() 280 throw (::com::sun::star::uno::RuntimeException); 281 virtual sal_Bool SAL_CALL isCollapsed() 282 throw (::com::sun::star::uno::RuntimeException); 283 virtual sal_Bool SAL_CALL goLeft(sal_Int16 nCount, sal_Bool bExpand) 284 throw (::com::sun::star::uno::RuntimeException); 285 virtual sal_Bool SAL_CALL goRight(sal_Int16 nCount, sal_Bool bExpand) 286 throw (::com::sun::star::uno::RuntimeException); 287 virtual void SAL_CALL gotoStart(sal_Bool bExpand) 288 throw (::com::sun::star::uno::RuntimeException); 289 virtual void SAL_CALL gotoEnd(sal_Bool bExpand) 290 throw (::com::sun::star::uno::RuntimeException); 291 virtual void SAL_CALL gotoRange( 292 const ::com::sun::star::uno::Reference< 293 ::com::sun::star::text::XTextRange >& xRange, 294 sal_Bool bExpand) 295 throw (::com::sun::star::uno::RuntimeException); 296 297 // XWordCursor 298 virtual sal_Bool SAL_CALL isStartOfWord() 299 throw (::com::sun::star::uno::RuntimeException); 300 virtual sal_Bool SAL_CALL isEndOfWord() 301 throw (::com::sun::star::uno::RuntimeException); 302 virtual sal_Bool SAL_CALL gotoNextWord(sal_Bool bExpand) 303 throw (::com::sun::star::uno::RuntimeException); 304 virtual sal_Bool SAL_CALL gotoPreviousWord(sal_Bool bExpand) 305 throw (::com::sun::star::uno::RuntimeException); 306 virtual sal_Bool SAL_CALL gotoEndOfWord(sal_Bool bExpand) 307 throw (::com::sun::star::uno::RuntimeException); 308 virtual sal_Bool SAL_CALL gotoStartOfWord(sal_Bool bExpand) 309 throw (::com::sun::star::uno::RuntimeException); 310 311 // XSentenceCursor 312 virtual sal_Bool SAL_CALL isStartOfSentence() 313 throw (::com::sun::star::uno::RuntimeException); 314 virtual sal_Bool SAL_CALL isEndOfSentence() 315 throw (::com::sun::star::uno::RuntimeException); 316 virtual sal_Bool SAL_CALL gotoNextSentence(sal_Bool Expand) 317 throw (::com::sun::star::uno::RuntimeException); 318 virtual sal_Bool SAL_CALL gotoPreviousSentence(sal_Bool Expand) 319 throw (::com::sun::star::uno::RuntimeException); 320 virtual sal_Bool SAL_CALL gotoStartOfSentence(sal_Bool Expand) 321 throw (::com::sun::star::uno::RuntimeException); 322 virtual sal_Bool SAL_CALL gotoEndOfSentence(sal_Bool Expand) 323 throw (::com::sun::star::uno::RuntimeException); 324 325 // XParagraphCursor 326 virtual sal_Bool SAL_CALL isStartOfParagraph() 327 throw (::com::sun::star::uno::RuntimeException); 328 virtual sal_Bool SAL_CALL isEndOfParagraph() 329 throw (::com::sun::star::uno::RuntimeException); 330 virtual sal_Bool SAL_CALL gotoStartOfParagraph(sal_Bool Expand) 331 throw (::com::sun::star::uno::RuntimeException); 332 virtual sal_Bool SAL_CALL gotoEndOfParagraph(sal_Bool Expand) 333 throw (::com::sun::star::uno::RuntimeException); 334 virtual sal_Bool SAL_CALL gotoNextParagraph(sal_Bool Expand) 335 throw (::com::sun::star::uno::RuntimeException); 336 virtual sal_Bool SAL_CALL gotoPreviousParagraph(sal_Bool Expand) 337 throw (::com::sun::star::uno::RuntimeException); 338 339 // XRedline 340 virtual void SAL_CALL makeRedline( 341 const ::rtl::OUString& rRedlineType, 342 const ::com::sun::star::uno::Sequence< 343 ::com::sun::star::beans::PropertyValue >& RedlineProperties) 344 throw (::com::sun::star::lang::IllegalArgumentException, 345 ::com::sun::star::uno::RuntimeException); 346 347 //XMarkingAccess 348 virtual void SAL_CALL invalidateMarkings(::sal_Int32 nType) 349 throw (::com::sun::star::uno::RuntimeException); 350 351 }; 352 353 #endif // SW_UNOTEXTCURSOR_HXX 354 355