xref: /trunk/main/sw/inc/unotextbodyhf.hxx (revision 1d2dbeb0)
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         throw (::com::sun::star::uno::RuntimeException);
acquire()65     virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
release()66     virtual void SAL_CALL release() throw() { OWeakObject::release(); }
67 
68     // XAggregation
69     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
70             const ::com::sun::star::uno::Type& rType)
71         throw (::com::sun::star::uno::RuntimeException);
72 
73     // XTypeProvider
74     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
75         SAL_CALL getTypes()
76         throw (::com::sun::star::uno::RuntimeException);
77     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
78         getImplementationId()
79         throw (::com::sun::star::uno::RuntimeException);
80 
81     // XServiceInfo
82     virtual ::rtl::OUString SAL_CALL getImplementationName()
83         throw (::com::sun::star::uno::RuntimeException);
84     virtual sal_Bool SAL_CALL supportsService(
85             const ::rtl::OUString& rServiceName)
86         throw (::com::sun::star::uno::RuntimeException);
87     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
88         getSupportedServiceNames()
89         throw (::com::sun::star::uno::RuntimeException);
90 
91     // XElementAccess
92     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
93         throw (::com::sun::star::uno::RuntimeException);
94     virtual sal_Bool SAL_CALL hasElements()
95         throw (::com::sun::star::uno::RuntimeException);
96 
97     // XEnumerationAccess
98     virtual ::com::sun::star::uno::Reference<
99             ::com::sun::star::container::XEnumeration >  SAL_CALL
100         createEnumeration()
101         throw (::com::sun::star::uno::RuntimeException);
102 
103     // XSimpleText
104     virtual ::com::sun::star::uno::Reference<
105                 ::com::sun::star::text::XTextCursor >  SAL_CALL
106         createTextCursor()
107         throw (::com::sun::star::uno::RuntimeException);
108     virtual ::com::sun::star::uno::Reference<
109                 ::com::sun::star::text::XTextCursor >  SAL_CALL
110         createTextCursorByRange(
111             const ::com::sun::star::uno::Reference<
112                 ::com::sun::star::text::XTextRange > & xTextPosition)
113         throw (::com::sun::star::uno::RuntimeException);
114 
115 };
116 
117 
118 /* -----------------25.08.98 11:02-------------------
119  *
120  * --------------------------------------------------*/
121 typedef ::cppu::WeakImplHelper2
122 <   ::com::sun::star::lang::XServiceInfo
123 ,   ::com::sun::star::container::XEnumerationAccess
124 > SwXHeadFootText_Base;
125 
126 class SwXHeadFootText
127     : public SwXHeadFootText_Base
128     , public SwXText
129 {
130 
131 private:
132 
133     class Impl;
134     ::sw::UnoImplPtr<Impl> m_pImpl;
135 
136 protected:
137 
138     virtual const SwStartNode *GetStartNode() const;
139     virtual ::com::sun::star::uno::Reference<
140                 ::com::sun::star::text::XTextCursor >
141         CreateCursor()
142         throw (::com::sun::star::uno::RuntimeException);
143 
144     virtual ~SwXHeadFootText();
145 
146     SwXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader);
147 
148 public:
149 
150     static ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
151         CreateXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader);
152     static bool IsXHeadFootText(SwClient *const pClient);
153 
154     // XInterface
155     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
156             const ::com::sun::star::uno::Type& rType)
157         throw (::com::sun::star::uno::RuntimeException);
acquire()158     virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
release()159     virtual void SAL_CALL release() throw() { OWeakObject::release(); }
160 
161     // XTypeProvider
162     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
163         SAL_CALL getTypes()
164         throw (::com::sun::star::uno::RuntimeException);
165     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
166         getImplementationId()
167         throw (::com::sun::star::uno::RuntimeException);
168 
169     // XServiceInfo
170     virtual ::rtl::OUString SAL_CALL getImplementationName()
171         throw (::com::sun::star::uno::RuntimeException);
172     virtual sal_Bool SAL_CALL supportsService(
173             const ::rtl::OUString& rServiceName)
174         throw (::com::sun::star::uno::RuntimeException);
175     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
176         getSupportedServiceNames()
177         throw (::com::sun::star::uno::RuntimeException);
178 
179     // XElementAccess
180     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
181         throw (::com::sun::star::uno::RuntimeException);
182     virtual sal_Bool SAL_CALL hasElements()
183         throw (::com::sun::star::uno::RuntimeException);
184 
185     // XEnumerationAccess
186     virtual ::com::sun::star::uno::Reference<
187             ::com::sun::star::container::XEnumeration >  SAL_CALL
188         createEnumeration()
189         throw (::com::sun::star::uno::RuntimeException);
190 
191     // XSimpleText
192     virtual ::com::sun::star::uno::Reference<
193                 ::com::sun::star::text::XTextCursor >  SAL_CALL
194         createTextCursor()
195         throw (::com::sun::star::uno::RuntimeException);
196     virtual ::com::sun::star::uno::Reference<
197                 ::com::sun::star::text::XTextCursor >  SAL_CALL
198         createTextCursorByRange(
199             const ::com::sun::star::uno::Reference<
200                 ::com::sun::star::text::XTextRange > & xTextPosition)
201         throw (::com::sun::star::uno::RuntimeException);
202 
203 };
204 
205 #endif // SW_UNOTEXTBODYHF_HXX
206 
207