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_UNOPARAGRAPH_HXX 25 #define SW_UNOPARAGRAPH_HXX 26 27 #include <memory> 28 29 #include <com/sun/star/lang/XUnoTunnel.hpp> 30 #include <com/sun/star/lang/XServiceInfo.hpp> 31 #include <com/sun/star/beans/XPropertySet.hpp> 32 #include <com/sun/star/beans/XPropertyState.hpp> 33 #include <com/sun/star/beans/XMultiPropertySet.hpp> 34 #include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> 35 #include <com/sun/star/container/XEnumerationAccess.hpp> 36 #include <com/sun/star/container/XContentEnumerationAccess.hpp> 37 #include <com/sun/star/text/XTextContent.hpp> 38 #include <com/sun/star/text/XTextRange.hpp> 39 40 #include <cppuhelper/implbase10.hxx> 41 42 #include <sfx2/Metadatable.hxx> 43 44 #include <unobaseclass.hxx> 45 46 47 struct SwPosition; 48 class SwPaM; 49 class SwUnoCrsr; 50 class SwStartNode; 51 class SwTxtNode; 52 class SwTable; 53 class SwXText; 54 55 56 /*-----------------07.04.98 08:15------------------- 57 58 --------------------------------------------------*/ 59 typedef ::cppu::ImplInheritanceHelper10 60 < ::sfx2::MetadatableMixin 61 , ::com::sun::star::lang::XUnoTunnel 62 , ::com::sun::star::lang::XServiceInfo 63 , ::com::sun::star::beans::XPropertySet 64 , ::com::sun::star::beans::XPropertyState 65 , ::com::sun::star::beans::XMultiPropertySet 66 , ::com::sun::star::beans::XTolerantMultiPropertySet 67 , ::com::sun::star::container::XEnumerationAccess 68 , ::com::sun::star::container::XContentEnumerationAccess 69 , ::com::sun::star::text::XTextContent 70 , ::com::sun::star::text::XTextRange 71 > SwXParagraph_Base; 72 73 class SwXParagraph 74 : public SwXParagraph_Base 75 { 76 77 private: 78 79 class Impl; 80 ::sw::UnoImplPtr<Impl> m_pImpl; 81 82 virtual ~SwXParagraph(); 83 84 SwXParagraph(::com::sun::star::uno::Reference< 85 ::com::sun::star::text::XText > const & xParent, 86 SwTxtNode & rTxtNode, 87 const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1); 88 89 public: 90 91 /// descriptor 92 SwXParagraph(); 93 94 static ::com::sun::star::uno::Reference< 95 ::com::sun::star::text::XTextContent> 96 CreateXParagraph(SwDoc & rDoc, SwTxtNode& rTxtNode, 97 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> 98 const& xParentText = 0, 99 const sal_Int32 nSelStart = -1, const sal_Int32 nSelEnd = - 1); 100 101 const SwTxtNode * GetTxtNode() const; 102 bool IsDescriptor() const; 103 /// make rPaM select the paragraph 104 bool SelectPaM(SwPaM & rPaM); 105 /// for SwXText 106 void attachToText(SwXText & rParent, SwTxtNode & rTxtNode); 107 108 // MetadatableMixin 109 virtual ::sfx2::Metadatable* GetCoreObject(); 110 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > 111 GetModel(); 112 113 static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); 114 115 // XUnoTunnel 116 virtual sal_Int64 SAL_CALL getSomething( 117 const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier); 118 119 // XServiceInfo 120 virtual ::rtl::OUString SAL_CALL getImplementationName(); 121 virtual sal_Bool SAL_CALL supportsService( 122 const ::rtl::OUString& rServiceName); 123 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 124 getSupportedServiceNames(); 125 126 // XComponent 127 virtual void SAL_CALL dispose(); 128 virtual void SAL_CALL addEventListener( 129 const ::com::sun::star::uno::Reference< 130 ::com::sun::star::lang::XEventListener > & xListener); 131 virtual void SAL_CALL removeEventListener( 132 const ::com::sun::star::uno::Reference< 133 ::com::sun::star::lang::XEventListener > & xListener); 134 135 // XPropertySet 136 virtual ::com::sun::star::uno::Reference< 137 ::com::sun::star::beans::XPropertySetInfo > SAL_CALL 138 getPropertySetInfo(); 139 virtual void SAL_CALL setPropertyValue( 140 const ::rtl::OUString& rPropertyName, 141 const ::com::sun::star::uno::Any& rValue); 142 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( 143 const ::rtl::OUString& rPropertyName); 144 virtual void SAL_CALL addPropertyChangeListener( 145 const ::rtl::OUString& rPropertyName, 146 const ::com::sun::star::uno::Reference< 147 ::com::sun::star::beans::XPropertyChangeListener >& xListener); 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 virtual void SAL_CALL addVetoableChangeListener( 153 const ::rtl::OUString& rPropertyName, 154 const ::com::sun::star::uno::Reference< 155 ::com::sun::star::beans::XVetoableChangeListener >& xListener); 156 virtual void SAL_CALL removeVetoableChangeListener( 157 const ::rtl::OUString& rPropertyName, 158 const ::com::sun::star::uno::Reference< 159 ::com::sun::star::beans::XVetoableChangeListener >& xListener); 160 161 // XPropertyState 162 virtual ::com::sun::star::beans::PropertyState SAL_CALL 163 getPropertyState(const ::rtl::OUString& rPropertyName); 164 virtual ::com::sun::star::uno::Sequence< 165 ::com::sun::star::beans::PropertyState > SAL_CALL 166 getPropertyStates( 167 const ::com::sun::star::uno::Sequence< 168 ::rtl::OUString >& rPropertyNames); 169 virtual void SAL_CALL setPropertyToDefault( 170 const ::rtl::OUString& rPropertyName); 171 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( 172 const ::rtl::OUString& rPropertyName); 173 174 // XMultiPropertySet 175 virtual void SAL_CALL setPropertyValues( 176 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 177 rPropertyNames, 178 const ::com::sun::star::uno::Sequence< 179 ::com::sun::star::uno::Any >& rValues); 180 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > 181 SAL_CALL getPropertyValues( 182 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 183 rPropertyNames); 184 virtual void SAL_CALL addPropertiesChangeListener( 185 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 186 rPropertyNames, 187 const ::com::sun::star::uno::Reference< 188 ::com::sun::star::beans::XPropertiesChangeListener >& xListener); 189 virtual void SAL_CALL removePropertiesChangeListener( 190 const ::com::sun::star::uno::Reference< 191 ::com::sun::star::beans::XPropertiesChangeListener >& xListener); 192 virtual void SAL_CALL firePropertiesChangeEvent( 193 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 194 rPropertyNames, 195 const ::com::sun::star::uno::Reference< 196 ::com::sun::star::beans::XPropertiesChangeListener >& xListener); 197 198 // XTolerantMultiPropertySet 199 virtual ::com::sun::star::uno::Sequence< 200 ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL 201 setPropertyValuesTolerant( 202 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 203 rPropertyNames, 204 const ::com::sun::star::uno::Sequence< 205 ::com::sun::star::uno::Any >& rValues); 206 virtual ::com::sun::star::uno::Sequence< 207 ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL 208 getPropertyValuesTolerant( 209 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 210 rPropertyNames); 211 virtual ::com::sun::star::uno::Sequence< 212 ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL 213 getDirectPropertyValuesTolerant( 214 const ::com::sun::star::uno::Sequence< ::rtl::OUString >& 215 rPropertyNames); 216 217 // XElementAccess 218 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(); 219 virtual sal_Bool SAL_CALL hasElements(); 220 221 // XEnumerationAccess 222 virtual ::com::sun::star::uno::Reference< 223 ::com::sun::star::container::XEnumeration > SAL_CALL 224 createEnumeration(); 225 226 // XContentEnumerationAccess 227 virtual ::com::sun::star::uno::Reference< 228 ::com::sun::star::container::XEnumeration > SAL_CALL 229 createContentEnumeration(const ::rtl::OUString& rServiceName); 230 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 231 getAvailableServiceNames(); 232 233 // XTextContent 234 virtual void SAL_CALL attach( 235 const ::com::sun::star::uno::Reference< 236 ::com::sun::star::text::XTextRange > & xTextRange); 237 virtual ::com::sun::star::uno::Reference< 238 ::com::sun::star::text::XTextRange > SAL_CALL getAnchor(); 239 240 // XTextRange 241 virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > 242 SAL_CALL getText(); 243 virtual ::com::sun::star::uno::Reference< 244 ::com::sun::star::text::XTextRange > SAL_CALL getStart(); 245 virtual ::com::sun::star::uno::Reference< 246 ::com::sun::star::text::XTextRange > SAL_CALL getEnd(); 247 virtual ::rtl::OUString SAL_CALL getString(); 248 virtual void SAL_CALL setString(const ::rtl::OUString& rString); 249 250 }; 251 252 253 /*-----------------07.04.98 08:10------------------- 254 255 --------------------------------------------------*/ 256 class SwXParagraphEnumeration 257 : public SwSimpleEnumeration_Base 258 { 259 260 private: 261 262 class Impl; 263 ::sw::UnoImplPtr<Impl> m_pImpl; 264 265 virtual ~SwXParagraphEnumeration(); 266 267 public: 268 269 /// takes ownership of cursor 270 SwXParagraphEnumeration( 271 ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > 272 const & xParent, 273 ::std::auto_ptr<SwUnoCrsr> pCursor, 274 const CursorType eType, 275 SwStartNode const*const pStartNode = 0, 276 SwTable const*const pTable = 0); 277 278 // XServiceInfo 279 virtual ::rtl::OUString SAL_CALL getImplementationName(); 280 virtual sal_Bool SAL_CALL supportsService( 281 const ::rtl::OUString& rServiceName); 282 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 283 getSupportedServiceNames(); 284 285 // XEnumeration 286 virtual sal_Bool SAL_CALL hasMoreElements(); 287 virtual ::com::sun::star::uno::Any SAL_CALL nextElement(); 288 289 }; 290 291 #endif // SW_UNOPARAGRAPH_HXX 292