LCOV - code coverage report
Current view: top level - sc/inc - rangeutl.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 4 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 4 0.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_RANGEUTL_HXX
      21             : #define INCLUDED_SC_INC_RANGEUTL_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include "rangenam.hxx"
      25             : #include "dbdata.hxx"
      26             : #include "scdllapi.h"
      27             : 
      28             : #include <com/sun/star/table/CellAddress.hpp>
      29             : #include <com/sun/star/table/CellRangeAddress.hpp>
      30             : #include <com/sun/star/uno/Sequence.hxx>
      31             : 
      32             : class ScArea;
      33             : class ScDocument;
      34             : class ScRange;
      35             : class ScRangeName;
      36             : class ScRangeList;
      37             : class ScDBCollection;
      38             : 
      39             : enum RutlNameScope { RUTL_NONE=0, RUTL_NAMES, RUTL_DBASE };
      40             : 
      41             : class SC_DLLPUBLIC ScRangeUtil
      42             : {
      43             : public:
      44           0 :                 ScRangeUtil()  {}
      45           0 :                 ~ScRangeUtil() {}
      46             : 
      47             :     static bool MakeArea        ( const OUString&     rAreaStr,
      48             :                                   ScArea&           rArea,
      49             :                                   ScDocument*       pDoc,
      50             :                                   SCTAB         nTab,
      51             :                                   ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
      52             : 
      53             :     static void CutPosString    ( const OUString&     theAreaStr,
      54             :                                   OUString&           thePosStr );
      55             : 
      56             :     static bool IsAbsTabArea    ( const OUString&   rAreaStr,
      57             :                                   ScDocument*       pDoc,
      58             :                                   ScArea***         pppAreas    = 0,
      59             :                                   sal_uInt16*       pAreaCount  = 0,
      60             :                                   bool              bAcceptCellRef = false,
      61             :                                   ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
      62             : 
      63             :     static bool IsAbsArea       ( const OUString& rAreaStr,
      64             :                                   ScDocument*   pDoc,
      65             :                                   SCTAB     nTab,
      66             :                                   OUString*     pCompleteStr = 0,
      67             :                                   ScRefAddress* pStartPos    = 0,
      68             :                                   ScRefAddress* pEndPos      = 0,
      69             :                                   ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
      70             : 
      71             :     static bool IsAbsPos        ( const OUString& rPosStr,
      72             :                                   ScDocument*   pDoc,
      73             :                                   SCTAB     nTab,
      74             :                                   OUString*       pCompleteStr = 0,
      75             :                                   ScRefAddress* pPosTripel   = 0,
      76             :                                   ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
      77             : 
      78             :     static bool MakeRangeFromName( const OUString& rName,
      79             :                                     ScDocument*     pDoc,
      80             :                                     SCTAB           nCurTab,
      81             :                                     ScRange&        rRange,
      82             :                                   RutlNameScope eScope=RUTL_NAMES,
      83             :                                   ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 );
      84             : };
      85             : 
      86             : class SC_DLLPUBLIC ScRangeStringConverter
      87             : {
      88             : public:
      89             : 
      90             : /// helper methods
      91             :     static void         AssignString(
      92             :                             OUString& rString,
      93             :                             const OUString& rNewStr,
      94             :                             bool bAppendStr,
      95             :                             sal_Unicode cSeparator = ' ');
      96             : 
      97             :     static sal_Int32    IndexOf(
      98             :                             const OUString& rString,
      99             :                             sal_Unicode cSearchChar,
     100             :                             sal_Int32 nOffset,
     101             :                             sal_Unicode cQuote = '\'');
     102             : 
     103             :     static sal_Int32    IndexOfDifferent(
     104             :                             const OUString& rString,
     105             :                             sal_Unicode cSearchChar,
     106             :                             sal_Int32 nOffset );
     107             : 
     108             :     static sal_Int32    GetTokenCount(
     109             :                             const OUString& rString,
     110             :                             sal_Unicode cSeparator = ' ',
     111             :                             sal_Unicode cQuote = '\'');
     112             : 
     113             :     static void         GetTokenByOffset(
     114             :                             OUString& rToken,
     115             :                             const OUString& rString,
     116             :                             sal_Int32& nOffset,
     117             :                             sal_Unicode cSeparator = ' ',
     118             :                             sal_Unicode cQuote = '\'');
     119             : 
     120             :     static void         AppendTableName(
     121             :                             OUStringBuffer& rBuf,
     122             :                             const OUString& rTabName,
     123             :                             sal_Unicode cQuote = '\'');
     124             : 
     125             : /// String to Range core
     126             :     static bool     GetAddressFromString(
     127             :                             ScAddress& rAddress,
     128             :                             const OUString& rAddressStr,
     129             :                             const ScDocument* pDocument,
     130             :                             formula::FormulaGrammar::AddressConvention eConv,
     131             :                             sal_Int32& nOffset,
     132             :                             sal_Unicode cSeparator = ' ',
     133             :                             sal_Unicode cQuote = '\'');
     134             :     static bool     GetRangeFromString(
     135             :                             ScRange& rRange,
     136             :                             const OUString& rRangeStr,
     137             :                             const ScDocument* pDocument,
     138             :                             formula::FormulaGrammar::AddressConvention eConv,
     139             :                             sal_Int32& nOffset,
     140             :                             sal_Unicode cSeparator = ' ',
     141             :                             sal_Unicode cQuote = '\'');
     142             :     static bool     GetRangeListFromString(
     143             :                             ScRangeList& rRangeList,
     144             :                             const OUString& rRangeListStr,
     145             :                             const ScDocument* pDocument,
     146             :                             formula::FormulaGrammar::AddressConvention eConv,
     147             :                             sal_Unicode cSeparator = ' ',
     148             :                             sal_Unicode cQuote = '\'');
     149             : 
     150             :     static bool     GetAreaFromString(
     151             :                             ScArea& rArea,
     152             :                             const OUString& rRangeStr,
     153             :                             const ScDocument* pDocument,
     154             :                             formula::FormulaGrammar::AddressConvention eConv,
     155             :                             sal_Int32& nOffset,
     156             :                             sal_Unicode cSeparator = ' ',
     157             :                             sal_Unicode cQuote = '\'');
     158             : 
     159             : /// String to Range API
     160             :     static bool     GetAddressFromString(
     161             :                             ::com::sun::star::table::CellAddress& rAddress,
     162             :                             const OUString& rAddressStr,
     163             :                             const ScDocument* pDocument,
     164             :                             formula::FormulaGrammar::AddressConvention eConv,
     165             :                             sal_Int32& nOffset,
     166             :                             sal_Unicode cSeparator = ' ',
     167             :                             sal_Unicode cQuote = '\'');
     168             :     static bool     GetRangeFromString(
     169             :                             ::com::sun::star::table::CellRangeAddress& rRange,
     170             :                             const OUString& rRangeStr,
     171             :                             const ScDocument* pDocument,
     172             :                             formula::FormulaGrammar::AddressConvention eConv,
     173             :                             sal_Int32& nOffset,
     174             :                             sal_Unicode cSeparator = ' ',
     175             :                             sal_Unicode cQuote = '\'');
     176             : 
     177             : /// Range to String core
     178             :     static void         GetStringFromAddress(
     179             :                             OUString& rString,
     180             :                             const ScAddress& rAddress,
     181             :                             const ScDocument* pDocument,
     182             :                             formula::FormulaGrammar::AddressConvention eConv,
     183             :                             sal_Unicode cSeparator = ' ',
     184             :                             bool bAppendStr = false,
     185             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) );
     186             :     static void         GetStringFromRange(
     187             :                             OUString& rString,
     188             :                             const ScRange& rRange,
     189             :                             const ScDocument* pDocument,
     190             :                             formula::FormulaGrammar::AddressConvention eConv,
     191             :                             sal_Unicode cSeparator = ' ',
     192             :                             bool bAppendStr = false,
     193             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) );
     194             :     static void         GetStringFromRangeList(
     195             :                             OUString& rString,
     196             :                             const ScRangeList* pRangeList,
     197             :                             const ScDocument* pDocument,
     198             :                             formula::FormulaGrammar::AddressConvention eConv,
     199             :                             sal_Unicode cSeparator = ' ',
     200             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D));
     201             : 
     202             :     static void         GetStringFromArea(
     203             :                             OUString& rString,
     204             :                             const ScArea& rArea,
     205             :                             const ScDocument* pDocument,
     206             :                             formula::FormulaGrammar::AddressConvention eConv,
     207             :                             sal_Unicode cSeparator = ' ',
     208             :                             bool bAppendStr = false,
     209             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) );
     210             : 
     211             : /// Range to String API
     212             :     static void         GetStringFromAddress(
     213             :                             OUString& rString,
     214             :                             const ::com::sun::star::table::CellAddress& rAddress,
     215             :                             const ScDocument* pDocument,
     216             :                             formula::FormulaGrammar::AddressConvention eConv,
     217             :                             sal_Unicode cSeparator = ' ',
     218             :                             bool bAppendStr = false,
     219             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) );
     220             :     static void         GetStringFromRange(
     221             :                             OUString& rString,
     222             :                             const ::com::sun::star::table::CellRangeAddress& rRange,
     223             :                             const ScDocument* pDocument,
     224             :                             formula::FormulaGrammar::AddressConvention eConv,
     225             :                             sal_Unicode cSeparator = ' ',
     226             :                             bool bAppendStr = false,
     227             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) );
     228             :     static void         GetStringFromRangeList(
     229             :                             OUString& rString,
     230             :                             const ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress >& rRangeSeq,
     231             :                             const ScDocument* pDocument,
     232             :                             formula::FormulaGrammar::AddressConvention eConv,
     233             :                             sal_Unicode cSeparator = ' ',
     234             :                             sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) );
     235             : 
     236             : /// XML Range to Calc Range
     237             :     static void         GetStringFromXMLRangeString(
     238             :                             OUString& rString,
     239             :                             const OUString& rXMLRange,
     240             :                             ScDocument* pDoc );
     241             : 
     242             : /// String to RangeData core
     243             :     static ScRangeData* GetRangeDataFromString(const OUString& rString, const SCTAB nTab, const ScDocument* pDoc);
     244             : };
     245             : 
     246             : class ScArea
     247             : {
     248             : public:
     249             :             ScArea( SCTAB tab      = 0,
     250             :                     SCCOL colStart = 0,
     251             :                     SCROW rowStart = 0,
     252             :                     SCCOL colEnd   = 0,
     253             :                     SCROW rowEnd   = 0 );
     254             : 
     255             :             ScArea( const ScArea& r );
     256             : 
     257             :     ScArea& operator=   ( const ScArea& r );
     258             :     bool    operator==  ( const ScArea& r ) const;
     259             :     bool    operator!=  ( const ScArea& r ) const  { return !( operator==(r) ); }
     260             : 
     261             : public:
     262             :     SCTAB nTab;
     263             :     SCCOL nColStart;
     264             :     SCROW nRowStart;
     265             :     SCCOL nColEnd;
     266             :     SCROW nRowEnd;
     267             : };
     268             : 
     269             : ///  @return areas with reference and all db-areas
     270             : 
     271             : class SC_DLLPUBLIC ScAreaNameIterator
     272             : {
     273             : private:
     274             :     ScRangeName*    pRangeName;
     275             :     ScDBCollection* pDBCollection;
     276             :     ScRangeName::const_iterator maRNPos;
     277             :     ScRangeName::const_iterator maRNEnd;
     278             :     ScDBCollection::NamedDBs::const_iterator maDBPos;
     279             :     ScDBCollection::NamedDBs::const_iterator maDBEnd;
     280             :     bool            bFirstPass;
     281             : 
     282             : public:
     283             :             ScAreaNameIterator( ScDocument* pDoc );
     284           0 :             ~ScAreaNameIterator() {}
     285             : 
     286             :     bool Next( OUString& rName, ScRange& rRange );
     287           0 :     bool WasDBName() const { return !bFirstPass; }
     288             : };
     289             : 
     290             : #endif // INCLUDED_SC_INC_RANGEUTL_HXX
     291             : 
     292             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11