LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - xlstyle.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 13 84.6 %
Date: 2012-12-27 Functions: 15 17 88.2 %
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_XLSTYLE_HXX
      21             : #define SC_XLSTYLE_HXX
      22             : 
      23             : #include <map>
      24             : #include <com/sun/star/awt/FontSlant.hpp>
      25             : #include <com/sun/star/awt/FontUnderline.hpp>
      26             : #include <com/sun/star/awt/FontStrikeout.hpp>
      27             : #include <tools/color.hxx>
      28             : #include <vcl/vclenum.hxx>
      29             : #include <editeng/svxenum.hxx>
      30             : #include <editeng/frmdir.hxx>
      31             : #include <svl/zforlist.hxx>
      32             : #include "fapihelper.hxx"
      33             : 
      34             : class XclRoot;
      35             : 
      36             : // Constants and Enumerations =================================================
      37             : 
      38             : // Line styles ----------------------------------------------------------------
      39             : 
      40             : const sal_uInt8 EXC_LINE_NONE               = 0x00;
      41             : const sal_uInt8 EXC_LINE_THIN               = 0x01;
      42             : const sal_uInt8 EXC_LINE_MEDIUM             = 0x02;
      43             : const sal_uInt8 EXC_LINE_DASHED             = 0x03;
      44             : const sal_uInt8 EXC_LINE_DOTTED             = 0x04;
      45             : const sal_uInt8 EXC_LINE_THICK              = 0x05;
      46             : const sal_uInt8 EXC_LINE_DOUBLE             = 0x06;
      47             : const sal_uInt8 EXC_LINE_HAIR               = 0x07;
      48             : const sal_uInt8 EXC_LINE_MEDIUMDASHED       = 0x08;
      49             : 
      50             : // Background patterns --------------------------------------------------------
      51             : 
      52             : const sal_uInt8 EXC_PATT_NONE               = 0x00;
      53             : const sal_uInt8 EXC_PATT_SOLID              = 0x01;
      54             : const sal_uInt8 EXC_PATT_50_PERC            = 0x02;
      55             : const sal_uInt8 EXC_PATT_75_PERC            = 0x03;
      56             : const sal_uInt8 EXC_PATT_25_PERC            = 0x04;
      57             : const sal_uInt8 EXC_PATT_12_5_PERC          = 0x11;
      58             : const sal_uInt8 EXC_PATT_6_25_PERC          = 0x12;
      59             : 
      60             : // (0x001E, 0x041E) FORMAT ----------------------------------------------------
      61             : 
      62             : const sal_uInt16 EXC_ID2_FORMAT             = 0x001E;
      63             : const sal_uInt16 EXC_ID4_FORMAT             = 0x041E;
      64             : 
      65             : const sal_uInt16 EXC_FORMAT_OFFSET5         = 164;
      66             : const sal_uInt16 EXC_FORMAT_OFFSET8         = 164;
      67             : const sal_uInt16 EXC_FORMAT_NOTFOUND        = 0xFFFF;
      68             : 
      69             : // (0x0031) FONT --------------------------------------------------------------
      70             : 
      71             : const sal_uInt16 EXC_ID2_FONT               = 0x0031;
      72             : const sal_uInt16 EXC_ID3_FONT               = 0x0231;
      73             : 
      74             : const sal_uInt16 EXC_FONT_APP               = 0;        /// Application font index.
      75             : const sal_uInt16 EXC_FONT_NOTFOUND          = 0xFFFF;
      76             : 
      77             : const size_t EXC_FONT_MAXCOUNT4             = 0x00FF;
      78             : const size_t EXC_FONT_MAXCOUNT5             = 0x00FF;
      79             : const size_t EXC_FONT_MAXCOUNT8             = 0xFFFF;
      80             : 
      81             : // families
      82             : const sal_uInt8 EXC_FONTFAM_DONTKNOW        = 0x00;
      83             : const sal_uInt8 EXC_FONTFAM_ROMAN           = 0x01;
      84             : const sal_uInt8 EXC_FONTFAM_SWISS           = 0x02;
      85             : const sal_uInt8 EXC_FONTFAM_SYSTEM          = EXC_FONTFAM_SWISS;
      86             : const sal_uInt8 EXC_FONTFAM_MODERN          = 0x03;
      87             : const sal_uInt8 EXC_FONTFAM_SCRIPT          = 0x04;
      88             : const sal_uInt8 EXC_FONTFAM_DECORATIVE      = 0x05;
      89             : 
      90             : // charsets
      91             : const sal_uInt8 EXC_FONTCSET_ANSI_LATIN     = 0x00;
      92             : 
      93             : // attributes
      94             : const sal_uInt16 EXC_FONTATTR_NONE          = 0x0000;
      95             : const sal_uInt16 EXC_FONTATTR_BOLD          = 0x0001;
      96             : const sal_uInt16 EXC_FONTATTR_ITALIC        = 0x0002;
      97             : const sal_uInt16 EXC_FONTATTR_UNDERLINE     = 0x0004;
      98             : const sal_uInt16 EXC_FONTATTR_STRIKEOUT     = 0x0008;
      99             : const sal_uInt16 EXC_FONTATTR_OUTLINE       = 0x0010;
     100             : const sal_uInt16 EXC_FONTATTR_SHADOW        = 0x0020;
     101             : 
     102             : // weight
     103             : const sal_uInt16 EXC_FONTWGHT_DONTKNOW      = 0;
     104             : const sal_uInt16 EXC_FONTWGHT_THIN          = 100;
     105             : const sal_uInt16 EXC_FONTWGHT_ULTRALIGHT    = 200;
     106             : const sal_uInt16 EXC_FONTWGHT_LIGHT         = 300;
     107             : const sal_uInt16 EXC_FONTWGHT_SEMILIGHT     = 350;
     108             : const sal_uInt16 EXC_FONTWGHT_NORMAL        = 400;
     109             : const sal_uInt16 EXC_FONTWGHT_MEDIUM        = 500;
     110             : const sal_uInt16 EXC_FONTWGHT_SEMIBOLD      = 600;
     111             : const sal_uInt16 EXC_FONTWGHT_BOLD          = 700;
     112             : const sal_uInt16 EXC_FONTWGHT_ULTRABOLD     = 800;
     113             : const sal_uInt16 EXC_FONTWGHT_BLACK         = 900;
     114             : 
     115             : // underline
     116             : const sal_uInt8 EXC_FONTUNDERL_NONE         = 0x00;
     117             : const sal_uInt8 EXC_FONTUNDERL_SINGLE       = 0x01;
     118             : const sal_uInt8 EXC_FONTUNDERL_DOUBLE       = 0x02;
     119             : const sal_uInt8 EXC_FONTUNDERL_SINGLE_ACC   = 0x21;
     120             : const sal_uInt8 EXC_FONTUNDERL_DOUBLE_ACC   = 0x22;
     121             : 
     122             : // escapement
     123             : const sal_uInt16 EXC_FONTESC_NONE           = 0x00;
     124             : const sal_uInt16 EXC_FONTESC_SUPER          = 0x01;
     125             : const sal_uInt16 EXC_FONTESC_SUB            = 0x02;
     126             : 
     127             : // (0x0043, 0x0243, 0x0443, 0x00E0) XF ----------------------------------------
     128             : 
     129             : const sal_uInt16 EXC_ID2_XF                 = 0x0043;
     130             : const sal_uInt16 EXC_ID3_XF                 = 0x0243;
     131             : const sal_uInt16 EXC_ID4_XF                 = 0x0443;
     132             : const sal_uInt16 EXC_ID5_XF                 = 0x00E0;
     133             : 
     134             : const sal_uInt32 EXC_XF_MAXCOUNT            = 4050;     /// Maximum number of all XF records.
     135             : const sal_uInt32 EXC_XF_MAXSTYLECOUNT       = 1536;     /// Arbitrary maximum number of style XFs.
     136             : const sal_uInt16 EXC_XF_DEFAULTSTYLE        = 0;        /// Excel index to default style XF.
     137             : const sal_uInt16 EXC_XF_DEFAULTCELL         = 15;       /// Excel index to default cell XF.
     138             : const sal_uInt16 EXC_XF_NOTFOUND            = 0xFFFF;   /// Special index for "not found" state.
     139             : 
     140             : const sal_uInt32 EXC_XFID_NOTFOUND          = 0xFFFFFFFF;
     141             : 
     142             : const sal_uInt16 EXC_XF_LOCKED              = 0x0001;
     143             : const sal_uInt16 EXC_XF_HIDDEN              = 0x0002;
     144             : const sal_uInt16 EXC_XF_STYLE               = 0x0004;
     145             : const sal_uInt16 EXC_XF_STYLEPARENT         = 0x0FFF;   /// Syles don't have a parent.
     146             : const sal_uInt16 EXC_XF_LINEBREAK           = 0x0008;   /// Automatic line break.
     147             : const sal_uInt16 EXC_XF_SHRINK              = 0x0010;   /// Shrink to fit into cell.
     148             : 
     149             : const sal_uInt8 EXC_XF_DIFF_VALFMT          = 0x01;
     150             : const sal_uInt8 EXC_XF_DIFF_FONT            = 0x02;
     151             : const sal_uInt8 EXC_XF_DIFF_ALIGN           = 0x04;
     152             : const sal_uInt8 EXC_XF_DIFF_BORDER          = 0x08;
     153             : const sal_uInt8 EXC_XF_DIFF_AREA            = 0x10;
     154             : const sal_uInt8 EXC_XF_DIFF_PROT            = 0x20;
     155             : 
     156             : const sal_uInt8 EXC_XF_HOR_GENERAL          = 0x00;
     157             : const sal_uInt8 EXC_XF_HOR_LEFT             = 0x01;
     158             : const sal_uInt8 EXC_XF_HOR_CENTER           = 0x02;
     159             : const sal_uInt8 EXC_XF_HOR_RIGHT            = 0x03;
     160             : const sal_uInt8 EXC_XF_HOR_FILL             = 0x04;
     161             : const sal_uInt8 EXC_XF_HOR_JUSTIFY          = 0x05;
     162             : const sal_uInt8 EXC_XF_HOR_CENTER_AS        = 0x06;
     163             : const sal_uInt8 EXC_XF_HOR_DISTRIB          = 0x07;
     164             : 
     165             : const sal_uInt8 EXC_XF_VER_TOP              = 0x00;
     166             : const sal_uInt8 EXC_XF_VER_CENTER           = 0x01;
     167             : const sal_uInt8 EXC_XF_VER_BOTTOM           = 0x02;
     168             : const sal_uInt8 EXC_XF_VER_JUSTIFY          = 0x03;
     169             : const sal_uInt8 EXC_XF_VER_DISTRIB          = 0x04;
     170             : 
     171             : const sal_uInt8 EXC_XF_TEXTDIR_CONTEXT      = 0x00;
     172             : const sal_uInt8 EXC_XF_TEXTDIR_LTR          = 0x01;
     173             : const sal_uInt8 EXC_XF_TEXTDIR_RTL          = 0x02;
     174             : 
     175             : const sal_uInt8 EXC_XF2_VALFMT_MASK         = 0x3F;
     176             : const sal_uInt8 EXC_XF2_LOCKED              = 0x40;
     177             : const sal_uInt8 EXC_XF2_HIDDEN              = 0x80;
     178             : const sal_uInt8 EXC_XF2_LEFTLINE            = 0x08;
     179             : const sal_uInt8 EXC_XF2_RIGHTLINE           = 0x10;
     180             : const sal_uInt8 EXC_XF2_TOPLINE             = 0x20;
     181             : const sal_uInt8 EXC_XF2_BOTTOMLINE          = 0x40;
     182             : const sal_uInt8 EXC_XF2_BACKGROUND          = 0x80;
     183             : 
     184             : const sal_uInt16 EXC_XF8_SHRINK             = 0x0010;   /// Shrink to fit into cell.
     185             : const sal_uInt16 EXC_XF8_MERGE              = 0x0020;
     186             : 
     187             : const sal_uInt32 EXC_XF_DIAGONAL_TL_TO_BR   = 0x40000000;   /// Top-left to bottom-right.
     188             : const sal_uInt32 EXC_XF_DIAGONAL_BL_TO_TR   = 0x80000000;   /// Bottom-left to top-right.
     189             : const sal_uInt32 EXC_XF_DIAGONAL_BOTH       = 0xC0000000;   /// Both.
     190             : 
     191             : // (0x0045) EFONT -------------------------------------------------------------
     192             : 
     193             : const sal_uInt16 EXC_ID_EFONT               = 0x0045;
     194             : 
     195             : // (0x0092) PALETTE -----------------------------------------------------------
     196             : 
     197             : const sal_uInt16 EXC_ID_PALETTE             = 0x0092;
     198             : 
     199             : const sal_uInt16 EXC_COLOR_BIFF2_BLACK      = 0;
     200             : const sal_uInt16 EXC_COLOR_BIFF2_WHITE      = 1;
     201             : 
     202             : const sal_uInt16 EXC_COLOR_USEROFFSET       = 8;        /// First user defined color.
     203             : const sal_uInt16 EXC_COLOR_WINDOWTEXT3      = 24;       /// System window text color (BIFF3-BIFF4).
     204             : const sal_uInt16 EXC_COLOR_WINDOWBACK3      = 25;       /// System window background color (BIFF3-BIFF4).
     205             : const sal_uInt16 EXC_COLOR_WINDOWTEXT       = 64;       /// System window text color (>=BIFF5).
     206             : const sal_uInt16 EXC_COLOR_WINDOWBACK       = 65;       /// System window background color (>=BIFF5).
     207             : const sal_uInt16 EXC_COLOR_BUTTONBACK       = 67;       /// System button background color (face color).
     208             : const sal_uInt16 EXC_COLOR_CHWINDOWTEXT     = 77;       /// System window text color (BIFF8 charts).
     209             : const sal_uInt16 EXC_COLOR_CHWINDOWBACK     = 78;       /// System window background color (BIFF8 charts).
     210             : const sal_uInt16 EXC_COLOR_CHBORDERAUTO     = 79;       /// Automatic frame border for series (BIFF8 charts).
     211             : const sal_uInt16 EXC_COLOR_NOTEBACK         = 80;       /// Note background color.
     212             : const sal_uInt16 EXC_COLOR_NOTETEXT         = 81;       /// Note text color.
     213             : const sal_uInt16 EXC_COLOR_FONTAUTO         = 0x7FFF;   /// Font auto color (system window text color).
     214             : 
     215             : // (0x0293) STYLE -------------------------------------------------------------
     216             : 
     217             : const sal_uInt16 EXC_ID_STYLE               = 0x0293;
     218             : 
     219             : const sal_uInt16 EXC_STYLE_BUILTIN          = 0x8000;
     220             : const sal_uInt16 EXC_STYLE_XFMASK           = 0x0FFF;
     221             : 
     222             : const sal_uInt8 EXC_STYLE_NORMAL            = 0x00;         /// "Normal" style.
     223             : const sal_uInt8 EXC_STYLE_ROWLEVEL          = 0x01;         /// "RowLevel_*" styles.
     224             : const sal_uInt8 EXC_STYLE_COLLEVEL          = 0x02;         /// "ColLevel_*" styles.
     225             : const sal_uInt8 EXC_STYLE_COMMA             = 0x03;         /// "Comma" style.
     226             : const sal_uInt8 EXC_STYLE_CURRENCY          = 0x04;         /// "Currency" style.
     227             : const sal_uInt8 EXC_STYLE_PERCENT           = 0x05;         /// "Percent" style.
     228             : const sal_uInt8 EXC_STYLE_COMMA_0           = 0x06;         /// "Comma [0]" style.
     229             : const sal_uInt8 EXC_STYLE_CURRENCY_0        = 0x07;         /// "Currency [0]" style.
     230             : const sal_uInt8 EXC_STYLE_HYPERLINK         = 0x08;         /// "Hyperlink" style.
     231             : const sal_uInt8 EXC_STYLE_FOLLOWED_HYPERLINK= 0x09;         /// "Followed_Hyperlink" style.
     232             : const sal_uInt8 EXC_STYLE_USERDEF           = 0xFF;         /// No built-in style.
     233             : 
     234             : const sal_uInt8 EXC_STYLE_LEVELCOUNT        = 7;            /// Number of outline level styles.
     235             : const sal_uInt8 EXC_STYLE_NOLEVEL           = 0xFF;         /// Default value for unused level.
     236             : 
     237             : // (0x0892) STYLEEXT ----------------------------------------------------------
     238             : 
     239             : const sal_uInt16 EXC_ID_STYLEEXT            = 0x0892;
     240             : 
     241             : const sal_uInt8 EXC_STYLEEXT_BUILTIN        = 0x01;
     242             : const sal_uInt8 EXC_STYLEEXT_HIDDEN         = 0x02;
     243             : const sal_uInt8 EXC_STYLEEXT_CUSTOM         = 0x04;
     244             : 
     245             : // Structs and classes ========================================================
     246             : 
     247             : // Color data =================================================================
     248             : 
     249             : /** Stores all default colors for a specific BIFF version. */
     250             : class XclDefaultPalette
     251             : {
     252             : public:
     253             :     explicit            XclDefaultPalette( const XclRoot& rRoot );
     254             : 
     255             :     /** Returns the color count in the current palette. */
     256           3 :     inline sal_uInt32   GetColorCount() const { return mnTableSize - EXC_COLOR_USEROFFSET; }
     257             : 
     258             :     /** Returns the default RGB color data for a (non-zero-based) Excel color or COL_AUTO on error. */
     259             :     ColorData           GetDefColorData( sal_uInt16 nXclIndex ) const;
     260             :     /** Returns the default color for a (non-zero-based) Excel color or COL_AUTO on error. */
     261         112 :     inline Color        GetDefColor( sal_uInt16 nXclIndex ) const
     262         112 :                             { return Color( GetDefColorData( nXclIndex ) ); }
     263             : 
     264             :     /** Returns true, if the passed Excel color index is a system color. */
     265           0 :     inline bool         IsSystemColor( sal_uInt16 nXclIndex ) const { return nXclIndex >= mnTableSize; }
     266             : 
     267             : private:
     268             :     const ColorData*    mpnColorTable;      /// The table with RGB values.
     269             :     ColorData           mnWindowText;       /// System window text color.
     270             :     ColorData           mnWindowBack;       /// System window background color.
     271             :     ColorData           mnFaceColor;        /// System button background color.
     272             :     ColorData           mnNoteText;         /// Note text color.
     273             :     ColorData           mnNoteBack;         /// Note background color.
     274             :     sal_uInt32          mnTableSize;        /// The color table size.
     275             : };
     276             : 
     277             : // Font data ==================================================================
     278             : 
     279             : class Font;
     280             : class SvxFont;
     281             : 
     282             : /** This struct helps reading and writing Excel fonts.
     283             : 
     284             :     It stores all Excel compatible properties of a font. In detail this is the
     285             :     name, family, character set, height, color, boldness, posture, script,
     286             :     underline, strikeout, outline and shadow of the font.
     287             :  */
     288         808 : struct XclFontData
     289             : {
     290             :     String              maName;         /// Font name.
     291             :     String              maStyle;        /// String with styles (bold, italic).
     292             :     Color               maColor;        /// Font color.
     293             :     sal_uInt16          mnHeight;       /// Font height in twips (1/20 of a point).
     294             :     sal_uInt16          mnWeight;       /// Boldness: 400=normal, 700=bold.
     295             :     sal_uInt16          mnEscapem;      /// Escapement type.
     296             :     sal_uInt8           mnFamily;       /// Windows font family.
     297             :     sal_uInt8           mnCharSet;      /// Windows character set.
     298             :     sal_uInt8           mnUnderline;    /// Underline style.
     299             :     bool                mbItalic;       /// true = Italic.
     300             :     bool                mbStrikeout;    /// true = Struck out.
     301             :     bool                mbOutline;      /// true = Outlined.
     302             :     bool                mbShadow;       /// true = Shadowed.
     303             : 
     304             :     /** Constructs an empty font data structure. */
     305             :     explicit            XclFontData();
     306             :     /** Constructs a font data structure and fills it with the passed font attributes (except color). */
     307             :     explicit            XclFontData( const Font& rFont );
     308             :     /** As directly above but also fills in the escapement member. */
     309             :     explicit            XclFontData( const SvxFont& rFont );
     310             : 
     311             :     /** Resets all members to default (empty) values. */
     312             :     void                Clear();
     313             :     /** Fills all members (except color and escapement) from the passed font. */
     314             :     void                FillFromVclFont( const Font& rFont );
     315             :     /** Fills all members (except color) from the passed SVX font. */
     316             :     void                FillFromSvxFont( const SvxFont& rFont );
     317             : 
     318             : // *** conversion of VCL/SVX constants *** ------------------------------------
     319             : 
     320             :     /** Returns the Calc font family. */
     321             :     FontFamily          GetScFamily( rtl_TextEncoding eDefTextEnc ) const;
     322             :     /** Returns the font text encoding. */
     323             :     rtl_TextEncoding    GetFontEncoding() const;
     324             :     /** Returns the Calc font posture. */
     325             :     FontItalic          GetScPosture() const;
     326             :     /** Returns the Calc font weight. */
     327             :     FontWeight          GetScWeight() const;
     328             :     /** Returns the Calc font underline style. */
     329             :     FontUnderline       GetScUnderline() const;
     330             :     /** Returns the Calc escapement style. */
     331             :     SvxEscapement       GetScEscapement() const;
     332             :     /** Returns the Calc strike-out style. */
     333             :     FontStrikeout       GetScStrikeout() const;
     334             : 
     335             :     /** Sets the Calc font height (in twips). */
     336             :     void                SetScHeight( sal_Int32 nTwips );
     337             :     /** Sets the Calc font family. */
     338             :     void                SetScFamily( FontFamily eScFamily );
     339             :     /** Sets the font text encoding. */
     340             :     void                SetFontEncoding( rtl_TextEncoding eFontEnc );
     341             :     /** Sets the Calc font posture. */
     342             :     void                SetScPosture( FontItalic eScPosture );
     343             :     /** Sets the Calc font weight. */
     344             :     void                SetScWeight( FontWeight eScWeight );
     345             :     /** Sets the Calc underline style. */
     346             :     void                SetScUnderline( FontUnderline eScUnderl );
     347             :     /** Sets the Calc escapement style. */
     348             :     void                SetScEscapement( short nScEscapem );
     349             :     /** Sets the Calc strike-out style. */
     350             :     void                SetScStrikeout( FontStrikeout eScStrikeout );
     351             : 
     352             : // *** conversion of API constants *** ----------------------------------------
     353             : 
     354             :     /** Returns the API font height. */
     355             :     float               GetApiHeight() const;
     356             :     /** Returns the API font family. */
     357             :     sal_Int16           GetApiFamily() const;
     358             :     /** Returns the API font text encoding. */
     359             :     sal_Int16           GetApiFontEncoding() const;
     360             :     /** Returns the API font posture. */
     361             :     ::com::sun::star::awt::FontSlant GetApiPosture() const;
     362             :     /** Returns the API font weight. */
     363             :     float               GetApiWeight() const;
     364             :     /** Returns the API font underline style. */
     365             :     sal_Int16           GetApiUnderline() const;
     366             :     /** Returns the API escapement style. */
     367             :     sal_Int16           GetApiEscapement() const;
     368             :     /** Returns the API font strike-out style. */
     369             :     sal_Int16           GetApiStrikeout() const;
     370             : 
     371             :     /** Sets the API font height. */
     372             :     void                SetApiHeight( float fPoint );
     373             :     /** Sets the API font family. */
     374             :     void                SetApiFamily( sal_Int16 nApiFamily );
     375             :     /** Sets the API font posture. */
     376             :     void                SetApiPosture( ::com::sun::star::awt::FontSlant eApiPosture );
     377             :     /** Sets the API font weight. */
     378             :     void                SetApiWeight( float fApiWeight );
     379             :     /** Sets the API font underline style. */
     380             :     void                SetApiUnderline( sal_Int16 nApiUnderl );
     381             :     /** Sets the API escapement style. */
     382             :     void                SetApiEscapement( sal_Int16 nApiEscapem );
     383             :     /** Sets the API font strike-out style. */
     384             :     void                SetApiStrikeout( sal_Int16 nApiStrikeout );
     385             : };
     386             : 
     387             : bool operator==( const XclFontData& rLeft, const XclFontData& rRight );
     388             : 
     389             : // ----------------------------------------------------------------------------
     390             : 
     391             : /** Enumerates different types of Which-IDs for font items. */
     392             : enum XclFontItemType
     393             : {
     394             :     EXC_FONTITEM_CELL,          /// Use Calc Which-IDs (ATTR_*).
     395             :     EXC_FONTITEM_EDITENG,       /// Use edit engine Which-IDs (EE_CHAR_*).
     396             :     EXC_FONTITEM_HF,            /// Use header/footer edit engine Which-IDs (EE_CHAR_*).
     397             :     EXC_FONTITEM_NOTE           /// Use note edit engine Which-IDs (EE_CHAR_*), special font handling.
     398             : };
     399             : 
     400             : /** Enumerates different types for objects with font settings (using different property names). */
     401             : enum XclFontPropSetType
     402             : {
     403             :     EXC_FONTPROPSET_CHART,          /// All text objects in charts.
     404             :     EXC_FONTPROPSET_CONTROL         /// Text formatting in form controls.
     405             : };
     406             : 
     407             : // ----------------------------------------------------------------------------
     408             : 
     409             : /** Helper class for usage of property sets. */
     410          21 : class XclFontPropSetHelper
     411             : {
     412             : public:
     413             :     explicit            XclFontPropSetHelper();
     414             : 
     415             :     /** Reads all font properties from the passed property set. */
     416             :     void                ReadFontProperties( XclFontData& rFontData,
     417             :                             const ScfPropertySet& rPropSet, XclFontPropSetType eType,
     418             :                             sal_Int16 nScript = -1 );
     419             : 
     420             :     /** Writes all font properties to the passed property set, uses passed color as font color. */
     421             :     void                WriteFontProperties(
     422             :                             ScfPropertySet& rPropSet, XclFontPropSetType eType,
     423             :                             const XclFontData& rFontData,
     424             :                             bool bHasWstrn, bool bHasAsian, bool bHasCmplx,
     425             :                             const Color* pFontColor = 0 );
     426             : 
     427             : private:
     428             :     /** Returns a chart property set helper according to the passed script type. */
     429             :     ScfPropSetHelper&   GetChartHelper( sal_Int16 nScript );
     430             : 
     431             : private:
     432             :     ScfPropSetHelper    maHlpChCommon;      /// Chart properties for all scripts.
     433             :     ScfPropSetHelper    maHlpChWstrn;       /// Chart properties for Western script.
     434             :     ScfPropSetHelper    maHlpChAsian;       /// Chart properties for Asian script.
     435             :     ScfPropSetHelper    maHlpChCmplx;       /// Chart properties for Complex script.
     436             :     ScfPropSetHelper    maHlpChWstrnNoName; /// Chart properties for Western script, no font name.
     437             :     ScfPropSetHelper    maHlpChAsianNoName; /// Chart properties for Asian script, no font name.
     438             :     ScfPropSetHelper    maHlpChCmplxNoName; /// Chart properties for Complex script, no font name.
     439             :     ScfPropSetHelper    maHlpChEscapement;  /// Chart properties for font escapement.
     440             :     ScfPropSetHelper    maHlpControl;       /// Properties for form controls.
     441             : };
     442             : 
     443             : // Number formats =============================================================
     444             : 
     445       10716 : struct XclNumFmt
     446             : {
     447             :     String              maFormat;       /// Format string, may be empty (meOffset used then).
     448             :     NfIndexTableOffset  meOffset;       /// SvNumberFormatter format index, if maFormat is empty.
     449             :     LanguageType        meLanguage;     /// Language type to be set with the number format.
     450             : };
     451             : 
     452             : // ----------------------------------------------------------------------------
     453             : 
     454          20 : class XclNumFmtBuffer
     455             : {
     456             : public:
     457             :     explicit            XclNumFmtBuffer( const XclRoot& rRoot );
     458             : 
     459             :     /** Returns the core index of the current standard number format. */
     460           0 :     inline sal_uLong        GetStdScNumFmt() const { return mnStdScNumFmt; }
     461             : 
     462             : protected:
     463             :     typedef ::std::map< sal_uInt16, XclNumFmt > XclNumFmtMap;
     464             : 
     465             :     /** Clears all buffered data, used to set up for a new sheet. */
     466             :     void                InitializeImport();
     467             : 
     468             :     /** Returns the current number format map. */
     469          38 :     inline const XclNumFmtMap& GetFormatMap() const { return maFmtMap; }
     470             : 
     471             :     /** Inserts a new number format for the specified Excel format index. */
     472             :     void                InsertFormat( sal_uInt16 nXclNumFmt, const String& rFormat );
     473             : 
     474             : private:
     475             :     /** Inserts built-in number formats for the current system language. */
     476             :     void                InsertBuiltinFormats();
     477             : 
     478             :     XclNumFmtMap        maFmtMap;       /// Map containing all default and user-defined formats.
     479             :     LanguageType        meSysLang;      /// Current system language.
     480             :     sal_uLong               mnStdScNumFmt;  /// Calc format key for standard number format.
     481             : };
     482             : 
     483             : // Cell formatting data (XF) ==================================================
     484             : 
     485             : /** Contains all cell protection attributes. */
     486             : struct XclCellProt
     487             : {
     488             :     bool                mbLocked;       /// true = Locked against editing.
     489             :     bool                mbHidden;       /// true = Formula is hidden.
     490             : 
     491             :     explicit            XclCellProt();
     492             : };
     493             : 
     494             : bool operator==( const XclCellProt& rLeft, const XclCellProt& rRight );
     495             : 
     496             : // ----------------------------------------------------------------------------
     497             : 
     498             : /** Contains all cell alignment attributes. */
     499             : struct XclCellAlign
     500             : {
     501             :     sal_uInt8           mnHorAlign;     /// Horizontal alignment.
     502             :     sal_uInt8           mnVerAlign;     /// Vertical alignment.
     503             :     sal_uInt8           mnOrient;       /// Text orientation.
     504             :     sal_uInt8           mnTextDir;      /// CTL text direction.
     505             :     sal_uInt8           mnRotation;     /// Text rotation angle.
     506             :     sal_uInt8           mnIndent;       /// Indentation.
     507             :     bool                mbLineBreak;    /// true = Multi-line text.
     508             :     bool                mbShrink;       /// true = Shrink to fit cell size.
     509             : 
     510             :     explicit            XclCellAlign();
     511             : 
     512             :     /** Returns the Calc horizontal alignment. */
     513             :     SvxCellHorJustify   GetScHorAlign() const;
     514             :     /** Returns horizontal justification method as Calc's attribute. */
     515             :     SvxCellJustifyMethod GetScHorJustifyMethod() const;
     516             :     /** Returns the Calc vertical alignment. */
     517             :     SvxCellVerJustify   GetScVerAlign() const;
     518             :     /** Returns vertical justification method as Calc's attribute. */
     519             :     SvxCellJustifyMethod GetScVerJustifyMethod() const;
     520             :     /** Returns the Calc frame direction. */
     521             :     SvxFrameDirection   GetScFrameDir() const;
     522             : 
     523             :     /** Sets the Calc horizontal alignment. */
     524             :     void                SetScHorAlign( SvxCellHorJustify eHorJust );
     525             :     /** Sets the Calc vertical alignment. */
     526             :     void                SetScVerAlign( SvxCellVerJustify eVerJust );
     527             :     /** Sets the Calc frame direction. */
     528             :     void                SetScFrameDir( SvxFrameDirection eFrameDir );
     529             : };
     530             : 
     531             : bool operator==( const XclCellAlign& rLeft, const XclCellAlign& rRight );
     532             : 
     533             : // ----------------------------------------------------------------------------
     534             : 
     535             : /** Contains color and line style for each cell border line. */
     536             : struct XclCellBorder
     537             : {
     538             :     sal_uInt16          mnLeftColor;    /// Palette index for left line.
     539             :     sal_uInt16          mnRightColor;   /// Palette index for right line.
     540             :     sal_uInt16          mnTopColor;     /// Palette index for top line.
     541             :     sal_uInt16          mnBottomColor;  /// Palette index for bottom line.
     542             :     sal_uInt16          mnDiagColor;    /// Palette index for diagonal line(s).
     543             :     sal_uInt8           mnLeftLine;     /// Style of left line.
     544             :     sal_uInt8           mnRightLine;    /// Style of right line.
     545             :     sal_uInt8           mnTopLine;      /// Style of top line.
     546             :     sal_uInt8           mnBottomLine;   /// Style of bottom line.
     547             :     sal_uInt8           mnDiagLine;     /// Style of diagonal line(s).
     548             :     bool                mbDiagTLtoBR;   /// true = Top-left to bottom-right on.
     549             :     bool                mbDiagBLtoTR;   /// true = Bottom-left to top-right on.
     550             : 
     551             :     explicit            XclCellBorder();
     552             : };
     553             : 
     554             : bool operator==( const XclCellBorder& rLeft, const XclCellBorder& rRight );
     555             : 
     556             : // ----------------------------------------------------------------------------
     557             : 
     558             : /** Contains background colors and pattern for a cell. */
     559             : struct XclCellArea
     560             : {
     561             :     sal_uInt16          mnForeColor;    /// Palette index to foreground color.
     562             :     sal_uInt16          mnBackColor;    /// Palette index to background color.
     563             :     sal_uInt8           mnPattern;      /// Fill pattern.
     564             : 
     565             :     explicit            XclCellArea();
     566             : 
     567             :     /** Returns true, if the area represents transparent state. */
     568             :     bool                IsTransparent() const;
     569             : };
     570             : 
     571             : bool operator==( const XclCellArea& rLeft, const XclCellArea& rRight );
     572             : 
     573             : // ----------------------------------------------------------------------------
     574             : 
     575             : /** Contains base members for XF record import/export.
     576             :     @descr  In detail this class stores the XF type (cell/style), the index to the
     577             :     parent style XF and all "attribute used" flags, which reflect the state of
     578             :     specific attribute groups (true = user has changed the attributes). */
     579          19 : class XclXFBase
     580             : {
     581             : public:
     582             :     explicit            XclXFBase( bool bCellXF );
     583             :     virtual             ~XclXFBase();
     584             : 
     585             :     /** Sets all "attribute used" flags to the passed state. */
     586             :     void                SetAllUsedFlags( bool bUsed );
     587             :     /** Returns true, if any "attribute used" flags are ste in this XF. */
     588             :     bool                HasUsedFlags() const;
     589             : 
     590             :     /** Returns true, if this is a hard cell format. */
     591      106718 :     inline bool         IsCellXF() const    { return mbCellXF; }
     592             :     /** Returns true, if this is a cell style. */
     593         172 :     inline bool         IsStyleXF() const   { return !IsCellXF(); }
     594             : 
     595             : protected:
     596             :     /** Returns true, if this object is equal to the passed. */
     597             :     bool                Equals( const XclXFBase& rCmp ) const;
     598             : 
     599             : protected:
     600             :     sal_uInt16          mnParent;           /// Index to parent style XF.
     601             :     bool                mbCellXF;           /// true = cell XF, false = style XF.
     602             :     bool                mbProtUsed;         /// true = cell protection used.
     603             :     bool                mbFontUsed;         /// true = font index used.
     604             :     bool                mbFmtUsed;          /// true = number format used.
     605             :     bool                mbAlignUsed;        /// true = alignment used.
     606             :     bool                mbBorderUsed;       /// true = border data used.
     607             :     bool                mbAreaUsed;         /// true = area data used.
     608             : };
     609             : 
     610             : // ============================================================================
     611             : 
     612             : #endif
     613             : 
     614             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10