1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_TABLE_HXX
21 #define INCLUDED_SC_INC_TABLE_HXX
25 #include <tools/gen.hxx>
26 #include <tools/color.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
29 #include "sortparam.hxx"
30 #include "compressedarray.hxx"
33 #include "cellvalue.hxx"
34 #include <formula/types.hxx>
35 #include "calcmacros.hxx"
39 #include <boost/scoped_ptr.hpp>
40 #include <boost/noncopyable.hpp>
46 namespace com
{ namespace sun
{ namespace star
{
48 struct TablePageBreakData
;
52 namespace formula
{ struct VectorRefArray
; }
55 struct FormulaGroupContext
;
56 class StartListeningContext
;
57 class EndListeningContext
;
58 class CopyFromClipContext
;
59 class CopyToClipContext
;
60 class CopyToDocContext
;
64 struct ColumnBlockPosition
;
65 struct RefUpdateContext
;
66 struct RefUpdateInsertTabContext
;
67 struct RefUpdateDeleteTabContext
;
68 struct RefUpdateMoveTabContext
;
70 class DocumentStreamAccess
;
72 class RowHeightContext
;
73 class CompileFormulaContext
;
74 struct SetFormulaDirtyContext
;
81 class SfxStyleSheetBase
;
86 class ScAutoFormatData
;
88 class ScEditDataArray
;
91 class ScPrintSaverTab
;
95 class ScSortInfoArray
;
96 class ScConditionalFormat
;
97 class ScConditionalFormatList
;
99 class ScTableProtection
;
100 class ScUserListData
;
102 struct ScFunctionData
;
104 class CollatorWrapper
;
105 class ScFlatUInt16RowSegments
;
106 class ScFlatBoolRowSegments
;
107 class ScFlatBoolColSegments
;
108 struct ScSetStringParam
;
109 struct ScColWidthParam
;
110 struct ScColWidthParam
;
113 class ScDocumentImport
;
115 class ScTable
: boost::noncopyable
118 typedef ::std::vector
< ScRange
> ScRangeVec
;
120 ScColumn aCol
[MAXCOLCOUNT
];
130 sal_uLong nLinkRefreshDelay
;
133 // page style template
135 Size aPageSizeTwips
; // size of the print-page
136 SCCOL nRepeatStartX
; // repeating rows/columns
137 SCCOL nRepeatEndX
; // REPEAT_NONE, if not used
141 boost::scoped_ptr
<ScTableProtection
> pTabProtection
;
143 sal_uInt16
* pColWidth
;
144 boost::scoped_ptr
<ScFlatUInt16RowSegments
> mpRowHeights
;
146 sal_uInt8
* pColFlags
;
147 ScBitMaskCompressedArray
< SCROW
, sal_uInt8
>* pRowFlags
;
148 boost::scoped_ptr
<ScFlatBoolColSegments
> mpHiddenCols
;
149 boost::scoped_ptr
<ScFlatBoolRowSegments
> mpHiddenRows
;
150 boost::scoped_ptr
<ScFlatBoolColSegments
> mpFilteredCols
;
151 boost::scoped_ptr
<ScFlatBoolRowSegments
> mpFilteredRows
;
153 ::std::set
<SCROW
> maRowPageBreaks
;
154 ::std::set
<SCROW
> maRowManualBreaks
;
155 ::std::set
<SCCOL
> maColPageBreaks
;
156 ::std::set
<SCCOL
> maColManualBreaks
;
158 ScOutlineTable
* pOutlineTable
;
160 ScSheetEvents
* pSheetEvents
;
162 mutable SCCOL nTableAreaX
;
163 mutable SCROW nTableAreaY
;
166 ScDocument
* pDocument
;
167 utl::TextSearch
* pSearchText
;
169 mutable OUString aUpperName
; // #i62977# filled only on demand, reset in SetName
171 // sort parameter to minimize stack size of quicksort
172 ScSortParam aSortParam
;
173 CollatorWrapper
* pSortCollator
;
175 ScRangeVec aPrintRanges
;
177 ScRange
* pRepeatColRange
;
178 ScRange
* pRepeatRowRange
;
180 sal_uInt16 nLockCount
;
182 ScRangeList
* pScenarioRanges
;
183 Color aScenarioColor
;
185 sal_uInt16 nScenarioFlags
;
186 ScDBData
* pDBDataNoName
;
187 mutable ScRangeName
* mpRangeName
;
189 boost::scoped_ptr
<ScConditionalFormatList
> mpCondFormatList
;
194 bool bPageSizeValid
:1;
195 mutable bool bTableAreaValid
:1;
198 bool bPendingRowHeights
:1;
199 bool bCalcNotification
:1;
200 bool bGlobalKeepQuery
:1;
201 bool bPrintEntireSheet
:1;
202 bool bActiveScenario
:1;
203 bool mbPageBreaksValid
:1;
204 bool mbForceBreaks
:1;
206 friend class ScDocument
; // for FillInfo
207 friend class ScValueIterator
;
208 friend class ScHorizontalValueIterator
;
209 friend class ScDBQueryDataIterator
;
210 friend class ScCellIterator
;
211 friend class ScQueryCellIterator
;
212 friend class ScHorizontalCellIterator
;
213 friend class ScHorizontalAttrIterator
;
214 friend class ScDocAttrIterator
;
215 friend class ScAttrRectIterator
;
216 friend class ScColumnTextWidthIterator
;
217 friend class ScDocumentImport
;
218 friend class sc::DocumentStreamAccess
;
219 friend class sc::ColumnSpanSet
;
220 friend class sc::EditTextIterator
;
223 ScTable( ScDocument
* pDoc
, SCTAB nNewTab
, const OUString
& rNewName
,
224 bool bColInfo
= true, bool bRowInfo
= true );
227 ScDocument
& GetDoc();
228 const ScDocument
& GetDoc() const;
229 SCTAB
GetTab() const { return nTab
; }
231 ScOutlineTable
* GetOutlineTable() { return pOutlineTable
; }
233 sal_uLong
GetCellCount() const;
234 sal_uLong
GetWeightedCount() const;
235 sal_uLong
GetCodeCount() const; // RPN code in formula
237 sal_uInt16
GetTextWidth(SCCOL nCol
, SCROW nRow
) const;
239 bool SetOutlineTable( const ScOutlineTable
* pNewOutline
);
240 void StartOutlineTable();
242 void DoAutoOutline( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
);
244 bool TestRemoveSubTotals( const ScSubTotalParam
& rParam
);
245 void RemoveSubTotals( ScSubTotalParam
& rParam
);
246 bool DoSubTotals( ScSubTotalParam
& rParam
);
248 void MarkSubTotalCells( sc::ColumnSpanSet
& rSet
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, bool bVal
) const;
250 const ScSheetEvents
* GetSheetEvents() const { return pSheetEvents
; }
251 void SetSheetEvents( const ScSheetEvents
* pNew
);
253 bool IsVisible() const { return bVisible
; }
254 void SetVisible( bool bVis
);
256 bool IsStreamValid() const { return bStreamValid
; }
257 void SetStreamValid( bool bSet
, bool bIgnoreLock
= false );
259 bool IsPendingRowHeights() const { return bPendingRowHeights
; }
260 void SetPendingRowHeights( bool bSet
);
262 bool GetCalcNotification() const { return bCalcNotification
; }
263 void SetCalcNotification( bool bSet
);
265 bool IsLayoutRTL() const { return bLayoutRTL
; }
266 bool IsLoadingRTL() const { return bLoadingRTL
; }
267 void SetLayoutRTL( bool bSet
);
268 void SetLoadingRTL( bool bSet
);
270 bool IsScenario() const { return bScenario
; }
271 void SetScenario( bool bFlag
);
272 void GetScenarioComment( OUString
& rComment
) const { rComment
= aComment
; }
273 void SetScenarioComment( const OUString
& rComment
) { aComment
= rComment
; }
274 const Color
& GetScenarioColor() const { return aScenarioColor
; }
275 void SetScenarioColor(const Color
& rNew
) { aScenarioColor
= rNew
; }
276 const Color
& GetTabBgColor() const;
277 void SetTabBgColor(const Color
& rColor
);
278 sal_uInt16
GetScenarioFlags() const { return nScenarioFlags
; }
279 void SetScenarioFlags(sal_uInt16 nNew
) { nScenarioFlags
= nNew
; }
280 void SetActiveScenario(bool bSet
) { bActiveScenario
= bSet
; }
281 bool IsActiveScenario() const { return bActiveScenario
; }
283 sal_uInt8
GetLinkMode() const { return nLinkMode
; }
284 bool IsLinked() const { return nLinkMode
!= SC_LINK_NONE
; }
285 const OUString
& GetLinkDoc() const { return aLinkDoc
; }
286 const OUString
& GetLinkFlt() const { return aLinkFlt
; }
287 const OUString
& GetLinkOpt() const { return aLinkOpt
; }
288 const OUString
& GetLinkTab() const { return aLinkTab
; }
289 sal_uLong
GetLinkRefreshDelay() const { return nLinkRefreshDelay
; }
291 void SetLink( sal_uInt8 nMode
, const OUString
& rDoc
, const OUString
& rFlt
,
292 const OUString
& rOpt
, const OUString
& rTab
, sal_uLong nRefreshDelay
);
294 void GetName( OUString
& rName
) const;
295 void SetName( const OUString
& rNewName
);
297 void SetAnonymousDBData(ScDBData
* pDBData
);
298 ScDBData
* GetAnonymousDBData();
300 void GetCodeName( OUString
& rName
) const { rName
= aCodeName
; }
301 void SetCodeName( const OUString
& rNewName
) { aCodeName
= rNewName
; }
303 const OUString
& GetUpperName() const;
305 const OUString
& GetPageStyle() const { return aPageStyle
; }
306 void SetPageStyle( const OUString
& rName
);
307 void PageStyleModified( const OUString
& rNewName
);
309 bool IsProtected() const;
310 void SetProtection(const ScTableProtection
* pProtect
);
311 ScTableProtection
* GetProtection();
313 Size
GetPageSize() const;
314 void SetPageSize( const Size
& rSize
);
315 void SetRepeatArea( SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCROW nEndRow
);
320 bool IsBlockEditable( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
,
321 SCROW nRow2
, bool* pOnlyNotBecauseOfMatrix
= NULL
) const;
322 bool IsSelectionEditable( const ScMarkData
& rMark
,
323 bool* pOnlyNotBecauseOfMatrix
= NULL
) const;
325 bool HasBlockMatrixFragment( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
326 bool HasSelectionMatrixFragment( const ScMarkData
& rMark
) const;
328 bool IsBlockEmpty( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, bool bIgnoreNotes
= false ) const;
330 bool SetString( SCCOL nCol
, SCROW nRow
, SCTAB nTab
, const OUString
& rString
,
331 ScSetStringParam
* pParam
= NULL
);
333 void SetEditText( SCCOL nCol
, SCROW nRow
, EditTextObject
* pEditText
);
334 void SetEditText( SCCOL nCol
, SCROW nRow
, const EditTextObject
& rEditText
, const SfxItemPool
* pEditPool
);
335 SCROW
GetFirstEditTextRow( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
337 void SetEmptyCell( SCCOL nCol
, SCROW nRow
);
339 SCCOL nCol
, SCROW nRow
, const ScTokenArray
& rArray
, formula::FormulaGrammar::Grammar eGram
);
341 SCCOL nCol
, SCROW nRow
, const OUString
& rFormula
, formula::FormulaGrammar::Grammar eGram
);
344 * Takes ownership of pCell
346 * @return pCell if it was successfully inserted, NULL otherwise. pCell
347 * is deleted automatically on failure to insert.
349 ScFormulaCell
* SetFormulaCell( SCCOL nCol
, SCROW nRow
, ScFormulaCell
* pCell
);
351 bool SetFormulaCells( SCCOL nCol
, SCROW nRow
, std::vector
<ScFormulaCell
*>& rCells
);
353 svl::SharedString
GetSharedString( SCCOL nCol
, SCROW nRow
) const;
355 void SetValue( SCCOL nCol
, SCROW nRow
, const double& rVal
);
356 void SetValues( SCCOL nCol
, SCROW nRow
, const std::vector
<double>& rVals
);
357 void SetError( SCCOL nCol
, SCROW nRow
, sal_uInt16 nError
);
358 SCSIZE
GetPatternCount( SCCOL nCol
) const;
359 SCSIZE
GetPatternCount( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
) const;
360 bool ReservePatternCount( SCCOL nCol
, SCSIZE nReserve
);
362 void SetRawString( SCCOL nCol
, SCROW nRow
, const svl::SharedString
& rStr
);
363 void GetString( SCCOL nCol
, SCROW nRow
, OUString
& rString
) const;
364 double* GetValueCell( SCCOL nCol
, SCROW nRow
);
365 void GetInputString( SCCOL nCol
, SCROW nRow
, OUString
& rString
) const;
366 double GetValue( const ScAddress
& rPos
) const
368 return ValidColRow(rPos
.Col(),rPos
.Row()) ?
369 aCol
[rPos
.Col()].GetValue( rPos
.Row() ) :
372 double GetValue( SCCOL nCol
, SCROW nRow
) const;
373 const EditTextObject
* GetEditText( SCCOL nCol
, SCROW nRow
) const;
374 void RemoveEditTextCharAttribs( SCCOL nCol
, SCROW nRow
, const ScPatternAttr
& rAttr
);
375 void GetFormula( SCCOL nCol
, SCROW nRow
, OUString
& rFormula
) const;
376 const ScFormulaCell
* GetFormulaCell( SCCOL nCol
, SCROW nRow
) const;
377 ScFormulaCell
* GetFormulaCell( SCCOL nCol
, SCROW nRow
);
379 CellType
GetCellType( const ScAddress
& rPos
) const
381 return ValidColRow(rPos
.Col(),rPos
.Row()) ?
382 aCol
[rPos
.Col()].GetCellType( rPos
.Row() ) :
385 CellType
GetCellType( SCCOL nCol
, SCROW nRow
) const;
386 ScRefCellValue
GetCellValue( SCCOL nCol
, SCROW nRow
) const;
388 void GetFirstDataPos(SCCOL
& rCol
, SCROW
& rRow
) const;
389 void GetLastDataPos(SCCOL
& rCol
, SCROW
& rRow
) const;
391 ScPostIt
* ReleaseNote( SCCOL nCol
, SCROW nRow
);
393 size_t GetNoteCount( SCCOL nCol
) const;
394 SCROW
GetNotePosition( SCCOL nCol
, size_t nIndex
) const;
395 void CreateAllNoteCaptions();
396 void ForgetNoteCaptions( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
398 void GetAllNoteEntries( std::vector
<sc::NoteEntry
>& rNotes
) const;
399 void GetNotesInRange( const ScRange
& rRange
, std::vector
<sc::NoteEntry
>& rNotes
) const;
400 bool ContainsNotesInRange( const ScRange
& rRange
) const;
402 bool TestInsertRow( SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCSIZE nSize
) const;
403 void InsertRow( SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCSIZE nSize
);
405 const sc::ColumnSet
& rRegroupCols
, SCCOL nStartCol
, SCCOL nEndCol
, SCROW nStartRow
, SCSIZE nSize
, bool* pUndoOutline
= NULL
);
407 bool TestInsertCol( SCROW nStartRow
, SCROW nEndRow
, SCSIZE nSize
) const;
409 const sc::ColumnSet
& rRegroupCols
, SCCOL nStartCol
, SCROW nStartRow
, SCROW nEndRow
, SCSIZE nSize
);
411 const sc::ColumnSet
& rRegroupCols
, SCCOL nStartCol
, SCROW nStartRow
, SCROW nEndRow
, SCSIZE nSize
, bool* pUndoOutline
= NULL
);
413 void DeleteArea(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, sal_uInt16 nDelFlag
);
414 void CopyToClip( sc::CopyToClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScTable
* pTable
);
415 void CopyToClip( sc::CopyToClipContext
& rCxt
, const ScRangeList
& rRanges
, ScTable
* pTable
);
417 void CopyStaticToDocument(
418 SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, const SvNumberFormatterMergeMap
& rMap
,
421 void CopyCellToDocument( SCCOL nSrcCol
, SCROW nSrcRow
, SCCOL nDestCol
, SCROW nDestRow
, ScTable
& rDestTab
);
423 bool InitColumnBlockPosition( sc::ColumnBlockPosition
& rBlockPos
, SCCOL nCol
);
425 void DeleteBeforeCopyFromClip( sc::CopyFromClipContext
& rCxt
, const ScTable
& rClipTab
);
427 void CopyOneCellFromClip(
428 sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
431 sc::CopyFromClipContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
432 SCsCOL nDx
, SCsROW nDy
, ScTable
* pTable
);
434 void StartListeningInArea(
435 sc::StartListeningContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
437 void BroadcastInArea( SCCOL nCol1
, SCROW nRow1
,
438 SCCOL nCol2
, SCROW nRow2
);
441 sc::CopyToDocContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
442 sal_uInt16 nFlags
, bool bMarked
, ScTable
* pDestTab
,
443 const ScMarkData
* pMarkData
= NULL
, bool bAsLink
= false, bool bColRowFlags
= true );
446 sc::CopyToDocContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
447 sal_uInt16 nFlags
, bool bMarked
, ScTable
* pDestTab
, const ScMarkData
* pMarkData
= NULL
);
449 void CopyConditionalFormat( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
450 SCsCOL nDx
, SCsROW nDy
, ScTable
* pTable
);
451 void TransposeClip( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
452 ScTable
* pTransClip
, sal_uInt16 nFlags
, bool bAsLink
);
454 // mark of this document
456 sc::MixDocContext
& rCxt
, const ScMarkData
& rMark
, sal_uInt16 nFunction
,
457 bool bSkipEmpty
, const ScTable
* pSrcTab
);
460 sc::MixDocContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
461 sal_uInt16 nFunction
, bool bSkipEmpty
, const ScTable
* pSrcTab
);
463 void CopyData( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
464 SCCOL nDestCol
, SCROW nDestRow
, SCTAB nDestTab
);
466 void CopyScenarioFrom( const ScTable
* pSrcTab
);
467 void CopyScenarioTo( ScTable
* pDestTab
) const;
468 bool TestCopyScenarioTo( const ScTable
* pDestTab
) const;
469 void MarkScenarioIn( ScMarkData
& rMark
, sal_uInt16 nNeededBits
) const;
470 bool HasScenarioRange( const ScRange
& rRange
) const;
471 void InvalidateScenarioRanges();
472 const ScRangeList
* GetScenarioRanges() const;
474 void CopyUpdated( const ScTable
* pPosTab
, ScTable
* pDestTab
) const;
476 void InvalidateTableArea();
477 void InvalidatePageBreaks();
479 bool GetCellArea( SCCOL
& rEndCol
, SCROW
& rEndRow
) const; // FALSE = empty
480 bool GetTableArea( SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
481 bool GetPrintArea( SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bNotes
, bool bFullFormattedArea
= false ) const;
482 bool GetPrintAreaHor( SCROW nStartRow
, SCROW nEndRow
,
483 SCCOL
& rEndCol
, bool bNotes
) const;
484 bool GetPrintAreaVer( SCCOL nStartCol
, SCCOL nEndCol
,
485 SCROW
& rEndRow
, bool bNotes
) const;
487 bool GetDataStart( SCCOL
& rStartCol
, SCROW
& rStartRow
) const;
489 void ExtendPrintArea( OutputDevice
* pDev
,
490 SCCOL nStartCol
, SCROW nStartRow
, SCCOL
& rEndCol
, SCROW nEndRow
);
492 void GetDataArea( SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
,
493 bool bIncludeOld
, bool bOnlyDown
) const;
495 bool ShrinkToUsedDataArea( bool& o_bShrunk
, SCCOL
& rStartCol
, SCROW
& rStartRow
,
496 SCCOL
& rEndCol
, SCROW
& rEndRow
, bool bColumnsOnly
) const;
498 SCROW
GetLastDataRow( SCCOL nCol1
, SCCOL nCol2
, SCROW nLastRow
) const;
500 SCSIZE
GetEmptyLinesInBlock( SCCOL nStartCol
, SCROW nStartRow
,
501 SCCOL nEndCol
, SCROW nEndRow
, ScDirection eDir
) const;
503 void FindAreaPos( SCCOL
& rCol
, SCROW
& rRow
, ScMoveDirection eDirection
) const;
504 void GetNextPos( SCCOL
& rCol
, SCROW
& rRow
, SCsCOL nMovX
, SCsROW nMovY
,
505 bool bMarked
, bool bUnprotected
, const ScMarkData
& rMark
) const;
507 void LimitChartArea( SCCOL
& rStartCol
, SCROW
& rStartRow
, SCCOL
& rEndCol
, SCROW
& rEndRow
) const;
509 bool HasData( SCCOL nCol
, SCROW nRow
) const;
510 bool HasStringData( SCCOL nCol
, SCROW nRow
) const;
511 bool HasValueData( SCCOL nCol
, SCROW nRow
) const;
512 bool HasStringCells( SCCOL nStartCol
, SCROW nStartRow
,
513 SCCOL nEndCol
, SCROW nEndRow
) const;
515 sal_uInt16
GetErrCode( const ScAddress
& rPos
) const
517 return ValidColRow(rPos
.Col(),rPos
.Row()) ?
518 aCol
[rPos
.Col()].GetErrCode( rPos
.Row() ) :
522 void ResetChanged( const ScRange
& rRange
);
524 void SetAllFormulasDirty( const sc::SetFormulaDirtyContext
& rCxt
);
525 void SetDirty( const ScRange
&, bool bIncludeEmptyCells
= false );
526 void SetDirtyAfterLoad();
528 void SetTableOpDirty( const ScRange
& );
530 void CalcAfterLoad( sc::CompileFormulaContext
& rCxt
);
531 void CompileAll( sc::CompileFormulaContext
& rCxt
);
532 void CompileXML( sc::CompileFormulaContext
& rCxt
, ScProgress
& rProgress
);
534 bool CompileErrorCells( sc::CompileFormulaContext
& rCxt
, sal_uInt16 nErrCode
);
536 void UpdateReference(
537 sc::RefUpdateContext
& rCxt
, ScDocument
* pUndoDoc
= NULL
,
538 bool bIncludeDraw
= true, bool bUpdateNoteCaptionPos
= true );
540 void UpdateDrawRef( UpdateRefMode eUpdateRefMode
, SCCOL nCol1
, SCROW nRow1
, SCTAB nTab1
,
541 SCCOL nCol2
, SCROW nRow2
, SCTAB nTab2
,
542 SCsCOL nDx
, SCsROW nDy
, SCsTAB nDz
, bool bUpdateNoteCaptionPos
= true );
544 void UpdateTranspose( const ScRange
& rSource
, const ScAddress
& rDest
,
545 ScDocument
* pUndoDoc
);
547 void UpdateGrow( const ScRange
& rArea
, SCCOL nGrowX
, SCROW nGrowY
);
549 void UpdateInsertTab( sc::RefUpdateInsertTabContext
& rCxt
);
550 void UpdateDeleteTab( sc::RefUpdateDeleteTabContext
& rCxt
);
551 void UpdateMoveTab( sc::RefUpdateMoveTabContext
& rCxt
, SCTAB nTabNo
, ScProgress
* pProgress
);
552 void UpdateCompile( bool bForceIfNameInUse
= false );
553 void SetTabNo(SCTAB nNewTab
);
554 void FindRangeNamesInUse(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
555 std::set
<sal_uInt16
>& rIndexes
) const;
556 void Fill( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
557 sal_uLong nFillCount
, FillDir eFillDir
, FillCmd eFillCmd
, FillDateCmd eFillDateCmd
,
558 double nStepValue
, double nMaxValue
, ScProgress
* pProgress
);
559 OUString
GetAutoFillPreview( const ScRange
& rSource
, SCCOL nEndX
, SCROW nEndY
);
561 void UpdateSelectionFunction( ScFunctionData
& rData
, const ScMarkData
& rMark
);
563 void AutoFormat( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
564 sal_uInt16 nFormatNo
);
565 void GetAutoFormatData(SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, ScAutoFormatData
& rData
);
566 void ScReplaceTabsStr( OUString
& rStr
, const OUString
& rSrch
, const OUString
& rRepl
); // from sw
567 bool SearchAndReplace(
568 const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
, const ScMarkData
& rMark
,
569 ScRangeList
& rMatchedRanges
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
571 void FindMaxRotCol( RowInfo
* pRowInfo
, SCSIZE nArrCount
, SCCOL nX1
, SCCOL nX2
);
573 void GetBorderLines( SCCOL nCol
, SCROW nRow
,
574 const ::editeng::SvxBorderLine
** ppLeft
, const ::editeng::SvxBorderLine
** ppTop
,
575 const ::editeng::SvxBorderLine
** ppRight
, const ::editeng::SvxBorderLine
** ppBottom
) const;
577 bool HasAttrib( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, sal_uInt16 nMask
) const;
578 bool HasAttribSelection( const ScMarkData
& rMark
, sal_uInt16 nMask
) const;
579 bool IsMerged( SCCOL nCol
, SCROW nRow
) const;
580 bool ExtendMerge( SCCOL nStartCol
, SCROW nStartRow
,
581 SCCOL
& rEndCol
, SCROW
& rEndRow
,
583 const SfxPoolItem
* GetAttr( SCCOL nCol
, SCROW nRow
, sal_uInt16 nWhich
) const;
584 const ScPatternAttr
* GetPattern( SCCOL nCol
, SCROW nRow
) const;
585 const ScPatternAttr
* GetMostUsedPattern( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
) const;
587 sal_uInt32
GetNumberFormat( const ScAddress
& rPos
) const;
588 sal_uInt32
GetNumberFormat( SCCOL nCol
, SCROW nRow
) const;
589 sal_uInt32
GetNumberFormat( SCCOL nCol
, SCROW nStartRow
, SCROW nEndRow
) const;
591 void SetNumberFormat( SCCOL nCol
, SCROW nRow
, sal_uInt32 nNumberFormat
);
593 void MergeSelectionPattern( ScMergePatternState
& rState
,
594 const ScMarkData
& rMark
, bool bDeep
) const;
595 void MergePatternArea( ScMergePatternState
& rState
, SCCOL nCol1
, SCROW nRow1
,
596 SCCOL nCol2
, SCROW nRow2
, bool bDeep
) const;
597 void MergeBlockFrame( SvxBoxItem
* pLineOuter
, SvxBoxInfoItem
* pLineInner
,
599 SCCOL nStartCol
, SCROW nStartRow
,
600 SCCOL nEndCol
, SCROW nEndRow
) const;
601 void ApplyBlockFrame( const SvxBoxItem
* pLineOuter
,
602 const SvxBoxInfoItem
* pLineInner
,
603 SCCOL nStartCol
, SCROW nStartRow
,
604 SCCOL nEndCol
, SCROW nEndRow
);
606 void ApplyAttr( SCCOL nCol
, SCROW nRow
, const SfxPoolItem
& rAttr
);
607 void ApplyPattern( SCCOL nCol
, SCROW nRow
, const ScPatternAttr
& rAttr
);
608 void ApplyPatternArea( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
609 const ScPatternAttr
& rAttr
, ScEditDataArray
* pDataArray
= NULL
);
610 bool SetAttrEntries(SCCOL nCol
, ScAttrEntry
* pData
, SCSIZE nSize
);
612 void SetPattern( const ScAddress
& rPos
, const ScPatternAttr
& rAttr
, bool bPutToPool
= false )
614 if (ValidColRow(rPos
.Col(),rPos
.Row()))
615 aCol
[rPos
.Col()].SetPattern( rPos
.Row(), rAttr
, bPutToPool
);
617 void SetPattern( SCCOL nCol
, SCROW nRow
, const ScPatternAttr
& rAttr
, bool bPutToPool
= false );
618 void ApplyPatternIfNumberformatIncompatible( const ScRange
& rRange
,
619 const ScPatternAttr
& rPattern
, short nNewType
);
620 void AddCondFormatData( const ScRangeList
& rRange
, sal_uInt32 nIndex
);
621 void RemoveCondFormatData( const ScRangeList
& rRange
, sal_uInt32 nIndex
);
623 void ApplyStyle( SCCOL nCol
, SCROW nRow
, const ScStyleSheet
& rStyle
);
624 void ApplyStyleArea( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, const ScStyleSheet
& rStyle
);
625 void ApplySelectionStyle(const ScStyleSheet
& rStyle
, const ScMarkData
& rMark
);
626 void ApplySelectionLineStyle( const ScMarkData
& rMark
,
627 const ::editeng::SvxBorderLine
* pLine
, bool bColorOnly
);
629 const ScStyleSheet
* GetStyle( SCCOL nCol
, SCROW nRow
) const;
630 const ScStyleSheet
* GetSelectionStyle( const ScMarkData
& rMark
, bool& rFound
) const;
631 const ScStyleSheet
* GetAreaStyle( bool& rFound
, SCCOL nCol1
, SCROW nRow1
,
632 SCCOL nCol2
, SCROW nRow2
) const;
634 void StyleSheetChanged( const SfxStyleSheetBase
* pStyleSheet
, bool bRemoved
,
636 double nPPTX
, double nPPTY
,
637 const Fraction
& rZoomX
, const Fraction
& rZoomY
);
639 bool IsStyleSheetUsed( const ScStyleSheet
& rStyle
, bool bGatherAllStyles
) const;
641 bool ApplyFlags( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, sal_Int16 nFlags
);
642 bool RemoveFlags( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
, sal_Int16 nFlags
);
644 void ApplySelectionCache( SfxItemPoolCache
* pCache
, const ScMarkData
& rMark
, ScEditDataArray
* pDataArray
= NULL
);
645 void DeleteSelection( sal_uInt16 nDelFlag
, const ScMarkData
& rMark
, bool bBroadcast
= true );
647 void ClearSelectionItems( const sal_uInt16
* pWhich
, const ScMarkData
& rMark
);
648 void ChangeSelectionIndent( bool bIncrement
, const ScMarkData
& rMark
);
650 const ScRange
* GetRepeatColRange() const { return pRepeatColRange
; }
651 const ScRange
* GetRepeatRowRange() const { return pRepeatRowRange
; }
652 void SetRepeatColRange( const ScRange
* pNew
);
653 void SetRepeatRowRange( const ScRange
* pNew
);
655 sal_uInt16
GetPrintRangeCount() const { return static_cast< sal_uInt16
>( aPrintRanges
.size() ); }
656 const ScRange
* GetPrintRange(sal_uInt16 nPos
) const;
657 /** Returns true, if the sheet is always printed. */
658 bool IsPrintEntireSheet() const { return bPrintEntireSheet
; }
660 /** Removes all print ranges. */
661 void ClearPrintRanges();
662 /** Adds a new print ranges. */
663 void AddPrintRange( const ScRange
& rNew
);
664 /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
665 void SetPrintEntireSheet();
667 void FillPrintSaver( ScPrintSaverTab
& rSaveTab
) const;
668 void RestorePrintRanges( const ScPrintSaverTab
& rSaveTab
);
670 sal_uInt16
GetOptimalColWidth( SCCOL nCol
, OutputDevice
* pDev
,
671 double nPPTX
, double nPPTY
,
672 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
673 bool bFormula
, const ScMarkData
* pMarkData
,
674 const ScColWidthParam
* pParam
);
675 bool SetOptimalHeight(
676 sc::RowHeightContext
& rCxt
, SCROW nStartRow
, SCROW nEndRow
,
677 ScProgress
* pOuterProgress
= NULL
, sal_uLong nProgressStart
= 0 );
679 void SetOptimalHeightOnly(
680 sc::RowHeightContext
& rCxt
, SCROW nStartRow
, SCROW nEndRow
,
681 ScProgress
* pOuterProgress
= NULL
, sal_uLong nProgressStart
= 0 );
683 long GetNeededSize( SCCOL nCol
, SCROW nRow
,
685 double nPPTX
, double nPPTY
,
686 const Fraction
& rZoomX
, const Fraction
& rZoomY
,
687 bool bWidth
, bool bTotalSize
);
688 void SetColWidth( SCCOL nCol
, sal_uInt16 nNewWidth
);
689 void SetColWidthOnly( SCCOL nCol
, sal_uInt16 nNewWidth
);
690 void SetRowHeight( SCROW nRow
, sal_uInt16 nNewHeight
);
691 bool SetRowHeightRange( SCROW nStartRow
, SCROW nEndRow
, sal_uInt16 nNewHeight
,
692 double nPPTX
, double nPPTY
);
695 * Set specified row height to specified ranges. Don't check for drawing
696 * objects etc. Just set the row height. Nothing else.
698 * Note that setting a new row height via this function will not
699 * invalidate page breaks.
701 void SetRowHeightOnly( SCROW nStartRow
, SCROW nEndRow
, sal_uInt16 nNewHeight
);
703 // nPPT to test for modification
704 void SetManualHeight( SCROW nStartRow
, SCROW nEndRow
, bool bManual
);
706 sal_uInt16
GetColWidth( SCCOL nCol
, bool bHiddenAsZero
= true ) const;
707 SC_DLLPUBLIC sal_uInt16
GetRowHeight( SCROW nRow
, SCROW
* pStartRow
= NULL
, SCROW
* pEndRow
= NULL
, bool bHiddenAsZero
= true ) const;
708 sal_uLong
GetRowHeight( SCROW nStartRow
, SCROW nEndRow
, bool bHiddenAsZero
= true ) const;
709 sal_uLong
GetScaledRowHeight( SCROW nStartRow
, SCROW nEndRow
, double fScale
) const;
710 sal_uLong
GetColOffset( SCCOL nCol
, bool bHiddenAsZero
= true ) const;
711 sal_uLong
GetRowOffset( SCROW nRow
, bool bHiddenAsZero
= true ) const;
714 * Get the last row such that the height of row 0 to the end row is as
715 * high as possible without exceeding the specified height value.
717 * @param nHeight maximum desired height
719 * @return SCROW last row of the range within specified height.
721 SCROW
GetRowForHeight(sal_uLong nHeight
) const;
723 sal_uInt16
GetOriginalWidth( SCCOL nCol
) const;
724 sal_uInt16
GetOriginalHeight( SCROW nRow
) const;
726 sal_uInt16
GetCommonWidth( SCCOL nEndCol
) const;
728 SCROW
GetHiddenRowCount( SCROW nRow
) const;
730 void ShowCol(SCCOL nCol
, bool bShow
);
731 void ShowRow(SCROW nRow
, bool bShow
);
732 void DBShowRow(SCROW nRow
, bool bShow
);
734 void ShowRows(SCROW nRow1
, SCROW nRow2
, bool bShow
);
735 void DBShowRows(SCROW nRow1
, SCROW nRow2
, bool bShow
);
737 void SetRowFlags( SCROW nRow
, sal_uInt8 nNewFlags
);
738 void SetRowFlags( SCROW nStartRow
, SCROW nEndRow
, sal_uInt8 nNewFlags
);
740 /// @return the index of the last row with any set flags (auto-pagebreak is ignored).
741 SCROW
GetLastFlaggedRow() const;
743 /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored).
744 SCCOL
GetLastChangedCol() const;
745 /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored).
746 SCROW
GetLastChangedRow() const;
748 bool IsDataFiltered(SCCOL nColStart
, SCROW nRowStart
, SCCOL nColEnd
, SCROW nRowEnd
) const;
749 bool IsDataFiltered(const ScRange
& rRange
) const;
750 sal_uInt8
GetColFlags( SCCOL nCol
) const;
751 sal_uInt8
GetRowFlags( SCROW nRow
) const;
753 const ScBitMaskCompressedArray
< SCROW
, sal_uInt8
> * GetRowFlagsArray() const
754 { return pRowFlags
; }
756 bool UpdateOutlineCol( SCCOL nStartCol
, SCCOL nEndCol
, bool bShow
);
757 bool UpdateOutlineRow( SCROW nStartRow
, SCROW nEndRow
, bool bShow
);
759 void UpdatePageBreaks( const ScRange
* pUserArea
);
760 void RemoveManualBreaks();
761 bool HasManualBreaks() const;
762 void SetRowManualBreaks( const ::std::set
<SCROW
>& rBreaks
);
763 void SetColManualBreaks( const ::std::set
<SCCOL
>& rBreaks
);
765 void GetAllRowBreaks(::std::set
<SCROW
>& rBreaks
, bool bPage
, bool bManual
) const;
766 void GetAllColBreaks(::std::set
<SCCOL
>& rBreaks
, bool bPage
, bool bManual
) const;
767 bool HasRowPageBreak(SCROW nRow
) const;
768 bool HasColPageBreak(SCCOL nCol
) const;
769 bool HasRowManualBreak(SCROW nRow
) const;
770 bool HasColManualBreak(SCCOL nCol
) const;
773 * Get the row position of the next manual break that occurs at or below
774 * specified row. When no more manual breaks are present at or below
775 * the specified row, -1 is returned.
777 * @param nRow row at which the search begins.
779 * @return SCROW next row position with manual page break, or -1 if no
780 * more manual breaks are present.
782 SCROW
GetNextManualBreak(SCROW nRow
) const;
784 void RemoveRowPageBreaks(SCROW nStartRow
, SCROW nEndRow
);
785 void RemoveRowBreak(SCROW nRow
, bool bPage
, bool bManual
);
786 void RemoveColBreak(SCCOL nCol
, bool bPage
, bool bManual
);
787 void SetRowBreak(SCROW nRow
, bool bPage
, bool bManual
);
788 void SetColBreak(SCCOL nCol
, bool bPage
, bool bManual
);
789 ::com::sun::star::uno::Sequence
<
790 ::com::sun::star::sheet::TablePageBreakData
> GetRowBreakData() const;
792 bool RowHidden(SCROW nRow
, SCROW
* pFirstRow
= NULL
, SCROW
* pLastRow
= NULL
) const;
793 bool RowHiddenLeaf(SCROW nRow
, SCROW
* pFirstRow
= NULL
, SCROW
* pLastRow
= NULL
) const;
794 bool HasHiddenRows(SCROW nStartRow
, SCROW nEndRow
) const;
795 bool ColHidden(SCCOL nCol
, SCCOL
* pFirstCol
= NULL
, SCCOL
* pLastCol
= NULL
) const;
796 bool SetRowHidden(SCROW nStartRow
, SCROW nEndRow
, bool bHidden
);
797 bool SetColHidden(SCCOL nStartCol
, SCCOL nEndCol
, bool bHidden
);
798 void CopyColHidden(ScTable
& rTable
, SCCOL nStartCol
, SCCOL nEndCol
);
799 void CopyRowHidden(ScTable
& rTable
, SCROW nStartRow
, SCROW nEndRow
);
800 void CopyRowHeight(ScTable
& rSrcTable
, SCROW nStartRow
, SCROW nEndRow
, SCROW nSrcOffset
);
801 SCROW
FirstVisibleRow(SCROW nStartRow
, SCROW nEndRow
) const;
802 SCROW
LastVisibleRow(SCROW nStartRow
, SCROW nEndRow
) const;
803 SCROW
CountVisibleRows(SCROW nStartRow
, SCROW nEndRow
) const;
804 sal_uInt32
GetTotalRowHeight(SCROW nStartRow
, SCROW nEndRow
, bool bHiddenAsZero
= true) const;
806 SCCOLROW
LastHiddenColRow(SCCOLROW nPos
, bool bCol
) const;
808 bool RowFiltered(SCROW nRow
, SCROW
* pFirstRow
= NULL
, SCROW
* pLastRow
= NULL
) const;
809 bool ColFiltered(SCCOL nCol
, SCCOL
* pFirstCol
= NULL
, SCCOL
* pLastCol
= NULL
) const;
810 bool HasFilteredRows(SCROW nStartRow
, SCROW nEndRow
) const;
811 void CopyColFiltered(ScTable
& rTable
, SCCOL nStartCol
, SCCOL nEndCol
);
812 void CopyRowFiltered(ScTable
& rTable
, SCROW nStartRow
, SCROW nEndRow
);
813 void SetRowFiltered(SCROW nStartRow
, SCROW nEndRow
, bool bFiltered
);
814 void SetColFiltered(SCCOL nStartCol
, SCCOL nEndCol
, bool bFiltered
);
815 SCROW
FirstNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
) const;
816 SCROW
LastNonFilteredRow(SCROW nStartRow
, SCROW nEndRow
) const;
817 SCROW
CountNonFilteredRows(SCROW nStartRow
, SCROW nEndRow
) const;
819 bool IsManualRowHeight(SCROW nRow
) const;
821 bool HasUniformRowHeight( SCROW nRow1
, SCROW nRow2
) const;
823 void SyncColRowFlags();
825 void StripHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
);
826 void ExtendHidden( SCCOL
& rX1
, SCROW
& rY1
, SCCOL
& rX2
, SCROW
& rY2
);
828 /** Sort a range of data.
829 @param rSortParam may get adjusted to the actual range used if it did
830 encompass leading or trailing empty blocks
833 ScSortParam
& rSortParam
, bool bKeepQuery
, bool bUpdateRefs
,
834 ScProgress
* pProgress
, sc::ReorderParam
* pUndo
);
836 void Reorder( const sc::ReorderParam
& rParam
, ScProgress
* pProgress
);
839 SCROW nRow
, const ScQueryParam
& rQueryParam
, ScRefCellValue
* pCell
= NULL
,
840 bool* pbTestEqualCondition
= NULL
);
841 void TopTenQuery( ScQueryParam
& );
842 SCSIZE
Query(ScQueryParam
& rQueryParam
, bool bKeepSub
);
843 bool CreateQueryParam(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScQueryParam
& rQueryParam
);
845 void GetFilterEntries(SCCOL nCol
, SCROW nRow1
, SCROW nRow2
, std::vector
<ScTypedStrData
>& rStrings
, bool& rHasDates
);
846 void GetFilteredFilterEntries(SCCOL nCol
, SCROW nRow1
, SCROW nRow2
, const ScQueryParam
& rParam
, std::vector
<ScTypedStrData
>& rStrings
, bool& rHasDates
);
847 bool GetDataEntries(SCCOL nCol
, SCROW nRow
, std::set
<ScTypedStrData
>& rStrings
, bool bLimit
);
849 bool HasColHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
) const;
850 bool HasRowHeader( SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
) const;
852 sal_Int32
GetMaxStringLen( SCCOL nCol
,
853 SCROW nRowStart
, SCROW nRowEnd
, rtl_TextEncoding eCharSet
) const;
854 sal_Int32
GetMaxNumberStringLen( sal_uInt16
& nPrecision
,
856 SCROW nRowStart
, SCROW nRowEnd
) const;
858 bool IsSortCollatorGlobal() const;
859 void InitSortCollator( const ScSortParam
& rPar
);
860 void DestroySortCollator();
861 void SetDrawPageSize( bool bResetStreamValid
= true, bool bUpdateNoteCaptionPos
= true );
863 void SetRangeName(ScRangeName
* pNew
);
864 ScRangeName
* GetRangeName() const;
866 void PreprocessRangeNameUpdate(
867 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
869 void CompileHybridFormula(
870 sc::StartListeningContext
& rStartListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
872 void PreprocessDBDataUpdate(
873 sc::EndListeningContext
& rEndListenCxt
, sc::CompileFormulaContext
& rCompileCxt
);
875 ScConditionalFormatList
* GetCondFormList();
876 const ScConditionalFormatList
* GetCondFormList() const;
877 void SetCondFormList( ScConditionalFormatList
* pList
);
879 void DeleteConditionalFormat(sal_uLong nOldIndex
);
881 sal_uLong
AddCondFormat( ScConditionalFormat
* pNew
);
883 sal_uInt8
GetScriptType( SCCOL nCol
, SCROW nRow
) const;
884 void SetScriptType( SCCOL nCol
, SCROW nRow
, sal_uInt8 nType
);
885 void UpdateScriptTypes( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
887 sal_uInt8
GetRangeScriptType( sc::ColumnBlockPosition
& rBlockPos
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
889 size_t GetFormulaHash( SCCOL nCol
, SCROW nRow
) const;
891 ScFormulaVectorState
GetFormulaVectorState( SCCOL nCol
, SCROW nRow
) const;
892 formula::FormulaTokenRef
ResolveStaticReference( SCCOL nCol
, SCROW nRow
);
893 formula::FormulaTokenRef
ResolveStaticReference( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
894 formula::VectorRefArray
FetchVectorRefArray( SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
896 void SplitFormulaGroups( SCCOL nCol
, std::vector
<SCROW
>& rRows
);
897 void UnshareFormulaCells( SCCOL nCol
, std::vector
<SCROW
>& rRows
);
898 void RegroupFormulaCells( SCCOL nCol
);
900 ScRefCellValue
GetRefCellValue( SCCOL nCol
, SCROW nRow
);
902 SvtBroadcaster
* GetBroadcaster( SCCOL nCol
, SCROW nRow
);
903 const SvtBroadcaster
* GetBroadcaster( SCCOL nCol
, SCROW nRow
) const;
904 void DeleteBroadcasters( sc::ColumnBlockPosition
& rBlockPos
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
905 bool HasBroadcaster( SCCOL nCol
) const;
907 void FillMatrix( ScMatrix
& rMat
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
) const;
909 void InterpretDirtyCells( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
911 void SetFormulaResults( SCCOL nCol
, SCROW nRow
, const double* pResults
, size_t nLen
);
912 void SetFormulaResults( SCCOL nCol
, SCROW nRow
, const formula::FormulaTokenRef
* pResults
, size_t nLen
);
915 * Have formula cells with NeedsListening() == true start listening to the
918 void StartNeededListeners();
921 * Mark formula cells dirty that have the mbPostponedDirty flag set or
922 * contain named ranges with relative references.
924 void SetDirtyIfPostponed();
927 * Broadcast dirty formula cells that contain functions such as CELL(),
928 * COLUMN() or ROW() which may change its value on move.
930 void BroadcastRecalcOnRefMove();
932 void CollectListeners( std::vector
<SvtListener
*>& rListeners
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
934 void TransferListeners(
935 ScTable
& rDestTab
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
936 SCCOL nColDelta
, SCROW nRowDelta
);
938 void TransferCellValuesTo( SCCOL nCol
, SCROW nRow
, size_t nLen
, sc::CellValues
& rDest
);
939 void CopyCellValuesFrom( SCCOL nCol
, SCROW nRow
, const sc::CellValues
& rSrc
);
941 #if DEBUG_COLUMN_STORAGE
942 void DumpFormulaGroups( SCCOL nCol
) const;
945 /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly.
947 'Replace' replaces at the 'current' position, but in order to achieve
948 that, we have to 'shift' the rCol / rRow to the 'previous' position -
949 what it is depends on various settings in rSearchItem.
951 static void UpdateSearchItemAddressForReplace( const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
);
955 void FillFormulaVertical(
956 const ScFormulaCell
& rSrcCell
,
957 SCCOLROW
& rInner
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
,
958 ScProgress
* pProgress
, sal_uLong
& rProgress
);
960 void FillSeriesSimple(
961 ScCellValue
& rSrcCell
, SCCOLROW
& rInner
, SCCOLROW nIMin
, SCCOLROW nIMax
,
962 SCCOLROW
& rCol
, SCCOLROW
& rRow
, bool bVertical
, ScProgress
* pProgress
, sal_uLong
& rProgress
);
965 SCCOLROW nISrcStart
, SCCOLROW nISrcEnd
, SCCOLROW nIStart
, SCCOLROW nIEnd
,
966 SCCOLROW
& rInner
, SCCOLROW
& rCol
, SCCOLROW
& rRow
,
967 sal_uLong nActFormCnt
, sal_uLong nMaxFormCnt
,
968 bool bHasFiltered
, bool bVertical
, bool bPositive
,
969 ScProgress
* pProgress
, sal_uLong
& rProgress
);
971 void FillSeries( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
972 sal_uLong nFillCount
, FillDir eFillDir
, FillCmd eFillCmd
,
973 FillDateCmd eFillDateCmd
,
974 double nStepValue
, double nMaxValue
, sal_uInt16 nMinDigits
,
975 bool bAttribs
, ScProgress
* pProgress
);
976 void FillAnalyse( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
977 FillCmd
& rCmd
, FillDateCmd
& rDateCmd
,
978 double& rInc
, sal_uInt16
& rMinDigits
,
979 ScUserListData
*& rListData
, sal_uInt16
& rListIndex
);
980 void FillAuto( SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
,
981 sal_uLong nFillCount
, FillDir eFillDir
, ScProgress
* pProgress
);
983 bool ValidNextPos( SCCOL nCol
, SCROW nRow
, const ScMarkData
& rMark
,
984 bool bMarked
, bool bUnprotected
) const;
986 void AutoFormatArea(SCCOL nStartCol
, SCROW nStartRow
, SCCOL nEndCol
, SCROW nEndRow
,
987 const ScPatternAttr
& rAttr
, sal_uInt16 nFormatNo
);
988 void GetAutoFormatAttr(SCCOL nCol
, SCROW nRow
, sal_uInt16 nIndex
, ScAutoFormatData
& rData
);
989 void GetAutoFormatFrame(SCCOL nCol
, SCROW nRow
, sal_uInt16 nFlags
, sal_uInt16 nIndex
, ScAutoFormatData
& rData
);
990 bool SearchCell(const SvxSearchItem
& rSearchItem
, SCCOL nCol
, SCROW nRow
,
991 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
992 bool Search(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
993 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
994 bool SearchAll(const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
,
995 ScRangeList
& rMatchedRanges
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
996 bool Replace(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
997 const ScMarkData
& rMark
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
999 const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1000 OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1002 bool SearchStyle(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1003 const ScMarkData
& rMark
);
1004 bool ReplaceStyle(const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1005 const ScMarkData
& rMark
, bool bIsUndo
);
1006 bool SearchAllStyle(
1007 const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
);
1008 bool ReplaceAllStyle(
1009 const SvxSearchItem
& rSearchItem
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1010 ScDocument
* pUndoDoc
);
1011 bool SearchAndReplaceEmptyCells(
1012 const SvxSearchItem
& rSearchItem
,
1013 SCCOL
& rCol
, SCROW
& rRow
, const ScMarkData
& rMark
, ScRangeList
& rMatchedRanges
,
1014 OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1015 bool SearchRangeForEmptyCell(const ScRange
& rRange
,
1016 const SvxSearchItem
& rSearchItem
, SCCOL
& rCol
, SCROW
& rRow
,
1017 OUString
& rUndoStr
);
1018 bool SearchRangeForAllEmptyCells(
1019 const ScRange
& rRange
, const SvxSearchItem
& rSearchItem
,
1020 ScRangeList
& rMatchedRanges
, OUString
& rUndoStr
, ScDocument
* pUndoDoc
);
1022 // use the global sort parameter:
1023 bool IsSorted(SCCOLROW nStart
, SCCOLROW nEnd
) const;
1024 void DecoladeRow( ScSortInfoArray
*, SCROW nRow1
, SCROW nRow2
);
1027 ScRefCellValue
& rCell1
, SCCOL nCell1Col
, SCROW nCell1Row
,
1028 ScRefCellValue
& rCell2
, SCCOL nCell2Col
, SCROW nCell2Row
) const;
1029 short Compare(SCCOLROW nIndex1
, SCCOLROW nIndex2
) const;
1030 short Compare( ScSortInfoArray
*, SCCOLROW nIndex1
, SCCOLROW nIndex2
) const;
1031 ScSortInfoArray
* CreateSortInfoArray( const sc::ReorderParam
& rParam
);
1032 ScSortInfoArray
* CreateSortInfoArray(
1033 const ScSortParam
& rSortParam
, SCCOLROW nInd1
, SCCOLROW nInd2
,
1034 bool bKeepQuery
, bool bUpdateRefs
);
1035 void QuickSort( ScSortInfoArray
*, SCsCOLROW nLo
, SCsCOLROW nHi
);
1036 void SortReorderByColumn( ScSortInfoArray
* pArray
, SCROW nRow1
, SCROW nRow2
, bool bPattern
, ScProgress
* pProgress
);
1037 void SortReorderByRow( ScSortInfoArray
* pArray
, SCCOL nCol1
, SCCOL nCol2
, ScProgress
* pProgress
);
1039 bool CreateExcelQuery(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScQueryParam
& rQueryParam
);
1040 bool CreateStarQuery(SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
, ScQueryParam
& rQueryParam
);
1041 void GetUpperCellString(SCCOL nCol
, SCROW nRow
, OUString
& rStr
);
1043 bool RefVisible(ScFormulaCell
* pCell
);
1045 bool IsEmptyLine(SCROW nRow
, SCCOL nStartCol
, SCCOL nEndCol
) const;
1047 void IncDate(double& rVal
, sal_uInt16
& nDayOfMonth
, double nStep
, FillDateCmd eCmd
);
1049 ScFormulaCell
* pSrcCell
, SCCOL nDestCol
, SCROW nDestRow
, bool bLast
);
1050 void UpdateInsertTabAbs(SCTAB nNewPos
);
1051 bool GetNextSpellingCell(SCCOL
& rCol
, SCROW
& rRow
, bool bInSel
,
1052 const ScMarkData
& rMark
) const;
1053 bool GetNextMarkedCell( SCCOL
& rCol
, SCROW
& rRow
, const ScMarkData
& rMark
) const;
1054 bool TestTabRefAbs(SCTAB nTable
) const;
1055 void CompileDBFormula( sc::CompileFormulaContext
& rCxt
);
1056 void CompileColRowNameFormula( sc::CompileFormulaContext
& rCxt
);
1058 void StartListening( const ScAddress
& rAddress
, SvtListener
* pListener
);
1059 void EndListening( const ScAddress
& rAddress
, SvtListener
* pListener
);
1060 void StartListening( sc::StartListeningContext
& rCxt
, SCCOL nCol
, SCROW nRow
, SvtListener
& rListener
);
1061 void EndListening( sc::EndListeningContext
& rCxt
, SCCOL nCol
, SCROW nRow
, SvtListener
& rListener
);
1062 void StartAllListeners();
1064 void AttachFormulaCells( sc::StartListeningContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1065 void DetachFormulaCells( sc::EndListeningContext
& rCxt
, SCCOL nCol1
, SCROW nRow1
, SCCOL nCol2
, SCROW nRow2
);
1067 void SetLoadingMedium(bool bLoading
);
1069 SCSIZE
FillMaxRot( RowInfo
* pRowInfo
, SCSIZE nArrCount
, SCCOL nX1
, SCCOL nX2
,
1070 SCCOL nCol
, SCROW nAttrRow1
, SCROW nAttrRow2
, SCSIZE nArrY
,
1071 const ScPatternAttr
* pPattern
, const SfxItemSet
* pCondSet
);
1073 // idle calculation of OutputDevice text width for cell
1074 // also invalidates script type, broadcasts for "calc as shown"
1075 void InvalidateTextWidth( const ScAddress
* pAdrFrom
, const ScAddress
* pAdrTo
,
1076 bool bNumFormatChanged
, bool bBroadcast
);
1078 void SkipFilteredRows(SCROW
& rRow
, SCROW
& rLastNonFilteredRow
, bool bForward
);
1081 * In case the cell text goes beyond the column width, move the max column
1082 * position to the right. This is called from ExtendPrintArea.
1084 void MaybeAddExtraColumn(SCCOL
& rCol
, SCROW nRow
, OutputDevice
* pDev
, double nPPTX
, double nPPTY
);
1086 void CopyPrintRange(const ScTable
& rTable
);
1088 SCCOL
FindNextVisibleColWithContent(SCCOL nCol
, bool bRight
, SCROW nRow
) const;
1090 SCCOL
FindNextVisibleCol(SCCOL nCol
, bool bRight
) const;
1092 // Clipboard transpose for notes
1093 void TransposeColNotes(ScTable
* pTransClip
, SCCOL nCol1
, SCCOL nCol
, SCROW nRow1
, SCROW nRow2
);
1096 * Use this to iterate through non-empty visible cells in a single column.
1098 class VisibleDataCellIterator
1101 static SCROW ROW_NOT_FOUND
;
1103 explicit VisibleDataCellIterator(ScFlatBoolRowSegments
& rRowSegs
, ScColumn
& rColumn
);
1104 ~VisibleDataCellIterator();
1107 * Set the start row position. In case there is not visible data cell
1108 * at the specified row position, it will move to the position of the
1109 * first visible data cell below that point.
1111 * @return First visible data cell if found, or NULL otherwise.
1113 ScRefCellValue
reset(SCROW nRow
);
1116 * Find the next visible data cell position.
1118 * @return Next visible data cell if found, or NULL otherwise.
1120 ScRefCellValue
next();
1123 * Get the current row position.
1125 * @return Current row position, or ROW_NOT_FOUND if the iterator
1126 * doesn't point to a valid data cell position.
1128 SCROW
getRow() const;
1131 ScFlatBoolRowSegments
& mrRowSegs
;
1133 ScRefCellValue maCell
;
1144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */