LCOV - code coverage report
Current view: top level - sc/inc - global.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 43 44 97.7 %
Date: 2014-11-03 Functions: 16 18 88.9 %
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_GLOBAL_HXX
      21             : #define INCLUDED_SC_INC_GLOBAL_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include <i18nlangtag/lang.h>
      25             : #include <tools/stream.hxx>
      26             : #include <osl/endian.h>
      27             : #include <com/sun/star/uno/Reference.hxx>
      28             : #include "scdllapi.h"
      29             : #include <rtl/ustring.hxx>
      30             : 
      31             : #include <boost/static_assert.hpp>
      32             : #include <boost/unordered_map.hpp>
      33             : #include <vector>
      34             : 
      35             : class ImageList;
      36             : class Bitmap;
      37             : class SfxItemSet;
      38             : class Color;
      39             : 
      40             : #define SC_COLLATOR_IGNORES ( \
      41             :     ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
      42             : 
      43             : #define SC_TRANSLITERATION_IGNORECASE ( \
      44             :     ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
      45             : #define SC_TRANSLITERATION_CASESENSE 0
      46             : 
      47             : //  Calc has lots of names...
      48             : //  Clipboard names are in so3/soapp.hxx now
      49             : //  STRING_SCAPP was "scalc3", "scalc4", now just "scalc"
      50             : 
      51             : #define STRING_SCAPP    "scalc"
      52             : #define STRING_SCSTREAM "StarCalcDocument"
      53             : 
      54             : #define STRING_STANDARD "Standard"
      55             : 
      56             : // characters
      57             : 
      58             : //  '\r' does not work on a Mac...
      59             : #define CHAR_CR     char(13)
      60             : 
      61             : const sal_Unicode CHAR_NBSP     = 0x00A0;
      62             : const sal_Unicode CHAR_SHY      = 0x00AD;
      63             : const sal_Unicode CHAR_ZWSP     = 0x200B;
      64             : const sal_Unicode CHAR_LRM      = 0x200E;
      65             : const sal_Unicode CHAR_RLM      = 0x200F;
      66             : const sal_Unicode CHAR_NBHY     = 0x2011;
      67             : const sal_Unicode CHAR_ZWNBSP   = 0x2060;
      68             : 
      69             : #define MINDOUBLE   1.7e-307
      70             : #define MAXDOUBLE   1.7e307
      71             : 
      72             : #define MINZOOM     20
      73             : #define MAXZOOM     400
      74             : 
      75             : const SCSIZE MAXSUBTOTAL        = 3;
      76             : 
      77             : #define SC_START_INDEX_DB_COLL 50000
      78             :                                         // Above this threshold are indices
      79             :                                         // for data base areas
      80             : 
      81             : #define SC_USE_PS_POINTS    1       /**< use PostScript points (72ppi) instead of old TeX points (72.27ppi) */
      82             : 
      83             : #define PIXEL_PER_INCH      96.0
      84             : 
      85             : #define CM_PER_INCH         2.54
      86             : #define PS_POINTS_PER_INCH  72.0    /**< PostScript points per inch */
      87             : #define TEX_POINTS_PER_INCH 72.27   /**< old printer points, or TeX points per inch */
      88             : #if SC_USE_PS_POINTS
      89             : #define POINTS_PER_INCH     PS_POINTS_PER_INCH  /**< the actual definition of points used */
      90             : #else
      91             : #define POINTS_PER_INCH     TEX_POINTS_PER_INCH
      92             : #endif
      93             : #define PIXEL_PER_POINT     (PIXEL_PER_INCH / POINTS_PER_INCH)
      94             : #define TWIPS_PER_POINT     20.0
      95             : #define TWIPS_PER_INCH      (TWIPS_PER_POINT * POINTS_PER_INCH)
      96             : #define TWIPS_PER_CM        (TWIPS_PER_INCH / CM_PER_INCH)
      97             : #define CM_PER_TWIPS        (CM_PER_INCH / TWIPS_PER_INCH)
      98             : #define TWIPS_PER_PIXEL     (TWIPS_PER_INCH / PIXEL_PER_INCH)
      99             : #define TWIPS_PER_CHAR      (TWIPS_PER_INCH / 13.6)
     100             : #define PIXEL_PER_TWIPS     (PIXEL_PER_INCH / TWIPS_PER_INCH)
     101             : #define HMM_PER_TWIPS       (CM_PER_TWIPS * 1000.0)
     102             : 
     103             : #if SC_USE_PS_POINTS
     104             : #define STD_COL_WIDTH       1280    /* 2.2577cm, 64.00pt PS */
     105             : #else
     106             : #define STD_COL_WIDTH       1285    /* 2.2581cm, 64.25pt TeX */
     107             : #endif
     108             : #define STD_EXTRA_WIDTH     113     /* 2mm extra for optimal width,
     109             :                                      * 0.1986cm with TeX points,
     110             :                                      * 0.1993cm with PS points. */
     111             : 
     112             : #define MAX_EXTRA_WIDTH     23811   /* 42cm in TWIPS, 41.8430cm TeX, 41.9999cm PS */
     113             : #define MAX_EXTRA_HEIGHT    23811
     114             : #define MAX_COL_WIDTH       56693   /* 1m in TWIPS, 99.6266cm TeX, 100.0001cm PS */
     115             : #define MAX_ROW_HEIGHT      56693
     116             : 
     117             :                                     /* standard row height: text + margin - STD_ROWHEIGHT_DIFF */
     118             : #define STD_ROWHEIGHT_DIFF  23
     119             : 
     120             : namespace sc
     121             : {
     122      113611 :     inline long TwipsToHMM( long nTwips )     { return (nTwips * 127 + 36) / 72; }
     123      279446 :     inline long HMMToTwips( long nHMM )       { return (nHMM * 72 + 63) / 127; }
     124          48 :     inline long TwipsToEvenHMM( long nTwips ) { return ( (nTwips * 127 + 72) / 144 ) * 2; }
     125             : }
     126             : 
     127             :                                     // standard size as OLE server (cells)
     128             : #define OLE_STD_CELLS_X     4
     129             : #define OLE_STD_CELLS_Y     5
     130             : 
     131             : #define SC_SIZE_OPTIMUM     0xFFFF
     132             : 
     133             :                                     // repaint flags (for messages)
     134             : #define PAINT_GRID          1
     135             : #define PAINT_TOP           2
     136             : #define PAINT_LEFT          4
     137             : #define PAINT_EXTRAS        8
     138             : #define PAINT_MARKS         16
     139             : #define PAINT_OBJECTS       32
     140             : #define PAINT_SIZE          64
     141             : #define PAINT_ALL           ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE )
     142             : 
     143             :                                     // flags for columns / rows
     144             :                                     // FILTERED always together with HIDDEN
     145             :                                     // FILTERED and MANUALSIZE only valid for rows
     146             : const sal_uInt8   CR_HIDDEN      = 1;
     147             : const sal_uInt8   CR_MANUALBREAK = 8;
     148             : const sal_uInt8   CR_FILTERED    = 16;
     149             : const sal_uInt8   CR_MANUALSIZE  = 32;
     150             : const sal_uInt8   CR_ALL         = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE);
     151             : 
     152             : typedef sal_uInt8 ScBreakType;
     153             : const ScBreakType BREAK_NONE   = 0;
     154             : const ScBreakType BREAK_PAGE   = 1;
     155             : const ScBreakType BREAK_MANUAL = 2;
     156             : 
     157             : // insert/delete flags - typesafe bitfield
     158             : struct InsertDeleteFlags SAL_FINAL {
     159             : private:
     160             :     sal_uInt16 v;
     161             :     // hidden so that it doesn't accidentally get called in constructor initialiser lists
     162     3730438 :     explicit InsertDeleteFlags(sal_uInt16 _v) : v(_v) {}
     163             : public:
     164     3730438 :     static InsertDeleteFlags fromInt(sal_uInt16 v) { return InsertDeleteFlags(v); }
     165      703566 :     operator bool() const { return v != 0; }
     166     6276058 :     sal_uInt16 val() const { return v; }
     167      333726 :     bool operator ==(const InsertDeleteFlags& other) const { return v == other.v; }
     168      920894 :     bool operator !=(const InsertDeleteFlags& other) const { return v != other.v; }
     169             : private:
     170             :     // disallow implicit conversion to int
     171             :     operator int() const { return v; }
     172             : };
     173             : // make combining these type-safe
     174      901440 : inline InsertDeleteFlags operator| (const InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
     175             : {
     176      901440 :     return InsertDeleteFlags::fromInt(lhs.val() | rhs.val());
     177             : }
     178     2124664 : inline InsertDeleteFlags operator& (const InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
     179             : {
     180     2124664 :     return InsertDeleteFlags::fromInt(lhs.val() & rhs.val());
     181             : }
     182       91386 : inline InsertDeleteFlags& operator|= (InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
     183             : {
     184       91386 :     lhs = InsertDeleteFlags::fromInt(lhs.val() | rhs.val());
     185       91386 :     return lhs;
     186             : }
     187          16 : inline InsertDeleteFlags& operator&= (InsertDeleteFlags& lhs, const InsertDeleteFlags& rhs)
     188             : {
     189          16 :     lhs = InsertDeleteFlags::fromInt(lhs.val() & rhs.val());
     190          16 :     return lhs;
     191             : }
     192             : 
     193       40838 : const InsertDeleteFlags IDF_NONE      = InsertDeleteFlags::fromInt(0x0000);
     194       40838 : const InsertDeleteFlags IDF_VALUE     = InsertDeleteFlags::fromInt(0x0001);   /// Numeric values (and numeric results if IDF_FORMULA is not set).
     195       40838 : const InsertDeleteFlags IDF_DATETIME  = InsertDeleteFlags::fromInt(0x0002);   /// Dates, times, datetime values.
     196       40838 : const InsertDeleteFlags IDF_STRING    = InsertDeleteFlags::fromInt(0x0004);   /// Strings (and string results if IDF_FORMULA is not set).
     197       40838 : const InsertDeleteFlags IDF_NOTE      = InsertDeleteFlags::fromInt(0x0008);   /// Cell notes.
     198       40838 : const InsertDeleteFlags IDF_FORMULA   = InsertDeleteFlags::fromInt(0x0010);   /// Formula cells.
     199       40838 : const InsertDeleteFlags IDF_HARDATTR  = InsertDeleteFlags::fromInt(0x0020);   /// Hard cell attributes.
     200       40838 : const InsertDeleteFlags IDF_STYLES    = InsertDeleteFlags::fromInt(0x0040);   /// Cell styles.
     201       40838 : const InsertDeleteFlags IDF_OBJECTS   = InsertDeleteFlags::fromInt(0x0080);   /// Drawing objects.
     202       40838 : const InsertDeleteFlags IDF_EDITATTR  = InsertDeleteFlags::fromInt(0x0100);   /// Rich-text attributes.
     203       40838 : const InsertDeleteFlags IDF_OUTLINE   = InsertDeleteFlags::fromInt(0x0800);   /// Sheet / outlining (grouping) information
     204       40838 : const InsertDeleteFlags IDF_NOCAPTIONS  = InsertDeleteFlags::fromInt(0x0200);   /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes.
     205       40838 : const InsertDeleteFlags IDF_ADDNOTES    = InsertDeleteFlags::fromInt(0x0400);   /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes.
     206       40838 : const InsertDeleteFlags IDF_SPECIAL_BOOLEAN  = InsertDeleteFlags::fromInt(0x1000);
     207       40838 : const InsertDeleteFlags IDF_ATTRIB     = IDF_HARDATTR | IDF_STYLES;
     208       40838 : const InsertDeleteFlags IDF_CONTENTS   = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA | IDF_OUTLINE;
     209       40838 : const InsertDeleteFlags IDF_ALL        = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS;
     210       40838 : const InsertDeleteFlags IDF_ALL_USED_BITS = IDF_ALL | IDF_EDITATTR | IDF_NOCAPTIONS | IDF_ADDNOTES | IDF_SPECIAL_BOOLEAN;
     211             : 
     212       41046 : inline InsertDeleteFlags operator~ (const InsertDeleteFlags& rhs)
     213             : {
     214       41046 :     return IDF_ALL_USED_BITS & InsertDeleteFlags::fromInt(~rhs.val());
     215             : }
     216             : 
     217             : // boost can't cope with this at the moment, perhaps when we have constexpr we can modify InsertDeleteFlags to make it work.
     218             : //BOOST_STATIC_ASSERT((IDF_ATTRIB & IDF_CONTENTS) == IDF_NONE);
     219             : 
     220             : /// Copy flags for auto/series fill functions: do not touch notes and drawing objects.
     221       40838 : const InsertDeleteFlags IDF_AUTOFILL   = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS);
     222             : 
     223             : #define PASTE_NOFUNC        0
     224             : #define PASTE_ADD           1
     225             : #define PASTE_SUB           2
     226             : #define PASTE_MUL           3
     227             : #define PASTE_DIV           4
     228             : 
     229             :                                         // bits for HasAttr
     230             : #define HASATTR_LINES           1
     231             : #define HASATTR_MERGED          2
     232             : #define HASATTR_OVERLAPPED      4
     233             : #define HASATTR_PROTECTED       8
     234             : #define HASATTR_SHADOW          16
     235             : #define HASATTR_NEEDHEIGHT      32
     236             : #define HASATTR_SHADOW_RIGHT    64
     237             : #define HASATTR_SHADOW_DOWN     128
     238             : #define HASATTR_AUTOFILTER      256
     239             : #define HASATTR_CONDITIONAL     512
     240             : #define HASATTR_ROTATE          1024
     241             : #define HASATTR_NOTOVERLAPPED   2048
     242             : #define HASATTR_RTL             4096
     243             : #define HASATTR_RIGHTORCENTER   8192    // right or centered logical alignment
     244             : 
     245             : #define HASATTR_PAINTEXT        ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL )
     246             : 
     247             : #define EMPTY_OUSTRING ScGlobal::GetEmptyOUString()
     248             : 
     249             :                                         //  layer id's for drawing
     250             : #define SC_LAYER_FRONT      0
     251             : #define SC_LAYER_BACK       1
     252             : #define SC_LAYER_INTERN     2
     253             : #define SC_LAYER_CONTROLS   3
     254             : #define SC_LAYER_HIDDEN     4
     255             : 
     256             :                                         //  link tables
     257             : #define SC_LINK_NONE        0
     258             : #define SC_LINK_NORMAL      1
     259             : #define SC_LINK_VALUE       2
     260             : 
     261             :                                         //  input
     262             : #define SC_ENTER_NORMAL     0
     263             : #define SC_ENTER_BLOCK      1
     264             : #define SC_ENTER_MATRIX     2
     265             : 
     266             :                                         //  step = 10pt, max. indention = 100 steps
     267             : #define SC_INDENT_STEP      200
     268             : #define SC_MAX_INDENT       20000
     269             : 
     270             :                                         //  scenario flags
     271             : #define SC_SCENARIO_COPYALL     1
     272             : #define SC_SCENARIO_SHOWFRAME   2
     273             : #define SC_SCENARIO_PRINTFRAME  4
     274             : #define SC_SCENARIO_TWOWAY      8
     275             : #define SC_SCENARIO_ATTRIB      16
     276             : #define SC_SCENARIO_VALUE       32
     277             : #define SC_SCENARIO_PROTECT     64
     278             : 
     279             : #define SUBTOTAL_IGN_NESTED_ST_AG  0x08
     280             : #define SUBTOTAL_IGN_ERR_VAL       0x04
     281             : #define SUBTOTAL_IGN_HIDDEN        0x02
     282             : #define SUBTOTAL_IGN_FILTERED      0x01
     283             : 
     284             : /** Default cell clone flags: do not start listening, do not adjust 3D refs to
     285             :     old position, clone note captions of cell notes. */
     286             : const int SC_CLONECELL_DEFAULT          = 0x0000;
     287             : 
     288             : /** If set, cloned formula cells will start to listen to the document. */
     289             : const int SC_CLONECELL_STARTLISTENING   = 0x0001;
     290             : 
     291             : /** If set, relative 3D references of cloned formula cells will be adjusted to
     292             :     old position (used while swapping cells for sorting a cell range). */
     293             : const int SC_CLONECELL_ADJUST3DREL      = 0x0002;
     294             : 
     295             : /** If set, the caption object of a cell note will not be cloned (used while
     296             :     copying cells to undo document, where captions are handled in drawing undo). */
     297             : const int SC_CLONECELL_NOCAPTION        = 0x0004;
     298             : 
     299             : /** If set, absolute refs will not transformed to external references */
     300             : const int SC_CLONECELL_NOMAKEABS_EXTERNAL = 0x0008;
     301             : 
     302             : #ifndef DELETEZ
     303             : #define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
     304             : #endif
     305             : 
     306             :                                     // is bit set in set?
     307             : #define IS_SET(bit,set)(((set)&(bit))==(bit))
     308             : 
     309             : enum CellType
     310             :     {
     311             :         CELLTYPE_NONE,
     312             :         CELLTYPE_VALUE,
     313             :         CELLTYPE_STRING,
     314             :         CELLTYPE_FORMULA,
     315             :         CELLTYPE_EDIT,
     316             :     };
     317             : 
     318             : enum DelCellCmd
     319             :     {
     320             :         DEL_CELLSUP,
     321             :         DEL_CELLSLEFT,
     322             :         DEL_DELROWS,
     323             :         DEL_DELCOLS,
     324             :         DEL_NONE
     325             :     };
     326             : 
     327             : enum InsCellCmd
     328             :     {
     329             :         INS_CELLSDOWN,
     330             :         INS_CELLSRIGHT,
     331             :         INS_INSROWS,
     332             :         INS_INSCOLS,
     333             :         INS_NONE
     334             :     };
     335             : 
     336             : enum UpdateRefMode
     337             :     {
     338             :         URM_INSDEL,
     339             :         URM_COPY,
     340             :         URM_MOVE,
     341             :         URM_REORDER
     342             :     };
     343             : 
     344             : enum FillDir
     345             :     {
     346             :         FILL_TO_BOTTOM,
     347             :         FILL_TO_RIGHT,
     348             :         FILL_TO_TOP,
     349             :         FILL_TO_LEFT
     350             :     };
     351             : 
     352             : enum FillCmd
     353             :     {
     354             :         FILL_SIMPLE,
     355             :         FILL_LINEAR,
     356             :         FILL_GROWTH,
     357             :         FILL_DATE,
     358             :         FILL_AUTO
     359             :     };
     360             : 
     361             : enum ScMoveDirection
     362             : {
     363             :     SC_MOVE_RIGHT,
     364             :     SC_MOVE_LEFT,
     365             :     SC_MOVE_UP,
     366             :     SC_MOVE_DOWN
     367             : };
     368             : 
     369             : enum FillDateCmd
     370             :     {
     371             :         FILL_DAY,
     372             :         FILL_WEEKDAY,
     373             :         FILL_MONTH,
     374             :         FILL_YEAR
     375             :     };
     376             : 
     377             : enum ScDirection
     378             :     {
     379             :         DIR_BOTTOM,
     380             :         DIR_RIGHT,
     381             :         DIR_TOP,
     382             :         DIR_LEFT
     383             :     };
     384             : 
     385             : enum ScSizeMode
     386             :     {
     387             :         SC_SIZE_DIRECT,             // set size or hide if value is 0
     388             :         SC_SIZE_OPTIMAL,            // set optimal size for everything
     389             :         SC_SIZE_SHOW,               // show with original size
     390             :         SC_SIZE_VISOPT,             // set optimal size only if visible
     391             :         SC_SIZE_ORIGINAL            // only set size, don't change visible flag
     392             :     };
     393             : 
     394             : enum ScInputMode
     395             :     {
     396             :         SC_INPUT_NONE,
     397             :         SC_INPUT_TYPE,              // input, while not in inplace mode
     398             :         SC_INPUT_TABLE,             // text cursor in the table
     399             :         SC_INPUT_TOP                // text cursor in the input line
     400             :     };
     401             : 
     402             : enum ScVObjMode                     // output modes of objects on a page
     403             : {
     404             :     VOBJ_MODE_SHOW,
     405             :     VOBJ_MODE_HIDE
     406             : };
     407             : 
     408             : enum ScAnchorType                   // anchor of a character object
     409             : {
     410             :     SCA_CELL,
     411             :     SCA_PAGE,
     412             :     SCA_DONTKNOW                    // for multi selection
     413             : };
     414             : 
     415             : enum ScGetDBMode
     416             : {
     417             :     SC_DB_MAKE,     // create "untitled" (if necessary)
     418             :     SC_DB_IMPORT,   // create "Importx" (if necessary)
     419             :     SC_DB_OLD       // don't create
     420             : };
     421             : 
     422             : /// For ScDBFunc::GetDBData()
     423             : enum ScGetDBSelection
     424             : {
     425             :     /** Keep selection as is, expand to used data area if no selection. */
     426             :     SC_DBSEL_KEEP,
     427             : 
     428             :     /** Shrink selection to sheet's data area. */
     429             :     SC_DBSEL_SHRINK_TO_SHEET_DATA,
     430             : 
     431             :     /** Shrink selection to actually used data area within the selection. */
     432             :     SC_DBSEL_SHRINK_TO_USED_DATA,
     433             : 
     434             :     /** If only one row or portion thereof is selected, shrink row to used data
     435             :         columns and select further rows down until end of data. If an area is
     436             :         selected, shrink rows to actually used columns. Else, no selection,
     437             :         expand to used data area. */
     438             :     SC_DBSEL_ROW_DOWN,
     439             : 
     440             :     /** Behave as if the range corresponding to a ScDBData area was selected,
     441             :         for API use. */
     442             :     SC_DBSEL_FORCE_MARK
     443             : };
     444             : 
     445             : enum ScLkUpdMode    // modes for updating links
     446             : {
     447             :     LM_ALWAYS,
     448             :     LM_NEVER,
     449             :     LM_ON_DEMAND,
     450             :     LM_UNKNOWN
     451             : };
     452             : 
     453             : // enum with values equal to old DBObject enum from sdb
     454             : enum ScDBObject
     455             : {
     456             :     ScDbTable,
     457             :     ScDbQuery
     458             : };
     459             : 
     460             : struct ScImportParam
     461             : {
     462             :     SCCOL           nCol1;
     463             :     SCROW           nRow1;
     464             :     SCCOL           nCol2;
     465             :     SCROW           nRow2;
     466             :     bool            bImport;
     467             :     OUString aDBName;                    // alias of data base
     468             :     OUString aStatement;
     469             :     bool            bNative;
     470             :     bool            bSql;                       // statement or name?
     471             :     sal_uInt8       nType;                      // enum DBObject
     472             : 
     473             :     ScImportParam();
     474             :     ScImportParam( const ScImportParam& r );
     475             :     ~ScImportParam();
     476             : 
     477             :     ScImportParam&  operator=   ( const ScImportParam& r );
     478             :     bool            operator==  ( const ScImportParam& r ) const;
     479             : };
     480             : 
     481             : class ScDocument;
     482             : class ScDocShell;
     483             : class SvxSearchItem;
     484             : class ScAutoFormat;
     485             : class FuncCollection;
     486             : class ScUnoAddInCollection;
     487             : class ScUserList;
     488             : class SvxBrushItem;
     489             : class ScFunctionList;
     490             : class ScFunctionMgr;
     491             : class SfxItemPool;
     492             : class SdrModel;
     493             : class EditTextObject;
     494             : class SfxObjectShell;
     495             : class SvNumberFormatter;
     496             : class ScUnitConverter;
     497             : class CharClass;
     498             : class LocaleDataWrapper;
     499             : class SvtSysLocale;
     500             : class CalendarWrapper;
     501             : class CollatorWrapper;
     502             : class IntlWrapper;
     503             : class OutputDevice;
     504             : class ScFieldEditEngine;
     505             : 
     506             : namespace com { namespace sun { namespace star {
     507             :     namespace lang {
     508             :         struct Locale;
     509             :     }
     510             :     namespace i18n {
     511             :         class XOrdinalSuffix;
     512             :     }
     513             : }}}
     514             : namespace utl {
     515             :     class TransliterationWrapper;
     516             : }
     517             : 
     518             : #ifndef _SCALC_EXE
     519             : class ScGlobal
     520             : {
     521             :     static SvxSearchItem*   pSearchItem;
     522             :     static ScAutoFormat*    pAutoFormat;
     523             :     static FuncCollection*  pFuncCollection;
     524             :     static ScUnoAddInCollection* pAddInCollection;
     525             :     static ScUserList*      pUserList;
     526             :     static OUString**       ppRscString;
     527             :     static OUString*        pStrScDoc;
     528             :     static OUString*        pEmptyOUString;
     529             :     static OUString*        pStrClipDocName;
     530             :     static SvxBrushItem*    pEmptyBrushItem;
     531             :     static SvxBrushItem*    pButtonBrushItem;
     532             :     static SvxBrushItem*    pEmbeddedBrushItem;
     533             :     static SvxBrushItem*    pProtectedBrushItem;
     534             : 
     535             :     static ImageList*       pOutlineBitmaps;
     536             : 
     537             :     static ScFunctionList*  pStarCalcFunctionList;
     538             :     static ScFunctionMgr*   pStarCalcFunctionMgr;
     539             : 
     540             :     static ScUnitConverter* pUnitConverter;
     541             : 
     542             :     static  SvNumberFormatter*  pEnglishFormatter;          // for UNO / XML export
     543             : 
     544             :     static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix;
     545             :     static CalendarWrapper*     pCalendar;
     546             :     static CollatorWrapper*     pCaseCollator;
     547             :     static CollatorWrapper*     pCollator;
     548             :     static ::utl::TransliterationWrapper* pTransliteration;
     549             :     static ::utl::TransliterationWrapper* pCaseTransliteration;
     550             :     static IntlWrapper*         pScIntlWrapper;
     551             :     static ::com::sun::star::lang::Locale*      pLocale;
     552             : 
     553             :     static ScFieldEditEngine*   pFieldEditEngine;
     554             : 
     555             : public:
     556             :     static SvtSysLocale*        pSysLocale;
     557             :     // for faster access a pointer to the single instance provided by SvtSysLocale
     558             :     SC_DLLPUBLIC static const CharClass*     pCharClass;
     559             :     // for faster access a pointer to the single instance provided by SvtSysLocale
     560             :     SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData;
     561             :     SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData();
     562             : 
     563             :     static CalendarWrapper*     GetCalendar();
     564             :     SC_DLLPUBLIC static CollatorWrapper*        GetCollator();
     565             :     static CollatorWrapper*     GetCaseCollator();
     566             :     static IntlWrapper*         GetScIntlWrapper();
     567             :     static ::com::sun::star::lang::Locale*      GetLocale();
     568             : 
     569             :     SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration();
     570             :     static ::utl::TransliterationWrapper* GetCaseTransliteration();
     571             : 
     572             :     SC_DLLPUBLIC static LanguageType            eLnge;
     573             :     static sal_Unicode          cListDelimiter;
     574             : 
     575             :     static const OUString&      GetClipDocName();
     576             :     static void                 SetClipDocName( const OUString& rNew );
     577             :     SC_DLLPUBLIC static const SvxSearchItem&    GetSearchItem();
     578             :     SC_DLLPUBLIC static void                    SetSearchItem( const SvxSearchItem& rNew );
     579             :     SC_DLLPUBLIC static ScAutoFormat*       GetAutoFormat();
     580             :     SC_DLLPUBLIC static ScAutoFormat*       GetOrCreateAutoFormat();
     581             :     static void                 ClearAutoFormat(); //BugId 54209
     582             :     static FuncCollection*      GetFuncCollection();
     583             :     SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection();
     584             :     SC_DLLPUBLIC static ScUserList*         GetUserList();
     585             :     static void                 SetUserList( const ScUserList* pNewList );
     586             :     SC_DLLPUBLIC static const OUString&       GetRscString( sal_uInt16 nIndex );
     587             :     static void                 OpenURL( const OUString& rURL, const OUString& rTarget );
     588             :     SC_DLLPUBLIC static OUString            GetAbsDocName( const OUString& rFileName,
     589             :                                                 SfxObjectShell* pShell );
     590             :     SC_DLLPUBLIC static OUString            GetDocTabName( const OUString& rFileName,
     591             :                                                 const OUString& rTabName );
     592             :     SC_DLLPUBLIC static sal_uLong               GetStandardFormat( SvNumberFormatter&,
     593             :                                     sal_uLong nFormat, short nType );
     594             : 
     595             :     SC_DLLPUBLIC static sal_uInt16 GetStandardRowHeight();
     596             :     SC_DLLPUBLIC static double              nScreenPPTX;
     597             :     SC_DLLPUBLIC static double              nScreenPPTY;
     598             : 
     599             :     static tools::SvRef<ScDocShell>*   pDrawClipDocShellRef;
     600             : 
     601             :     static sal_uInt16           nDefFontHeight;
     602             :     SC_DLLPUBLIC static sal_uInt16           nStdRowHeight;
     603             : 
     604             :     SC_DLLPUBLIC static long                nLastRowHeightExtra;
     605             :     static long             nLastColWidthExtra;
     606             : 
     607             :     static void             Init();                     // during start up
     608             :     static void             InitAddIns();
     609             :     static void             Clear();                    // at the end of the program
     610             : 
     611             :     static void             UpdatePPT(OutputDevice* pDev);
     612             : 
     613             :     static void             InitTextHeight(SfxItemPool* pPool);
     614        2336 :     static SvxBrushItem*    GetEmptyBrushItem() { return pEmptyBrushItem; }
     615             :     static SvxBrushItem*    GetButtonBrushItem();
     616             :     static SvxBrushItem*    GetEmbeddedBrushItem()  { return pEmbeddedBrushItem; }
     617           0 :     static SvxBrushItem*    GetProtectedBrushItem() { return pProtectedBrushItem; }
     618             :     SC_DLLPUBLIC    static const OUString&    GetEmptyOUString();
     619             :     static const OUString&  GetScDocString();
     620             : 
     621             :     /** Returns the specified image list with outline symbols. */
     622             :     static ImageList*       GetOutlineSymbols();
     623             : 
     624             :     static bool             HasStarCalcFunctionList();
     625             :     static ScFunctionList*  GetStarCalcFunctionList();
     626             :     static ScFunctionMgr*   GetStarCalcFunctionMgr();
     627             :     static void             ResetFunctionList();
     628             : 
     629             :     static OUString         GetErrorString(sal_uInt16 nErrNumber);
     630             :     static OUString         GetLongErrorString(sal_uInt16 nErrNumber);
     631             :     static bool             EETextObjEqual( const EditTextObject* pObj1,
     632             :                                             const EditTextObject* pObj2 );
     633             :     static bool             CheckWidthInvalidate( bool& bNumFormatChanged,
     634             :                                                   const SfxItemSet& rNewAttrs,
     635             :                                                   const SfxItemSet& rOldAttrs );
     636             :     static bool             HasAttrChanged( const SfxItemSet& rNewAttrs,
     637             :                                             const SfxItemSet& rOldAttrs,
     638             :                                             const sal_uInt16      nWhich );
     639             : 
     640             :     static ScUnitConverter* GetUnitConverter();
     641             : 
     642             :     /// strchr() functionality on unicode, as long as we need it for FormulaToken etc.
     643             :     static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c );
     644             : 
     645       24196 :     static inline sal_Unicode ToUpperAlpha( sal_Unicode c )
     646       24196 :         { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; }
     647             : 
     648             :     /** Adds the string rToken to rTokenList, using a list separator character.
     649             :         @param rTokenList  The string list where the token will be appended to.
     650             :         @param rToken  The token string to append to the token list.
     651             :         @param cSep  The character to separate the tokens.
     652             :         @param nSepCount  Specifies how often cSep is inserted between two tokens.
     653             :         @param bForceSep  true = Always insert separator; false = Only, if not at begin or end. */
     654             :     SC_DLLPUBLIC static OUString addToken(
     655             :                                 const OUString& rTokenList, const OUString& rToken,
     656             :                                 sal_Unicode cSep, sal_Int32 nSepCount = 1,
     657             :                                 bool bForceSep = false );
     658             : 
     659             :     /** Returns true, if the first and last character of the string is cQuote. */
     660             :     SC_DLLPUBLIC static bool             IsQuoted( const OUString& rString, sal_Unicode cQuote = '\'' );
     661             : 
     662             :     /** Inserts the character cQuote at beginning and end of rString.
     663             :         @param bEscapeEmbedded      If <TRUE/>, embedded quote characters are
     664             :                                     escaped by doubling them.
     665             :      */
     666             : SC_DLLPUBLIC    static void             AddQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true );
     667             : 
     668             :     /** Erases the character cQuote from rString, if it exists at beginning AND end.
     669             :         @param bUnescapeEmbedded    If <TRUE/>, embedded doubled quote characters
     670             :                                     are unescaped by replacing them with a
     671             :                                     single instance.
     672             :      */
     673             : SC_DLLPUBLIC    static void             EraseQuotes( OUString& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true );
     674             : 
     675             :     /** Finds an unquoted instance of cChar in rString, starting at
     676             :         offset nStart. Unquoted instances may occur when concatenating two
     677             :         quoted strings with a separator, for example, 's1':'s2'. Embedded
     678             :         quotes have to be escaped by being doubled. Caller must ensure that
     679             :         nStart points into an unquoted range or the opening quote. Specialty:
     680             :         if cChar==cQuote the first cQuote character from nStart on is found.
     681             :         @returns offset if found, else -1
     682             :      */
     683             : SC_DLLPUBLIC    static sal_Int32       FindUnquoted( const OUString& rString, sal_Unicode cChar);
     684             : 
     685             :     /** Finds an unquoted instance of cChar in null-terminated pString. Same
     686             :         semantics as FindUnquoted( const String&, ...)
     687             :         @returns: pointer to cChar if found, else NULL
     688             :      */
     689             : SC_DLLPUBLIC    static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' );
     690             : 
     691             :     static  rtl_TextEncoding GetCharsetValue( const OUString& rCharSet );
     692             :     static  OUString        GetCharsetString( rtl_TextEncoding eVal );
     693             : 
     694             :     /// a "ReadOnly" formatter for UNO/XML export
     695             :     static  SvNumberFormatter*  GetEnglishFormatter();
     696             : 
     697             :     static bool IsSystemRTL();                      // depending on system language
     698             :     static LanguageType GetEditDefaultLanguage();   // for EditEngine::SetDefaultLanguage
     699             :     SC_DLLPUBLIC static sal_uInt8   GetDefaultScriptType();             // for all WEAK characters
     700             :     /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
     701             :         If more than one SCRIPTTYPE_... values are or'ed together, prefers
     702             :         first COMPLEX, then ASIAN */
     703             :     SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich );
     704             : 
     705             :     /** Adds a language item to the item set, if the number format item contains
     706             :         a language that differs from its parent's language. */
     707             :     SC_DLLPUBLIC static void             AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter );
     708             : 
     709             :     /** Obtain the ordinal suffix for a number according to the system locale */
     710             :     static OUString         GetOrdinalSuffix( sal_Int32 nNumber);
     711             : 
     712             :     /** A static instance of ScFieldEditEngine not capable of resolving
     713             :         document specific fields, to be used only by ScEditUtil::GetString(). */
     714             :     static ScFieldEditEngine&   GetStaticFieldEditEngine();
     715             : 
     716             :     /** Replaces the first occurrence of rPlaceholder in rString with
     717             :         rReplacement, or if rPlaceholder is not found appends one space if
     718             :         rString does not end in a space and appends rReplacement.
     719             : 
     720             :         Meant to be used with resource strings ala "Column %1" where a
     721             :         translation may have omitted the %1 placeholder and a simple
     722             :         replacement would end up with nothing replaced so no column indicator
     723             :         in the result string.
     724             :      */
     725             :     SC_DLLPUBLIC static OUString    ReplaceOrAppend( const OUString& rString,
     726             :                                                      const OUString& rPlaceholder,
     727             :                                                      const OUString& rReplacement );
     728             : };
     729             : #endif
     730             : 
     731             : // maybe move to dbdata.hxx (?):
     732             : 
     733             : enum ScQueryOp
     734             :     {
     735             :         SC_EQUAL,
     736             :         SC_LESS,
     737             :         SC_GREATER,
     738             :         SC_LESS_EQUAL,
     739             :         SC_GREATER_EQUAL,
     740             :         SC_NOT_EQUAL,
     741             :         SC_TOPVAL,
     742             :         SC_BOTVAL,
     743             :         SC_TOPPERC,
     744             :         SC_BOTPERC,
     745             :         SC_CONTAINS,
     746             :         SC_DOES_NOT_CONTAIN,
     747             :         SC_BEGINS_WITH,
     748             :         SC_DOES_NOT_BEGIN_WITH,
     749             :         SC_ENDS_WITH,
     750             :         SC_DOES_NOT_END_WITH
     751             :     };
     752             : 
     753             : enum ScQueryConnect
     754             :     {
     755             :         SC_AND,
     756             :         SC_OR
     757             :     };
     758             : 
     759             : enum ScSubTotalFunc
     760             :     {
     761             :         SUBTOTAL_FUNC_NONE  = 0,
     762             :         SUBTOTAL_FUNC_AVE   = 1,
     763             :         SUBTOTAL_FUNC_CNT   = 2,
     764             :         SUBTOTAL_FUNC_CNT2  = 3,
     765             :         SUBTOTAL_FUNC_MAX   = 4,
     766             :         SUBTOTAL_FUNC_MIN   = 5,
     767             :         SUBTOTAL_FUNC_PROD  = 6,
     768             :         SUBTOTAL_FUNC_STD   = 7,
     769             :         SUBTOTAL_FUNC_STDP  = 8,
     770             :         SUBTOTAL_FUNC_SUM   = 9,
     771             :         SUBTOTAL_FUNC_VAR   = 10,
     772             :         SUBTOTAL_FUNC_VARP  = 11,
     773             :         SUBTOTAL_FUNC_SELECTION_COUNT = 12
     774             :     };
     775             : 
     776             : enum ScAggregateFunc
     777             :     {
     778             :         AGGREGATE_FUNC_MEDIAN  = 12,
     779             :         AGGREGATE_FUNC_MODSNGL = 13,
     780             :         AGGREGATE_FUNC_LARGE   = 14,
     781             :         AGGREGATE_FUNC_SMALL   = 15,
     782             :         AGGREGATE_FUNC_PERCINC = 16,
     783             :         AGGREGATE_FUNC_QRTINC  = 17,
     784             :         AGGREGATE_FUNC_PERCEXC = 18,
     785             :         AGGREGATE_FUNC_QRTEXC  = 19
     786             :     };
     787             : 
     788             : class ScArea;
     789             : 
     790             : struct ScConsolidateParam
     791             : {
     792             :     SCCOL           nCol;                   // cursor position /
     793             :     SCROW           nRow;                   // or start of destination area respectively
     794             :     SCTAB           nTab;
     795             :     ScSubTotalFunc  eFunction;
     796             :     sal_uInt16      nDataAreaCount;         // number of data areas
     797             :     ScArea**        ppDataAreas;            // array of pointers into data areas
     798             :     bool            bByCol;
     799             :     bool            bByRow;
     800             :     bool            bReferenceData;         // reference source data
     801             : 
     802             :     ScConsolidateParam();
     803             :     ScConsolidateParam( const ScConsolidateParam& r );
     804             :     ~ScConsolidateParam();
     805             : 
     806             :     ScConsolidateParam& operator=       ( const ScConsolidateParam& r );
     807             :     bool                operator==      ( const ScConsolidateParam& r ) const;
     808             :     void                Clear           (); // = ClearDataAreas()+Members
     809             :     void                ClearDataAreas  ();
     810             :     void                SetAreas        ( ScArea* const* ppAreas, sal_uInt16 nCount );
     811             : };
     812             : 
     813             : #endif
     814             : 
     815             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10