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 : : #ifndef _SWTABLE_HXX
29 : : #define _SWTABLE_HXX
30 : : #include <tools/mempool.hxx>
31 : : #include <tools/ref.hxx>
32 : : #include <tblenum.hxx>
33 : : #include <swtypes.hxx>
34 : : #include <calbck.hxx>
35 : : #include <swrect.hxx>
36 : :
37 : : #include <memory>
38 : : #include <boost/noncopyable.hpp>
39 : : #include <vector>
40 : : #include <algorithm>
41 : : #include <o3tl/sorted_vector.hxx>
42 : :
43 : : class SwStartNode;
44 : : class SwFmt;
45 : : class Color;
46 : : class SwFrmFmt;
47 : : class SwTableFmt;
48 : : class SwTableLineFmt;
49 : : class SwTableBoxFmt;
50 : : class SwHTMLTableLayout;
51 : : class SwTableLine;
52 : : class SwTableBox;
53 : : class SwTableNode;
54 : : class SwTabCols;
55 : : class SwDoc;
56 : : class SwSelBoxes;
57 : : class SwTblCalcPara;
58 : : struct SwPosition;
59 : : class SwNodeIndex;
60 : : class SwNode;
61 : : class SfxPoolItem;
62 : : class SwUndoTblMerge;
63 : : class SwUndo;
64 : : class SwPaM;
65 : : class SwTableBox_Impl;
66 : : class SwUndoTblCpyTbl;
67 : : class SwBoxSelection;
68 : : struct SwSaveRowSpan;
69 : : struct Parm;
70 : :
71 : : #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
72 : : #define SW_DECL_SWSERVEROBJECT_DEFINED
73 : : SV_DECL_REF( SwServerObject )
74 : : #endif
75 : :
76 : 2544 : class SwTableLines : public std::vector<SwTableLine*> {
77 : : public:
78 : : // free's any remaining child objects
79 : : ~SwTableLines();
80 : :
81 : : // return USHRT_MAX if not found, else index of position
82 : 2261 : sal_uInt16 GetPos(const SwTableLine* pBox) const
83 : : {
84 [ + - ]: 2261 : const_iterator it = std::find(begin(), end(), pBox);
85 [ + - ][ - + ]: 2261 : return it == end() ? USHRT_MAX : it - begin();
[ + - ][ + - ]
[ # # ]
86 : : }
87 : : };
88 : :
89 : 1096 : class SwTableBoxes : public std::vector<SwTableBox*> {
90 : : public:
91 : : // return USHRT_MAX if not found, else index of position
92 : 2089 : sal_uInt16 GetPos(const SwTableBox* pBox) const
93 : : {
94 [ + - ]: 2089 : const_iterator it = std::find(begin(), end(), pBox);
95 [ + - ][ - + ]: 2089 : return it == end() ? USHRT_MAX : it - begin();
[ + - ][ + - ]
[ # # ]
96 : : }
97 : : };
98 : :
99 : : // Save content-bearing box-pointers additionally in a sorted array
100 : : // (for calculation in table).
101 : 476 : class SwTableSortBoxes : public o3tl::sorted_vector<SwTableBox*> {};
102 : :
103 : : class SW_DLLPUBLIC SwTable: public SwClient //Client of FrmFmt.
104 : : {
105 : :
106 : :
107 : : protected:
108 : : SwTableLines aLines;
109 : : SwTableSortBoxes aSortCntBoxes;
110 : : SwServerObjectRef refObj; // In case DataServer -> pointer is set.
111 : :
112 : : SwHTMLTableLayout *pHTMLLayout;
113 : :
114 : : // Usually, the table node of a SwTable can be accessed by getting a box
115 : : // out of aSortCntBoxes, which know their SwStartNode. But in some rare
116 : : // cases, we need to know the table node of a SwTable, before the table
117 : : // boxes have been build (SwTableNode::MakeCopy with tables in tables).
118 : : SwTableNode* pTableNode;
119 : :
120 : : // Should that be adjustable for every table?
121 : : TblChgMode eTblChgMode;
122 : :
123 : : sal_uInt16 nGrfsThatResize; // Count of Grfs that initiate a resize of table
124 : : // at HTML-import.
125 : : sal_uInt16 nRowsToRepeat; // Number of rows to repeat on every page.
126 : :
127 : : sal_Bool bModifyLocked :1;
128 : : sal_Bool bNewModel :1; // sal_False: old SubTableModel; sal_True: new RowSpanModel
129 : : #ifdef DBG_UTIL
130 : : /// This is set by functions (like Merge()) to forbid a late model change.
131 : : bool m_bDontChangeModel;
132 : : #endif
133 : :
134 : 171 : sal_Bool IsModifyLocked(){ return bModifyLocked;}
135 : :
136 : : virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
137 : :
138 : : public:
139 : : enum SearchType
140 : : {
141 : : SEARCH_NONE, // Default: expand to rectangle
142 : : SEARCH_ROW, // row selection
143 : : SEARCH_COL // column selection
144 : : };
145 : :
146 : : TYPEINFO();
147 : :
148 : : // single argument ctors shall be explicit.
149 : : explicit SwTable( SwTableFmt* );
150 : : virtual ~SwTable();
151 : :
152 : : // @@@ public copy ctor, but no copy assignment?
153 : : SwTable( const SwTable& rTable ); // kein Copy der Lines !!
154 : : private:
155 : : // @@@ public copy ctor, but no copy assignment?
156 : : SwTable & operator= (const SwTable &);
157 : : // no default ctor.
158 : : SwTable();
159 : : sal_Bool OldMerge( SwDoc*, const SwSelBoxes&, SwTableBox*, SwUndoTblMerge* );
160 : : sal_Bool OldSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, sal_Bool );
161 : : sal_Bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged,
162 : : SwTableBox*, SwUndoTblMerge* );
163 : : sal_Bool NewSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, sal_Bool );
164 : : SwBoxSelection* CollectBoxSelection( const SwPaM& rPam ) const;
165 : : void InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
166 : : sal_Bool _InsertRow( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, sal_Bool bBehind );
167 : : sal_Bool NewInsertCol( SwDoc*, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool );
168 : : void _FindSuperfluousRows( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* );
169 : : void AdjustWidths( const long nOld, const long nNew );
170 : : void NewSetTabCols( Parm &rP, const SwTabCols &rNew, const SwTabCols &rOld,
171 : : const SwTableBox *pStart, sal_Bool bCurRowOnly );
172 : :
173 : : public:
174 : :
175 : 1204 : SwHTMLTableLayout *GetHTMLTableLayout() { return pHTMLLayout; }
176 : 0 : const SwHTMLTableLayout *GetHTMLTableLayout() const { return pHTMLLayout; }
177 : : void SetHTMLTableLayout( SwHTMLTableLayout *p ); //Change of property!
178 : :
179 : 0 : sal_uInt16 IncGrfsThatResize() { return ++nGrfsThatResize; }
180 [ # # ]: 0 : sal_uInt16 DecGrfsThatResize() { return nGrfsThatResize ? --nGrfsThatResize : 0; }
181 : :
182 : 0 : void LockModify() { bModifyLocked = sal_True; } // Must be used always
183 : 0 : void UnlockModify() { bModifyLocked = sal_False;} // in pairs!
184 : :
185 : 163 : void SetTableModel( sal_Bool bNew ){ bNewModel = bNew; }
186 : 2327 : sal_Bool IsNewModel() const { return bNewModel; }
187 : :
188 : 1556 : sal_uInt16 GetRowsToRepeat() const { return Min( (sal_uInt16)GetTabLines().size(), nRowsToRepeat ); }
189 : : sal_uInt16 _GetRowsToRepeat() const { return nRowsToRepeat; }
190 : 325 : void SetRowsToRepeat( sal_uInt16 nNumOfRows ) { nRowsToRepeat = nNumOfRows; }
191 : :
192 : : bool IsHeadline( const SwTableLine& rLine ) const;
193 : :
194 : 2301 : SwTableLines &GetTabLines() { return aLines; }
195 : 7631 : const SwTableLines &GetTabLines() const { return aLines; }
196 : :
197 : 3763 : SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
198 : 2147 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
199 : 0 : SwTableFmt* GetTableFmt() const { return (SwTableFmt*)GetRegisteredIn(); }
200 : :
201 : : void GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart,
202 : : sal_Bool bHidden = sal_False, sal_Bool bCurRowOnly = sal_False ) const;
203 : : void SetTabCols( const SwTabCols &rNew, const SwTabCols &rOld,
204 : : const SwTableBox *pStart, sal_Bool bCurRowOnly );
205 : :
206 : : // The following functions are for new table model only...
207 : : void CreateSelection( const SwPaM& rPam, SwSelBoxes& rBoxes,
208 : : const SearchType eSearchType, bool bProtect ) const;
209 : : void CreateSelection( const SwNode* pStart, const SwNode* pEnd,
210 : : SwSelBoxes& rBoxes, const SearchType eSearchType, bool bProtect ) const;
211 : : void ExpandSelection( SwSelBoxes& rBoxes ) const;
212 : : // When a table is splitted into two tables, the row spans which overlaps
213 : : // the split have to be corrected and stored for undo
214 : : // SwSavRowSpan is the structure needed by Undo to undo the split operation
215 : : // CleanUpRowSpan corrects the (top of the) second table and delviers the structure
216 : : // for Undo
217 : : SwSaveRowSpan* CleanUpTopRowSpan( sal_uInt16 nSplitLine );
218 : : // RestoreRowSpan is called by Undo to restore the old row span values
219 : : void RestoreRowSpan( const SwSaveRowSpan& );
220 : : // CleanUpBottomRowSpan corrects the overhanging row spans at the end of the first table
221 : : void CleanUpBottomRowSpan( sal_uInt16 nDelLines );
222 : :
223 : :
224 : : // The following functions are "pseudo-virtual", i.e. they are different for old and new table model
225 : : // It's not allowed to change the table model after the first call of one of these functions.
226 : :
227 : 2 : sal_Bool Merge( SwDoc* pDoc, const SwSelBoxes& rBoxes, const SwSelBoxes& rMerged,
228 : : SwTableBox* pMergeBox, SwUndoTblMerge* pUndo = 0 )
229 : : {
230 : : #ifdef DBG_UTIL
231 : : m_bDontChangeModel = true;
232 : : #endif
233 : : return bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pMergeBox, pUndo ) :
234 [ + - ]: 2 : OldMerge( pDoc, rBoxes, pMergeBox, pUndo );
235 : : }
236 : 2 : sal_Bool SplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt=1,
237 : : sal_Bool bSameHeight = sal_False )
238 : : {
239 : : #ifdef DBG_UTIL
240 : : m_bDontChangeModel = true;
241 : : #endif
242 : 2 : return bNewModel ? NewSplitRow( pDoc, rBoxes, nCnt, bSameHeight ) :
243 [ + - ]: 2 : OldSplitRow( pDoc, rBoxes, nCnt, bSameHeight );
244 : : }
245 : : bool PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
246 : : SwSelBoxes& rMerged, SwTableBox** ppMergeBox, SwUndoTblMerge* pUndo );
247 : : void ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax ) const;
248 : : void PrepareDeleteCol( long nMin, long nMax );
249 : :
250 : : sal_Bool InsertCol( SwDoc*, const SwSelBoxes& rBoxes,
251 : : sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
252 : : sal_Bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
253 : : sal_uInt16 nCnt = 1, sal_Bool bBehind = sal_True );
254 : : sal_Bool AppendRow( SwDoc* pDoc, sal_uInt16 nCnt = 1 );
255 : : void PrepareDelBoxes( const SwSelBoxes& rBoxes );
256 : : sal_Bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged,
257 : : SwUndo* pUndo, const sal_Bool bDelMakeFrms, const sal_Bool bCorrBorder );
258 : : sal_Bool SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt=1 );
259 : : sal_Bool Merge( const SwSelBoxes& rBoxes,
260 : : SwTableBox* pMergeBox, SwUndoTblMerge* = 0 );
261 : :
262 : 12 : void FindSuperfluousRows( SwSelBoxes& rBoxes )
263 : 12 : { _FindSuperfluousRows( rBoxes, 0, 0 ); }
264 : : void CheckRowSpan( SwTableLine* &rpLine, bool bUp ) const;
265 : :
266 : 18557 : SwTableSortBoxes& GetTabSortBoxes() { return aSortCntBoxes; }
267 : 4071 : const SwTableSortBoxes& GetTabSortBoxes() const { return aSortCntBoxes; }
268 : :
269 : : // Read 1st number and delete it from string (used by GetTblBox and SwTblFld).
270 : :
271 : : // #i80314#
272 : : // add 3rd parameter in order to control validation check on <rStr>
273 : : static sal_uInt16 _GetBoxNum( String& rStr,
274 : : sal_Bool bFirst = sal_False,
275 : : const bool bPerformValidCheck = false );
276 : :
277 : : // Search content-bearing box with that name.
278 : :
279 : : // #i80314#
280 : : // add 2nd parameter in order to control validation check in called method
281 : : // <_GetBoxNum(..)>
282 : : const SwTableBox* GetTblBox( const String& rName,
283 : : const bool bPerformValidCheck = false ) const;
284 : : // Copy selected boxes to another document.
285 : : sal_Bool MakeCopy( SwDoc*, const SwPosition&, const SwSelBoxes&,
286 : : sal_Bool bCpyNds = sal_True, sal_Bool bCpyName = sal_False ) const;
287 : : // Copy table in this (implemented in TBLRWCL.CXX).
288 : : sal_Bool InsTable( const SwTable& rCpyTbl, const SwNodeIndex&,
289 : : SwUndoTblCpyTbl* pUndo = 0 );
290 : : sal_Bool InsTable( const SwTable& rCpyTbl, const SwSelBoxes&,
291 : : SwUndoTblCpyTbl* pUndo = 0 );
292 : : sal_Bool InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes&,
293 : : SwUndoTblCpyTbl* pUndo );
294 : : // Copy headline of table (with content!) into an other one.
295 : : sal_Bool CopyHeadlineIntoTable( SwTableNode& rTblNd );
296 : :
297 : : // Get box, whose start index is set on nBoxStt.
298 : : SwTableBox* GetTblBox( sal_uLong nSttIdx );
299 : 789 : const SwTableBox* GetTblBox( sal_uLong nSttIdx ) const
300 : 789 : { return ((SwTable*)this)->GetTblBox( nSttIdx ); }
301 : :
302 : : // Returns sal_True if table contains nestings.
303 : : sal_Bool IsTblComplex() const;
304 : :
305 : : // Returns sal_True if table or selection is balanced.
306 : : sal_Bool IsTblComplexForChart( const String& rSel ) const;
307 : :
308 : : // Search all content-bearing boxes of the base line on which this box stands.
309 : : // rBoxes as a return value for immediate use.
310 : : // steht. rBoxes auch als Return-Wert, um es gleich weiter zu benutzen
311 : : // bToTop = sal_True -> up to base line, sal_False-> else only line of box.
312 : : SwSelBoxes& SelLineFromBox( const SwTableBox* pBox,
313 : : SwSelBoxes& rBoxes, sal_Bool bToTop = sal_True ) const;
314 : :
315 : : // Get information from client.
316 : : virtual sal_Bool GetInfo( SfxPoolItem& ) const;
317 : :
318 : : // Search in format for registered table.
319 : : static SwTable * FindTable( SwFrmFmt const*const pFmt );
320 : :
321 : : // Clean up structure a bit.
322 : : void GCLines();
323 : :
324 : : // Returns the table node via aSortCntBoxes or pTableNode.
325 : : SwTableNode* GetTableNode() const;
326 : 6 : void SetTableNode( SwTableNode* pNode ) { pTableNode = pNode; }
327 : :
328 : : // Data server methods.
329 : : void SetRefObject( SwServerObject* );
330 : : const SwServerObject* GetObject() const { return &refObj; }
331 : 0 : SwServerObject* GetObject() { return &refObj; }
332 : :
333 : : // Fill data for chart.
334 : : void UpdateCharts() const;
335 : :
336 : 3 : TblChgMode GetTblChgMode() const { return eTblChgMode; }
337 : 3 : void SetTblChgMode( TblChgMode eMode ) { eTblChgMode = eMode; }
338 : :
339 : : sal_Bool SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
340 : : SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo );
341 : : sal_Bool SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
342 : : SwTwips nAbsDiff, SwTwips nRelDiff, SwUndo** ppUndo );
343 : : void RegisterToFormat( SwFmt& rFmt );
344 : : #ifdef DBG_UTIL
345 : : void CheckConsistency() const;
346 : : #endif
347 : :
348 : : bool HasLayout() const;
349 : : };
350 : :
351 : : class SW_DLLPUBLIC SwTableLine: public SwClient // Client of FrmFmt.
352 : : {
353 : : SwTableBoxes aBoxes;
354 : : SwTableBox *pUpper;
355 : :
356 : : public:
357 : : TYPEINFO();
358 : :
359 : : SwTableLine() : pUpper(0) {}
360 : :
361 : : SwTableLine( SwTableLineFmt*, sal_uInt16 nBoxes, SwTableBox *pUp );
362 : : virtual ~SwTableLine();
363 : :
364 : 18579 : SwTableBoxes &GetTabBoxes() { return aBoxes; }
365 : 9261 : const SwTableBoxes &GetTabBoxes() const { return aBoxes; }
366 : :
367 : 1182 : SwTableBox *GetUpper() { return pUpper; }
368 : 6805 : const SwTableBox *GetUpper() const { return pUpper; }
369 : 0 : void SetUpper( SwTableBox *pNew ) { pUpper = pNew; }
370 : :
371 : :
372 : 1102 : SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
373 : 1929 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
374 : :
375 : : // Creates a own FrmFmt if more lines depend on it.
376 : : SwFrmFmt* ClaimFrmFmt();
377 : : void ChgFrmFmt( SwTableLineFmt* pNewFmt );
378 : :
379 : : // Search next/previous box with content.
380 : : SwTableBox* FindNextBox( const SwTable&, const SwTableBox* =0,
381 : : sal_Bool bOvrTblLns=sal_True ) const;
382 : : SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* =0,
383 : : sal_Bool bOvrTblLns=sal_True ) const;
384 : :
385 : : SwTwips GetTableLineHeight( bool& bLayoutAvailable ) const;
386 : :
387 : : bool hasSoftPageBreak() const;
388 : : void RegisterToFormat( SwFmt& rFmt );
389 : : };
390 : :
391 : : class SW_DLLPUBLIC SwTableBox: public SwClient //Client of FrmFmt.
392 : : {
393 : : friend class SwNodes; // Transpose index.
394 : : friend void DelBoxNode(SwTableSortBoxes&); // Delete StartNode* !
395 : : friend class SwXMLTableContext;
396 : :
397 : : // Not implemented (any more).
398 : : SwTableBox( const SwTableBox & );
399 : : SwTableBox &operator=( const SwTableBox &); // Does not exist.
400 : :
401 : : SwTableLines aLines;
402 : : const SwStartNode * pSttNd;
403 : : SwTableLine *pUpper;
404 : : SwTableBox_Impl* pImpl;
405 : :
406 : : // In case Format contains formulas/values already,
407 : : // a new one must be created for the new box.
408 : : SwTableBoxFmt* CheckBoxFmt( SwTableBoxFmt* );
409 : :
410 : : public:
411 : : TYPEINFO();
412 : :
413 : : SwTableBox() : pSttNd(0), pUpper(0), pImpl(0) {}
414 : :
415 : : SwTableBox( SwTableBoxFmt*, sal_uInt16 nLines, SwTableLine *pUp = 0 );
416 : : SwTableBox( SwTableBoxFmt*, const SwStartNode&, SwTableLine *pUp = 0 );
417 : : SwTableBox( SwTableBoxFmt*, const SwNodeIndex&, SwTableLine *pUp = 0 );
418 : : virtual ~SwTableBox();
419 : :
420 : 3028 : SwTableLines &GetTabLines() { return aLines; }
421 : 482 : const SwTableLines &GetTabLines() const { return aLines; }
422 : :
423 : 1235 : SwTableLine *GetUpper() { return pUpper; }
424 : 7830 : const SwTableLine *GetUpper() const { return pUpper; }
425 : 3 : void SetUpper( SwTableLine *pNew ) { pUpper = pNew; }
426 : :
427 : 27474 : SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); }
428 : 7356 : SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
429 : :
430 : : // Creates its own FrmFmt if more boxes depend on it.
431 : : SwFrmFmt* ClaimFrmFmt();
432 : : void ChgFrmFmt( SwTableBoxFmt *pNewFmt );
433 : :
434 : 16149 : const SwStartNode *GetSttNd() const { return pSttNd; }
435 : : sal_uLong GetSttIdx() const;
436 : :
437 : : // Search next/previous box with content.
438 : : SwTableBox* FindNextBox( const SwTable&, const SwTableBox* =0,
439 : : sal_Bool bOvrTblLns=sal_True ) const;
440 : : SwTableBox* FindPreviousBox( const SwTable&, const SwTableBox* =0,
441 : : sal_Bool bOvrTblLns=sal_True ) const;
442 : : // Return name of this box. It is determined dynamically and
443 : : // is calculated from the position in the lines/boxes/table.
444 : : String GetName() const;
445 : : // Return "value" of box (for calculating in table).
446 : : double GetValue( SwTblCalcPara& rPara ) const;
447 : :
448 : : sal_Bool IsInHeadline( const SwTable* pTbl = 0 ) const;
449 : :
450 : : // Contains box contents, that can be formated as a number?
451 : : sal_Bool HasNumCntnt( double& rNum, sal_uInt32& rFmtIndex,
452 : : sal_Bool& rIsEmptyTxtNd ) const;
453 : : sal_uLong IsValidNumTxtNd( sal_Bool bCheckAttr = sal_True ) const;
454 : : // If a table formula is set, test if box contents is congruent with number.
455 : : // (For Redo of change of NumFormat!).
456 : : sal_Bool IsNumberChanged() const;
457 : :
458 : : // Is that a formula box or a box with numeric contents (AutoSum)?
459 : : // What it is is indicated by the return value - the WhichId of the attribute.
460 : : // Empty boxes have the return value USHRT_MAX !!
461 : : sal_uInt16 IsFormulaOrValueBox() const;
462 : :
463 : : // Loading of a document requires an actualisation of cells with values
464 : : void ActualiseValueBox();
465 : :
466 [ + - ][ + - ]: 4624 : DECL_FIXEDMEMPOOL_NEWDEL(SwTableBox)
467 : :
468 : : // Access on internal data - currently used for the NumFormatter.
469 : : inline const Color* GetSaveUserColor() const;
470 : : inline const Color* GetSaveNumFmtColor() const;
471 : : inline void SetSaveUserColor(const Color* p );
472 : : inline void SetSaveNumFmtColor( const Color* p );
473 : :
474 : : long getRowSpan() const;
475 : : void setRowSpan( long nNewRowSpan );
476 : : bool getDummyFlag() const;
477 : : void setDummyFlag( bool bDummy );
478 : :
479 : : SwTableBox& FindStartOfRowSpan( const SwTable&, sal_uInt16 nMaxStep = USHRT_MAX );
480 : 0 : const SwTableBox& FindStartOfRowSpan( const SwTable& rTable,
481 : : sal_uInt16 nMaxStep = USHRT_MAX ) const
482 : 0 : { return const_cast<SwTableBox*>(this)->FindStartOfRowSpan( rTable, nMaxStep ); }
483 : :
484 : : SwTableBox& FindEndOfRowSpan( const SwTable&, sal_uInt16 nMaxStep = USHRT_MAX );
485 : 0 : const SwTableBox& FindEndOfRowSpan( const SwTable& rTable,
486 : : sal_uInt16 nMaxStep = USHRT_MAX ) const
487 : 0 : { return const_cast<SwTableBox*>(this)->FindEndOfRowSpan( rTable, nMaxStep ); }
488 : : void RegisterToFormat( SwFmt& rFmt ) ;
489 : : void ForgetFrmFmt();
490 : : };
491 : :
492 : : class SwCellFrm;
493 : : class SW_DLLPUBLIC SwTableCellInfo : public ::boost::noncopyable
494 : : {
495 : : struct Impl;
496 : : ::std::auto_ptr<Impl> m_pImpl;
497 : :
498 : : const SwCellFrm * getCellFrm() const ;
499 : :
500 : : public:
501 : : SwTableCellInfo(const SwTable * pTable);
502 : : ~SwTableCellInfo();
503 : :
504 : : bool getNext();
505 : : SwRect getRect() const;
506 : : const SwTableBox * getTableBox() const;
507 : : };
508 : :
509 : : #endif //_SWTABLE_HXX
510 : :
511 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|