xref: /AOO41X/main/sc/inc/table.hxx (revision b2937f997bda0a05141a2d862a64f7be893955b7)
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        GetInputString( SCCOL nCol, SCROW nRow, String& rString );
317     double      GetValue( const ScAddress& rPos ) const
318                     {
319                         return ValidColRow(rPos.Col(),rPos.Row()) ?
320                             aCol[rPos.Col()].GetValue( rPos.Row() ) :
321                             0.0;
322                     }
323     double      GetValue( SCCOL nCol, SCROW nRow );
324     void        GetFormula( SCCOL nCol, SCROW nRow, String& rFormula,
325                             sal_Bool bAsciiExport = sal_False );
326 
327     CellType    GetCellType( const ScAddress& rPos ) const
328                     {
329                         return ValidColRow(rPos.Col(),rPos.Row()) ?
330                             aCol[rPos.Col()].GetCellType( rPos.Row() ) :
331                             CELLTYPE_NONE;
332                     }
333     CellType    GetCellType( SCCOL nCol, SCROW nRow ) const;
334     ScBaseCell* GetCell( const ScAddress& rPos ) const
335                     {
336                         return ValidColRow(rPos.Col(),rPos.Row()) ?
337                             aCol[rPos.Col()].GetCell( rPos.Row() ) :
338                             NULL;
339                     }
340     ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const;
341 
342     void        GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const;
343     void        GetLastDataPos(SCCOL& rCol, SCROW& rRow) const;
344 
345     /** Returns the pointer to a cell note object at the passed cell address. */
346     ScPostIt*   GetNote( SCCOL nCol, SCROW nRow );
347     /** Sets the passed cell note object at the passed cell address. Takes ownership! */
348     void        TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote );
349     /** Returns and forgets the cell note object at the passed cell address. */
350     ScPostIt*   ReleaseNote( SCCOL nCol, SCROW nRow );
351     /** Deletes the note at the passed cell address. */
352     void        DeleteNote( SCCOL nCol, SCROW nRow );
353     /** Creates the captions of all uninitialized cell notes.
354         @param bForced  True = always create all captions, false = skip when Undo is disabled. */
355     void        InitializeNoteCaptions( bool bForced = false );
356 
357     sal_Bool        TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize );
358     void        InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize );
359     void        DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
360                             sal_Bool* pUndoOutline = NULL );
361 
362     sal_Bool        TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
363     void        InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize );
364     void        DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize,
365                             sal_Bool* pUndoOutline = NULL );
366 
367     void        DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag);
368     void        CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable,
369                             sal_Bool bKeepScenarioFlags, sal_Bool bCloneNoteCaptions);
370     void        CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
371                            bool bKeepScenarioFlags, bool bCloneNoteCaptions);
372     void        CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy,
373                                 sal_uInt16 nInsFlag, sal_Bool bAsLink, sal_Bool bSkipAttrForEmpty, ScTable* pTable);
374     void        StartListeningInArea( SCCOL nCol1, SCROW nRow1,
375                                         SCCOL nCol2, SCROW nRow2 );
376     void        BroadcastInArea( SCCOL nCol1, SCROW nRow1,
377                                     SCCOL nCol2, SCROW nRow2 );
378 
379     void        CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
380                             sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab,
381                             const ScMarkData* pMarkData = NULL,
382                             sal_Bool bAsLink = sal_False, sal_Bool bColRowFlags = sal_True);
383     void        UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
384                             sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab,
385                             const ScMarkData* pMarkData = NULL);
386 
387     void        TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
388                                 ScTable* pTransClip, sal_uInt16 nFlags, sal_Bool bAsLink );
389 
390                 //  Markierung von diesem Dokument
391     void        MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction,
392                             sal_Bool bSkipEmpty, ScTable* pSrcTab );
393     void        MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
394                             sal_uInt16 nFunction, sal_Bool bSkipEmpty, ScTable* pSrcTab );
395 
396     void        CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
397                             SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab );
398 
399     void        CopyScenarioFrom( const ScTable* pSrcTab );
400     void        CopyScenarioTo( ScTable* pDestTab ) const;
401     sal_Bool        TestCopyScenarioTo( const ScTable* pDestTab ) const;
402     void        MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const;
403     sal_Bool        HasScenarioRange( const ScRange& rRange ) const;
404     void        InvalidateScenarioRanges();
405     const ScRangeList* GetScenarioRanges() const;
406 
407     void        CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const;
408 
409     void        InvalidateTableArea();
410     void        InvalidatePageBreaks();
411 
412     sal_Bool        GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const;            // sal_False = leer
413     sal_Bool        GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const;
414     sal_Bool        GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, sal_Bool bNotes ) const;
415     sal_Bool        GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
416                                 SCCOL& rEndCol, sal_Bool bNotes ) const;
417     sal_Bool        GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
418                                 SCROW& rEndRow, sal_Bool bNotes ) const;
419 
420     sal_Bool        GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const;
421 
422     void        ExtendPrintArea( OutputDevice* pDev,
423                         SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow );
424 
425     void        GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow,
426                              sal_Bool bIncludeOld, bool bOnlyDown ) const;
427 
428     bool        ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow,
429                                       SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const;
430 
431     SCSIZE      GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow,
432                                         SCCOL nEndCol, SCROW nEndRow, ScDirection eDir );
433 
434     void        FindAreaPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY );
435     void        GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY,
436                                 sal_Bool bMarked, sal_Bool bUnprotected, const ScMarkData& rMark );
437 
438     void        LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow );
439 
440     sal_Bool        HasData( SCCOL nCol, SCROW nRow );
441     sal_Bool        HasStringData( SCCOL nCol, SCROW nRow );
442     sal_Bool        HasValueData( SCCOL nCol, SCROW nRow );
443 //UNUSED2008-05  sal_uInt16     GetErrorData(SCCOL nCol, SCROW nRow) const;
444     sal_Bool        HasStringCells( SCCOL nStartCol, SCROW nStartRow,
445                                 SCCOL nEndCol, SCROW nEndRow ) const;
446 
447     sal_uInt16      GetErrCode( const ScAddress& rPos ) const
448                     {
449                         return ValidColRow(rPos.Col(),rPos.Row()) ?
450                             aCol[rPos.Col()].GetErrCode( rPos.Row() ) :
451                             0;
452                     }
453 //UNUSED2008-05  sal_uInt16     GetErrCode( SCCOL nCol, SCROW nRow ) const;
454 
455     void        ResetChanged( const ScRange& rRange );
456 
457     void        SetDirty();
458     void        SetDirty( const ScRange& );
459     void        SetDirtyAfterLoad();
460     void        SetDirtyVar();
461     void        SetTableOpDirty( const ScRange& );
462     void        CalcAll();
463     void        CalcAfterLoad();
464     void        CompileAll();
465     void        CompileXML( ScProgress& rProgress );
466 
467     void        UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
468                                     SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
469                                     SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
470                                     ScDocument* pUndoDoc = NULL, sal_Bool bIncludeDraw = sal_True, bool bUpdateNoteCaptionPos = true );
471 
472     void        UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
473                                     SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
474                                     SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true );
475 
476     void        UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
477                                     ScDocument* pUndoDoc );
478 
479     void        UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
480 
481     void        UpdateInsertTab(SCTAB nTable);
482 //UNUSED2008-05  void        UpdateInsertTabOnlyCells(SCTAB nTable);
483     void        UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo = NULL );
484     void        UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& );
485     void        UpdateCompile( sal_Bool bForceIfNameInUse = sal_False );
486     void        SetTabNo(SCTAB nNewTab);
487     sal_Bool        IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
488                                  sal_uInt16 nIndex) const;
489     void        FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
490                                  std::set<sal_uInt16>& rIndexes) const;
491     void        ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
492                                       const ScRangeData::IndexMap& rMap );
493     void        Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
494                         sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd,
495                         double nStepValue, double nMaxValue);
496     String      GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY );
497 
498     void        UpdateSelectionFunction( ScFunctionData& rData,
499                         SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
500                         const ScMarkData& rMark );
501 
502     void        AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
503                                     sal_uInt16 nFormatNo );
504     void        GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData);
505     void        ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // aus sw
506     sal_Bool        SearchAndReplace(const SvxSearchItem& rSearchItem,
507                                 SCCOL& rCol, SCROW& rRow, ScMarkData& rMark,
508                                 String& rUndoStr, ScDocument* pUndoDoc);
509 
510     void        FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 );
511 
512     void        GetBorderLines( SCCOL nCol, SCROW nRow,
513                                 const SvxBorderLine** ppLeft, const SvxBorderLine** ppTop,
514                                 const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const;
515 
516 //UNUSED2009-05 sal_Bool        HasLines( const ScRange& rRange, Rectangle& rSizes ) const;
517     bool        HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const;
518     sal_Bool        HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
519     sal_Bool        ExtendMerge( SCCOL nStartCol, SCROW nStartRow,
520                                 SCCOL& rEndCol, SCROW& rEndRow,
521                                 sal_Bool bRefresh, sal_Bool bAttrs );
522     const SfxPoolItem*      GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
523     const ScPatternAttr*    GetPattern( SCCOL nCol, SCROW nRow ) const;
524     const ScPatternAttr*    GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;
525 
526     sal_uLong                   GetNumberFormat( const ScAddress& rPos ) const
527                                 {
528                                     return ValidColRow(rPos.Col(),rPos.Row()) ?
529                                         aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) :
530                                         0;
531                                 }
532     sal_uLong                   GetNumberFormat( SCCOL nCol, SCROW nRow ) const;
533     void                    MergeSelectionPattern( ScMergePatternState& rState,
534                                                 const ScMarkData& rMark, sal_Bool bDeep ) const;
535     void                    MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1,
536                                                 SCCOL nCol2, SCROW nRow2, sal_Bool bDeep ) const;
537     void                    MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
538                                             ScLineFlags& rFlags,
539                                             SCCOL nStartCol, SCROW nStartRow,
540                                             SCCOL nEndCol, SCROW nEndRow ) const;
541     void                    ApplyBlockFrame( const SvxBoxItem* pLineOuter,
542                                             const SvxBoxInfoItem* pLineInner,
543                                             SCCOL nStartCol, SCROW nStartRow,
544                                             SCCOL nEndCol, SCROW nEndRow );
545 
546     void        ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr );
547     void        ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr );
548     void        ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScPatternAttr& rAttr );
549     void        SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False )
550                     {
551                         if (ValidColRow(rPos.Col(),rPos.Row()))
552                             aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool );
553                     }
554     void        SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, sal_Bool bPutToPool = sal_False );
555     void        ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
556                             const ScPatternAttr& rPattern, short nNewType );
557 
558     void        ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
559     void        ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
560     void        ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
561     void        ApplySelectionLineStyle( const ScMarkData& rMark,
562                                     const SvxBorderLine* pLine, sal_Bool bColorOnly );
563 
564     const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const;
565     const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const;
566     const ScStyleSheet* GetAreaStyle( sal_Bool& rFound, SCCOL nCol1, SCROW nRow1,
567                                                     SCCOL nCol2, SCROW nRow2 ) const;
568 
569     void        StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, sal_Bool bRemoved,
570                                     OutputDevice* pDev,
571                                     double nPPTX, double nPPTY,
572                                     const Fraction& rZoomX, const Fraction& rZoomY );
573 
574     sal_Bool        IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const;
575 
576     sal_Bool        ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
577     sal_Bool        RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags );
578 
579     void        ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark );
580     void        DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark );
581 
582     void        ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
583     void        ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark );
584 
585     const ScRange*  GetRepeatColRange() const   { return pRepeatColRange; }
586     const ScRange*  GetRepeatRowRange() const   { return pRepeatRowRange; }
587     void            SetRepeatColRange( const ScRange* pNew );
588     void            SetRepeatRowRange( const ScRange* pNew );
589 
590     sal_uInt16          GetPrintRangeCount() const          { return static_cast< sal_uInt16 >( aPrintRanges.size() ); }
591     const ScRange*  GetPrintRange(sal_uInt16 nPos) const;
592     /** Returns true, if the sheet is always printed. */
593     sal_Bool            IsPrintEntireSheet() const          { return bPrintEntireSheet; }
594 
595     /** Removes all print ranges. */
596     void            ClearPrintRanges();
597     /** Adds a new print ranges. */
598     void            AddPrintRange( const ScRange& rNew );
599 //UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */
600 //UNUSED2009-05 void            SetPrintRange( const ScRange& rNew );
601     /** Marks the specified sheet to be printed completely. Deletes old print ranges! */
602     void            SetPrintEntireSheet();
603 
604     void            FillPrintSaver( ScPrintSaverTab& rSaveTab ) const;
605     void            RestorePrintRanges( const ScPrintSaverTab& rSaveTab );
606 
607     sal_uInt16      GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev,
608                                     double nPPTX, double nPPTY,
609                                     const Fraction& rZoomX, const Fraction& rZoomY,
610                                     sal_Bool bFormula, const ScMarkData* pMarkData,
611                                     sal_Bool bSimpleTextImport );
612     sal_Bool        SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra,
613                                     OutputDevice* pDev,
614                                     double nPPTX, double nPPTY,
615                                     const Fraction& rZoomX, const Fraction& rZoomY,
616                                     sal_Bool bForce,
617                                     ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 );
618     long        GetNeededSize( SCCOL nCol, SCROW nRow,
619                                     OutputDevice* pDev,
620                                     double nPPTX, double nPPTY,
621                                     const Fraction& rZoomX, const Fraction& rZoomY,
622                                     sal_Bool bWidth, sal_Bool bTotalSize );
623     void        SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth );
624     void        SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight );
625     sal_Bool        SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
626                                     double nPPTX, double nPPTY );
627 
628     /**
629      * Set specified row height to specified ranges.  Don't check for drawing
630      * objects etc.  Just set the row height.  Nothing else.
631      *
632      * Note that setting a new row height via this function will not
633      * invalidate page breaks.
634      */
635     void        SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight );
636 
637                         // nPPT fuer Test auf Veraenderung
638     void        SetManualHeight( SCROW nStartRow, SCROW nEndRow, sal_Bool bManual );
639 
640     sal_uInt16      GetColWidth( SCCOL nCol ) const;
641     SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const;
642     sal_uLong       GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const;
643     sal_uLong       GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const;
644     sal_uLong       GetColOffset( SCCOL nCol ) const;
645     sal_uLong       GetRowOffset( SCROW nRow ) const;
646 
647     /**
648      * Get the last row such that the height of row 0 to the end row is as
649      * high as possible without exceeding the specified height value.
650      *
651      * @param nHeight maximum desired height
652      *
653      * @return SCROW last row of the range within specified height.
654      */
655     SCROW       GetRowForHeight(sal_uLong nHeight) const;
656 
657     sal_uInt16      GetOriginalWidth( SCCOL nCol ) const;
658     sal_uInt16      GetOriginalHeight( SCROW nRow ) const;
659 
660     sal_uInt16      GetCommonWidth( SCCOL nEndCol );
661 
662     SCROW       GetHiddenRowCount( SCROW nRow );
663 
664     void        ShowCol(SCCOL nCol, bool bShow);
665     void        ShowRow(SCROW nRow, bool bShow);
666     void        DBShowRow(SCROW nRow, bool bShow);
667 
668     void        ShowRows(SCROW nRow1, SCROW nRow2, bool bShow);
669     void        DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow, bool bSetFlags);   // if bSetFlags=false, no SetRowHidden/SetRowFiltered
670 
671     void        SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags );
672     void        SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags );
673     void        SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags );
674 
675                 /// @return  the index of the last row with any set flags (auto-pagebreak is ignored).
676     SCROW      GetLastFlaggedRow() const;
677 
678                 /// @return  the index of the last changed column (flags and column width, auto pagebreak is ignored).
679     SCCOL      GetLastChangedCol() const;
680                 /// @return  the index of the last changed row (flags and row height, auto pagebreak is ignored).
681     SCROW      GetLastChangedRow() const;
682 
683     sal_Bool        IsDataFiltered() const;
684     sal_uInt8       GetColFlags( SCCOL nCol ) const;
685     sal_uInt8       GetRowFlags( SCROW nRow ) const;
686 
687     const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const
688                     { return pRowFlags; }
689 
690     sal_Bool        UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, sal_Bool bShow );
691     sal_Bool        UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, sal_Bool bShow );
692 
693     void        UpdatePageBreaks( const ScRange* pUserArea );
694     void        RemoveManualBreaks();
695     sal_Bool        HasManualBreaks() const;
696     void        SetRowManualBreaks( const ::std::set<SCROW>& rBreaks );
697     void        SetColManualBreaks( const ::std::set<SCCOL>& rBreaks );
698 
699     void        GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const;
700     void        GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const;
701     bool        HasRowPageBreak(SCROW nRow) const;
702     bool        HasColPageBreak(SCCOL nCol) const;
703     bool        HasRowManualBreak(SCROW nRow) const;
704     bool        HasColManualBreak(SCCOL nCol) const;
705 
706     /**
707      * Get the row position of the next manual break that occurs at or below
708      * specified row.  When no more manual breaks are present at or below
709      * the specified row, -1 is returned.
710      *
711      * @param nRow row at which the search begins.
712      *
713      * @return SCROW next row position with manual page break, or -1 if no
714      *         more manual breaks are present.
715      */
716     SCROW       GetNextManualBreak(SCROW nRow) const;
717 
718     void        RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow);
719     void        RemoveRowBreak(SCROW nRow, bool bPage, bool bManual);
720     void        RemoveColBreak(SCCOL nCol, bool bPage, bool bManual);
721     void        SetRowBreak(SCROW nRow, bool bPage, bool bManual);
722     void        SetColBreak(SCCOL nCol, bool bPage, bool bManual);
723     ::com::sun::star::uno::Sequence<
724         ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const;
725 
726     bool        RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
727     bool        RowHidden(SCROW nRow, SCROW& rLastRow) const;
728     bool        HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const;
729     bool        ColHidden(SCCOL nCol, SCCOL& rLastCol) const;
730     bool        ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
731     void        SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden);
732     void        SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden);
733     void        CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
734     void        CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
735     void        CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset);
736     SCROW       FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
737     SCROW       LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const;
738     SCROW       CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const;
739     sal_uInt32  GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const;
740 
741     SCCOLROW    LastHiddenColRow(SCCOLROW nPos, bool bCol) const;
742 
743     bool        RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const;
744     bool        ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const;
745     bool        HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
746     void        CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol);
747     void        CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow);
748     void        SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered);
749     void        SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered);
750     SCROW       FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
751     SCROW       LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const;
752     SCROW       CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const;
753 
754     void        SyncColRowFlags();
755 
756     void        StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
757     void        ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
758 
759     void        Sort(const ScSortParam& rSortParam, sal_Bool bKeepQuery);
760     sal_Bool        ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam,
761                     sal_Bool* pSpecial = NULL, ScBaseCell* pCell = NULL,
762                     sal_Bool* pbTestEqualCondition = NULL );
763     void        TopTenQuery( ScQueryParam& );
764     SCSIZE      Query(ScQueryParam& rQueryParam, sal_Bool bKeepSub);
765     sal_Bool        CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
766 
767     void        GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates);
768     void        GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates );
769     sal_Bool        GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit);
770 
771     sal_Bool        HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
772     sal_Bool        HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
773 
774     void        DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd );
775 
776 
777     sal_Int32   GetMaxStringLen( SCCOL nCol,
778                                     SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const;
779     xub_StrLen  GetMaxNumberStringLen( sal_uInt16& nPrecision,
780                                        SCCOL nCol,
781                                        SCROW nRowStart, SCROW nRowEnd ) const;
782 
783     void        FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges );
784 
785     void        IncRecalcLevel() { ++nRecalcLvl; }
786     void        DecRecalcLevel( bool bUpdateNoteCaptionPos = true ) { if (!--nRecalcLvl) SetDrawPageSize(true, bUpdateNoteCaptionPos); }
787 
788     sal_Bool        IsSortCollatorGlobal() const;
789     void        InitSortCollator( const ScSortParam& rPar );
790     void        DestroySortCollator();
791 
792 private:
793     void        FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
794                                 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
795                                 FillDateCmd eFillDateCmd,
796                                 double nStepValue, double nMaxValue, sal_uInt16 nMinDigits,
797                                 sal_Bool bAttribs, ScProgress& rProgress );
798     void        FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
799                                 FillCmd& rCmd, FillDateCmd& rDateCmd,
800                                 double& rInc, sal_uInt16& rMinDigits,
801                                 ScUserListData*& rListData, sal_uInt16& rListIndex);
802     void        FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
803                         sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress );
804 
805     sal_Bool        ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
806                                 sal_Bool bMarked, sal_Bool bUnprotected );
807 
808     void        AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
809                                 const ScPatternAttr& rAttr, sal_uInt16 nFormatNo);
810     void        GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData);
811     void        GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData);
812     sal_Bool        SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow,
813                             const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
814     sal_Bool        Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
815                         const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
816     sal_Bool        SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
817                         String& rUndoStr, ScDocument* pUndoDoc);
818     sal_Bool        Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
819                         const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc);
820     sal_Bool        ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
821                             String& rUndoStr, ScDocument* pUndoDoc);
822 
823     sal_Bool        SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
824                                 ScMarkData& rMark);
825     sal_Bool        ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
826                                 ScMarkData& rMark, sal_Bool bIsUndo);
827     sal_Bool        SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark);
828     sal_Bool        ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark,
829                                 ScDocument* pUndoDoc);
830 
831                                 // benutzen globalen SortParam:
832     sal_Bool        IsSorted(SCCOLROW nStart, SCCOLROW nEnd);
833     void        DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 );
834     void        SwapCol(SCCOL nCol1, SCCOL nCol2);
835     void        SwapRow(SCROW nRow1, SCROW nRow2);
836     short       CompareCell( sal_uInt16 nSort,
837                     ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row,
838                     ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row );
839     short       Compare(SCCOLROW nIndex1, SCCOLROW nIndex2);
840     short       Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2);
841     ScSortInfoArray*    CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 );
842     void        QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi);
843     void        SortReorder( ScSortInfoArray*, ScProgress& );
844 
845     sal_Bool        CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
846     sal_Bool        CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam);
847     void        GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr);
848 
849     sal_Bool        RefVisible(ScFormulaCell* pCell);
850 
851     sal_Bool        IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol);
852 
853     void        IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd);
854     void        FillFormula(sal_uLong& nFormulaCounter, sal_Bool bFirst, ScFormulaCell* pSrcCell,
855                             SCCOL nDestCol, SCROW nDestRow, sal_Bool bLast );
856     void        UpdateInsertTabAbs(SCTAB nNewPos);
857     sal_Bool        GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, sal_Bool bInSel,
858                                     const ScMarkData& rMark) const;
859     sal_Bool        GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark );
860     void        SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true );
861     sal_Bool        TestTabRefAbs(SCTAB nTable);
862     void        CompileDBFormula();
863     void        CompileDBFormula( sal_Bool bCreateFormulaString );
864     void        CompileNameFormula( sal_Bool bCreateFormulaString );
865     void        CompileColRowNameFormula();
866 
867     void        StartListening( const ScAddress& rAddress, SvtListener* pListener );
868     void        EndListening( const ScAddress& rAddress, SvtListener* pListener );
869     void        StartAllListeners();
870     void        StartNeededListeners(); // only for cells where NeedsListening()==TRUE
871     void        SetRelNameDirty();
872 
873     void        SetLoadingMedium(bool bLoading);
874 
875     SCSIZE      FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2,
876                             SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY,
877                             const ScPatternAttr* pPattern, const SfxItemSet* pCondSet );
878 
879     // idle calculation of OutputDevice text width for cell
880     // also invalidates script type, broadcasts for "calc as shown"
881     void        InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo,
882                                      sal_Bool bNumFormatChanged, sal_Bool bBroadcast );
883 
884     /**
885      * In case the cell text goes beyond the column width, move the max column
886      * position to the right.  This is called from ExtendPrintArea.
887      */
888     void        MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY);
889 
890     /**
891      * Use this to iterate through non-empty visible cells in a single column.
892      */
893     class VisibleDataCellIterator
894     {
895     public:
896         static SCROW ROW_NOT_FOUND;
897 
898         explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn);
899         ~VisibleDataCellIterator();
900 
901         /**
902          * Set the start row position.  In case there is not visible data cell
903          * at the specified row position, it will move to the position of the
904          * first visible data cell below that point.
905          *
906          * @return First visible data cell if found, or NULL otherwise.
907          */
908         ScBaseCell* reset(SCROW nRow);
909 
910         /**
911          * Find the next visible data cell position.
912          *
913          * @return Next visible data cell if found, or NULL otherwise.
914          */
915         ScBaseCell* next();
916 
917         /**
918          * Get the current row position.
919          *
920          * @return Current row position, or ROW_NOT_FOUND if the iterator
921          *         doesn't point to a valid data cell position.
922          */
923         SCROW getRow() const;
924 
925     private:
926         ScFlatBoolRowSegments& mrRowSegs;
927         ScColumn& mrColumn;
928         ScBaseCell* mpCell;
929         SCROW mnCurRow;
930         SCROW mnUBound;
931     };
932 };
933 
934 
935 #endif
936 
937 
938