Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SW_UNOBOOKMARK_HXX
30 : : #define SW_UNOBOOKMARK_HXX
31 : :
32 : : #include <com/sun/star/lang/XUnoTunnel.hpp>
33 : : #include <com/sun/star/lang/XServiceInfo.hpp>
34 : : #include <com/sun/star/beans/XPropertySet.hpp>
35 : : #include <com/sun/star/container/XNamed.hpp>
36 : : #include <com/sun/star/text/XTextContent.hpp>
37 : : #include <com/sun/star/text/XFormField.hpp>
38 : :
39 : : #include <cppuhelper/implbase5.hxx>
40 : :
41 : : #include <sfx2/Metadatable.hxx>
42 : :
43 : : #include <unobaseclass.hxx>
44 : : #include <IDocumentMarkAccess.hxx>
45 : :
46 : :
47 : : class SwDoc;
48 : :
49 : :
50 : : typedef ::cppu::ImplInheritanceHelper5
51 : : < ::sfx2::MetadatableMixin
52 : : , ::com::sun::star::lang::XUnoTunnel
53 : : , ::com::sun::star::lang::XServiceInfo
54 : : , ::com::sun::star::beans::XPropertySet
55 : : , ::com::sun::star::container::XNamed
56 : : , ::com::sun::star::text::XTextContent
57 : : > SwXBookmark_Base;
58 : :
59 : : class SwXBookmark
60 : : : public SwXBookmark_Base
61 : : {
62 : :
63 : : private:
64 : :
65 : : class Impl;
66 : : ::sw::UnoImplPtr<Impl> m_pImpl;
67 : :
68 : : protected:
69 : :
70 : : void attachToRangeEx(
71 : : const ::com::sun::star::uno::Reference<
72 : : ::com::sun::star::text::XTextRange > & xTextRange,
73 : : IDocumentMarkAccess::MarkType eType)
74 : : throw (::com::sun::star::lang::IllegalArgumentException,
75 : : ::com::sun::star::uno::RuntimeException );
76 : : virtual void attachToRange(
77 : : const ::com::sun::star::uno::Reference<
78 : : ::com::sun::star::text::XTextRange > & xTextRange)
79 : : throw (::com::sun::star::lang::IllegalArgumentException,
80 : : ::com::sun::star::uno::RuntimeException);
81 : :
82 : : const ::sw::mark::IMark* GetBookmark() const;
83 : :
84 : : void registerInMark( SwXBookmark& rXMark, ::sw::mark::IMark* const pMarkBase );
85 : :
86 : : virtual ~SwXBookmark();
87 : :
88 : : /// @param pDoc and pMark != 0, but not & because of ImplInheritanceHelper
89 : : SwXBookmark(::sw::mark::IMark *const pMark, SwDoc *const pDoc);
90 : :
91 : : public:
92 : :
93 : : /// descriptor
94 : : SwXBookmark();
95 : :
96 : : static ::com::sun::star::uno::Reference<
97 : : ::com::sun::star::text::XTextContent>
98 : : CreateXBookmark(SwDoc & rDoc, ::sw::mark::IMark & rBookmark);
99 : :
100 : : /// @return IMark for this, but only if it lives in pDoc
101 : : static ::sw::mark::IMark const* GetBookmarkInDoc(SwDoc const*const pDoc,
102 : : const ::com::sun::star::uno::Reference<
103 : : ::com::sun::star::lang::XUnoTunnel> & xUT);
104 : :
105 : : // MetadatableMixin
106 : : virtual ::sfx2::Metadatable* GetCoreObject();
107 : : virtual ::com::sun::star::uno::Reference<
108 : : ::com::sun::star::frame::XModel > GetModel();
109 : :
110 : : static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId();
111 : :
112 : : // XUnoTunnel
113 : : virtual sal_Int64 SAL_CALL getSomething(
114 : : const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier)
115 : : throw (::com::sun::star::uno::RuntimeException);
116 : :
117 : : // XServiceInfo
118 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
119 : : throw (::com::sun::star::uno::RuntimeException);
120 : : virtual sal_Bool SAL_CALL supportsService(
121 : : const ::rtl::OUString& rServiceName)
122 : : throw (::com::sun::star::uno::RuntimeException);
123 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
124 : : getSupportedServiceNames()
125 : : throw (::com::sun::star::uno::RuntimeException);
126 : :
127 : : // XComponent
128 : : virtual void SAL_CALL dispose()
129 : : throw (::com::sun::star::uno::RuntimeException);
130 : : virtual void SAL_CALL addEventListener(
131 : : const ::com::sun::star::uno::Reference<
132 : : ::com::sun::star::lang::XEventListener > & xListener)
133 : : throw (::com::sun::star::uno::RuntimeException);
134 : : virtual void SAL_CALL removeEventListener(
135 : : const ::com::sun::star::uno::Reference<
136 : : ::com::sun::star::lang::XEventListener > & xListener)
137 : : throw (::com::sun::star::uno::RuntimeException);
138 : :
139 : : // XPropertySet
140 : : virtual ::com::sun::star::uno::Reference<
141 : : ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
142 : : getPropertySetInfo()
143 : : throw (::com::sun::star::uno::RuntimeException);
144 : : virtual void SAL_CALL setPropertyValue(
145 : : const ::rtl::OUString& rPropertyName,
146 : : const ::com::sun::star::uno::Any& rValue)
147 : : throw (::com::sun::star::beans::UnknownPropertyException,
148 : : ::com::sun::star::beans::PropertyVetoException,
149 : : ::com::sun::star::lang::IllegalArgumentException,
150 : : ::com::sun::star::lang::WrappedTargetException,
151 : : ::com::sun::star::uno::RuntimeException);
152 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
153 : : const ::rtl::OUString& rPropertyName)
154 : : throw (::com::sun::star::beans::UnknownPropertyException,
155 : : ::com::sun::star::lang::WrappedTargetException,
156 : : ::com::sun::star::uno::RuntimeException);
157 : : virtual void SAL_CALL addPropertyChangeListener(
158 : : const ::rtl::OUString& rPropertyName,
159 : : const ::com::sun::star::uno::Reference<
160 : : ::com::sun::star::beans::XPropertyChangeListener >& xListener)
161 : : throw (::com::sun::star::beans::UnknownPropertyException,
162 : : ::com::sun::star::lang::WrappedTargetException,
163 : : ::com::sun::star::uno::RuntimeException);
164 : : virtual void SAL_CALL removePropertyChangeListener(
165 : : const ::rtl::OUString& rPropertyName,
166 : : const ::com::sun::star::uno::Reference<
167 : : ::com::sun::star::beans::XPropertyChangeListener >& xListener)
168 : : throw (::com::sun::star::beans::UnknownPropertyException,
169 : : ::com::sun::star::lang::WrappedTargetException,
170 : : ::com::sun::star::uno::RuntimeException);
171 : : virtual void SAL_CALL addVetoableChangeListener(
172 : : const ::rtl::OUString& rPropertyName,
173 : : const ::com::sun::star::uno::Reference<
174 : : ::com::sun::star::beans::XVetoableChangeListener >& xListener)
175 : : throw (::com::sun::star::beans::UnknownPropertyException,
176 : : ::com::sun::star::lang::WrappedTargetException,
177 : : ::com::sun::star::uno::RuntimeException);
178 : : virtual void SAL_CALL removeVetoableChangeListener(
179 : : const ::rtl::OUString& rPropertyName,
180 : : const ::com::sun::star::uno::Reference<
181 : : ::com::sun::star::beans::XVetoableChangeListener >& xListener)
182 : : throw (::com::sun::star::beans::UnknownPropertyException,
183 : : ::com::sun::star::lang::WrappedTargetException,
184 : : ::com::sun::star::uno::RuntimeException);
185 : :
186 : : // XNamed
187 : : virtual ::rtl::OUString SAL_CALL getName()
188 : : throw (::com::sun::star::uno::RuntimeException);
189 : : virtual void SAL_CALL setName(const ::rtl::OUString& rName)
190 : : throw (::com::sun::star::uno::RuntimeException);
191 : :
192 : : // XTextContent
193 : : virtual void SAL_CALL attach(
194 : : const ::com::sun::star::uno::Reference<
195 : : ::com::sun::star::text::XTextRange > & xTextRange)
196 : : throw (::com::sun::star::lang::IllegalArgumentException,
197 : : ::com::sun::star::uno::RuntimeException);
198 : : virtual ::com::sun::star::uno::Reference<
199 : : ::com::sun::star::text::XTextRange > SAL_CALL getAnchor()
200 : : throw (::com::sun::star::uno::RuntimeException);
201 : :
202 : : };
203 : :
204 [ + - ][ - + ]: 12 : class SwXFieldmarkParameters
205 : : : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XNameContainer>
206 : : , private SwClient
207 : : {
208 : : public:
209 : 6 : SwXFieldmarkParameters(::sw::mark::IFieldmark* const pFieldmark)
210 : 6 : {
211 [ + - ]: 6 : pFieldmark->Add(this);
212 : 6 : }
213 : :
214 : : // XNameContainer
215 : : virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
216 : : virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
217 : : // XNameReplace
218 : : virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
219 : : // XNameAccess
220 : : virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
221 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (::com::sun::star::uno::RuntimeException);
222 : : virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException);
223 : : // XElementAccess
224 : : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
225 : : virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
226 : : protected:
227 : : //SwClient
228 : : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew );
229 : : private:
230 : : ::sw::mark::IFieldmark::parameter_map_t* getCoreParameters() throw (::com::sun::star::uno::RuntimeException);
231 : : };
232 : :
233 : : typedef cppu::ImplInheritanceHelper1< SwXBookmark,
234 : : ::com::sun::star::text::XFormField > SwXFieldmark_Base;
235 : :
236 [ - + ]: 36 : class SwXFieldmark
237 : : : public SwXFieldmark_Base
238 : : {
239 : :
240 : : private:
241 : : ::sw::mark::ICheckboxFieldmark* getCheckboxFieldmark();
242 : : bool isReplacementObject;
243 : : public:
244 : :
245 : : static ::com::sun::star::uno::Reference<
246 : : ::com::sun::star::text::XTextContent>
247 : : CreateXFieldmark( SwDoc & rDoc, ::sw::mark::IMark & rMark );
248 : :
249 : : SwXFieldmark(bool isReplacementObject,
250 : : ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0);
251 : :
252 : : virtual void attachToRange(
253 : : const ::com::sun::star::uno::Reference<
254 : : ::com::sun::star::text::XTextRange > & xTextRange)
255 : : throw (::com::sun::star::lang::IllegalArgumentException,
256 : : ::com::sun::star::uno::RuntimeException);
257 : : virtual ::rtl::OUString SAL_CALL getFieldType(void)
258 : : throw( ::com::sun::star::uno::RuntimeException );
259 : : virtual void SAL_CALL setFieldType(const ::rtl::OUString& description )
260 : : throw (::com::sun::star::uno::RuntimeException);
261 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL getParameters( )
262 : : throw (::com::sun::star::uno::RuntimeException);
263 : : virtual void SAL_CALL setPropertyValue(
264 : : const ::rtl::OUString& rPropertyName,
265 : : const ::com::sun::star::uno::Any& rValue)
266 : : throw (::com::sun::star::beans::UnknownPropertyException,
267 : : ::com::sun::star::beans::PropertyVetoException,
268 : : ::com::sun::star::lang::IllegalArgumentException,
269 : : ::com::sun::star::lang::WrappedTargetException,
270 : : ::com::sun::star::uno::RuntimeException);
271 : :
272 : : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
273 : : const ::rtl::OUString& rPropertyName)
274 : : throw (::com::sun::star::beans::UnknownPropertyException,
275 : : ::com::sun::star::lang::WrappedTargetException,
276 : : ::com::sun::star::uno::RuntimeException);
277 : : };
278 : :
279 [ # # ]: 0 : class SwXODFCheckboxField : public SwXFieldmark
280 : : {
281 : : public:
282 : : SwXODFCheckboxField( ::sw::mark::IMark* pBkm = 0, SwDoc* pDoc = 0) : SwXFieldmark(true,
283 : : pBkm, pDoc) {}
284 : : };
285 : : #endif // SW_UNOBOOKMARK_HXX
286 : :
287 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|