Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SW_UNOTBL_HXX
21 : #define SW_UNOTBL_HXX
22 :
23 : #include <com/sun/star/container/XNamed.hpp>
24 : #include <com/sun/star/container/XEnumerationAccess.hpp>
25 : #include <com/sun/star/util/XSortable.hpp>
26 : #include <com/sun/star/chart/XChartData.hpp>
27 : #include <com/sun/star/chart/XChartDataArray.hpp>
28 : #include <com/sun/star/chart2/data/XLabeledDataSequence.hpp>
29 : #include <com/sun/star/text/XTextTableCursor.hpp>
30 : #include <com/sun/star/text/XTextTable.hpp>
31 : #include <com/sun/star/table/XCellRange.hpp>
32 : #include <com/sun/star/sheet/XCellRangeData.hpp>
33 : #include <com/sun/star/table/XAutoFormattable.hpp>
34 :
35 : #include <cppuhelper/implbase3.hxx>
36 : #include <cppuhelper/implbase4.hxx>
37 : #include <cppuhelper/implbase5.hxx>
38 : #include <cppuhelper/implbase7.hxx>
39 : #include <cppuhelper/implbase10.hxx>
40 : #include <cppuhelper/interfacecontainer.h>
41 :
42 : #include <comphelper/uno3.hxx>
43 : #include <tools/string.hxx>
44 :
45 : #include <calbck.hxx>
46 : #include <TextCursorHelper.hxx>
47 : #include <unotext.hxx>
48 :
49 :
50 : class SwUnoCrsr;
51 : class SwTable;
52 : class SwTableBox;
53 : class SwTableLine;
54 : class SwTableCursor;
55 : class SwTableBoxFmt;
56 : class SwChartDataProvider;
57 : class SwFrmFmt;
58 :
59 :
60 : typedef
61 : cppu::WeakImplHelper4
62 : <
63 : ::com::sun::star::table::XCell,
64 : ::com::sun::star::lang::XServiceInfo,
65 : ::com::sun::star::beans::XPropertySet,
66 : ::com::sun::star::container::XEnumerationAccess
67 : >
68 : SwXCellBaseClass;
69 : class SwXCell : public SwXCellBaseClass,
70 : public SwXText,
71 : public SwClient
72 : {
73 : friend void sw_setString( SwXCell &rCell, const OUString &rTxt,
74 : sal_Bool bKeepNumberFmt = sal_False );
75 : friend double sw_getValue( SwXCell &rCell );
76 : friend void sw_setValue( SwXCell &rCell, double nVal );
77 :
78 :
79 : const SfxItemPropertySet* m_pPropSet;
80 : SwTableBox* pBox; // only set in non-XML import
81 : const SwStartNode* pStartNode; // only set in XML import
82 :
83 : // table position where pBox was found last
84 : size_t nFndPos;
85 : static size_t const NOTFOUND = SAL_MAX_SIZE;
86 :
87 : protected:
88 : virtual const SwStartNode *GetStartNode() const;
89 :
90 : virtual ::com::sun::star::uno::Reference<
91 : ::com::sun::star::text::XTextCursor >
92 : CreateCursor()
93 : throw (::com::sun::star::uno::RuntimeException);
94 :
95 : bool IsValid() const;
96 :
97 : virtual ~SwXCell();
98 :
99 : //SwClient
100 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
101 :
102 : public:
103 : SwXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, size_t nPos = NOTFOUND);
104 : SwXCell(SwFrmFmt* pTblFmt, const SwStartNode& rStartNode); // XML import interface
105 :
106 :
107 : TYPEINFO();
108 :
109 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
110 :
111 : //XUnoTunnel
112 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
113 :
114 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
115 : virtual void SAL_CALL acquire( ) throw();
116 : virtual void SAL_CALL release( ) throw();
117 :
118 : //XTypeProvider
119 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
120 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
121 :
122 : //XCell
123 : virtual OUString SAL_CALL getFormula( ) throw(::com::sun::star::uno::RuntimeException);
124 : virtual void SAL_CALL setFormula( const OUString& aFormula ) throw(::com::sun::star::uno::RuntimeException);
125 : virtual double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
126 : virtual void SAL_CALL setValue( double nValue ) throw(::com::sun::star::uno::RuntimeException);
127 : virtual ::com::sun::star::table::CellContentType SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException);
128 : virtual sal_Int32 SAL_CALL getError( ) throw(::com::sun::star::uno::RuntimeException);
129 :
130 : //XText
131 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor(void) throw( ::com::sun::star::uno::RuntimeException );
132 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & aTextPosition) throw( ::com::sun::star::uno::RuntimeException );
133 : virtual void SAL_CALL setString(const OUString& aString) throw( ::com::sun::star::uno::RuntimeException );
134 :
135 : //XPropertySet
136 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
137 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
138 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
139 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
140 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
141 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
142 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
143 :
144 : //XServiceInfo
145 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
146 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
147 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
148 :
149 : //XEnumerationAccess - was: XParagraphEnumerationAccess
150 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration(void) throw( ::com::sun::star::uno::RuntimeException );
151 :
152 : //XElementAccess
153 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
154 : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
155 :
156 457 : SwTableBox* GetTblBox()const {return pBox;}
157 : static SwXCell* CreateXCell(SwFrmFmt* pTblFmt, SwTableBox* pBox, SwTable *pTbl = 0 );
158 : SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox);
159 :
160 8254 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
161 : };
162 :
163 : class SwXTextTableRow : public cppu::WeakImplHelper2
164 : <
165 : ::com::sun::star::beans::XPropertySet,
166 : ::com::sun::star::lang::XServiceInfo
167 : >,
168 : public SwClient
169 : {
170 : const SfxItemPropertySet* m_pPropSet;
171 : SwTableLine* pLine;
172 :
173 499 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
174 : protected:
175 : virtual ~SwXTextTableRow();
176 : //SwClient
177 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
178 :
179 : public:
180 : SwXTextTableRow(SwFrmFmt* pFmt, SwTableLine* pLine);
181 :
182 :
183 : TYPEINFO();
184 :
185 : //XPropertySet
186 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
187 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
188 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
189 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
190 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
191 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
192 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
193 :
194 : //XServiceInfo
195 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
196 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
197 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
198 :
199 3 : const SwTableLine* GetTblRow() const {return pLine;}
200 : static SwTableLine* FindLine(SwTable* pTable, SwTableLine* pLine);
201 : };
202 :
203 : typedef cppu::WeakImplHelper3<
204 : ::com::sun::star::text::XTextTableCursor,
205 : ::com::sun::star::lang::XServiceInfo,
206 : ::com::sun::star::beans::XPropertySet
207 : > SwXTextTableCursor_Base;
208 : class SW_DLLPUBLIC SwXTextTableCursor : public SwXTextTableCursor_Base
209 : ,public SwClient
210 : ,public OTextCursorHelper
211 : {
212 : SwDepend aCrsrDepend;
213 : const SfxItemPropertySet* m_pPropSet;
214 :
215 : protected:
216 : virtual ~SwXTextTableCursor();
217 : public:
218 : SwXTextTableCursor(SwFrmFmt* pFmt, SwTableBox* pBox);
219 : SwXTextTableCursor(SwFrmFmt& rTableFmt,
220 : const SwTableCursor* pTableSelection);
221 :
222 :
223 : DECLARE_XINTERFACE()
224 :
225 : //XTextTableCursor
226 : virtual OUString SAL_CALL getRangeName( ) throw(::com::sun::star::uno::RuntimeException);
227 : virtual sal_Bool SAL_CALL gotoCellByName( const OUString& aCellName, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
228 : virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
229 : virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
230 : virtual sal_Bool SAL_CALL goUp( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
231 : virtual sal_Bool SAL_CALL goDown( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
232 : virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
233 : virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
234 : virtual sal_Bool SAL_CALL mergeRange( ) throw(::com::sun::star::uno::RuntimeException);
235 : virtual sal_Bool SAL_CALL splitRange( sal_Int16 Count, sal_Bool Horizontal ) throw(::com::sun::star::uno::RuntimeException);
236 :
237 : //XPropertySet
238 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
239 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
240 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
241 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
242 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
243 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
244 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
245 :
246 : //XServiceInfo
247 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
248 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
249 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
250 :
251 : //SwClient
252 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
253 :
254 : // ITextCursorHelper
255 : virtual const SwPaM* GetPaM() const;
256 : virtual SwPaM* GetPaM();
257 : virtual const SwDoc* GetDoc() const;
258 : virtual SwDoc* GetDoc();
259 :
260 : const SwUnoCrsr* GetCrsr() const;
261 : SwUnoCrsr* GetCrsr();
262 7 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
263 : };
264 :
265 : struct SwRangeDescriptor
266 : {
267 : sal_Int32 nTop;
268 : sal_Int32 nLeft;
269 : sal_Int32 nBottom;
270 : sal_Int32 nRight;
271 :
272 : void Normalize();
273 : };
274 :
275 : class SwTableProperties_Impl;
276 : class SwXTextTable : public cppu::WeakImplHelper10
277 : <
278 : ::com::sun::star::text::XTextTable,
279 : ::com::sun::star::lang::XServiceInfo,
280 : ::com::sun::star::table::XCellRange,
281 : ::com::sun::star::chart::XChartDataArray,
282 : ::com::sun::star::beans::XPropertySet,
283 : ::com::sun::star::container::XNamed,
284 : ::com::sun::star::table::XAutoFormattable,
285 : ::com::sun::star::util::XSortable,
286 : ::com::sun::star::lang::XUnoTunnel,
287 : ::com::sun::star::sheet::XCellRangeData
288 : >,
289 : public SwClient
290 : {
291 : private:
292 : class Impl;
293 : ::sw::UnoImplPtr<Impl> m_pImpl;
294 :
295 : const SfxItemPropertySet* m_pPropSet;
296 :
297 : // Descriptor-interface
298 : SwTableProperties_Impl* pTableProps;
299 : String m_sTableName;
300 : sal_Bool bIsDescriptor;
301 : unsigned short nRows;
302 : unsigned short nColumns;
303 :
304 :
305 : sal_Bool bFirstRowAsLabel :1;
306 : sal_Bool bFirstColumnAsLabel :1;
307 : protected:
308 : virtual ~SwXTextTable();
309 : public:
310 : SwXTextTable();
311 : SwXTextTable(SwFrmFmt& rFrmFmt);
312 :
313 :
314 : SW_DLLPUBLIC static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
315 :
316 : //XUnoTunnel
317 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
318 :
319 : TYPEINFO();
320 :
321 : //XTextTable
322 : virtual void SAL_CALL initialize( sal_Int32 nRows, sal_Int32 nColumns ) throw(::com::sun::star::uno::RuntimeException);
323 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows > SAL_CALL getRows( ) throw(::com::sun::star::uno::RuntimeException);
324 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
325 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByName( const OUString& aCellName ) throw(::com::sun::star::uno::RuntimeException);
326 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getCellNames( ) throw(::com::sun::star::uno::RuntimeException);
327 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextTableCursor > SAL_CALL createCursorByCellName( const OUString& aCellName ) throw(::com::sun::star::uno::RuntimeException);
328 :
329 : //XTextContent
330 : virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
331 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
332 :
333 : //XComponent
334 : virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException );
335 : virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
336 : virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw( ::com::sun::star::uno::RuntimeException );
337 :
338 : //XCellRange
339 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
340 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw(com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
341 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) throw(::com::sun::star::uno::RuntimeException);
342 :
343 : //XChartDataArray
344 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData( ) throw(::com::sun::star::uno::RuntimeException);
345 : virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) throw(::com::sun::star::uno::RuntimeException);
346 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getRowDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
347 : virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< OUString >& aRowDescriptions ) throw(::com::sun::star::uno::RuntimeException);
348 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getColumnDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
349 : virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< OUString >& aColumnDescriptions ) throw(::com::sun::star::uno::RuntimeException);
350 :
351 : //XChartData
352 : virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
353 : virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
354 : virtual double SAL_CALL getNotANumber( ) throw(::com::sun::star::uno::RuntimeException);
355 : virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) throw(::com::sun::star::uno::RuntimeException);
356 :
357 : //XSortable
358 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL createSortDescriptor(void) throw( ::com::sun::star::uno::RuntimeException );
359 : virtual void SAL_CALL sort(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xDescriptor) throw( ::com::sun::star::uno::RuntimeException );
360 :
361 : //XAutoFormattable
362 : virtual void SAL_CALL autoFormat(const OUString& aName) throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
363 :
364 : //XPropertySet
365 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
366 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
367 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
368 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
369 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
370 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
371 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
372 :
373 : //XNamed
374 : virtual OUString SAL_CALL getName(void) throw( ::com::sun::star::uno::RuntimeException );
375 : virtual void SAL_CALL setName(const OUString& Name_) throw( ::com::sun::star::uno::RuntimeException );
376 :
377 : //XCellRangeData
378 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL getDataArray( ) throw (::com::sun::star::uno::RuntimeException);
379 : virtual void SAL_CALL setDataArray( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aArray ) throw (::com::sun::star::uno::RuntimeException);
380 :
381 : //XServiceInfo
382 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
383 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
384 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
385 :
386 : void attachToRange(const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & xTextRange)throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
387 :
388 : sal_uInt16 getRowCount(void);
389 : sal_uInt16 getColumnCount(void);
390 : ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > GetRangeByName(SwFrmFmt* pFmt, SwTable* pTable,
391 : const String& sTLName, const String& sBRName,
392 : SwRangeDescriptor& rDesc);
393 :
394 : //SwClient
395 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
396 :
397 2523 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
398 : };
399 :
400 : class SwXCellRange : public cppu::WeakImplHelper7
401 : <
402 : ::com::sun::star::table::XCellRange,
403 : ::com::sun::star::lang::XServiceInfo,
404 : ::com::sun::star::lang::XUnoTunnel,
405 : ::com::sun::star::beans::XPropertySet,
406 : ::com::sun::star::chart::XChartDataArray,
407 : ::com::sun::star::util::XSortable,
408 : ::com::sun::star::sheet::XCellRangeData
409 : >,
410 : public SwClient
411 : {
412 : SwDepend aCursorDepend; //the cursor is removed after the doc has been removed
413 : ::osl::Mutex m_Mutex;
414 : ::cppu::OInterfaceContainerHelper m_ChartListeners;
415 :
416 : SwRangeDescriptor aRgDesc;
417 : const SfxItemPropertySet* m_pPropSet;
418 :
419 : SwUnoCrsr* pTblCrsr;
420 :
421 : sal_Bool bFirstRowAsLabel :1;
422 : sal_Bool bFirstColumnAsLabel :1;
423 :
424 : public:
425 : SwXCellRange(SwUnoCrsr* pCrsr, SwFrmFmt& rFrmFmt, SwRangeDescriptor& rDesc);
426 : ~SwXCellRange();
427 :
428 : TYPEINFO();
429 :
430 : static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId();
431 :
432 : //XUnoTunnel
433 : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
434 :
435 :
436 : //XCellRange
437 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
438 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw(com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
439 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) throw(::com::sun::star::uno::RuntimeException);
440 :
441 : //XPropertySet
442 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
443 : virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
444 : virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
445 : virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
446 : virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
447 : virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
448 : virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
449 :
450 : //XChartData
451 : virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
452 : virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
453 : virtual double SAL_CALL getNotANumber( ) throw(::com::sun::star::uno::RuntimeException);
454 : virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) throw(::com::sun::star::uno::RuntimeException);
455 :
456 : //XChartDataArray
457 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL getData( ) throw(::com::sun::star::uno::RuntimeException);
458 : virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& aData ) throw(::com::sun::star::uno::RuntimeException);
459 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getRowDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
460 : virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< OUString >& aRowDescriptions ) throw(::com::sun::star::uno::RuntimeException);
461 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getColumnDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
462 : virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< OUString >& aColumnDescriptions ) throw(::com::sun::star::uno::RuntimeException);
463 :
464 : //XSortable
465 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL createSortDescriptor(void) throw( ::com::sun::star::uno::RuntimeException );
466 : virtual void SAL_CALL sort(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& xDescriptor) throw( ::com::sun::star::uno::RuntimeException );
467 :
468 : //XCellRangeData
469 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > SAL_CALL getDataArray( ) throw (::com::sun::star::uno::RuntimeException);
470 : virtual void SAL_CALL setDataArray( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aArray ) throw (::com::sun::star::uno::RuntimeException);
471 :
472 : //XServiceInfo
473 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
474 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
475 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
476 :
477 : //SwClient
478 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
479 :
480 268 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
481 : sal_uInt16 getRowCount(void);
482 : sal_uInt16 getColumnCount(void);
483 :
484 : const SwUnoCrsr* GetTblCrsr() const;
485 :
486 : // for SwChartDataSequence
487 : void GetDataSequence(
488 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > *pAnySeq,
489 : ::com::sun::star::uno::Sequence< OUString > *pTxtSeq,
490 : ::com::sun::star::uno::Sequence< double > *pDblSeq,
491 : sal_Bool bForceNumberResults = sal_False ) throw (::com::sun::star::uno::RuntimeException);
492 :
493 : };
494 :
495 : class SwXTableRows : public cppu::WeakImplHelper2
496 : <
497 : ::com::sun::star::table::XTableRows,
498 : ::com::sun::star::lang::XServiceInfo
499 : >,
500 : public SwClient
501 :
502 : {
503 484 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
504 : protected:
505 : virtual ~SwXTableRows();
506 : public:
507 : SwXTableRows(SwFrmFmt& rFrmFmt);
508 :
509 :
510 : TYPEINFO();
511 :
512 : //XIndexAccess
513 : virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
514 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
515 :
516 : //XElementAccess
517 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
518 : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
519 :
520 : //XTableRows
521 : virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
522 : virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
523 :
524 : //XServiceInfo
525 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
526 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
527 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
528 :
529 : //SwClient
530 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
531 : };
532 :
533 : class SwXTableColumns : public cppu::WeakImplHelper2
534 : <
535 : ::com::sun::star::table::XTableColumns,
536 : ::com::sun::star::lang::XServiceInfo
537 : >,
538 : public SwClient
539 :
540 : {
541 7 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
542 : protected:
543 : virtual ~SwXTableColumns();
544 : public:
545 : SwXTableColumns(SwFrmFmt& rFrmFmt);
546 :
547 :
548 : TYPEINFO();
549 :
550 : //XIndexAccess
551 : virtual sal_Int32 SAL_CALL getCount(void) throw( ::com::sun::star::uno::RuntimeException );
552 : virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
553 :
554 : //XElementAccess
555 : virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
556 : virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
557 :
558 : //XTableColumns
559 : virtual void SAL_CALL insertByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
560 : virtual void SAL_CALL removeByIndex(sal_Int32 nIndex, sal_Int32 nCount) throw( ::com::sun::star::uno::RuntimeException );
561 :
562 : //XServiceInfo
563 : virtual OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException );
564 : virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException );
565 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException );
566 :
567 : //SwClient
568 : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
569 : };
570 :
571 : #endif
572 :
573 :
574 :
575 :
576 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|