xref: /trunk/main/sw/inc/unotextbodyhf.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SW_UNOTEXTBODYHF_HXX
29 #define SW_UNOTEXTBODYHF_HXX
30 
31 #include <com/sun/star/lang/XUnoTunnel.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/container/XEnumerationAccess.hpp>
34 
35 #include <cppuhelper/implbase2.hxx>
36 
37 #include <unotext.hxx>
38 
39 
40 class SwDoc;
41 class SwFrmFmt;
42 class SwXTextCursor;
43 
44 
45 typedef ::cppu::WeakAggImplHelper2
46 <   ::com::sun::star::lang::XServiceInfo
47 ,   ::com::sun::star::container::XEnumerationAccess
48 > SwXBodyText_Base;
49 
50 class SwXBodyText
51     : public SwXBodyText_Base
52     , public SwXText
53 {
54 
55 protected:
56 
57     virtual ~SwXBodyText();
58 
59 public:
60 
61     SwXBodyText(SwDoc *const pDoc);
62 
63     SwXTextCursor * CreateTextCursor(const bool bIgnoreTables = false);
64 
65     // XInterface
66     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
67             const ::com::sun::star::uno::Type& rType)
68         throw (::com::sun::star::uno::RuntimeException);
69     virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
70     virtual void SAL_CALL release() throw() { OWeakObject::release(); }
71 
72     // XAggregation
73     virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(
74             const ::com::sun::star::uno::Type& rType)
75         throw (::com::sun::star::uno::RuntimeException);
76 
77     // XTypeProvider
78     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
79         SAL_CALL getTypes()
80         throw (::com::sun::star::uno::RuntimeException);
81     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
82         getImplementationId()
83         throw (::com::sun::star::uno::RuntimeException);
84 
85     // XServiceInfo
86     virtual ::rtl::OUString SAL_CALL getImplementationName()
87         throw (::com::sun::star::uno::RuntimeException);
88     virtual sal_Bool SAL_CALL supportsService(
89             const ::rtl::OUString& rServiceName)
90         throw (::com::sun::star::uno::RuntimeException);
91     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
92         getSupportedServiceNames()
93         throw (::com::sun::star::uno::RuntimeException);
94 
95     // XElementAccess
96     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
97         throw (::com::sun::star::uno::RuntimeException);
98     virtual sal_Bool SAL_CALL hasElements()
99         throw (::com::sun::star::uno::RuntimeException);
100 
101     // XEnumerationAccess
102     virtual ::com::sun::star::uno::Reference<
103             ::com::sun::star::container::XEnumeration >  SAL_CALL
104         createEnumeration()
105         throw (::com::sun::star::uno::RuntimeException);
106 
107     // XSimpleText
108     virtual ::com::sun::star::uno::Reference<
109                 ::com::sun::star::text::XTextCursor >  SAL_CALL
110         createTextCursor()
111         throw (::com::sun::star::uno::RuntimeException);
112     virtual ::com::sun::star::uno::Reference<
113                 ::com::sun::star::text::XTextCursor >  SAL_CALL
114         createTextCursorByRange(
115             const ::com::sun::star::uno::Reference<
116                 ::com::sun::star::text::XTextRange > & xTextPosition)
117         throw (::com::sun::star::uno::RuntimeException);
118 
119 };
120 
121 
122 /* -----------------25.08.98 11:02-------------------
123  *
124  * --------------------------------------------------*/
125 typedef ::cppu::WeakImplHelper2
126 <   ::com::sun::star::lang::XServiceInfo
127 ,   ::com::sun::star::container::XEnumerationAccess
128 > SwXHeadFootText_Base;
129 
130 class SwXHeadFootText
131     : public SwXHeadFootText_Base
132     , public SwXText
133 {
134 
135 private:
136 
137     class Impl;
138     ::sw::UnoImplPtr<Impl> m_pImpl;
139 
140 protected:
141 
142     virtual const SwStartNode *GetStartNode() const;
143     virtual ::com::sun::star::uno::Reference<
144                 ::com::sun::star::text::XTextCursor >
145         CreateCursor()
146         throw (::com::sun::star::uno::RuntimeException);
147 
148     virtual ~SwXHeadFootText();
149 
150     SwXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader);
151 
152 public:
153 
154     static ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >
155         CreateXHeadFootText(SwFrmFmt & rHeadFootFmt, const bool bIsHeader);
156     static bool IsXHeadFootText(SwClient *const pClient);
157 
158     // XInterface
159     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
160             const ::com::sun::star::uno::Type& rType)
161         throw (::com::sun::star::uno::RuntimeException);
162     virtual void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
163     virtual void SAL_CALL release() throw() { OWeakObject::release(); }
164 
165     // XTypeProvider
166     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
167         SAL_CALL getTypes()
168         throw (::com::sun::star::uno::RuntimeException);
169     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
170         getImplementationId()
171         throw (::com::sun::star::uno::RuntimeException);
172 
173     // XServiceInfo
174     virtual ::rtl::OUString SAL_CALL getImplementationName()
175         throw (::com::sun::star::uno::RuntimeException);
176     virtual sal_Bool SAL_CALL supportsService(
177             const ::rtl::OUString& rServiceName)
178         throw (::com::sun::star::uno::RuntimeException);
179     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
180         getSupportedServiceNames()
181         throw (::com::sun::star::uno::RuntimeException);
182 
183     // XElementAccess
184     virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
185         throw (::com::sun::star::uno::RuntimeException);
186     virtual sal_Bool SAL_CALL hasElements()
187         throw (::com::sun::star::uno::RuntimeException);
188 
189     // XEnumerationAccess
190     virtual ::com::sun::star::uno::Reference<
191             ::com::sun::star::container::XEnumeration >  SAL_CALL
192         createEnumeration()
193         throw (::com::sun::star::uno::RuntimeException);
194 
195     // XSimpleText
196     virtual ::com::sun::star::uno::Reference<
197                 ::com::sun::star::text::XTextCursor >  SAL_CALL
198         createTextCursor()
199         throw (::com::sun::star::uno::RuntimeException);
200     virtual ::com::sun::star::uno::Reference<
201                 ::com::sun::star::text::XTextCursor >  SAL_CALL
202         createTextCursorByRange(
203             const ::com::sun::star::uno::Reference<
204                 ::com::sun::star::text::XTextRange > & xTextPosition)
205         throw (::com::sun::star::uno::RuntimeException);
206 
207 };
208 
209 #endif // SW_UNOTEXTBODYHF_HXX
210 
211