LCOV - code coverage report
Current view: top level - sc/inc - column.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 7 100.0 %
Date: 2015-06-13 12:38:46 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SC_INC_COLUMN_HXX
      21             : #define INCLUDED_SC_INC_COLUMN_HXX
      22             : 
      23             : #include "markarr.hxx"
      24             : #include "global.hxx"
      25             : #include "address.hxx"
      26             : #include "rangenam.hxx"
      27             : #include "rangelst.hxx"
      28             : #include "types.hxx"
      29             : #include "mtvelements.hxx"
      30             : #include <formula/types.hxx>
      31             : #include <svl/zforlist.hxx>
      32             : 
      33             : #include <set>
      34             : #include <vector>
      35             : 
      36             : #include <boost/intrusive_ptr.hpp>
      37             : #include <mdds/flat_segment_tree.hpp>
      38             : 
      39             : namespace editeng { class SvxBorderLine; }
      40             : namespace formula { struct VectorRefArray; }
      41             : 
      42             : namespace sc {
      43             : 
      44             : struct FormulaGroupContext;
      45             : struct FormulaGroupEntry;
      46             : class StartListeningContext;
      47             : class EndListeningContext;
      48             : class CopyFromClipContext;
      49             : class CopyToClipContext;
      50             : class CopyToDocContext;
      51             : class MixDocContext;
      52             : class ColumnSpanSet;
      53             : struct ColumnBlockPosition;
      54             : class SingleColumnSpanSet;
      55             : struct RefUpdateContext;
      56             : struct RefUpdateInsertTabContext;
      57             : struct RefUpdateDeleteTabContext;
      58             : struct RefUpdateMoveTabContext;
      59             : class EditTextIterator;
      60             : struct NoteEntry;
      61             : class DocumentStreamAccess;
      62             : class CellValues;
      63             : class TableValues;
      64             : struct RowSpan;
      65             : class RowHeightContext;
      66             : class CompileFormulaContext;
      67             : struct SetFormulaDirtyContext;
      68             : class RefMovedHint;
      69             : 
      70             : }
      71             : 
      72             : class Fraction;
      73             : class OutputDevice;
      74             : class SfxItemPoolCache;
      75             : class SvtListener;
      76             : class SfxPoolItem;
      77             : class SfxStyleSheetBase;
      78             : class SvxBoxInfoItem;
      79             : class SvxBoxItem;
      80             : 
      81             : class ScAttrIterator;
      82             : class ScAttrArray;
      83             : struct ScAttrEntry;
      84             : class ScDocument;
      85             : class ScEditDataArray;
      86             : class ScFormulaCell;
      87             : class ScMarkData;
      88             : class ScPatternAttr;
      89             : class ScStyleSheet;
      90             : class SvtBroadcaster;
      91             : class ScTypedStrData;
      92             : class ScProgress;
      93             : struct ScFunctionData;
      94             : struct ScLineFlags;
      95             : struct ScMergePatternState;
      96             : class ScFlatBoolRowSegments;
      97             : struct ScSetStringParam;
      98             : struct ScColWidthParam;
      99             : class ScColumnTextWidthIterator;
     100             : struct ScFormulaCellGroup;
     101             : struct ScRefCellValue;
     102             : struct ScCellValue;
     103             : class ScDocumentImport;
     104             : class ScHint;
     105             : 
     106             : struct ScNeededSizeOptions
     107             : {
     108             :     const ScPatternAttr*    pPattern;
     109             :     bool                bFormula;
     110             :     bool                bSkipMerged;
     111             :     bool                bGetFont;
     112             :     bool                bTotalSize;
     113             : 
     114             :     ScNeededSizeOptions();
     115             : };
     116             : 
     117             : class ScColumn
     118             : {
     119             :     // Empty values correspond with empty cells. All non-empty cell positions
     120             :     // must have non-empty elements. For text width, the value should be
     121             :     // either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
     122             :     // calculated yet. For script type, it should be either the real script
     123             :     // type value or SvtScriptType::UNKNOWN.
     124             :     sc::CellTextAttrStoreType maCellTextAttrs;
     125             : 
     126             :     // Cell notes
     127             :     sc::CellNoteStoreType maCellNotes;
     128             : 
     129             :     // Broadcasters for formula cells.
     130             :     sc::BroadcasterStoreType maBroadcasters;
     131             : 
     132             :     // Cell values.
     133             :     sc::CellStoreType maCells;
     134             : 
     135             :     SCCOL           nCol;
     136             :     SCTAB           nTab;
     137             : 
     138             :     ScAttrArray*          pAttrArray;
     139             :     ScDocument*           pDocument;
     140             :     bool mbDirtyGroups;     /// formula groups are dirty.
     141             : 
     142             : friend class ScDocument;                    // for FillInfo
     143             : friend class ScTable;
     144             : friend class ScValueIterator;
     145             : friend class ScHorizontalValueIterator;
     146             : friend class ScDBQueryDataIterator;
     147             : friend class ScQueryCellIterator;
     148             : friend class ScFormulaGroupIterator;
     149             : friend class ScCellIterator;
     150             : friend class ScHorizontalCellIterator;
     151             : friend class ScHorizontalAttrIterator;
     152             : friend class ScColumnTextWidthIterator;
     153             : friend class ScDocumentImport;
     154             : friend class sc::DocumentStreamAccess;
     155             : friend class sc::SingleColumnSpanSet;
     156             : friend class sc::ColumnSpanSet;
     157             : friend class sc::EditTextIterator;
     158             : friend class sc::CellValues;
     159             : friend class sc::TableValues;
     160             : 
     161             :     ScColumn(const ScColumn&) SAL_DELETED_FUNCTION;
     162             :     ScColumn& operator= (const ScColumn&) SAL_DELETED_FUNCTION;
     163             : 
     164             :     bool ParseString(
     165             :         ScCellValue& rCell,
     166             :         SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
     167             :         ScSetStringParam* pParam );
     168             : 
     169             : public:
     170             : 
     171             :     /** Broadcast mode for SetDirty(SCROW,SCROW,BroadcastMode). */
     172             :     enum BroadcastMode
     173             :     {
     174             :         BROADCAST_NONE,             ///< no broadcasting
     175             :         BROADCAST_DATA_POSITIONS,   ///< broadcast existing cells with position => does AreaBroadcast
     176             :         BROADCAST_BROADCASTERS      ///< broadcast only existing cell broadcasters => no AreaBroadcast of range!
     177             :     };
     178             : 
     179             :                 ScColumn();
     180             :                 ~ScColumn();
     181             : 
     182             :     void        Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc);
     183             : 
     184       36708 :     ScDocument& GetDoc() { return *pDocument;}
     185        1593 :     const ScDocument& GetDoc() const { return *pDocument;}
     186       36477 :     SCTAB GetTab() const { return nTab; }
     187       18973 :     SCCOL GetCol() const { return nCol; }
     188      724878 :     sc::CellStoreType& GetCellStore() { return maCells; }
     189             :     const sc::CellStoreType& GetCellStore() const { return maCells; }
     190      739746 :     sc::CellTextAttrStoreType& GetCellAttrStore() { return maCellTextAttrs; }
     191             :     const sc::CellTextAttrStoreType& GetCellAttrStore() const { return maCellTextAttrs; }
     192          39 :     sc::CellNoteStoreType& GetCellNoteStore() { return maCellNotes; }
     193             :     const sc::CellNoteStoreType& GetCellNoteStore() const { return maCellNotes; }
     194             : 
     195             :     ScRefCellValue GetCellValue( SCROW nRow ) const;
     196             :     ScRefCellValue GetCellValue( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
     197             :     static ScRefCellValue GetCellValue( const sc::CellStoreType::const_iterator& itPos, size_t nOffset );
     198             : 
     199             :     const sc::CellTextAttr* GetCellTextAttr( SCROW nRow ) const;
     200             :     const sc::CellTextAttr* GetCellTextAttr( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
     201             : 
     202             :     void        Delete( SCROW nRow );
     203             :     void        DeleteContent( SCROW nRow, bool bBroadcast = true );
     204             :     void        FreeAll();
     205             :     void        FreeNotes();
     206             :     void Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern );
     207             : 
     208             :     bool        HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
     209             :     bool    HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const;
     210             :     bool IsMerged( SCROW nRow ) const;
     211             :     bool    ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow,
     212             :                                 SCCOL& rPaintCol, SCROW& rPaintRow,
     213             :                                 bool bRefresh );
     214             : 
     215             :     bool               IsEmptyData() const;
     216             :     bool               IsEmptyAttr() const;
     217             :     bool               IsEmpty() const;
     218             : 
     219             :                 // data only:
     220             :     bool               IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
     221             :     SCSIZE         GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const;
     222             :     bool               HasDataAt(SCROW nRow) const;
     223             :     bool               HasVisibleDataAt(SCROW nRow) const;
     224             :     SCROW              GetFirstDataPos() const;
     225             :     SCROW              GetLastDataPos() const;
     226             :     SCROW GetLastDataPos( SCROW nLastRow ) const;
     227             :     bool               GetPrevDataPos(SCROW& rRow) const;
     228             :     bool               GetNextDataPos(SCROW& rRow) const;
     229             :     void               FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster)
     230             :     void FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const;
     231             : 
     232             :     SCSIZE             VisibleCount( SCROW nStartRow, SCROW nEndRow ) const;
     233             :     sal_uInt16  GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const;
     234             :     bool    HasSelectionMatrixFragment(const ScMarkData& rMark) const;
     235             : 
     236             :     bool    GetFirstVisibleAttr( SCROW& rFirstRow ) const;
     237             :     bool    GetLastVisibleAttr( SCROW& rLastRow, bool bFullFormattedArea = false ) const;
     238             :     bool    HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
     239             :     bool    IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
     240             :                                     SCROW nEndRow = MAXROW ) const;
     241             :     bool    IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
     242             : 
     243             :     bool    TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
     244             :     bool TestInsertRow( SCROW nStartRow, SCSIZE nSize ) const;
     245             :     void        InsertRow( SCROW nStartRow, SCSIZE nSize );
     246             : 
     247             :     /**
     248             :      * @param nStartRow top row position
     249             :      * @param nSize size of the segment to delete.
     250             :      * @param pGroupPos when non-NULL, stores the top position of formula
     251             :      *                  group that's been merged as a result of row deletion.
     252             :      */
     253             :     void DeleteRow( SCROW nStartRow, SCSIZE nSize, std::vector<ScAddress>* pGroupPos = NULL );
     254             : 
     255             :     void DeleteArea(
     256             :         SCROW nStartRow, SCROW nEndRow, InsertDeleteFlags nDelFlag,
     257             :         bool bBroadcast = true, sc::ColumnSpanSet* pBroadcastSpans = NULL );
     258             : 
     259             :     void DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDeleteFlags nDelFlag, bool bBroadcast );
     260             : 
     261             :     void CopyToClip(
     262             :         sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const;
     263             : 
     264             :     void CopyStaticToDocument(
     265             :         SCROW nRow1, SCROW nRow2, const SvNumberFormatterMergeMap& rMap, ScColumn& rDestCol );
     266             : 
     267             :     void CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDestCol );
     268             :     bool InitBlockPosition( sc::ColumnBlockPosition& rBlockPos );
     269             :     bool InitBlockPosition( sc::ColumnBlockConstPosition& rBlockPos ) const;
     270             : 
     271             :     void DeleteBeforeCopyFromClip(
     272             :         sc::CopyFromClipContext& rCxt, const ScColumn& rClipCol, sc::ColumnSpanSet& rBroadcastSpans );
     273             : 
     274             :     void CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, size_t nColOffset );
     275             : 
     276             :     void CopyFromClip(
     277             :         sc::CopyFromClipContext& rCxt, SCROW nRow1, SCROW nRow2, long nDy, ScColumn& rColumn );
     278             : 
     279             :     void        RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow );
     280             : 
     281             :                 //  Selection (?) of this document
     282             :     void MixMarked(
     283             :         sc::MixDocContext& rCxt, const ScMarkData& rMark, sal_uInt16 nFunction,
     284             :         bool bSkipEmpty, const ScColumn& rSrcCol );
     285             :     void MixData(
     286             :         sc::MixDocContext& rCxt, SCROW nRow1, SCROW nRow2, sal_uInt16 nFunction, bool bSkipEmpty,
     287             :         const ScColumn& rSrcCol );
     288             : 
     289             :     ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const;
     290             : 
     291             :     void UpdateSelectionFunction(
     292             :         const ScRangeList& rRanges, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows );
     293             : 
     294             :     void CopyToColumn(
     295             :         sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
     296             :         ScColumn& rColumn, const ScMarkData* pMarkData = NULL, bool bAsLink = false) const;
     297             : 
     298             :     void UndoToColumn(
     299             :         sc::CopyToDocContext& rCxt, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nFlags, bool bMarked,
     300             :         ScColumn& rColumn, const ScMarkData* pMarkData = NULL) const;
     301             : 
     302             :     void        CopyScenarioFrom( const ScColumn& rSrcCol );
     303             :     void        CopyScenarioTo( ScColumn& rDestCol ) const;
     304             :     bool    TestCopyScenarioTo( const ScColumn& rDestCol ) const;
     305             :     void        MarkScenarioIn( ScMarkData& rDestMark ) const;
     306             : 
     307             :     void        CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const;
     308             : 
     309             :     void        SwapCol(ScColumn& rCol);
     310             :     void        MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol);
     311             : 
     312             :     bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst);
     313             : 
     314             :     bool SetString(
     315             :         SCROW nRow, SCTAB nTab, const OUString& rString, formula::FormulaGrammar::AddressConvention eConv,
     316             :         ScSetStringParam* pParam = NULL );
     317             : 
     318             :     void SetEditText( SCROW nRow, EditTextObject* pEditText );
     319             :     void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, EditTextObject* pEditText );
     320             :     void SetEditText( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const EditTextObject& rEditText );
     321             :     void SetEditText( SCROW nRow, const EditTextObject& rEditText, const SfxItemPool* pEditPool );
     322             :     void SetFormula( SCROW nRow, const ScTokenArray& rArray, formula::FormulaGrammar::Grammar eGram );
     323             :     void SetFormula( SCROW nRow, const OUString& rFormula, formula::FormulaGrammar::Grammar eGram );
     324             : 
     325             :     /**
     326             :      * Takes ownership of pCell
     327             :      *
     328             :      * @return pCell if it was successfully inserted, NULL otherwise. pCell
     329             :      *         is deleted automatically on failure to insert.
     330             :      */
     331             :     ScFormulaCell* SetFormulaCell(
     332             :         SCROW nRow, ScFormulaCell* pCell,
     333             :         sc::StartListeningType eListenType = sc::SingleCellListening );
     334             :     ScFormulaCell* SetFormulaCell(
     335             :         sc::ColumnBlockPosition& rBlockPos, SCROW nRow, ScFormulaCell* pCell,
     336             :         sc::StartListeningType eListenType = sc::SingleCellListening );
     337             : 
     338             :     bool SetFormulaCells( SCROW nRow, std::vector<ScFormulaCell*>& rCells );
     339             : 
     340             :     bool HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const;
     341             : 
     342             :     void CloneFormulaCell(
     343             :         const ScFormulaCell& rSrc, const sc::CellTextAttr& rAttr,
     344             :         const std::vector<sc::RowSpan>& rRanges, sc::StartListeningContext* pCxt );
     345             : 
     346             :     svl::SharedString GetSharedString( SCROW nRow ) const;
     347             : 
     348             :     void SetRawString( SCROW nRow, const OUString& rStr, bool bBroadcast = true );
     349             :     void SetRawString( SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
     350             :     void SetRawString( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, const svl::SharedString& rStr, bool bBroadcast = true );
     351             :     void SetValue( SCROW nRow, double fVal );
     352             :     void SetValues( SCROW nRow, const std::vector<double>& rVals );
     353             :     void SetValue( sc::ColumnBlockPosition& rBlockPos, SCROW nRow, double fVal, bool bBroadcast = true );
     354             :     void        SetError( SCROW nRow, const sal_uInt16 nError);
     355             : 
     356             :     void        GetString( SCROW nRow, OUString& rString ) const;
     357             :     double* GetValueCell( SCROW nRow );
     358             :     void        GetInputString( SCROW nRow, OUString& rString ) const;
     359             :     double      GetValue( SCROW nRow ) const;
     360             :     const EditTextObject* GetEditText( SCROW nRow ) const;
     361             :     void RemoveEditTextCharAttribs( SCROW nRow, const ScPatternAttr& rAttr );
     362             :     void        GetFormula( SCROW nRow, OUString& rFormula ) const;
     363             :     const ScFormulaCell* GetFormulaCell( SCROW nRow ) const;
     364             :     ScFormulaCell* GetFormulaCell( SCROW nRow );
     365             :     ScFormulaCell * const * GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const;
     366             :     CellType    GetCellType( SCROW nRow ) const;
     367             :     SCSIZE      GetCellCount() const;
     368             :     sal_uInt32 GetWeightedCount() const;
     369             :     sal_uInt32 GetCodeCount() const;       // RPN-Code in formulas
     370             :     sal_uInt16  GetErrCode( SCROW nRow ) const;
     371             : 
     372             :     bool    HasStringData( SCROW nRow ) const;
     373             :     bool    HasValueData( SCROW nRow ) const;
     374             :     bool    HasStringCells( SCROW nStartRow, SCROW nEndRow ) const;
     375             : 
     376             :     bool IsFormulaDirty( SCROW nRow ) const;
     377             : 
     378             :     void SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt );
     379             :     void SetDirtyFromClip( SCROW nRow1, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans );
     380             :     void SetDirty( SCROW nRow1, SCROW nRow2, BroadcastMode );
     381             :     void        SetDirtyVar();
     382             :     void        SetDirtyAfterLoad();
     383             :     void        SetTableOpDirty( const ScRange& );
     384             :     void        CalcAll();
     385             :     void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening );
     386             :     void CompileAll( sc::CompileFormulaContext& rCxt );
     387             :     void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress );
     388             : 
     389             :     /** Broadcast single broadcasters in range, without explicitly setting
     390             :         anything dirty, not doing area broadcasts.
     391             :         @param rHint address is modified to adapt to the actual broadcasted
     392             :                 position on each iteration and upon return points to the last
     393             :                 position broadcasted. */
     394             :     bool BroadcastBroadcasters( SCROW nRow1, SCROW nRow2, ScHint& rHint );
     395             : 
     396             :     bool CompileErrorCells( sc::CompileFormulaContext& rCxt, sal_uInt16 nErrCode );
     397             : 
     398             :     void        ResetChanged( SCROW nStartRow, SCROW nEndRow );
     399             : 
     400             :     bool UpdateReferenceOnCopy( const sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL );
     401             : 
     402             :     /**
     403             :      * Update reference addresses in formula cell in response to mass cell
     404             :      * movement.
     405             :      *
     406             :      * @return true if reference of at least one formula cell has been
     407             :      *         updated, false otherwise.
     408             :      */
     409             :     bool UpdateReference( sc::RefUpdateContext& rCxt, ScDocument* pUndoDoc = NULL );
     410             : 
     411             :     void UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt );
     412             :     void UpdateInsertTabOnlyCells( sc::RefUpdateInsertTabContext& rCxt );
     413             :     void UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt );
     414             :     void UpdateMoveTab( sc::RefUpdateMoveTabContext& rCxt, SCTAB nTabNo );
     415             :     void        UpdateCompile( bool bForceIfNameInUse = false );
     416             :     void        UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
     417             :                                     ScDocument* pUndoDoc );
     418             :     void        UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY );
     419             : 
     420             :     void        SetTabNo(SCTAB nNewTab);
     421             :     void        FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<sal_uInt16>& rIndexes) const;
     422             : 
     423             :     void PreprocessRangeNameUpdate(
     424             :         sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
     425             : 
     426             :     void CompileHybridFormula(
     427             :         sc::StartListeningContext& rStartListenCxt, sc::CompileFormulaContext& rCompileCxt );
     428             : 
     429             :     void PreprocessDBDataUpdate(
     430             :         sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
     431             : 
     432             :     const SfxPoolItem*      GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
     433             :     const ScPatternAttr*    GetPattern( SCROW nRow ) const;
     434             :     const ScPatternAttr*    GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
     435             : 
     436             :     sal_uInt32 GetNumberFormat( SCROW nRow ) const;
     437             :     sal_uInt32  GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const;
     438             : 
     439             :     void        MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, bool bDeep ) const;
     440             :     void        MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const;
     441             :     void        MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner,
     442             :                             ScLineFlags& rFlags,
     443             :                             SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const;
     444             :     void        ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner,
     445             :                             SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight );
     446             : 
     447             :     void        ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr );
     448             :     void        ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr );
     449             :     void        ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr,
     450             :                                   ScEditDataArray* pDataArray = NULL );
     451             :     void        SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, bool bPutToPool = false );
     452             :     void        SetPatternArea( SCROW nStartRow, SCROW nEndRow,
     453             :                                 const ScPatternAttr& rPatAttr, bool bPutToPool = false );
     454             :     void        ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
     455             :                             const ScPatternAttr& rPattern, short nNewType );
     456             : 
     457             :     void        ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle );
     458             :     void        ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
     459             :     void        ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
     460             :     void        ApplySelectionLineStyle( const ScMarkData& rMark,
     461             :                                     const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
     462             :     void        AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
     463             :     void        RemoveCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
     464             : 
     465             :     const ScStyleSheet* GetStyle( SCROW nRow ) const;
     466             :     const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
     467             :     const ScStyleSheet* GetAreaStyle( bool& rFound, SCROW nRow1, SCROW nRow2 ) const;
     468             : 
     469             :     void        FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset );
     470             :     bool    IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const;
     471             : 
     472             :                 /// May return -1 if not found
     473             :     SCsROW SearchStyle(
     474             :         SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection,
     475             :         const ScMarkData& rMark) const;
     476             : 
     477             :     bool SearchStyleRange(
     478             :         SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp,
     479             :         bool bInSelection, const ScMarkData& rMark) const;
     480             : 
     481             :     bool    ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
     482             :     bool    RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags );
     483             :     void        ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
     484             : 
     485             :     void        RemoveProtected( SCROW nStartRow, SCROW nEndRow );
     486             : 
     487             :     SCsROW      ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL );
     488             :     void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast );
     489             : 
     490             :     void        ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
     491             :     void        ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
     492             : 
     493             :     long GetNeededSize(
     494             :         SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY,
     495             :         const Fraction& rZoomX, const Fraction& rZoomY,
     496             :         bool bWidth, const ScNeededSizeOptions& rOptions, const ScPatternAttr** pPatternChange ) const;
     497             : 
     498             :     sal_uInt16 GetOptimalColWidth(
     499             :         OutputDevice* pDev, double nPPTX, double nPPTY,
     500             :         const Fraction& rZoomX, const Fraction& rZoomY,
     501             :         bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const;
     502             : 
     503             :     void GetOptimalHeight(
     504             :         sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nMinHeight, SCROW nMinStart );
     505             : 
     506             :                 /// Including current, may return -1
     507             :     SCsROW      GetNextUnprotected( SCROW nRow, bool bUp ) const;
     508             : 
     509             :     void GetFilterEntries(
     510             :         sc::ColumnBlockConstPosition& rBlockPos, SCROW nStartRow, SCROW nEndRow,
     511             :         std::vector<ScTypedStrData>& rStrings, bool& rHasDates );
     512             : 
     513             :     bool GetDataEntries( SCROW nRow, std::set<ScTypedStrData>& rStrings, bool bLimit ) const;
     514             : 
     515             :     void UpdateInsertTabAbs(SCTAB nNewPos);
     516             :     bool    TestTabRefAbs(SCTAB nTable) const;
     517             :     bool    GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const;
     518             : 
     519             :     void StartListeningFormulaCells(
     520             :         sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt, SCROW nRow1, SCROW nRow2,
     521             :         SCROW* pStartRow = NULL, SCROW* pEndRow = NULL );
     522             : 
     523             :     void EndListeningFormulaCells(
     524             :         sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2,
     525             :         SCROW* pStartRow = NULL, SCROW* pEndRow = NULL );
     526             : 
     527             :     void        StartListening( SvtListener& rLst, SCROW nRow );
     528             :     void        EndListening( SvtListener& rLst, SCROW nRow );
     529             :     void StartListening( sc::StartListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
     530             :     void EndListening( sc::EndListeningContext& rCxt, SCROW nRow, SvtListener& rListener );
     531             :     void StartListeners( sc::StartListeningContext& rCxt, bool bAll );
     532             :     void        SetDirtyIfPostponed();
     533             :     void BroadcastRecalcOnRefMove();
     534             :     void TransferListeners( ScColumn& rDestCol, SCROW nRow1, SCROW nRow2, SCROW nRowDelta );
     535             :     void CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nRow1, SCROW nRow2 );
     536             :     void CollectFormulaCells( std::vector<ScFormulaCell*>& rCells, SCROW nRow1, SCROW nRow2 );
     537             : 
     538             :     void CompileDBFormula( sc::CompileFormulaContext& rCxt );
     539             :     void CompileColRowNameFormula( sc::CompileFormulaContext& rCxt );
     540             : 
     541             :     sal_Int32   GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, rtl_TextEncoding eCharSet ) const;
     542             :     sal_Int32   GetMaxNumberStringLen( sal_uInt16& nPrecision,
     543             :                                        SCROW nRowStart, SCROW nRowEnd ) const;
     544             : 
     545             :     sal_uInt16 GetTextWidth(SCROW nRow) const;
     546             :     void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
     547             : 
     548             :     SvtScriptType GetScriptType( SCROW nRow ) const;
     549             : 
     550             :     /**
     551             :      * Get combined script types of the specified range. This method may
     552             :      * update script types on demand if they have not been determined.
     553             :      */
     554             :     SvtScriptType GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
     555             :             const sc::CellStoreType::iterator& itr);
     556             : 
     557             :     void SetScriptType( SCROW nRow, SvtScriptType nType );
     558             :     void UpdateScriptTypes( SCROW nRow1, SCROW nRow2 );
     559             : 
     560             :     size_t GetFormulaHash( SCROW nRow ) const;
     561             : 
     562             :     ScFormulaVectorState GetFormulaVectorState( SCROW nRow ) const;
     563             :     formula::FormulaTokenRef ResolveStaticReference( SCROW nRow );
     564             :     bool ResolveStaticReference( ScMatrix& rMat, SCCOL nMatCol, SCROW nRow1, SCROW nRow2 );
     565             :     void FillMatrix( ScMatrix& rMat, size_t nMatCol, SCROW nRow1, SCROW nRow2 ) const;
     566             :     formula::VectorRefArray FetchVectorRefArray( SCROW nRow1, SCROW nRow2 );
     567             :     void SetFormulaResults( SCROW nRow, const double* pResults, size_t nLen );
     568             :     void SetFormulaResults( SCROW nRow, const formula::FormulaTokenRef* pResults, size_t nLen );
     569             : 
     570             :     void SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat );
     571             : 
     572             :     SvtBroadcaster* GetBroadcaster( SCROW nRow );
     573             :     const SvtBroadcaster* GetBroadcaster( SCROW nRow ) const;
     574             :     const SvtBroadcaster* GetBroadcaster( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
     575             : 
     576             :     void DeleteBroadcasters( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
     577             :     void PrepareBroadcastersForDestruction();
     578             :     bool HasBroadcaster() const;
     579             : 
     580             :     void Broadcast( SCROW nRow );
     581             :     void BroadcastCells( const std::vector<SCROW>& rRows, sal_uLong nHint );
     582             : 
     583             :     // cell notes
     584             :     ScPostIt* GetCellNote( SCROW nRow );
     585             :     const ScPostIt* GetCellNote( SCROW nRow ) const;
     586             :     const ScPostIt* GetCellNote( sc::ColumnBlockConstPosition& rBlockPos, SCROW nRow ) const;
     587             :     void DeleteCellNotes( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 );
     588             :     bool HasCellNotes() const;
     589             :     void SetCellNote( SCROW nRow, ScPostIt* pNote);
     590             :     bool IsNotesEmptyBlock(SCROW nStartRow, SCROW nEndRow) const;
     591             : 
     592             :     ScPostIt* ReleaseNote( SCROW nRow );
     593             :     size_t GetNoteCount() const;
     594             :     void CreateAllNoteCaptions();
     595             :     void ForgetNoteCaptions( SCROW nRow1, SCROW nRow2 );
     596             :     SCROW GetNotePosition( size_t nIndex ) const;
     597             :     void GetAllNoteEntries( std::vector<sc::NoteEntry>& rNotes ) const;
     598             :     void GetNotesInRange( SCROW nStartRow, SCROW nEndRow, std::vector<sc::NoteEntry>& rNotes ) const;
     599             : 
     600             :     SCROW GetCellNotesMaxRow() const;
     601             :     SCROW GetCellNotesMinRow() const;
     602             : 
     603             :     void CopyCellNotesToDocument(
     604             :         SCROW nRow1, SCROW nRow2, ScColumn& rDestCol, bool bCloneCaption = true,
     605             :         SCROW nRowOffsetDest = 0) const;
     606             : 
     607             :     void DuplicateNotes(SCROW nStartRow, size_t nDataSize, ScColumn& rDestCol,
     608             :                             sc::ColumnBlockPosition& maDestBlockPos, bool bCloneCaption = true, SCROW nRowOffsetDest=0 ) const;
     609             : 
     610             :     void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 );
     611             : 
     612             :     void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 );
     613             : 
     614             :     static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
     615             : 
     616             :     /**
     617             :      * Detach a formula cell that's about to be deleted, or removed from
     618             :      * document storage (if that ever happens).
     619             :      */
     620             :     void DetachFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell );
     621             : 
     622             :     void DetachFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength );
     623             : 
     624             :     void AttachFormulaCells( sc::StartListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
     625             :     void DetachFormulaCells( sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2 );
     626             : 
     627             :     /**
     628             :      * Regroup formula cells for the entire column.
     629             :      */
     630             :     void RegroupFormulaCells( std::vector<ScAddress>* pGroupPos = NULL );
     631             : 
     632             :     /**
     633             :      * Reset column position of formula cells within specified row range.
     634             :      * If bUpdateRefs==true then reference positions are also adjusted to
     635             :      * reflect the new position so that the formula cells still reference the
     636             :      * same cells or ranges after the position change.
     637             :      * The position of a formula cell before the call is interpreted as the old
     638             :      * position of that cell.
     639             :      *
     640             :      * Caller needs to ensure that no formula groups cross the top and bottom
     641             :      * row boundaries.
     642             :      *
     643             :      * @param nRow1 top row boundary
     644             :      * @param nRow2 bottom row boundary
     645             :      * @param bUpdateRefs whether to adjust references
     646             :      */
     647             :     void ResetFormulaCellPositions( SCROW nRow1, SCROW nRow2, bool bUpdateRefs );
     648             : 
     649             :     void SplitFormulaGroupByRelativeRef( const ScRange& rBoundRange );
     650             : 
     651             :     void TransferCellValuesTo( SCROW nRow, size_t nLen, sc::CellValues& rDest );
     652             :     void CopyCellValuesFrom( SCROW nRow, const sc::CellValues& rSrc );
     653             :     void ConvertFormulaToValue(
     654             :         sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, sc::TableValues* pUndo );
     655             : 
     656             :     void SwapNonEmpty(
     657             :         sc::TableValues& rValues, sc::StartListeningContext& rStartCxt, sc::EndListeningContext& rEndCxt );
     658             : 
     659             : #if DEBUG_COLUMN_STORAGE
     660             :     void DumpFormulaGroups() const;
     661             : #endif
     662             : 
     663             :     SCSIZE      GetPatternCount() const;
     664             :     SCSIZE      GetPatternCount( SCROW nRow1, SCROW nRow2 ) const;
     665             :     bool        ReservePatternCount( SCSIZE nReserve );
     666             : private:
     667             : 
     668             :     sc::CellStoreType::iterator GetPositionToInsert( SCROW nRow );
     669             :     sc::CellStoreType::iterator GetPositionToInsert( const sc::CellStoreType::iterator& it, SCROW nRow );
     670             : 
     671             :     void AttachNewFormulaCell(
     672             :         const sc::CellStoreType::iterator& itPos, SCROW nRow, ScFormulaCell& rCell,
     673             :         bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening );
     674             : 
     675             :     void AttachNewFormulaCell(
     676             :         const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell,
     677             :         bool bJoin = true, sc::StartListeningType eListenType = sc::SingleCellListening );
     678             : 
     679             :     void AttachNewFormulaCells( const sc::CellStoreType::position_type& aPos, size_t nLength );
     680             :     void BroadcastNewCell( SCROW nRow );
     681             :     bool UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr );
     682             : 
     683             :     const ScFormulaCell* FetchFormulaCell( SCROW nRow ) const;
     684             : 
     685             :     SCROW FindNextVisibleRowWithContent(
     686             :         sc::CellStoreType::const_iterator& itPos, SCROW nRow, bool bForward) const;
     687             :     SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const;
     688             : 
     689             :     /**
     690             :      * Called whenever the state of cell array gets modified i.e. new cell
     691             :      * insertion, cell removal or relocation, cell value update and so on.
     692             :      *
     693             :      * Call this only from those methods where maCells is modified directly.
     694             :      */
     695             :     void CellStorageModified();
     696             : 
     697             :     void CopyCellTextAttrsToDocument(SCROW nRow1, SCROW nRow2, ScColumn& rDestCol) const;
     698             : 
     699             :     void DeleteCells(
     700             :         sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2, InsertDeleteFlags nDelFlag,
     701             :         sc::SingleColumnSpanSet& rDeleted );
     702             : 
     703             :     /**
     704             :      * Get all non-grouped formula cells and formula cell groups in the whole
     705             :      * column.
     706             :      */
     707             :     std::vector<sc::FormulaGroupEntry> GetFormulaGroupEntries();
     708             : 
     709             :     void EndListeningIntersectedGroup(
     710             :         sc::EndListeningContext& rCxt, SCROW nRow, std::vector<ScAddress>* pGroupPos = NULL );
     711             : 
     712             :     void EndListeningIntersectedGroups(
     713             :         sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, std::vector<ScAddress>* pGroupPos = NULL );
     714             : 
     715             :     void EndListeningGroup( sc::EndListeningContext& rCxt, SCROW nRow );
     716             :     void SetNeedsListeningGroup( SCROW nRow );
     717             : };
     718             : 
     719             : #endif
     720             : 
     721             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11