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