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_UNOTEXTBODYHF_HXX 25 #define SW_UNOTEXTBODYHF_HXX 26 27 #include <com/sun/star/lang/XUnoTunnel.hpp> 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/container/XEnumerationAccess.hpp> 30 31 #include <cppuhelper/implbase2.hxx> 32 33 #include <unotext.hxx> 34 35 36 class SwDoc; 37 class SwFrmFmt; 38 class SwXTextCursor; 39 40 41 typedef ::cppu::WeakAggImplHelper2 42 < ::com::sun::star::lang::XServiceInfo 43 , ::com::sun::star::container::XEnumerationAccess 44 > SwXBodyText_Base; 45 46 class SwXBodyText 47 : public SwXBodyText_Base 48 , public SwXText 49 { 50 51 protected: 52 53 virtual ~SwXBodyText(); 54 55 public: 56 57 SwXBodyText(SwDoc *const pDoc); 58 59 SwXTextCursor * CreateTextCursor(const bool bIgnoreTables = false); 60 61 // XInterface 62 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 63 const ::com::sun::star::uno::Type& rType); 64 virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); } 65 virtual void SAL_CALL release() throw() { OWeakObject::release(); } 66 67 // XAggregation 68 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( 69 const ::com::sun::star::uno::Type& rType); 70 71 // XTypeProvider 72 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > 73 SAL_CALL getTypes(); 74 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL 75 getImplementationId(); 76 77 // XServiceInfo 78 virtual ::rtl::OUString SAL_CALL getImplementationName(); 79 virtual sal_Bool SAL_CALL supportsService( 80 const ::rtl::OUString& rServiceName); 81 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 82 getSupportedServiceNames(); 83 84 // XElementAccess 85 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(); 86 virtual sal_Bool SAL_CALL hasElements(); 87 88 // XEnumerationAccess 89 virtual ::com::sun::star::uno::Reference< 90 ::com::sun::star::container::XEnumeration > SAL_CALL 91 createEnumeration(); 92 93 // XSimpleText 94 virtual ::com::sun::star::uno::Reference< 95 ::com::sun::star::text::XTextCursor > SAL_CALL 96 createTextCursor(); 97 virtual ::com::sun::star::uno::Reference< 98 ::com::sun::star::text::XTextCursor > SAL_CALL 99 createTextCursorByRange( 100 const ::com::sun::star::uno::Reference< 101 ::com::sun::star::text::XTextRange > & xTextPosition); 102 103 }; 104 105 106 /* -----------------25.08.98 11:02------------------- 107 * 108 * --------------------------------------------------*/ 109 typedef ::cppu::WeakImplHelper2 110 < ::com::sun::star::lang::XServiceInfo 111 , ::com::sun::star::container::XEnumerationAccess 112 > SwXHeadFootText_Base; 113 114 class SwXHeadFootText 115 : public SwXHeadFootText_Base 116 , public SwXText 117 { 118 119 private: 120 121 class Impl; 122 ::sw::UnoImplPtr<Impl> m_pImpl; 123 124 protected: 125 126 virtual const SwStartNode *GetStartNode() const; 127 virtual ::com::sun::star::uno::Reference< 128 ::com::sun::star::text::XTextCursor > 129 CreateCursor(); 130 131 virtual ~SwXHeadFootText(); 132 133 SwXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader); 134 135 public: 136 137 static ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > 138 CreateXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader); 139 static bool IsXHeadFootText(SwClient *const pClient); 140 141 // XInterface 142 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 143 const ::com::sun::star::uno::Type& rType); 144 virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); } 145 virtual void SAL_CALL release() throw() { OWeakObject::release(); } 146 147 // XTypeProvider 148 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > 149 SAL_CALL getTypes(); 150 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL 151 getImplementationId(); 152 153 // XServiceInfo 154 virtual ::rtl::OUString SAL_CALL getImplementationName(); 155 virtual sal_Bool SAL_CALL supportsService( 156 const ::rtl::OUString& rServiceName); 157 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL 158 getSupportedServiceNames(); 159 160 // XElementAccess 161 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(); 162 virtual sal_Bool SAL_CALL hasElements(); 163 164 // XEnumerationAccess 165 virtual ::com::sun::star::uno::Reference< 166 ::com::sun::star::container::XEnumeration > SAL_CALL 167 createEnumeration(); 168 169 // XSimpleText 170 virtual ::com::sun::star::uno::Reference< 171 ::com::sun::star::text::XTextCursor > SAL_CALL 172 createTextCursor(); 173 virtual ::com::sun::star::uno::Reference< 174 ::com::sun::star::text::XTextCursor > SAL_CALL 175 createTextCursorByRange( 176 const ::com::sun::star::uno::Reference< 177 ::com::sun::star::text::XTextRange > & xTextPosition); 178 179 }; 180 181 #endif // SW_UNOTEXTBODYHF_HXX 182