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 SC_TABLE_HXX
21 : #define SC_TABLE_HXX
22 :
23 : #include <vector>
24 : #include <utility>
25 : #include <tools/gen.hxx>
26 : #include <tools/color.hxx>
27 : #include <com/sun/star/uno/Sequence.hxx>
28 : #include "column.hxx"
29 : #include "sortparam.hxx"
30 : #include "compressedarray.hxx"
31 : #include "postit.hxx"
32 :
33 : #include <set>
34 : #include <map>
35 : #include <boost/scoped_ptr.hpp>
36 : #include <boost/noncopyable.hpp>
37 :
38 : namespace utl {
39 : class TextSearch;
40 : }
41 :
42 : namespace com { namespace sun { namespace star {
43 : namespace sheet {
44 : struct TablePageBreakData;
45 : }
46 : } } }
47 :
48 : class SfxItemSet;
49 : class SfxStyleSheetBase;
50 : class SvxBoxInfoItem;
51 : class SvxBoxItem;
52 : class SvxSearchItem;
53 :
54 : class ScAutoFormatData;
55 : class ScBaseCell;
56 : class ScDocument;
57 : class ScEditDataArray;
58 : class ScFormulaCell;
59 : class ScOutlineTable;
60 : class ScPrintSaverTab;
61 : class ScProgress;
62 : class ScRangeList;
63 : class ScSheetEvents;
64 : class ScSortInfoArray;
65 : class ScConditionalFormat;
66 : class ScConditionalFormatList;
67 : class ScStyleSheet;
68 : class ScTableProtection;
69 : class ScUserListData;
70 : struct RowInfo;
71 : struct ScFunctionData;
72 : struct ScLineFlags;
73 : class CollatorWrapper;
74 : class ScFlatUInt16RowSegments;
75 : class ScFlatBoolRowSegments;
76 : class ScFlatBoolColSegments;
77 : struct ScSetStringParam;
78 : struct ScColWidthParam;
79 : struct ScColWidthParam;
80 : class ScRangeName;
81 : class ScDBData;
82 :
83 : class ScTable : boost::noncopyable
84 : {
85 : private:
86 : typedef ::std::vector< ScRange > ScRangeVec;
87 : typedef ::std::pair< SCCOL, SCROW > ScAddress2D;
88 : typedef ::std::vector< ScAddress2D > ScAddress2DVec;
89 :
90 : ScColumn aCol[MAXCOLCOUNT];
91 :
92 : rtl::OUString aName;
93 : rtl::OUString aCodeName;
94 : rtl::OUString aComment;
95 :
96 : rtl::OUString aLinkDoc;
97 : rtl::OUString aLinkFlt;
98 : rtl::OUString aLinkOpt;
99 : rtl::OUString aLinkTab;
100 : sal_uLong nLinkRefreshDelay;
101 : sal_uInt8 nLinkMode;
102 :
103 : // page style template
104 : rtl::OUString aPageStyle;
105 : Size aPageSizeTwips; // size of the print-page
106 : SCCOL nRepeatStartX; // repeating rows/columns
107 : SCCOL nRepeatEndX; // REPEAT_NONE, if not used
108 : SCROW nRepeatStartY;
109 : SCROW nRepeatEndY;
110 :
111 : boost::scoped_ptr<ScTableProtection> pTabProtection;
112 :
113 : sal_uInt16* pColWidth;
114 : boost::scoped_ptr<ScFlatUInt16RowSegments> mpRowHeights;
115 :
116 : sal_uInt8* pColFlags;
117 : ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags;
118 : boost::scoped_ptr<ScFlatBoolColSegments> mpHiddenCols;
119 : boost::scoped_ptr<ScFlatBoolRowSegments> mpHiddenRows;
120 : boost::scoped_ptr<ScFlatBoolColSegments> mpFilteredCols;
121 : boost::scoped_ptr<ScFlatBoolRowSegments> mpFilteredRows;
122 :
123 : ::std::set<SCROW> maRowPageBreaks;
124 : ::std::set<SCROW> maRowManualBreaks;
125 : ::std::set<SCCOL> maColPageBreaks;
126 : ::std::set<SCCOL> maColManualBreaks;
127 :
128 : ScOutlineTable* pOutlineTable;
129 :
130 : ScSheetEvents* pSheetEvents;
131 :
132 : mutable SCCOL nTableAreaX;
133 : mutable SCROW nTableAreaY;
134 :
135 : SCTAB nTab;
136 : ScDocument* pDocument;
137 : utl::TextSearch* pSearchText;
138 :
139 : mutable rtl::OUString aUpperName; // #i62977# filled only on demand, reset in SetName
140 :
141 : boost::scoped_ptr<ScAddress2DVec> mxUninitNotes;
142 :
143 : // sort parameter to minimize stack size of quicksort
144 : ScSortParam aSortParam;
145 : CollatorWrapper* pSortCollator;
146 :
147 : ScRangeVec aPrintRanges;
148 :
149 : ScRange* pRepeatColRange;
150 : ScRange* pRepeatRowRange;
151 :
152 : sal_uInt16 nLockCount;
153 :
154 : ScRangeList* pScenarioRanges;
155 : Color aScenarioColor;
156 : Color aTabBgColor;
157 : sal_uInt16 nScenarioFlags;
158 : ScDBData* pDBDataNoName;
159 : mutable ScRangeName* mpRangeName;
160 :
161 : boost::scoped_ptr<ScConditionalFormatList> mpCondFormatList;
162 :
163 : ScNotes maNotes;
164 :
165 : bool bScenario:1;
166 : bool bLayoutRTL:1;
167 : bool bLoadingRTL:1;
168 : bool bPageSizeValid:1;
169 : mutable bool bTableAreaValid:1;
170 : bool bVisible:1;
171 : bool bStreamValid:1;
172 : bool bPendingRowHeights:1;
173 : bool bCalcNotification:1;
174 : bool bGlobalKeepQuery:1;
175 : bool bPrintEntireSheet:1;
176 : bool bActiveScenario:1;
177 : bool mbPageBreaksValid:1;
178 :
179 : friend class ScDocument; // for FillInfo
180 : friend class ScDocumentIterator;
181 : friend class ScValueIterator;
182 : friend class ScHorizontalValueIterator;
183 : friend class ScDBQueryDataIterator;
184 : friend class ScCellIterator;
185 : friend class ScQueryCellIterator;
186 : friend class ScHorizontalCellIterator;
187 : friend class ScHorizontalAttrIterator;
188 : friend class ScDocAttrIterator;
189 : friend class ScAttrRectIterator;
190 :
191 :
192 : public:
193 : ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName,
194 : bool bColInfo = true, bool bRowInfo = true );
195 : ~ScTable();
196 :
197 281 : ScOutlineTable* GetOutlineTable() { return pOutlineTable; }
198 :
199 : SCSIZE GetCellCount(SCCOL nCol) const;
200 : sal_uLong GetCellCount() const;
201 : sal_uLong GetWeightedCount() const;
202 : sal_uLong GetCodeCount() const; // RPN code in formula
203 :
204 : bool SetOutlineTable( const ScOutlineTable* pNewOutline );
205 : void StartOutlineTable();
206 :
207 : void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
208 :
209 : bool TestRemoveSubTotals( const ScSubTotalParam& rParam );
210 : void RemoveSubTotals( ScSubTotalParam& rParam );
211 : bool DoSubTotals( ScSubTotalParam& rParam );
212 :
213 7747 : const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; }
214 : void SetSheetEvents( const ScSheetEvents* pNew );
215 :
216 160 : bool IsVisible() const { return bVisible; }
217 : void SetVisible( bool bVis );
218 :
219 37935 : bool IsStreamValid() const { return bStreamValid; }
220 : void SetStreamValid( bool bSet, bool bIgnoreLock = false );
221 :
222 72 : bool IsPendingRowHeights() const { return bPendingRowHeights; }
223 : void SetPendingRowHeights( bool bSet );
224 :
225 0 : bool GetCalcNotification() const { return bCalcNotification; }
226 : void SetCalcNotification( bool bSet );
227 :
228 943 : bool IsLayoutRTL() const { return bLayoutRTL; }
229 53 : bool IsLoadingRTL() const { return bLoadingRTL; }
230 : void SetLayoutRTL( bool bSet );
231 : void SetLoadingRTL( bool bSet );
232 :
233 5168 : bool IsScenario() const { return bScenario; }
234 : void SetScenario( bool bFlag );
235 0 : void GetScenarioComment( rtl::OUString& rComment) const { rComment = aComment; }
236 0 : void SetScenarioComment( const rtl::OUString& rComment ) { aComment = rComment; }
237 0 : const Color& GetScenarioColor() const { return aScenarioColor; }
238 0 : void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; }
239 : const Color& GetTabBgColor() const;
240 : void SetTabBgColor(const Color& rColor);
241 0 : sal_uInt16 GetScenarioFlags() const { return nScenarioFlags; }
242 0 : void SetScenarioFlags(sal_uInt16 nNew) { nScenarioFlags = nNew; }
243 0 : void SetActiveScenario(bool bSet) { bActiveScenario = bSet; }
244 0 : bool IsActiveScenario() const { return bActiveScenario; }
245 :
246 3 : sal_uInt8 GetLinkMode() const { return nLinkMode; }
247 125 : bool IsLinked() const { return nLinkMode != SC_LINK_NONE; }
248 0 : const rtl::OUString& GetLinkDoc() const { return aLinkDoc; }
249 0 : const rtl::OUString& GetLinkFlt() const { return aLinkFlt; }
250 0 : const rtl::OUString& GetLinkOpt() const { return aLinkOpt; }
251 0 : const rtl::OUString& GetLinkTab() const { return aLinkTab; }
252 0 : sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; }
253 :
254 : void SetLink( sal_uInt8 nMode, const String& rDoc, const String& rFlt,
255 : const String& rOpt, const String& rTab, sal_uLong nRefreshDelay );
256 :
257 : void GetName( rtl::OUString& rName ) const;
258 : void SetName( const rtl::OUString& rNewName );
259 :
260 : void SetAnonymousDBData(ScDBData* pDBData);
261 : ScDBData* GetAnonymousDBData();
262 :
263 10 : void GetCodeName( rtl::OUString& rName ) const { rName = aCodeName; }
264 174 : void SetCodeName( const rtl::OUString& rNewName ) { aCodeName = rNewName; }
265 :
266 : const rtl::OUString& GetUpperName() const;
267 :
268 3360 : const rtl::OUString& GetPageStyle() const { return aPageStyle; }
269 : void SetPageStyle( const rtl::OUString& rName );
270 : void PageStyleModified( const String& rNewName );
271 :
272 : bool IsProtected() const;
273 : void SetProtection(const ScTableProtection* pProtect);
274 : ScTableProtection* GetProtection();
275 :
276 : Size GetPageSize() const;
277 : void SetPageSize( const Size& rSize );
278 : void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow );
279 :
280 : void RemoveAutoSpellObj();
281 :
282 : void LockTable();
283 : void UnlockTable();
284 :
285 : bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
286 : SCROW nRow2, bool* pOnlyNotBecauseOfMatrix = NULL ) const;
287 : bool IsSelectionEditable( const ScMarkData& rMark,
288 : bool* pOnlyNotBecauseOfMatrix = NULL ) const;
289 :
290 : bool HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const;
291 : bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const;
292 :
293 : bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const;
294 :
295 : void PutCell( const ScAddress&, ScBaseCell* pCell );
296 : void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell );
297 : void PutCell(SCCOL nCol, SCROW nRow, sal_uLong nFormatIndex, ScBaseCell* pCell);
298 : // TRUE = numberformat set
299 : bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString,
300 : ScSetStringParam* pParam = NULL );
301 : void SetValue( SCCOL nCol, SCROW nRow, const double& rVal );
302 : void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError);
303 :
304 : void GetString( SCCOL nCol, SCROW nRow, rtl::OUString& rString ) const;
305 : void GetInputString( SCCOL nCol, SCROW nRow, rtl::OUString& rString ) const;
306 348 : double GetValue( const ScAddress& rPos ) const
307 : {
308 348 : return ValidColRow(rPos.Col(),rPos.Row()) ?
309 348 : aCol[rPos.Col()].GetValue( rPos.Row() ) :
310 696 : 0.0;
311 : }
312 : double GetValue( SCCOL nCol, SCROW nRow ) const;
313 : void GetFormula( SCCOL nCol, SCROW nRow, rtl::OUString& rFormula );
314 :
315 434 : CellType GetCellType( const ScAddress& rPos ) const
316 : {
317 434 : return ValidColRow(rPos.Col(),rPos.Row()) ?
318 434 : aCol[rPos.Col()].GetCellType( rPos.Row() ) :
319 868 : CELLTYPE_NONE;
320 : }
321 : CellType GetCellType( SCCOL nCol, SCROW nRow ) const;
322 7325 : ScBaseCell* GetCell( const ScAddress& rPos ) const
323 : {
324 7325 : return ValidColRow(rPos.Col(),rPos.Row()) ?
325 7325 : aCol[rPos.Col()].GetCell( rPos.Row() ) :
326 14650 : NULL;
327 : }
328 : ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const;
329 :
330 : void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
331 : void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
332 :
333 : ScNotes* GetNotes();
334 : /** Creates the captions of all uninitialized cell notes.
335 : @param bForced True = always create all captions, false = skip when Undo is disabled. */
336 : void InitializeNoteCaptions( bool bForced = false );
337 :
338 : bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ) const;
339 : void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
340 : void DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
341 : bool* pUndoOutline = NULL );
342 :
343 : bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const;
344 : void InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
345 : void DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
346 : bool* pUndoOutline = NULL );
347 :
348 : void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
349 : void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
350 : bool bKeepScenarioFlags, bool bCloneNoteCaptions);
351 : void CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
352 : bool bKeepScenarioFlags, bool bCloneNoteCaptions);
353 : void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
354 : sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScTable* pTable);
355 : void StartListeningInArea( SCCOL nCol1, SCROW nRow1,
356 : SCCOL nCol2, SCROW nRow2 );
357 : void BroadcastInArea( SCCOL nCol1, SCROW nRow1,
358 : SCCOL nCol2, SCROW nRow2 );
359 :
360 : void CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
361 : sal_uInt16 nFlags, bool bMarked, ScTable* pDestTab,
362 : const ScMarkData* pMarkData = NULL,
363 : bool bAsLink = false, bool bColRowFlags = true);
364 : void UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
365 : sal_uInt16 nFlags, bool bMarked, ScTable* pDestTab,
366 : const ScMarkData* pMarkData = NULL);
367 :
368 : void CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
369 : SCsCOL nDx, SCsROW nDy, ScTable* pTable);
370 : void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
371 : ScTable* pTransClip, sal_uInt16 nFlags, bool bAsLink );
372 :
373 : // mark of this document
374 : void MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction,
375 : bool bSkipEmpty, ScTable* pSrcTab );
376 : void MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
377 : sal_uInt16 nFunction, bool bSkipEmpty, ScTable* pSrcTab );
378 :
379 : void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
380 : SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
381 :
382 : void CopyScenarioFrom( const ScTable* pSrcTab );
383 : void CopyScenarioTo( ScTable* pDestTab ) const;
384 : bool TestCopyScenarioTo( const ScTable* pDestTab ) const;
385 : void MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
386 : bool HasScenarioRange( const ScRange& rRange ) const;
387 : void InvalidateScenarioRanges();
388 : const ScRangeList* GetScenarioRanges() const;
389 :
390 : void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
391 :
392 : void InvalidateTableArea();
393 : void InvalidatePageBreaks();
394 :
395 : bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty
396 : bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
397 : bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bFullFormattedArea = false ) const;
398 : bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
399 : SCCOL& rEndCol, bool bNotes ) const;
400 : bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
401 : SCROW& rEndRow, bool bNotes ) const;
402 :
403 : bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
404 :
405 : void ExtendPrintArea( OutputDevice* pDev,
406 : SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
407 :
408 : void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
409 : bool bIncludeOld, bool bOnlyDown ) const;
410 :
411 : bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
412 : SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
413 :
414 : SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
415 : SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const;
416 :
417 : void FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection ) const;
418 : void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
419 : bool bMarked, bool bUnprotected, const ScMarkData& rMark ) const;
420 :
421 : void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const;
422 :
423 : bool HasData( SCCOL nCol, SCROW nRow ) const;
424 : bool HasStringData( SCCOL nCol, SCROW nRow ) const;
425 : bool HasValueData( SCCOL nCol, SCROW nRow ) const;
426 : bool HasStringCells( SCCOL nStartCol, SCROW nStartRow,
427 : SCCOL nEndCol, SCROW nEndRow ) const;
428 :
429 410 : sal_uInt16 GetErrCode( const ScAddress& rPos ) const
430 : {
431 410 : return ValidColRow(rPos.Col(),rPos.Row()) ?
432 410 : aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
433 820 : 0;
434 : }
435 :
436 : void ResetChanged( const ScRange& rRange );
437 :
438 : void SetDirty();
439 : void SetDirty( const ScRange& );
440 : void SetDirtyAfterLoad();
441 : void SetDirtyVar();
442 : void SetTableOpDirty( const ScRange& );
443 : void CalcAll();
444 : void CalcAfterLoad();
445 : void CompileAll();
446 : void CompileXML( ScProgress& rProgress );
447 :
448 : void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
449 : SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
450 : SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
451 : ScDocument* pUndoDoc = NULL, bool bIncludeDraw = true, bool bUpdateNoteCaptionPos = true );
452 :
453 : void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
454 : SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
455 : SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
456 :
457 : void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
458 : ScDocument* pUndoDoc );
459 :
460 : void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
461 :
462 : void UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets = 1);
463 : void UpdateDeleteTab( SCTAB nTable, bool bIsMove, ScTable* pRefUndo = NULL, SCTAB nSheets = 1 );
464 : void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress* pProgress );
465 : void UpdateCompile( bool bForceIfNameInUse = false );
466 : void SetTabNo(SCTAB nNewTab);
467 : void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
468 : std::set<sal_uInt16>& rIndexes) const;
469 : void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
470 : sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
471 : double nStepValue, double nMaxValue, ScProgress* pProgress);
472 : String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
473 :
474 : void UpdateSelectionFunction( ScFunctionData& rData,
475 : SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
476 : const ScMarkData& rMark );
477 :
478 : void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
479 : sal_uInt16 nFormatNo );
480 : void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
481 : void ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // from sw
482 : bool SearchAndReplace(
483 : const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark,
484 : ScRangeList& rMatchedRanges, rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
485 :
486 : void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
487 :
488 : void GetBorderLines( SCCOL nCol, SCROW nRow,
489 : const ::editeng::SvxBorderLine** ppLeft, const ::editeng::SvxBorderLine** ppTop,
490 : const ::editeng::SvxBorderLine** ppRight, const ::editeng::SvxBorderLine** ppBottom ) const;
491 :
492 : bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
493 : bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
494 : bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
495 : SCCOL& rEndCol, SCROW& rEndRow,
496 : bool bRefresh );
497 : const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
498 : const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
499 : const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
500 :
501 5700 : sal_uLong GetNumberFormat( const ScAddress& rPos ) const
502 : {
503 5700 : return ValidColRow(rPos.Col(),rPos.Row()) ?
504 5700 : aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
505 11400 : 0;
506 : }
507 : sal_uLong GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
508 : sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
509 : void MergeSelectionPattern( ScMergePatternState& rState,
510 : const ScMarkData& rMark, bool bDeep ) const;
511 : void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
512 : SCCOL nCol2, SCROW nRow2, bool bDeep ) const;
513 : void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
514 : ScLineFlags& rFlags,
515 : SCCOL nStartCol, SCROW nStartRow,
516 : SCCOL nEndCol, SCROW nEndRow ) const;
517 : void ApplyBlockFrame( const SvxBoxItem* pLineOuter,
518 : const SvxBoxInfoItem* pLineInner,
519 : SCCOL nStartCol, SCROW nStartRow,
520 : SCCOL nEndCol, SCROW nEndRow );
521 :
522 : void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
523 : void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
524 : void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
525 : const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL );
526 : bool SetAttrEntries(SCCOL nCol, ScAttrEntry* pData, SCSIZE nSize);
527 :
528 0 : void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, bool bPutToPool = false )
529 : {
530 0 : if (ValidColRow(rPos.Col(),rPos.Row()))
531 0 : aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
532 0 : }
533 : void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, bool bPutToPool = false );
534 : void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
535 : const ScPatternAttr& rPattern, short nNewType );
536 : void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
537 : void RemoveCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
538 :
539 : void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
540 : void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
541 : void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
542 : void ApplySelectionLineStyle( const ScMarkData& rMark,
543 : const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
544 :
545 : const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
546 : const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
547 : const ScStyleSheet* GetAreaStyle( bool& rFound, SCCOL nCol1, SCROW nRow1,
548 : SCCOL nCol2, SCROW nRow2 ) const;
549 :
550 : void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRemoved,
551 : OutputDevice* pDev,
552 : double nPPTX, double nPPTY,
553 : const Fraction& rZoomX, const Fraction& rZoomY );
554 :
555 : bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
556 :
557 : bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
558 : bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
559 :
560 : void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
561 : void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
562 :
563 : void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
564 : void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
565 :
566 74 : const ScRange* GetRepeatColRange() const { return pRepeatColRange; }
567 74 : const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; }
568 : void SetRepeatColRange( const ScRange* pNew );
569 : void SetRepeatRowRange( const ScRange* pNew );
570 :
571 209 : sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
572 : const ScRange* GetPrintRange(sal_uInt16 nPos) const;
573 : /** Returns true, if the sheet is always printed. */
574 141 : bool IsPrintEntireSheet() const { return bPrintEntireSheet; }
575 :
576 : /** Removes all print ranges. */
577 : void ClearPrintRanges();
578 : /** Adds a new print ranges. */
579 : void AddPrintRange( const ScRange& rNew );
580 : /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
581 : void SetPrintEntireSheet();
582 :
583 : void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
584 : void RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
585 :
586 : sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
587 : double nPPTX, double nPPTY,
588 : const Fraction& rZoomX, const Fraction& rZoomY,
589 : bool bFormula, const ScMarkData* pMarkData,
590 : const ScColWidthParam* pParam );
591 : bool SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
592 : OutputDevice* pDev,
593 : double nPPTX, double nPPTY,
594 : const Fraction& rZoomX, const Fraction& rZoomY,
595 : bool bForce,
596 : ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
597 :
598 : void SetOptimalHeightOnly(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
599 : OutputDevice* pDev,
600 : double nPPTX, double nPPTY,
601 : const Fraction& rZoomX, const Fraction& rZoomY,
602 : bool bForce,
603 : ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
604 :
605 : long GetNeededSize( SCCOL nCol, SCROW nRow,
606 : OutputDevice* pDev,
607 : double nPPTX, double nPPTY,
608 : const Fraction& rZoomX, const Fraction& rZoomY,
609 : bool bWidth, bool bTotalSize );
610 : void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
611 : void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth );
612 : void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
613 : bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
614 : double nPPTX, double nPPTY );
615 :
616 : /**
617 : * Set specified row height to specified ranges. Don't check for drawing
618 : * objects etc. Just set the row height. Nothing else.
619 : *
620 : * Note that setting a new row height via this function will not
621 : * invalidate page breaks.
622 : */
623 : void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
624 :
625 : // nPPT to test for modification
626 : void SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual );
627 :
628 : sal_uInt16 GetColWidth( SCCOL nCol ) const;
629 : SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
630 : sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const;
631 : sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
632 : sal_uLong GetColOffset( SCCOL nCol ) const;
633 : sal_uLong GetRowOffset( SCROW nRow ) const;
634 :
635 : /**
636 : * Get the last row such that the height of row 0 to the end row is as
637 : * high as possible without exceeding the specified height value.
638 : *
639 : * @param nHeight maximum desired height
640 : *
641 : * @return SCROW last row of the range within specified height.
642 : */
643 : SCROW GetRowForHeight(sal_uLong nHeight) const;
644 :
645 : sal_uInt16 GetOriginalWidth( SCCOL nCol ) const;
646 : sal_uInt16 GetOriginalHeight( SCROW nRow ) const;
647 :
648 : sal_uInt16 GetCommonWidth( SCCOL nEndCol ) const;
649 :
650 : SCROW GetHiddenRowCount( SCROW nRow ) const;
651 :
652 : void ShowCol(SCCOL nCol, bool bShow);
653 : void ShowRow(SCROW nRow, bool bShow);
654 : void DBShowRow(SCROW nRow, bool bShow);
655 :
656 : void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
657 : void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
658 :
659 : void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
660 : void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
661 :
662 : /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
663 : SCROW GetLastFlaggedRow() const;
664 :
665 : /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
666 : SCCOL GetLastChangedCol() const;
667 : /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
668 : SCROW GetLastChangedRow() const;
669 :
670 : bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const;
671 : bool IsDataFiltered(const ScRange& rRange) const;
672 : sal_uInt8 GetColFlags( SCCOL nCol ) const;
673 : sal_uInt8 GetRowFlags( SCROW nRow ) const;
674 :
675 2 : const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
676 2 : { return pRowFlags; }
677 :
678 : bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow );
679 : bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, bool bShow );
680 :
681 : void UpdatePageBreaks( const ScRange* pUserArea );
682 : void RemoveManualBreaks();
683 : bool HasManualBreaks() const;
684 : void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
685 : void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
686 :
687 : void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
688 : void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
689 : bool HasRowPageBreak(SCROW nRow) const;
690 : bool HasColPageBreak(SCCOL nCol) const;
691 : bool HasRowManualBreak(SCROW nRow) const;
692 : bool HasColManualBreak(SCCOL nCol) const;
693 :
694 : /**
695 : * Get the row position of the next manual break that occurs at or below
696 : * specified row. When no more manual breaks are present at or below
697 : * the specified row, -1 is returned.
698 : *
699 : * @param nRow row at which the search begins.
700 : *
701 : * @return SCROW next row position with manual page break, or -1 if no
702 : * more manual breaks are present.
703 : */
704 : SCROW GetNextManualBreak(SCROW nRow) const;
705 :
706 : void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
707 : void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
708 : void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
709 : void SetRowBreak(SCROW nRow, bool bPage, bool bManual);
710 : void SetColBreak(SCCOL nCol, bool bPage, bool bManual);
711 : ::com::sun::star::uno::Sequence<
712 : ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
713 :
714 : bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
715 : bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
716 : bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
717 : bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
718 : bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
719 : bool SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
720 : void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
721 : void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
722 : void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
723 : SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
724 : SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
725 : SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
726 : sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
727 :
728 : SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
729 :
730 : bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
731 : bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
732 : bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
733 : void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
734 : void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
735 : void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
736 : void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
737 : SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
738 : SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
739 : SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
740 :
741 : bool IsManualRowHeight(SCROW nRow) const;
742 :
743 : void SyncColRowFlags();
744 :
745 : void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
746 : void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
747 :
748 : void Sort(const ScSortParam& rSortParam, bool bKeepQuery, ScProgress* pProgress);
749 : bool ValidQuery(
750 : SCROW nRow, const ScQueryParam& rQueryParam, ScBaseCell* pCell = NULL,
751 : bool* pbTestEqualCondition = NULL);
752 : void TopTenQuery( ScQueryParam& );
753 : SCSIZE Query(ScQueryParam& rQueryParam, bool bKeepSub);
754 : bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
755 :
756 : void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, std::vector<ScTypedStrData>& rStrings, bool& rHasDates);
757 : void GetFilteredFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
758 : bool GetDataEntries(SCCOL nCol, SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit);
759 :
760 : bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
761 : bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) const;
762 :
763 : void DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
764 :
765 :
766 : sal_Int32 GetMaxStringLen( SCCOL nCol,
767 : SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
768 : xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision,
769 : SCCOL nCol,
770 : SCROW nRowStart, SCROW nRowEnd ) const;
771 :
772 : bool IsSortCollatorGlobal() const;
773 : void InitSortCollator( const ScSortParam& rPar );
774 : void DestroySortCollator();
775 : void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
776 :
777 : void SetRangeName(ScRangeName* pNew);
778 : ScRangeName* GetRangeName() const;
779 : void UpdateMoveTab(SCTAB nOldPos,SCTAB nNewPos);
780 :
781 : ScConditionalFormatList* GetCondFormList();
782 : const ScConditionalFormatList* GetCondFormList() const;
783 : void SetCondFormList( ScConditionalFormatList* pList );
784 :
785 : void DeleteConditionalFormat(sal_uLong nOldIndex);
786 :
787 : sal_uLong AddCondFormat( ScConditionalFormat* pNew );
788 :
789 : private:
790 : void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
791 : sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
792 : FillDateCmd eFillDateCmd,
793 : double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
794 : bool bAttribs, ScProgress* pProgress );
795 : void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
796 : FillCmd& rCmd, FillDateCmd& rDateCmd,
797 : double& rInc, sal_uInt16& rMinDigits,
798 : ScUserListData*& rListData, sal_uInt16& rListIndex);
799 : void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
800 : sal_uLong nFillCount, FillDir eFillDir, ScProgress* pProgress );
801 :
802 : bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
803 : bool bMarked, bool bUnprotected ) const;
804 :
805 : void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
806 : const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
807 : void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
808 : void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
809 : bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
810 : const ScMarkData& rMark, rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
811 : bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
812 : const ScMarkData& rMark, rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
813 : bool SearchAll(const SvxSearchItem& rSearchItem, const ScMarkData& rMark,
814 : ScRangeList& rMatchedRanges, rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
815 : bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
816 : const ScMarkData& rMark, rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
817 : bool ReplaceAll(
818 : const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
819 : rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
820 :
821 : bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
822 : const ScMarkData& rMark);
823 : bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
824 : const ScMarkData& rMark, bool bIsUndo);
825 : bool SearchAllStyle(
826 : const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges);
827 : bool ReplaceAllStyle(
828 : const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
829 : ScDocument* pUndoDoc);
830 : bool SearchAndReplaceEmptyCells(
831 : const SvxSearchItem& rSearchItem,
832 : SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark, ScRangeList& rMatchedRanges,
833 : rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
834 : bool SearchRangeForEmptyCell(const ScRange& rRange,
835 : const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
836 : rtl::OUString& rUndoStr);
837 : bool SearchRangeForAllEmptyCells(
838 : const ScRange& rRange, const SvxSearchItem& rSearchItem,
839 : ScRangeList& rMatchedRanges, rtl::OUString& rUndoStr, ScDocument* pUndoDoc);
840 :
841 : // use the global sort parameter:
842 : bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd) const;
843 : void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
844 : void SwapCol(SCCOL nCol1, SCCOL nCol2);
845 : void SwapRow(SCROW nRow1, SCROW nRow2);
846 : short CompareCell( sal_uInt16 nSort,
847 : ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
848 : ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row ) const;
849 : short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2) const;
850 : short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2) const;
851 : ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
852 : void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
853 : void SortReorder( ScSortInfoArray*, ScProgress* );
854 :
855 : bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
856 : bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
857 : void GetUpperCellString(SCCOL nCol, SCROW nRow, rtl::OUString& rStr);
858 :
859 : bool RefVisible(ScFormulaCell* pCell);
860 :
861 : bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol) const;
862 :
863 : void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
864 : void FillFormula(sal_uLong& nFormulaCounter, bool bFirst, ScFormulaCell* pSrcCell,
865 : SCCOL nDestCol, SCROW nDestRow, bool bLast );
866 : void UpdateInsertTabAbs(SCTAB nNewPos);
867 : bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
868 : const ScMarkData& rMark) const;
869 : bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ) const;
870 : bool TestTabRefAbs(SCTAB nTable) const;
871 : void CompileDBFormula();
872 : void CompileDBFormula( bool bCreateFormulaString );
873 : void CompileNameFormula( bool bCreateFormulaString );
874 : void CompileColRowNameFormula();
875 :
876 : void StartListening( const ScAddress& rAddress, SvtListener* pListener );
877 : void EndListening( const ScAddress& rAddress, SvtListener* pListener );
878 : void StartAllListeners();
879 : void StartNeededListeners(); // only for cells where NeedsListening()==TRUE
880 : void SetRelNameDirty();
881 :
882 : void SetLoadingMedium(bool bLoading);
883 :
884 : SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
885 : SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
886 : const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
887 :
888 : // idle calculation of OutputDevice text width for cell
889 : // also invalidates script type, broadcasts for "calc as shown"
890 : void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
891 : bool bNumFormatChanged, bool bBroadcast );
892 :
893 : void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward);
894 :
895 : /**
896 : * In case the cell text goes beyond the column width, move the max column
897 : * position to the right. This is called from ExtendPrintArea.
898 : */
899 : void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
900 :
901 : void CopyPrintRange(const ScTable& rTable);
902 :
903 : SCCOL FindNextVisibleColWithContent(SCCOL nCol, bool bRight, SCROW nRow) const;
904 :
905 : SCCOL FindNextVisibleCol(SCCOL nCol, bool bRight) const;
906 :
907 : /**
908 : * Use this to iterate through non-empty visible cells in a single column.
909 : */
910 : class VisibleDataCellIterator
911 : {
912 : public:
913 : static SCROW ROW_NOT_FOUND;
914 :
915 : explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
916 : ~VisibleDataCellIterator();
917 :
918 : /**
919 : * Set the start row position. In case there is not visible data cell
920 : * at the specified row position, it will move to the position of the
921 : * first visible data cell below that point.
922 : *
923 : * @return First visible data cell if found, or NULL otherwise.
924 : */
925 : ScBaseCell* reset(SCROW nRow);
926 :
927 : /**
928 : * Find the next visible data cell position.
929 : *
930 : * @return Next visible data cell if found, or NULL otherwise.
931 : */
932 : ScBaseCell* next();
933 :
934 : /**
935 : * Get the current row position.
936 : *
937 : * @return Current row position, or ROW_NOT_FOUND if the iterator
938 : * doesn't point to a valid data cell position.
939 : */
940 : SCROW getRow() const;
941 :
942 : private:
943 : ScFlatBoolRowSegments& mrRowSegs;
944 : ScColumn& mrColumn;
945 : ScBaseCell* mpCell;
946 : SCROW mnCurRow;
947 : SCROW mnUBound;
948 : };
949 : };
950 :
951 :
952 : #endif
953 :
954 :
955 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|