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