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