LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - xlpivot.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 17 64.7 %
Date: 2012-12-27 Functions: 12 21 57.1 %
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 SC_XLPIVOT_HXX
      21             : #define SC_XLPIVOT_HXX
      22             : 
      23             : #include <com/sun/star/sheet/GeneralFunction.hpp>
      24             : #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
      25             : #include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
      26             : #include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
      27             : #include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
      28             : #include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
      29             : #include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp>
      30             : #include <tools/datetime.hxx>
      31             : #include "ftools.hxx"
      32             : #include "xladdress.hxx"
      33             : #include "dpobject.hxx"
      34             : 
      35             : #include <boost/scoped_ptr.hpp>
      36             : 
      37             : class XclImpStream;
      38             : class XclExpStream;
      39             : 
      40             : // Constants and Enumerations =================================================
      41             : 
      42             : // misc -----------------------------------------------------------------------
      43             : 
      44             : #define EXC_STORAGE_PTCACHE         CREATE_STRING( "_SX_DB_CUR" )
      45             : 
      46             : // strings
      47             : const sal_uInt16 EXC_PT_NOSTRING            = 0xFFFF;
      48             : const sal_uInt16 EXC_PT_MAXSTRLEN           = 0xFFFE;
      49             : 
      50             : // pivot cache fields
      51             : const size_t EXC_PC_MAXFIELDCOUNT           = 0xFFFE;
      52             : const sal_uInt16 EXC_PC_NOFIELD             = 0xFFFF;
      53             : const xub_StrLen EXC_PC_MAXSTRLEN           = 255;
      54             : 
      55             : // pivot cache items
      56             : const size_t EXC_PC_MAXITEMCOUNT            = 32500;
      57             : const sal_uInt16 EXC_PC_NOITEM              = 0xFFFF;
      58             : 
      59             : // pivot table fields
      60             : const sal_uInt16 EXC_PT_MAXFIELDCOUNT       = 0xFFFE;
      61             : const sal_uInt16 EXC_PT_MAXROWCOLCOUNT      = EXC_PT_MAXFIELDCOUNT;
      62             : const sal_uInt16 EXC_PT_MAXPAGECOUNT        = 256;
      63             : const sal_uInt16 EXC_PT_MAXDATACOUNT        = 256;
      64             : 
      65             : // pivot table items
      66             : const sal_uInt16 EXC_PT_MAXITEMCOUNT        = 32500;
      67             : 
      68             : const sal_uInt16 EXC_PT_AUTOFMT_HEADER      = 0x810;
      69             : const sal_uInt16 EXC_PT_AUTOFMT_ZERO        = 0;
      70             : const sal_uInt32 EXC_PT_AUTOFMT_FLAGS       = 0x20;
      71             : 
      72             : /** Data type of a pivot cache item. */
      73             : enum XclPCItemType
      74             : {
      75             :     EXC_PCITEM_INVALID,         /// Special state, not used in Excel files.
      76             :     EXC_PCITEM_EMPTY,           /// Empty cell.
      77             :     EXC_PCITEM_TEXT,            /// String data.
      78             :     EXC_PCITEM_DOUBLE,          /// Floating-point value.
      79             :     EXC_PCITEM_DATETIME,        /// Date/time.
      80             :     EXC_PCITEM_INTEGER,         /// 16-bit integer value.
      81             :     EXC_PCITEM_BOOL,            /// Boolean value.
      82             :     EXC_PCITEM_ERROR            /// Error code.
      83             : };
      84             : 
      85             : /** Specifies the type of a pivot cache field. */
      86             : enum XclPCFieldType
      87             : {
      88             :     EXC_PCFIELD_STANDARD,       /// Standard field without grouping.
      89             :     EXC_PCFIELD_STDGROUP,       /// Standard grouping field.
      90             :     EXC_PCFIELD_NUMGROUP,       /// Numeric grouping field.
      91             :     EXC_PCFIELD_DATEGROUP,      /// First date grouping field (opt. with child grouping field).
      92             :     EXC_PCFIELD_DATECHILD,      /// Additional date grouping field.
      93             :     EXC_PCFIELD_CALCED,         /// Calculated field.
      94             :     EXC_PCFIELD_UNKNOWN         /// Unknown field state, handled like standard field.
      95             : };
      96             : 
      97             : // (0x0051,0x0052) DCONREF, DCONNAME ------------------------------------------
      98             : 
      99             : const sal_uInt16 EXC_ID_DCONREF             = 0x0051;
     100             : const sal_uInt16 EXC_ID_DCONNAME            = 0x0052;
     101             : 
     102             : // (0x00B0) SXVIEW ------------------------------------------------------------
     103             : 
     104             : const sal_uInt16 EXC_ID_SXVIEW              = 0x00B0;
     105             : 
     106             : const sal_uInt16 EXC_SXVIEW_ROWGRAND        = 0x0001;
     107             : const sal_uInt16 EXC_SXVIEW_COLGRAND        = 0x0002;
     108             : const sal_uInt16 EXC_SXVIEW_DEFAULTFLAGS    = 0x0208;
     109             : 
     110             : const sal_uInt16 EXC_SXVIEW_DATALAST        = 0xFFFF;
     111             : const sal_uInt16 EXC_SXVIEW_AUTOFMT         = 0x0001;
     112             : 
     113             : // (0x00B1) SXVD --------------------------------------------------------------
     114             : const sal_uInt16 EXC_ID_SXVD                = 0x00B1;
     115             : 
     116             : const sal_uInt16 EXC_SXVD_AXIS_NONE         = 0x0000;
     117             : const sal_uInt16 EXC_SXVD_AXIS_ROW          = 0x0001;
     118             : const sal_uInt16 EXC_SXVD_AXIS_COL          = 0x0002;
     119             : const sal_uInt16 EXC_SXVD_AXIS_PAGE         = 0x0004;
     120             : const sal_uInt16 EXC_SXVD_AXIS_DATA         = 0x0008;
     121             : const sal_uInt16 EXC_SXVD_AXIS_ROWCOL       = EXC_SXVD_AXIS_ROW | EXC_SXVD_AXIS_COL;
     122             : const sal_uInt16 EXC_SXVD_AXIS_ROWCOLPAGE   = EXC_SXVD_AXIS_ROWCOL | EXC_SXVD_AXIS_PAGE;
     123             : 
     124             : const sal_uInt16 EXC_SXVD_SUBT_NONE         = 0x0000;
     125             : const sal_uInt16 EXC_SXVD_SUBT_DEFAULT      = 0x0001;
     126             : const sal_uInt16 EXC_SXVD_SUBT_SUM          = 0x0002;
     127             : const sal_uInt16 EXC_SXVD_SUBT_COUNT        = 0x0004;
     128             : const sal_uInt16 EXC_SXVD_SUBT_AVERAGE      = 0x0008;
     129             : const sal_uInt16 EXC_SXVD_SUBT_MAX          = 0x0010;
     130             : const sal_uInt16 EXC_SXVD_SUBT_MIN          = 0x0020;
     131             : const sal_uInt16 EXC_SXVD_SUBT_PROD         = 0x0040;
     132             : const sal_uInt16 EXC_SXVD_SUBT_COUNTNUM     = 0x0080;
     133             : const sal_uInt16 EXC_SXVD_SUBT_STDDEV       = 0x0100;
     134             : const sal_uInt16 EXC_SXVD_SUBT_STDDEVP      = 0x0200;
     135             : const sal_uInt16 EXC_SXVD_SUBT_VAR          = 0x0400;
     136             : const sal_uInt16 EXC_SXVD_SUBT_VARP         = 0x0800;
     137             : 
     138             : const sal_uInt16 EXC_SXVD_DEFAULT_CACHE     = EXC_PC_NOFIELD;
     139             : 
     140             : // (0x00B2) SXVI --------------------------------------------------------------
     141             : const sal_uInt16 EXC_ID_SXVI                = 0x00B2;
     142             : 
     143             : const sal_uInt16 EXC_SXVI_TYPE_PAGE         = 0x00FE;
     144             : const sal_uInt16 EXC_SXVI_TYPE_NULL         = 0x00FF;
     145             : const sal_uInt16 EXC_SXVI_TYPE_DATA         = 0x0000;
     146             : const sal_uInt16 EXC_SXVI_TYPE_DEFAULT      = 0x0001;
     147             : const sal_uInt16 EXC_SXVI_TYPE_SUM          = 0x0002;
     148             : const sal_uInt16 EXC_SXVI_TYPE_COUNT        = 0x0003;
     149             : const sal_uInt16 EXC_SXVI_TYPE_AVERAGE      = 0x0004;
     150             : const sal_uInt16 EXC_SXVI_TYPE_MAX          = 0x0005;
     151             : const sal_uInt16 EXC_SXVI_TYPE_MIN          = 0x0006;
     152             : const sal_uInt16 EXC_SXVI_TYPE_PROD         = 0x0007;
     153             : const sal_uInt16 EXC_SXVI_TYPE_COUNTNUM     = 0x0008;
     154             : const sal_uInt16 EXC_SXVI_TYPE_STDDEV       = 0x0009;
     155             : const sal_uInt16 EXC_SXVI_TYPE_STDDEVP      = 0x000A;
     156             : const sal_uInt16 EXC_SXVI_TYPE_VAR          = 0x000B;
     157             : const sal_uInt16 EXC_SXVI_TYPE_VARP         = 0x000C;
     158             : const sal_uInt16 EXC_SXVI_TYPE_GRAND        = 0x000D;
     159             : 
     160             : const sal_uInt16 EXC_SXVI_DEFAULTFLAGS      = 0x0000;
     161             : const sal_uInt16 EXC_SXVI_HIDDEN            = 0x0001;
     162             : const sal_uInt16 EXC_SXVI_HIDEDETAIL        = 0x0002;
     163             : const sal_uInt16 EXC_SXVI_FORMULA           = 0x0004;
     164             : const sal_uInt16 EXC_SXVI_MISSING           = 0x0008;
     165             : 
     166             : const sal_uInt16 EXC_SXVI_DEFAULT_CACHE     = EXC_PC_NOFIELD;
     167             : 
     168             : // (0x00B4) SXIVD -------------------------------------------------------------
     169             : const sal_uInt16 EXC_ID_SXIVD               = 0x00B4;
     170             : const sal_uInt16 EXC_SXIVD_DATA             = 0xFFFE;
     171             : 
     172             : // (0x00B5) SXLI --------------------------------------------------------------
     173             : const sal_uInt16 EXC_ID_SXLI                = 0x00B5;
     174             : const sal_uInt16 EXC_SXLI_DEFAULTFLAGS      = 0x0000;
     175             : 
     176             : // (0x00B6) SXPI --------------------------------------------------------------
     177             : const sal_uInt16 EXC_ID_SXPI                = 0x00B6;
     178             : const sal_uInt16 EXC_SXPI_ALLITEMS          = 0x7FFD;
     179             : 
     180             : // (0x00C5) SXDI --------------------------------------------------------------
     181             : const sal_uInt16 EXC_ID_SXDI                = 0x00C5;
     182             : 
     183             : const sal_uInt16 EXC_SXDI_FUNC_SUM          = 0x0000;
     184             : const sal_uInt16 EXC_SXDI_FUNC_COUNT        = 0x0001;
     185             : const sal_uInt16 EXC_SXDI_FUNC_AVERAGE      = 0x0002;
     186             : const sal_uInt16 EXC_SXDI_FUNC_MAX          = 0x0003;
     187             : const sal_uInt16 EXC_SXDI_FUNC_MIN          = 0x0004;
     188             : const sal_uInt16 EXC_SXDI_FUNC_PRODUCT      = 0x0005;
     189             : const sal_uInt16 EXC_SXDI_FUNC_COUNTNUM     = 0x0006;
     190             : const sal_uInt16 EXC_SXDI_FUNC_STDDEV       = 0x0007;
     191             : const sal_uInt16 EXC_SXDI_FUNC_STDDEVP      = 0x0008;
     192             : const sal_uInt16 EXC_SXDI_FUNC_VAR          = 0x0009;
     193             : const sal_uInt16 EXC_SXDI_FUNC_VARP         = 0x000A;
     194             : 
     195             : const sal_uInt16 EXC_SXDI_REF_NORMAL        = 0x0000;
     196             : const sal_uInt16 EXC_SXDI_REF_DIFF          = 0x0001;
     197             : const sal_uInt16 EXC_SXDI_REF_PERC          = 0x0002;
     198             : const sal_uInt16 EXC_SXDI_REF_PERC_DIFF     = 0x0003;
     199             : const sal_uInt16 EXC_SXDI_REF_RUN_TOTAL     = 0x0004;
     200             : const sal_uInt16 EXC_SXDI_REF_PERC_ROW      = 0x0005;
     201             : const sal_uInt16 EXC_SXDI_REF_PERC_COL      = 0x0006;
     202             : const sal_uInt16 EXC_SXDI_REF_PERC_TOTAL    = 0x0007;
     203             : const sal_uInt16 EXC_SXDI_REF_INDEX         = 0x0008;
     204             : 
     205             : const sal_uInt16 EXC_SXDI_PREVITEM          = 0x7FFB;
     206             : const sal_uInt16 EXC_SXDI_NEXTITEM          = 0x7FFC;
     207             : 
     208             : // (0x00C6) SXDB --------------------------------------------------------------
     209             : const sal_uInt16 EXC_ID_SXDB                = 0x00C6;
     210             : 
     211             : const sal_uInt16 EXC_SXDB_SAVEDATA          = 0x0001;
     212             : const sal_uInt16 EXC_SXDB_INVALID           = 0x0002;
     213             : const sal_uInt16 EXC_SXDB_REFRESH_LOAD      = 0x0004;
     214             : const sal_uInt16 EXC_SXDB_OPT_CACHE         = 0x0008;
     215             : const sal_uInt16 EXC_SXDB_BG_QUERY          = 0x0010;
     216             : const sal_uInt16 EXC_SXDB_ENABLE_REFRESH    = 0x0020;
     217             : const sal_uInt16 EXC_SXDB_DEFAULTFLAGS      = EXC_SXDB_SAVEDATA | EXC_SXDB_ENABLE_REFRESH;
     218             : 
     219             : const sal_uInt16 EXC_SXDB_BLOCKRECS         = 0x1FFF;
     220             : 
     221             : const sal_uInt16 EXC_SXDB_SRC_SHEET         = 0x0001;
     222             : const sal_uInt16 EXC_SXDB_SRC_EXTERN        = 0x0002;
     223             : const sal_uInt16 EXC_SXDB_SRC_CONSOLID      = 0x0004;
     224             : const sal_uInt16 EXC_SXDB_SRC_SCENARIO      = 0x0008;
     225             : 
     226             : // (0x00C7) SXFIELD -----------------------------------------------------------
     227             : const sal_uInt16 EXC_ID_SXFIELD             = 0x00C7;
     228             : 
     229             : const sal_uInt16 EXC_SXFIELD_HASITEMS       = 0x0001;
     230             : const sal_uInt16 EXC_SXFIELD_POSTPONE       = 0x0002;
     231             : const sal_uInt16 EXC_SXFIELD_CALCED         = 0x0004;
     232             : const sal_uInt16 EXC_SXFIELD_HASCHILD       = 0x0008;
     233             : const sal_uInt16 EXC_SXFIELD_NUMGROUP       = 0x0010;
     234             : const sal_uInt16 EXC_SXFIELD_16BIT          = 0x0200;
     235             : 
     236             : const sal_uInt16 EXC_SXFIELD_DATA_MASK      = 0x0DE0;
     237             : // known data types
     238             : const sal_uInt16 EXC_SXFIELD_DATA_NONE      = 0x0000;   /// Special state for groupings.
     239             : const sal_uInt16 EXC_SXFIELD_DATA_STR       = 0x0480;   /// Only strings, nothing else.
     240             : const sal_uInt16 EXC_SXFIELD_DATA_INT       = 0x0520;   /// Only integers, opt. with doubles.
     241             : const sal_uInt16 EXC_SXFIELD_DATA_DBL       = 0x0560;   /// Only doubles, nothing else.
     242             : const sal_uInt16 EXC_SXFIELD_DATA_STR_INT   = 0x05A0;   /// Only strings and integers, opt. with doubles.
     243             : const sal_uInt16 EXC_SXFIELD_DATA_STR_DBL   = 0x05E0;   /// Only strings and doubles, nothing else.
     244             : const sal_uInt16 EXC_SXFIELD_DATA_DATE      = 0x0900;   /// Only dates, nothing else.
     245             : const sal_uInt16 EXC_SXFIELD_DATA_DATE_EMP  = 0x0980;   /// Dates and empty strings, nothing else (?).
     246             : const sal_uInt16 EXC_SXFIELD_DATA_DATE_NUM  = 0x0D00;   /// Dates with integers or doubles without strings.
     247             : const sal_uInt16 EXC_SXFIELD_DATA_DATE_STR  = 0x0D80;   /// Dates and strings, opt. with integers or doubles.
     248             : 
     249             : const sal_uInt16 EXC_SXFIELD_INDEX_MIN      = 0;        /// List index for minimum item in groupings.
     250             : const sal_uInt16 EXC_SXFIELD_INDEX_MAX      = 1;        /// List index for maximum item in groupings.
     251             : const sal_uInt16 EXC_SXFIELD_INDEX_STEP     = 2;        /// List index for step item in groupings.
     252             : 
     253             : // (0x00C8) SXINDEXLIST -------------------------------------------------------
     254             : const sal_uInt16 EXC_ID_SXINDEXLIST         = 0x00C8;
     255             : 
     256             : // (0x00C9) SXDOUBLE ----------------------------------------------------------
     257             : const sal_uInt16 EXC_ID_SXDOUBLE            = 0x00C9;
     258             : 
     259             : // (0x00CA) SXBOOLEAN ---------------------------------------------------------
     260             : const sal_uInt16 EXC_ID_SXBOOLEAN           = 0x00CA;
     261             : 
     262             : // (0x00CB) SXERROR -----------------------------------------------------------
     263             : const sal_uInt16 EXC_ID_SXERROR             = 0x00CB;
     264             : 
     265             : // (0x00CC) SXINTEGER ---------------------------------------------------------
     266             : const sal_uInt16 EXC_ID_SXINTEGER           = 0x00CC;
     267             : 
     268             : // (0x00CD) SXSTRING ----------------------------------------------------------
     269             : const sal_uInt16 EXC_ID_SXSTRING            = 0x00CD;
     270             : 
     271             : // (0x00CE) SXDATETIME --------------------------------------------------------
     272             : const sal_uInt16 EXC_ID_SXDATETIME          = 0x00CE;
     273             : 
     274             : // (0x00CF) SXEMPTY -----------------------------------------------------------
     275             : const sal_uInt16 EXC_ID_SXEMPTY             = 0x00CF;
     276             : 
     277             : // (0x00D5) SXIDSTM -----------------------------------------------------------
     278             : const sal_uInt16 EXC_ID_SXIDSTM             = 0x00D5;
     279             : 
     280             : // (0x00D8) SXNUMGROUP --------------------------------------------------------
     281             : const sal_uInt16 EXC_ID_SXNUMGROUP          = 0x00D8;
     282             : 
     283             : const sal_uInt16 EXC_SXNUMGROUP_AUTOMIN     = 0x0001;
     284             : const sal_uInt16 EXC_SXNUMGROUP_AUTOMAX     = 0x0002;
     285             : 
     286             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_SEC    = 1;
     287             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_MIN    = 2;
     288             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_HOUR   = 3;
     289             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_DAY    = 4;
     290             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_MONTH  = 5;
     291             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_QUART  = 6;
     292             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_YEAR   = 7;
     293             : const sal_uInt16 EXC_SXNUMGROUP_TYPE_NUM    = 8;
     294             : 
     295             : // (0x00D9) SXGROUPINFO -------------------------------------------------------
     296             : const sal_uInt16 EXC_ID_SXGROUPINFO         = 0x00D9;
     297             : 
     298             : // (0x00DC) SXEXT -------------------------------------------------------------
     299             : const sal_uInt16 EXC_ID_SXEXT               = 0x00DC;
     300             : 
     301             : // (0x00E3) SXVS --------------------------------------------------------------
     302             : const sal_uInt16 EXC_ID_SXVS                = 0x00E3;
     303             : 
     304             : const sal_uInt16 EXC_SXVS_UNKNOWN           = 0x0000;
     305             : const sal_uInt16 EXC_SXVS_SHEET             = 0x0001;
     306             : const sal_uInt16 EXC_SXVS_EXTERN            = 0x0002;
     307             : const sal_uInt16 EXC_SXVS_CONSOLID          = 0x0004;
     308             : const sal_uInt16 EXC_SXVS_PIVOTTAB          = 0x0008;
     309             : const sal_uInt16 EXC_SXVS_SCENARIO          = 0x0010;
     310             : 
     311             : // (0x00F0) SXRULE ------------------------------------------------------------
     312             : const sal_uInt16 EXC_ID_SXRULE              = 0x00F0;
     313             : 
     314             : // (0x00F1) SXEX --------------------------------------------------------------
     315             : const sal_uInt16 EXC_ID_SXEX                = 0x00F1;
     316             : 
     317             : const sal_uInt32 EXC_SXEX_DRILLDOWN         = 0x00020000;
     318             : const sal_uInt32 EXC_SXEX_DEFAULTFLAGS      = 0x004F0200;
     319             : 
     320             : // (0x00F2) SXFILT ------------------------------------------------------------
     321             : const sal_uInt16 EXC_ID_SXFILT              = 0x00F2;
     322             : 
     323             : // (0x00F5) -------------------------------------------------------------------
     324             : const sal_uInt16 EXC_ID_00F5                = 0x00F5;   /// Unknown record
     325             : 
     326             : // (0x00F6) SXNAME ------------------------------------------------------------
     327             : const sal_uInt16 EXC_ID_SXNAME              = 0x00F6;
     328             : 
     329             : // (0x00F8) SXPAIR ------------------------------------------------------------
     330             : const sal_uInt16 EXC_ID_SXPAIR              = 0x00F8;
     331             : 
     332             : // (0x00F9) SXFMLA ------------------------------------------------------------
     333             : const sal_uInt16 EXC_ID_SXFMLA              = 0x00F9;
     334             : 
     335             : // (0x0100) SXVDEX ------------------------------------------------------------
     336             : const sal_uInt16 EXC_ID_SXVDEX              = 0x0100;
     337             : 
     338             : const sal_uInt32 EXC_SXVDEX_SHOWALL         = 0x00000001;
     339             : const sal_uInt32 EXC_SXVDEX_SORT            = 0x00000200;
     340             : const sal_uInt32 EXC_SXVDEX_SORT_ASC        = 0x00000400;
     341             : const sal_uInt32 EXC_SXVDEX_AUTOSHOW        = 0x00000800;
     342             : const sal_uInt32 EXC_SXVDEX_AUTOSHOW_ASC    = 0x00001000;
     343             : const sal_uInt32 EXC_SXVDEX_LAYOUT_REPORT   = 0x00200000;
     344             : const sal_uInt32 EXC_SXVDEX_LAYOUT_BLANK    = 0x00400000;
     345             : const sal_uInt32 EXC_SXVDEX_LAYOUT_TOP      = 0x00800000;
     346             : const sal_uInt32 EXC_SXVDEX_DEFAULTFLAGS    = 0x0A00001E | EXC_SXVDEX_SORT_ASC | EXC_SXVDEX_AUTOSHOW_ASC;
     347             : 
     348             : const sal_uInt16 EXC_SXVDEX_SORT_OWN        = 0xFFFF;
     349             : const sal_uInt16 EXC_SXVDEX_SHOW_NONE       = 0xFFFF;
     350             : const sal_uInt16 EXC_SXVDEX_FORMAT_NONE     = 0x0000;
     351             : 
     352             : // (0x0103) SXFORMULA ---------------------------------------------------------
     353             : const sal_uInt16 EXC_ID_SXFORMULA           = 0x0103;
     354             : 
     355             : // (0x0122) SXDBEX ------------------------------------------------------------
     356             : const sal_uInt16 EXC_ID_SXDBEX              = 0x0122;
     357             : const double EXC_SXDBEX_CREATION_DATE       = 51901.029652778;
     358             : 
     359             : // (0x01BB) SXFDBTYPE ---------------------------------------------------------
     360             : const sal_uInt16 EXC_ID_SXFDBTYPE           = 0x01BB;
     361             : const sal_uInt16 EXC_SXFDBTYPE_DEFAULT      = 0x0000;
     362             : 
     363             : // (0x0810) SXVIEWEX9 ---------------------------------------------------------
     364             : const sal_uInt16 EXC_ID_SXVIEWEX9       = 0x0810;
     365             : 
     366             : // ============================================================================
     367             : // Pivot cache
     368             : // ============================================================================
     369             : 
     370             : /** Represents a data item of any type in a pivot cache. Supposed as base class for import and export. */
     371           0 : class XclPCItem
     372             : {
     373             : public:
     374             :     explicit            XclPCItem();
     375             :     virtual             ~XclPCItem();
     376             : 
     377             :     /** Sets the item to 'empty' type. */
     378             :     void                SetEmpty();
     379             :     /** Sets the item to 'text' type and adds the passed text. */
     380             :     void                SetText( const rtl::OUString& rText );
     381             :     /** Sets the item to 'double' type and adds the passed value. */
     382             :     void                SetDouble( double fValue );
     383             :     /** Sets the item to 'date/time' type and adds the passed date. */
     384             :     void                SetDateTime( const DateTime& rDateTime );
     385             :     /** Sets the item to 'integer' type and adds the passed value. */
     386             :     void                SetInteger( sal_Int16 nValue );
     387             :     /** Sets the item to 'error' type and adds the passed Excel error code. */
     388             :     void                SetError( sal_uInt16 nError );
     389             :     /** Sets the item to 'boolean' type and adds the passed Boolean value. */
     390             :     void                SetBool( bool bValue );
     391             : 
     392             :     /** Returns the current item type. */
     393             :     inline XclPCItemType GetType() const { return meType; }
     394             :     /** Returns the text representation of the item. */
     395           0 :     inline const rtl::OUString& ConvertToText() const { return maText; }
     396             : 
     397             :     /** Returns true, if the passed iterm equals this item. */
     398             :     bool                IsEqual( const XclPCItem& rItem ) const;
     399             : 
     400             :     /** Returns true, if the item type is 'empty'. */
     401             :     bool                IsEmpty() const;
     402             :     /** Returns pointer to text, if the item type is 'text', otherwise 0. */
     403             :     const rtl::OUString* GetText() const;
     404             :     /** Returns pointer to value, if the item type is 'double', otherwise 0. */
     405             :     const double*       GetDouble() const;
     406             :     /** Returns pointer to date, if the item type is 'date/time', otherwise 0. */
     407             :     const DateTime*     GetDateTime() const;
     408             :     /** Returns pointer to integer, if the item type is 'integer', otherwise 0. */
     409             :     const sal_Int16*    GetInteger() const;
     410             :     /** Returns pointer to error code, if the item type is 'error', otherwise 0. */
     411             :     const sal_uInt16*   GetError() const;
     412             :     /** Returns pointer to Boolean value, if the item type is 'boolean', otherwise 0. */
     413             :     const bool*         GetBool() const;
     414             : 
     415             : private:
     416             :     XclPCItemType       meType;         /// Type of the item.
     417             :     rtl::OUString       maText;         /// Text representation of the item.
     418             :     DateTime            maDateTime;     /// Value of a date/time item.
     419             :     union
     420             :     {
     421             :         double              mfValue;        /// Value of a floating-point item.
     422             :         sal_Int16           mnValue;        /// Value of an integer item.
     423             :         sal_uInt16          mnError;        /// Error code of an error item.
     424             :         bool                mbValue;        /// Value of a boolean item.
     425             :     };
     426             : };
     427             : 
     428           0 : inline bool operator==( const XclPCItem& rLeft, const XclPCItem& rRight ) { return rLeft.IsEqual( rRight ); }
     429           0 : inline bool operator!=( const XclPCItem& rLeft, const XclPCItem& rRight ) { return !(rLeft == rRight); }
     430             : 
     431             : // Field settings =============================================================
     432             : 
     433             : /** Contains data for a pivot cache field (SXFIELD record). */
     434           2 : struct XclPCFieldInfo
     435             : {
     436             :     rtl::OUString       maName;         /// Name of the pivot cache field.
     437             :     sal_uInt16          mnFlags;        /// Various flags.
     438             :     sal_uInt16          mnGroupChild;   /// Field containing grouping info for this field.
     439             :     sal_uInt16          mnGroupBase;    /// Base field if this field contains grouping info.
     440             :     sal_uInt16          mnVisItems;     /// Number of visible items for this field.
     441             :     sal_uInt16          mnGroupItems;   /// Number of special items in a grouping field.
     442             :     sal_uInt16          mnBaseItems;    /// Number of items in the base field.
     443             :     sal_uInt16          mnOrigItems;    /// Number of original source data items.
     444             : 
     445             :     explicit            XclPCFieldInfo();
     446             : };
     447             : 
     448             : XclImpStream& operator>>( XclImpStream& rStrm, XclPCFieldInfo& rInfo );
     449             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPCFieldInfo& rInfo );
     450             : 
     451             : // Numeric grouping field settings ============================================
     452             : 
     453             : /** Contains data for a numeric grouping field (SXNUMGROUP record). */
     454             : struct XclPCNumGroupInfo
     455             : {
     456             :     sal_uInt16          mnFlags;        /// Various flags.
     457             : 
     458             :     explicit            XclPCNumGroupInfo();
     459             : 
     460             :     void                SetNumType();
     461             : 
     462             :     sal_Int32           GetScDateType() const;
     463             :     void                SetScDateType( sal_Int32 nScType );
     464             : 
     465             :     sal_uInt16          GetXclDataType() const;
     466             :     void                SetXclDataType( sal_uInt16 nXclType );
     467             : };
     468             : 
     469             : XclImpStream& operator>>( XclImpStream& rStrm, XclPCNumGroupInfo& rInfo );
     470             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPCNumGroupInfo& rInfo );
     471             : 
     472             : // Base class for pivot cache fields ==========================================
     473             : 
     474             : /** Represents a field in a pivot cache. Supposed as base class for import and export. */
     475             : class XclPCField
     476             : {
     477             : public:
     478             :     explicit            XclPCField( XclPCFieldType eFieldType, sal_uInt16 nFieldIdx );
     479             :     virtual             ~XclPCField();
     480             : 
     481             :     /** Returns the index of this field in the containing pivot cache. */
     482           0 :     inline sal_uInt16   GetFieldIndex() const { return mnFieldIdx; }
     483             : 
     484             :     /** Returns true, if the type of the field is supported by Calc. */
     485             :     bool                IsSupportedField() const;
     486             : 
     487             :     /** Returns true, if this is a standard field build directly from source data. */
     488             :     bool                IsStandardField() const;
     489             : 
     490             :     /** Returns true, if this field is a grouping field. */
     491             :     bool                IsStdGroupField() const;
     492             :     /** Returns true, if this field is a numeric grouping field. */
     493             :     bool                IsNumGroupField() const;
     494             :     /** Returns true, if this field is a date/time grouping field. */
     495             :     bool                IsDateGroupField() const;
     496             :     /** Returns true, if this field is a grouping field of any type. */
     497             :     bool                IsGroupField() const;
     498             : 
     499             :     /** Returns true, if this field has a child field in a grouping. */
     500             :     bool                IsGroupBaseField() const;
     501             :     /** Returns true, if this field is a child field in a grouping (it has a base field). */
     502             :     bool                IsGroupChildField() const;
     503             : 
     504             :     /** Returns true, if the field is based on a column in the source data area. */
     505             :     bool                HasOrigItems() const;
     506             :     /** Returns true, if any items are stored after the SXFIELD record. */
     507             :     bool                HasInlineItems() const;
     508             :     /** Returns true, if the items are stored separately after the last field. */
     509             :     bool                HasPostponedItems() const;
     510             :     /** Returns true, if the item indexes in the SXINDEXLIST record are stored as 16-bit values. */
     511             :     bool                Has16BitIndexes() const;
     512             : 
     513             : protected:
     514             :     XclPCFieldInfo      maFieldInfo;        /// Pivot cache field info (SXFIELD record).
     515             :     XclPCFieldType      meFieldType;        /// Type of this pivot cache field.
     516             :     sal_uInt16          mnFieldIdx;         /// Own field index in pivot cache.
     517             :     ScfUInt16Vec        maGroupOrder;       /// Order of items in a grouping field (SXGROUPINFO record).
     518             :     XclPCNumGroupInfo   maNumGroupInfo;     /// Info for numeric grouping (SXNUMGROUP record).
     519             : };
     520             : 
     521             : // Pivot cache settings =======================================================
     522             : 
     523             : /** Contains data for a pivot cache (SXDB record). */
     524           1 : struct XclPCInfo
     525             : {
     526             :     sal_uInt32          mnSrcRecs;      /// Records in source database.
     527             :     sal_uInt16          mnStrmId;       /// Stream identifier.
     528             :     sal_uInt16          mnFlags;        /// Flags for the cache.
     529             :     sal_uInt16          mnBlockRecs;    /// Records in a source database block.
     530             :     sal_uInt16          mnStdFields;    /// Number of standard pivot cache fields.
     531             :     sal_uInt16          mnTotalFields;  /// Number of all fields (standard, grouped, calculated).
     532             :     sal_uInt16          mnSrcType;      /// Database type.
     533             :     rtl::OUString       maUserName;     /// Name of user who last modified the cache.
     534             : 
     535             :     explicit            XclPCInfo();
     536             : };
     537             : 
     538             : XclImpStream& operator>>( XclImpStream& rStrm, XclPCInfo& rInfo );
     539             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPCInfo& rInfo );
     540             : 
     541             : // ============================================================================
     542             : // Pivot table
     543             : // ============================================================================
     544             : 
     545             : // cached name ================================================================
     546             : 
     547             : /** A name for various pivot table info structs. Includes 'use cache' state. */
     548           9 : struct XclPTCachedName
     549             : {
     550             :     rtl::OUString       maName;         /// The visible name, if used.
     551             :     bool                mbUseCache;     /// true = Use name in cache instead of maName.
     552             : 
     553           9 :     inline explicit     XclPTCachedName() : mbUseCache( true ) {}
     554             : };
     555             : 
     556             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTCachedName& rCachedName );
     557             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTCachedName& rCachedName );
     558             : 
     559             : // ----------------------------------------------------------------------------
     560             : 
     561             : /** Base struct for named info structs. Supports explicit naming and using the cache. */
     562          18 : struct XclPTVisNameInfo
     563             : {
     564             :     XclPTCachedName     maVisName;      /// The displayed name of the item.
     565             : 
     566             :     /** Returns true, if the name is set explicitly (maVisName.mbUseCache is false). */
     567           2 :     inline bool         HasVisName() const { return !maVisName.mbUseCache; }
     568             :     /** Returns the name, if set explicitly (maVisName.mbUseCache is false). */
     569             :     const rtl::OUString* GetVisName() const;
     570             :     /** Sets the visible name and enables usage of cache if name is empty. */
     571             :     void                SetVisName( const rtl::OUString& rName );
     572             : };
     573             : 
     574             : // Field item settings ========================================================
     575             : 
     576             : /** Contains data for a pivot table data item (SXVI record). */
     577           6 : struct XclPTItemInfo : public XclPTVisNameInfo
     578             : {
     579             :     sal_uInt16          mnType;         /// Type of the item (e.g. data, function, grand total).
     580             :     sal_uInt16          mnFlags;        /// Several flags.
     581             :     sal_uInt16          mnCacheIdx;     /// Index into cache for item name.
     582             : 
     583             :     explicit            XclPTItemInfo();
     584             : };
     585             : 
     586             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTItemInfo& rInfo );
     587             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTItemInfo& rInfo );
     588             : 
     589             : // General field settings =====================================================
     590             : 
     591             : typedef ::std::vector< sal_uInt16 > XclPTSubtotalVec;
     592             : 
     593             : /** Contains data for a pivot table field (SXVD record). */
     594           3 : struct XclPTFieldInfo : public XclPTVisNameInfo
     595             : {
     596             :     sal_uInt16          mnAxes;         /// Flags for axes this field is part of.
     597             :     sal_uInt16          mnSubtCount;    /// Number of subtotal functions.
     598             :     sal_uInt16          mnSubtotals;    /// Bitfield for subtotal functions.
     599             :     sal_uInt16          mnItemCount;    /// Number of items of this field.
     600             :     sal_uInt16          mnCacheIdx;     /// Index into cache for field name (not part of record).
     601             : 
     602             :     explicit            XclPTFieldInfo();
     603             : 
     604             :     /** Returns the API enum representing the orientation (first of row/col/page/data).
     605             :         @param nMask  Restricts the axes taken into account.
     606             :         @return  The first found axis orientation, that is allowed in nMask parameter. */
     607             :     ::com::sun::star::sheet::DataPilotFieldOrientation GetApiOrient( sal_uInt16 nMask ) const;
     608             :     /** Adds the axis orientation represented by the passed API enum. */
     609             :     void                AddApiOrient( ::com::sun::star::sheet::DataPilotFieldOrientation eOrient );
     610             : 
     611             :     /** Returns a vector of all set subtotal functions. */
     612             :     void                GetSubtotals( XclPTSubtotalVec& rSubtotals ) const;
     613             :     /** Sets the subtotal functions contained in the passed sequence. */
     614             :     void                SetSubtotals( const XclPTSubtotalVec& rSubtotals );
     615             : };
     616             : 
     617             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTFieldInfo& rInfo );
     618             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTFieldInfo& rInfo );
     619             : 
     620             : // Extended field settings ====================================================
     621             : 
     622             : /** Contains extended data for a pivot table field (SXVDEX record). */
     623           3 : struct XclPTFieldExtInfo
     624             : {
     625             :     sal_uInt32          mnFlags;        /// Several flags and number of items for AutoShow.
     626             :     sal_uInt16          mnSortField;    /// Index to data field sorting bases on.
     627             :     sal_uInt16          mnShowField;    /// Index to data field AutoShow bases on.
     628             :     sal_uInt16          mnNumFmt;
     629             :     boost::scoped_ptr<rtl::OUString> mpFieldTotalName;
     630             : 
     631             :     explicit            XclPTFieldExtInfo();
     632             : 
     633             :     /** Returns the API constant representing the sorting mode. */
     634             :     sal_Int32           GetApiSortMode() const;
     635             :     /** Sets the sorting mode represented by the passed API constant. */
     636             :     void                SetApiSortMode( sal_Int32 nSortMode );
     637             : 
     638             :     /** Returns the API constant representing the AutoShow mode. */
     639             :     sal_Int32           GetApiAutoShowMode() const;
     640             :     /** Sets the AutoShow mode represented by the passed API constant. */
     641             :     void                SetApiAutoShowMode( sal_Int32 nShowMode );
     642             : 
     643             :     /** Returns the number of items to be shown in AutoShow mode. */
     644             :     sal_Int32           GetApiAutoShowCount() const;
     645             :     /** Sets the number of items to be shown in AutoShow mode. */
     646             :     void                SetApiAutoShowCount( sal_Int32 nShowCount );
     647             : 
     648             :     /** Returns the API constant representing the layout mode. */
     649             :     sal_Int32           GetApiLayoutMode() const;
     650             :     /** Sets the layout mode represented by the passed API constant. */
     651             :     void                SetApiLayoutMode( sal_Int32 nLayoutMode );
     652             : };
     653             : 
     654             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTFieldExtInfo& rInfo );
     655             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTFieldExtInfo& rInfo );
     656             : 
     657             : // Page field settings ========================================================
     658             : 
     659             : /** Contains data for a pivot table page field (part of SXPI record). */
     660             : struct XclPTPageFieldInfo
     661             : {
     662             :     sal_uInt16          mnField;        /// Base field for this page info.
     663             :     sal_uInt16          mnSelItem;      /// Index to selected item.
     664             :     sal_uInt16          mnObjId;        /// Escher object ID of dropdown listbox.
     665             : 
     666             :     explicit            XclPTPageFieldInfo();
     667             : };
     668             : 
     669             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTPageFieldInfo& rInfo );
     670             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTPageFieldInfo& rInfo );
     671             : 
     672             : // Data field settings ========================================================
     673             : 
     674             : /** Contains data for a pivot table data field (SXDI record). */
     675           0 : struct XclPTDataFieldInfo : public XclPTVisNameInfo
     676             : {
     677             :     sal_uInt16          mnField;        /// Base field for this data info.
     678             :     sal_uInt16          mnAggFunc;      /// Data aggregation function.
     679             :     sal_uInt16          mnRefType;      /// Result reference type.
     680             :     sal_uInt16          mnRefField;     /// Index to SXVD of referred field used for the results.
     681             :     sal_uInt16          mnRefItem;      /// Index to SXVI of referred item of the used field.
     682             :     sal_uInt16          mnNumFmt;       /// Number format of the results.
     683             : 
     684             :     explicit            XclPTDataFieldInfo();
     685             : 
     686             :     /** Returns the API enum representing the aggregation function. */
     687             :     ::com::sun::star::sheet::GeneralFunction GetApiAggFunc() const;
     688             :     /** Sets the aggregation function represented by the passed API enum. */
     689             :     void                SetApiAggFunc( ::com::sun::star::sheet::GeneralFunction eAggFunc );
     690             : 
     691             :     /** Returns the API constant representing the result reference type. */
     692             :     sal_Int32           GetApiRefType() const;
     693             :     /** Sets the result reference type represented by the passed API constant. */
     694             :     void                SetApiRefType( sal_Int32 nRefType );
     695             : 
     696             :     /** Returns the API constant representing the result reference item type. */
     697             :     sal_Int32           GetApiRefItemType() const;
     698             :     /** Sets the result reference item type represented by the passed API constant. */
     699             :     void                SetApiRefItemType( sal_Int32 nRefItemType );
     700             : };
     701             : 
     702             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTDataFieldInfo& rInfo );
     703             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTDataFieldInfo& rInfo );
     704             : 
     705             : // Pivot table settings =======================================================
     706             : 
     707             : /** Contains data for a pivot table (SXVIEW record). */
     708           1 : struct XclPTInfo
     709             : {
     710             :     rtl::OUString       maTableName;        /// The name of the pivot table.
     711             :     rtl::OUString       maDataName;         /// The visible name of the data field.
     712             :     XclRange            maOutXclRange;      /// Output range.
     713             :     XclAddress          maDataXclPos;       /// First cell containing data.
     714             :     sal_uInt16          mnFirstHeadRow;     /// First heading row.
     715             :     sal_uInt16          mnCacheIdx;         /// 0-based index of the pivot cache.
     716             :     sal_uInt16          mnDataAxis;         /// Orientation of data fields.
     717             :     sal_uInt16          mnDataPos;          /// Position of data fields.
     718             :     sal_uInt16          mnFields;           /// Number of all fields.
     719             :     sal_uInt16          mnRowFields;        /// Number of row fields.
     720             :     sal_uInt16          mnColFields;        /// Number of column fields.
     721             :     sal_uInt16          mnPageFields;       /// Number of page fields.
     722             :     sal_uInt16          mnDataFields;       /// Number of data fields.
     723             :     sal_uInt16          mnDataRows;         /// Number of rows containing data.
     724             :     sal_uInt16          mnDataCols;         /// Number of columns containing data.
     725             :     sal_uInt16          mnFlags;            /// Flags for the entire pivot table.
     726             :     sal_uInt16          mnAutoFmtIdx;       /// Index to pivot table autoformat.
     727             : 
     728             :     explicit            XclPTInfo();
     729             : };
     730             : 
     731             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTInfo& rInfo );
     732             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTInfo& rInfo );
     733             : 
     734             : // Extended pivot table settings ==============================================
     735             : 
     736             : /** Extended information about a pivot table (SXEX record). */
     737             : struct XclPTExtInfo
     738             : {
     739             :     sal_uInt16          mnSxformulaRecs;    /// Number of SXFORMULA records.
     740             :     sal_uInt16          mnSxselectRecs;     /// Number of SXSELECT records.
     741             :     sal_uInt16          mnPagePerRow;       /// Number of page fields per row.
     742             :     sal_uInt16          mnPagePerCol;       /// Number of page fields per column.
     743             :     sal_uInt32          mnFlags;            /// Flags for the entire pivot table.
     744             : 
     745             :     explicit            XclPTExtInfo();
     746             : };
     747             : 
     748             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTExtInfo& rInfo );
     749             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTExtInfo& rInfo );
     750             : 
     751             : // ============================================================================
     752             : 
     753             : // Pivot table autoformat settings ==============================================
     754             : 
     755             : /** Pivot table autoformat settings (SXVIEWEX9 record). */
     756           1 : struct XclPTViewEx9Info
     757             : {
     758             :     sal_uInt32          mbReport;           /// 2 for report* fmts ?
     759             :     sal_uInt8           mnAutoFormat;       /// AutoFormat ID
     760             :     sal_uInt8           mnGridLayout;       /// 0 == gridlayout, 0x10 == modern
     761             :     rtl::OUString       maGrandTotalName;
     762             : 
     763             :     explicit            XclPTViewEx9Info();
     764             :     void                Init( const ScDPObject& rDPObj );
     765             : };
     766             : 
     767             : XclImpStream& operator>>( XclImpStream& rStrm, XclPTViewEx9Info& rInfo );
     768             : XclExpStream& operator<<( XclExpStream& rStrm, const XclPTViewEx9Info& rInfo );
     769             : 
     770             : // ============================================================================
     771             : #endif
     772             : 
     773             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10