1*e3508121SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*e3508121SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*e3508121SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*e3508121SAndrew Rist * distributed with this work for additional information 6*e3508121SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*e3508121SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*e3508121SAndrew Rist * "License"); you may not use this file except in compliance 9*e3508121SAndrew Rist * with the License. You may obtain a copy of the License at 10*e3508121SAndrew Rist * 11*e3508121SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*e3508121SAndrew Rist * 13*e3508121SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*e3508121SAndrew Rist * software distributed under the License is distributed on an 15*e3508121SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*e3508121SAndrew Rist * KIND, either express or implied. See the License for the 17*e3508121SAndrew Rist * specific language governing permissions and limitations 18*e3508121SAndrew Rist * under the License. 19*e3508121SAndrew Rist * 20*e3508121SAndrew Rist *************************************************************/ 21*e3508121SAndrew Rist 22*e3508121SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef OOX_XLS_STYLESBUFFER_HXX 25cdf0e10cSrcweir #define OOX_XLS_STYLESBUFFER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 28cdf0e10cSrcweir #include <com/sun/star/table/CellHoriJustify.hpp> 29cdf0e10cSrcweir #include <com/sun/star/table/CellOrientation.hpp> 30cdf0e10cSrcweir #include <com/sun/star/table/CellVertJustify.hpp> 31cdf0e10cSrcweir #include <com/sun/star/table/TableBorder.hpp> 32cdf0e10cSrcweir #include <com/sun/star/util/CellProtection.hpp> 33cdf0e10cSrcweir #include "oox/drawingml/color.hxx" 34cdf0e10cSrcweir #include "oox/helper/graphichelper.hxx" 35cdf0e10cSrcweir #include "oox/helper/refmap.hxx" 36cdf0e10cSrcweir #include "oox/helper/refvector.hxx" 37cdf0e10cSrcweir #include "oox/xls/numberformatsbuffer.hxx" 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace com { namespace sun { namespace star { 40cdf0e10cSrcweir namespace awt { struct FontDescrtiptor; } 41cdf0e10cSrcweir } } } 42cdf0e10cSrcweir 43cdf0e10cSrcweir namespace oox { class PropertySet; } 44cdf0e10cSrcweir 45cdf0e10cSrcweir namespace oox { 46cdf0e10cSrcweir namespace xls { 47cdf0e10cSrcweir 48cdf0e10cSrcweir // ============================================================================ 49cdf0e10cSrcweir 50cdf0e10cSrcweir const sal_Int32 OOX_COLOR_WINDOWTEXT3 = 24; /// System window text color (BIFF3-BIFF4). 51cdf0e10cSrcweir const sal_Int32 OOX_COLOR_WINDOWBACK3 = 25; /// System window background color (BIFF3-BIFF4). 52cdf0e10cSrcweir const sal_Int32 OOX_COLOR_WINDOWTEXT = 64; /// System window text color (BIFF5+). 53cdf0e10cSrcweir const sal_Int32 OOX_COLOR_WINDOWBACK = 65; /// System window background color (BIFF5+). 54cdf0e10cSrcweir const sal_Int32 OOX_COLOR_BUTTONBACK = 67; /// System button background color (face color). 55cdf0e10cSrcweir const sal_Int32 OOX_COLOR_CHWINDOWTEXT = 77; /// System window text color (BIFF8 charts). 56cdf0e10cSrcweir const sal_Int32 OOX_COLOR_CHWINDOWBACK = 78; /// System window background color (BIFF8 charts). 57cdf0e10cSrcweir const sal_Int32 OOX_COLOR_CHBORDERAUTO = 79; /// Automatic frame border (BIFF8 charts). 58cdf0e10cSrcweir const sal_Int32 OOX_COLOR_NOTEBACK = 80; /// Note background color. 59cdf0e10cSrcweir const sal_Int32 OOX_COLOR_NOTETEXT = 81; /// Note text color. 60cdf0e10cSrcweir const sal_Int32 OOX_COLOR_FONTAUTO = 0x7FFF; /// Font auto color (system window text color). 61cdf0e10cSrcweir 62cdf0e10cSrcweir // ---------------------------------------------------------------------------- 63cdf0e10cSrcweir 64cdf0e10cSrcweir const sal_Int16 API_LINE_NONE = 0; 65cdf0e10cSrcweir const sal_Int16 API_LINE_HAIR = 2; 66cdf0e10cSrcweir const sal_Int16 API_LINE_THIN = 35; 67cdf0e10cSrcweir const sal_Int16 API_LINE_MEDIUM = 88; 68cdf0e10cSrcweir const sal_Int16 API_LINE_THICK = 141; 69cdf0e10cSrcweir 70cdf0e10cSrcweir const sal_Int16 API_ESCAPE_NONE = 0; /// No escapement. 71cdf0e10cSrcweir const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101; /// Superscript: raise characters automatically (magic value 101). 72cdf0e10cSrcweir const sal_Int16 API_ESCAPE_SUBSCRIPT = -101; /// Subscript: lower characters automatically (magic value -101). 73cdf0e10cSrcweir 74cdf0e10cSrcweir const sal_Int8 API_ESCAPEHEIGHT_NONE = 100; /// Relative character height if not escaped. 75cdf0e10cSrcweir const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; /// Relative character height if escaped. 76cdf0e10cSrcweir 77cdf0e10cSrcweir // ============================================================================ 78cdf0e10cSrcweir 79cdf0e10cSrcweir /** Special implementation of the GraphicHelper for Excel palette and scheme 80cdf0e10cSrcweir colors. 81cdf0e10cSrcweir */ 82cdf0e10cSrcweir class ExcelGraphicHelper : public GraphicHelper, public WorkbookHelper 83cdf0e10cSrcweir { 84cdf0e10cSrcweir public: 85cdf0e10cSrcweir explicit ExcelGraphicHelper( const WorkbookHelper& rHelper ); 86cdf0e10cSrcweir 87cdf0e10cSrcweir /** Derived classes may implement to resolve a scheme color from the passed XML token identifier. */ 88cdf0e10cSrcweir virtual sal_Int32 getSchemeColor( sal_Int32 nToken ) const; 89cdf0e10cSrcweir /** Derived classes may implement to resolve a palette index to an RGB color. */ 90cdf0e10cSrcweir virtual sal_Int32 getPaletteColor( sal_Int32 nPaletteIdx ) const; 91cdf0e10cSrcweir }; 92cdf0e10cSrcweir 93cdf0e10cSrcweir // ============================================================================ 94cdf0e10cSrcweir 95cdf0e10cSrcweir class Color : public ::oox::drawingml::Color 96cdf0e10cSrcweir { 97cdf0e10cSrcweir public: 98cdf0e10cSrcweir /** Sets the color to automatic. */ 99cdf0e10cSrcweir void setAuto(); 100cdf0e10cSrcweir /** Sets the color to the passed RGB value. */ 101cdf0e10cSrcweir void setRgb( sal_Int32 nRgbValue, double fTint = 0.0 ); 102cdf0e10cSrcweir /** Sets the color to the passed theme index. */ 103cdf0e10cSrcweir void setTheme( sal_Int32 nThemeIdx, double fTint = 0.0 ); 104cdf0e10cSrcweir /** Sets the color to the passed palette index. */ 105cdf0e10cSrcweir void setIndexed( sal_Int32 nPaletteIdx, double fTint = 0.0 ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** Imports the color from the passed attribute list. */ 108cdf0e10cSrcweir void importColor( const AttributeList& rAttribs ); 109cdf0e10cSrcweir 110cdf0e10cSrcweir /** Imports a 64-bit color from the passed binary stream. */ 111cdf0e10cSrcweir void importColor( SequenceInputStream& rStrm ); 112cdf0e10cSrcweir /** Imports a 32-bit palette color identifier from the passed BIFF12 stream. */ 113cdf0e10cSrcweir void importColorId( SequenceInputStream& rStrm ); 114cdf0e10cSrcweir /** Imports a 32-bit RGBA color value from the passed BIFF12 stream. */ 115cdf0e10cSrcweir void importColorRgb( SequenceInputStream& rStrm ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir /** Imports an 8-bit or 16-bit palette color identifier from the passed BIFF stream. */ 118cdf0e10cSrcweir void importColorId( BiffInputStream& rStrm, bool b16Bit = true ); 119cdf0e10cSrcweir /** Imports a 32-bit RGBA color value from the passed BIFF stream. */ 120cdf0e10cSrcweir void importColorRgb( BiffInputStream& rStrm ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir /** Returns true, if the color is set to automatic. */ isAuto() const123cdf0e10cSrcweir inline bool isAuto() const { return isPlaceHolder(); } 124cdf0e10cSrcweir }; 125cdf0e10cSrcweir 126cdf0e10cSrcweir // ---------------------------------------------------------------------------- 127cdf0e10cSrcweir 128cdf0e10cSrcweir SequenceInputStream& operator>>( SequenceInputStream& rStrm, Color& orColor ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir // ============================================================================ 131cdf0e10cSrcweir 132cdf0e10cSrcweir /** Stores all colors of the color palette. */ 133cdf0e10cSrcweir class ColorPalette : public WorkbookHelper 134cdf0e10cSrcweir { 135cdf0e10cSrcweir public: 136cdf0e10cSrcweir /** Constructs the color palette with predefined color values. */ 137cdf0e10cSrcweir explicit ColorPalette( const WorkbookHelper& rHelper ); 138cdf0e10cSrcweir 139cdf0e10cSrcweir /** Appends a new color from the passed attributes. */ 140cdf0e10cSrcweir void importPaletteColor( const AttributeList& rAttribs ); 141cdf0e10cSrcweir /** Appends a new color from the passed RGBCOLOR record. */ 142cdf0e10cSrcweir void importPaletteColor( SequenceInputStream& rStrm ); 143cdf0e10cSrcweir /** Imports the PALETTE record from the passed stream. */ 144cdf0e10cSrcweir void importPalette( BiffInputStream& rStrm ); 145cdf0e10cSrcweir /** Imports a color palette from a UNO sequence in the passed any. */ 146cdf0e10cSrcweir void importPalette( const ::com::sun::star::uno::Any& rPalette ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir /** Rturns the RGB value of the color with the passed index. */ 149cdf0e10cSrcweir sal_Int32 getColor( sal_Int32 nPaletteIdx ) const; 150cdf0e10cSrcweir 151cdf0e10cSrcweir private: 152cdf0e10cSrcweir /** Appends the passed color. */ 153cdf0e10cSrcweir void appendColor( sal_Int32 nRGBValue ); 154cdf0e10cSrcweir 155cdf0e10cSrcweir private: 156cdf0e10cSrcweir ::std::vector< sal_Int32 > maColors; /// List of RGB values. 157cdf0e10cSrcweir size_t mnAppendIndex; /// Index to append a new color. 158cdf0e10cSrcweir }; 159cdf0e10cSrcweir 160cdf0e10cSrcweir // ============================================================================ 161cdf0e10cSrcweir 162cdf0e10cSrcweir /** Contains all XML font attributes, e.g. from a font or rPr element. */ 163cdf0e10cSrcweir struct FontModel 164cdf0e10cSrcweir { 165cdf0e10cSrcweir ::rtl::OUString maName; /// Font name. 166cdf0e10cSrcweir Color maColor; /// Font color. 167cdf0e10cSrcweir sal_Int32 mnScheme; /// Major/minor scheme font. 168cdf0e10cSrcweir sal_Int32 mnFamily; /// Font family. 169cdf0e10cSrcweir sal_Int32 mnCharSet; /// Windows font character set. 170cdf0e10cSrcweir double mfHeight; /// Font height in points. 171cdf0e10cSrcweir sal_Int32 mnUnderline; /// Underline style. 172cdf0e10cSrcweir sal_Int32 mnEscapement; /// Escapement style. 173cdf0e10cSrcweir bool mbBold; /// True = bold characters. 174cdf0e10cSrcweir bool mbItalic; /// True = italic characters. 175cdf0e10cSrcweir bool mbStrikeout; /// True = Strike out characters. 176cdf0e10cSrcweir bool mbOutline; /// True = outlined characters. 177cdf0e10cSrcweir bool mbShadow; /// True = shadowed chgaracters. 178cdf0e10cSrcweir 179cdf0e10cSrcweir explicit FontModel(); 180cdf0e10cSrcweir 181cdf0e10cSrcweir void setBiff12Scheme( sal_uInt8 nScheme ); 182cdf0e10cSrcweir void setBiffHeight( sal_uInt16 nHeight ); 183cdf0e10cSrcweir void setBiffWeight( sal_uInt16 nWeight ); 184cdf0e10cSrcweir void setBiffUnderline( sal_uInt16 nUnderline ); 185cdf0e10cSrcweir void setBiffEscapement( sal_uInt16 nEscapement ); 186cdf0e10cSrcweir }; 187cdf0e10cSrcweir 188cdf0e10cSrcweir // ---------------------------------------------------------------------------- 189cdf0e10cSrcweir 190cdf0e10cSrcweir /** Enumerates different types of API font property sets. */ 191cdf0e10cSrcweir enum FontPropertyType 192cdf0e10cSrcweir { 193cdf0e10cSrcweir FONT_PROPTYPE_CELL, /// Font properties in a spreadsheet cell (table::Cell service). 194cdf0e10cSrcweir FONT_PROPTYPE_TEXT /// Font properties in a text object (text::Text service). 195cdf0e10cSrcweir }; 196cdf0e10cSrcweir 197cdf0e10cSrcweir // ---------------------------------------------------------------------------- 198cdf0e10cSrcweir 199cdf0e10cSrcweir /** Contains used flags for all API font attributes. */ 200cdf0e10cSrcweir struct ApiFontUsedFlags 201cdf0e10cSrcweir { 202cdf0e10cSrcweir bool mbNameUsed; /// True = font name/family/char set are used. 203cdf0e10cSrcweir bool mbColorUsed; /// True = font color is used. 204cdf0e10cSrcweir bool mbSchemeUsed; /// True = font scheme is used. 205cdf0e10cSrcweir bool mbHeightUsed; /// True = font height is used. 206cdf0e10cSrcweir bool mbUnderlineUsed; /// True = underline style is used. 207cdf0e10cSrcweir bool mbEscapementUsed; /// True = escapement style is used. 208cdf0e10cSrcweir bool mbWeightUsed; /// True = font weight (boldness) is used. 209cdf0e10cSrcweir bool mbPostureUsed; /// True = font posture (italic) is used. 210cdf0e10cSrcweir bool mbStrikeoutUsed; /// True = strike out style is used. 211cdf0e10cSrcweir bool mbOutlineUsed; /// True = outline style is used. 212cdf0e10cSrcweir bool mbShadowUsed; /// True = shadow style is used. 213cdf0e10cSrcweir 214cdf0e10cSrcweir explicit ApiFontUsedFlags( bool bAllUsed ); 215cdf0e10cSrcweir }; 216cdf0e10cSrcweir 217cdf0e10cSrcweir // ---------------------------------------------------------------------------- 218cdf0e10cSrcweir 219cdf0e10cSrcweir /** Contains API font name, family, and charset for a script type. */ 220cdf0e10cSrcweir struct ApiScriptFontName 221cdf0e10cSrcweir { 222cdf0e10cSrcweir ::rtl::OUString maName; /// Font name. 223cdf0e10cSrcweir sal_Int16 mnFamily; /// Font family. 224cdf0e10cSrcweir sal_Int16 mnTextEnc; /// Font text encoding. 225cdf0e10cSrcweir 226cdf0e10cSrcweir explicit ApiScriptFontName(); 227cdf0e10cSrcweir }; 228cdf0e10cSrcweir 229cdf0e10cSrcweir // ---------------------------------------------------------------------------- 230cdf0e10cSrcweir 231cdf0e10cSrcweir /** Contains all API font attributes. */ 232cdf0e10cSrcweir struct ApiFontData 233cdf0e10cSrcweir { 234cdf0e10cSrcweir typedef ::com::sun::star::awt::FontDescriptor ApiFontDescriptor; 235cdf0e10cSrcweir 236cdf0e10cSrcweir ApiScriptFontName maLatinFont; /// Font name for latin scripts. 237cdf0e10cSrcweir ApiScriptFontName maAsianFont; /// Font name for east-asian scripts. 238cdf0e10cSrcweir ApiScriptFontName maCmplxFont; /// Font name for complex scripts. 239cdf0e10cSrcweir ApiFontDescriptor maDesc; /// Font descriptor (height in twips, weight in %). 240cdf0e10cSrcweir sal_Int32 mnColor; /// Font color. 241cdf0e10cSrcweir sal_Int16 mnEscapement; /// Escapement style. 242cdf0e10cSrcweir sal_Int8 mnEscapeHeight; /// Escapement font height. 243cdf0e10cSrcweir bool mbOutline; /// True = outlined characters. 244cdf0e10cSrcweir bool mbShadow; /// True = shadowed chgaracters. 245cdf0e10cSrcweir 246cdf0e10cSrcweir explicit ApiFontData(); 247cdf0e10cSrcweir }; 248cdf0e10cSrcweir 249cdf0e10cSrcweir // ============================================================================ 250cdf0e10cSrcweir 251cdf0e10cSrcweir class Font : public WorkbookHelper 252cdf0e10cSrcweir { 253cdf0e10cSrcweir public: 254cdf0e10cSrcweir explicit Font( const WorkbookHelper& rHelper, bool bDxf ); 255cdf0e10cSrcweir explicit Font( const WorkbookHelper& rHelper, const FontModel& rModel ); 256cdf0e10cSrcweir 257cdf0e10cSrcweir /** Sets font formatting attributes for the passed element. */ 258cdf0e10cSrcweir void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs ); 259cdf0e10cSrcweir 260cdf0e10cSrcweir /** Imports the FONT record from the passed stream. */ 261cdf0e10cSrcweir void importFont( SequenceInputStream& rStrm ); 262cdf0e10cSrcweir /** Imports the font name from a DXF record. */ 263cdf0e10cSrcweir void importDxfName( SequenceInputStream& rStrm ); 264cdf0e10cSrcweir /** Imports the font color from a DXF record. */ 265cdf0e10cSrcweir void importDxfColor( SequenceInputStream& rStrm ); 266cdf0e10cSrcweir /** Imports the font scheme from a DXF record. */ 267cdf0e10cSrcweir void importDxfScheme( SequenceInputStream& rStrm ); 268cdf0e10cSrcweir /** Imports the font height from a DXF record. */ 269cdf0e10cSrcweir void importDxfHeight( SequenceInputStream& rStrm ); 270cdf0e10cSrcweir /** Imports the font weight from a DXF record. */ 271cdf0e10cSrcweir void importDxfWeight( SequenceInputStream& rStrm ); 272cdf0e10cSrcweir /** Imports the font underline style from a DXF record. */ 273cdf0e10cSrcweir void importDxfUnderline( SequenceInputStream& rStrm ); 274cdf0e10cSrcweir /** Imports the font escapement style from a DXF record. */ 275cdf0e10cSrcweir void importDxfEscapement( SequenceInputStream& rStrm ); 276cdf0e10cSrcweir /** Imports a font style flag from a DXF record. */ 277cdf0e10cSrcweir void importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm ); 278cdf0e10cSrcweir 279cdf0e10cSrcweir /** Imports the FONT record from the passed stream. */ 280cdf0e10cSrcweir void importFont( BiffInputStream& rStrm ); 281cdf0e10cSrcweir /** Imports the FONTCOLOR record from the passed stream. */ 282cdf0e10cSrcweir void importFontColor( BiffInputStream& rStrm ); 283cdf0e10cSrcweir /** Sets the font attributes from the font block of a CFRULE record. */ 284cdf0e10cSrcweir void importCfRule( BiffInputStream& rStrm ); 285cdf0e10cSrcweir 286cdf0e10cSrcweir /** Returns the font model structure. This function can be called before 287cdf0e10cSrcweir finalizeImport() has been called. */ getModel() const288cdf0e10cSrcweir inline const FontModel& getModel() const { return maModel; } 289cdf0e10cSrcweir /** Returns the text encoding for strings used with this font. This 290cdf0e10cSrcweir function can be called before finalizeImport() has been called. */ 291cdf0e10cSrcweir rtl_TextEncoding getFontEncoding() const; 292cdf0e10cSrcweir 293cdf0e10cSrcweir /** Final processing after import of all style settings. */ 294cdf0e10cSrcweir void finalizeImport(); 295cdf0e10cSrcweir 296cdf0e10cSrcweir /** Returns an API font descriptor with own font information. */ 297cdf0e10cSrcweir const ::com::sun::star::awt::FontDescriptor& getFontDescriptor() const; 298cdf0e10cSrcweir /** Returns true, if the font requires rich text formatting in Calc. 299cdf0e10cSrcweir @descr Example: Font escapement is a cell attribute in Excel, but Calc 300cdf0e10cSrcweir needs an rich text cell for this attribute. */ 301cdf0e10cSrcweir bool needsRichTextFormat() const; 302cdf0e10cSrcweir 303cdf0e10cSrcweir /** Writes all font attributes to the passed property map. */ 304cdf0e10cSrcweir void writeToPropertyMap( 305cdf0e10cSrcweir PropertyMap& rPropMap, 306cdf0e10cSrcweir FontPropertyType ePropType ) const; 307cdf0e10cSrcweir /** Writes all font attributes to the passed property set. */ 308cdf0e10cSrcweir void writeToPropertySet( 309cdf0e10cSrcweir PropertySet& rPropSet, 310cdf0e10cSrcweir FontPropertyType ePropType ) const; 311cdf0e10cSrcweir 312cdf0e10cSrcweir private: 313cdf0e10cSrcweir /** Reads and sets height and flags. */ 314cdf0e10cSrcweir void importFontData2( BiffInputStream& rStrm ); 315cdf0e10cSrcweir /** Reads and sets weight, escapement, underline, family, charset (BIFF5+). */ 316cdf0e10cSrcweir void importFontData5( BiffInputStream& rStrm ); 317cdf0e10cSrcweir 318cdf0e10cSrcweir /** Reads and sets a byte string as font name. */ 319cdf0e10cSrcweir void importFontName2( BiffInputStream& rStrm ); 320cdf0e10cSrcweir /** Reads and sets a Unicode string as font name. */ 321cdf0e10cSrcweir void importFontName8( BiffInputStream& rStrm ); 322cdf0e10cSrcweir 323cdf0e10cSrcweir private: 324cdf0e10cSrcweir FontModel maModel; 325cdf0e10cSrcweir ApiFontData maApiData; 326cdf0e10cSrcweir ApiFontUsedFlags maUsedFlags; 327cdf0e10cSrcweir bool mbDxf; 328cdf0e10cSrcweir }; 329cdf0e10cSrcweir 330cdf0e10cSrcweir typedef ::boost::shared_ptr< Font > FontRef; 331cdf0e10cSrcweir 332cdf0e10cSrcweir // ============================================================================ 333cdf0e10cSrcweir 334cdf0e10cSrcweir /** Contains all XML cell alignment attributes, e.g. from an alignment element. */ 335cdf0e10cSrcweir struct AlignmentModel 336cdf0e10cSrcweir { 337cdf0e10cSrcweir sal_Int32 mnHorAlign; /// Horizontal alignment. 338cdf0e10cSrcweir sal_Int32 mnVerAlign; /// Vertical alignment. 339cdf0e10cSrcweir sal_Int32 mnTextDir; /// CTL text direction. 340cdf0e10cSrcweir sal_Int32 mnRotation; /// Text rotation angle. 341cdf0e10cSrcweir sal_Int32 mnIndent; /// Indentation. 342cdf0e10cSrcweir bool mbWrapText; /// True = multi-line text. 343cdf0e10cSrcweir bool mbShrink; /// True = shrink to fit cell size. 344cdf0e10cSrcweir bool mbJustLastLine; /// True = justify last line in block text. 345cdf0e10cSrcweir 346cdf0e10cSrcweir explicit AlignmentModel(); 347cdf0e10cSrcweir 348cdf0e10cSrcweir /** Sets horizontal alignment from the passed BIFF data. */ 349cdf0e10cSrcweir void setBiffHorAlign( sal_uInt8 nHorAlign ); 350cdf0e10cSrcweir /** Sets vertical alignment from the passed BIFF data. */ 351cdf0e10cSrcweir void setBiffVerAlign( sal_uInt8 nVerAlign ); 352cdf0e10cSrcweir /** Sets rotation from the passed BIFF text orientation. */ 353cdf0e10cSrcweir void setBiffTextOrient( sal_uInt8 nTextOrient ); 354cdf0e10cSrcweir }; 355cdf0e10cSrcweir 356cdf0e10cSrcweir // ---------------------------------------------------------------------------- 357cdf0e10cSrcweir 358cdf0e10cSrcweir /** Contains all API cell alignment attributes. */ 359cdf0e10cSrcweir struct ApiAlignmentData 360cdf0e10cSrcweir { 361cdf0e10cSrcweir typedef ::com::sun::star::table::CellHoriJustify ApiCellHoriJustify; 362cdf0e10cSrcweir typedef ::com::sun::star::table::CellVertJustify ApiCellVertJustify; 363cdf0e10cSrcweir typedef ::com::sun::star::table::CellOrientation ApiCellOrientation; 364cdf0e10cSrcweir 365cdf0e10cSrcweir ApiCellHoriJustify meHorJustify; /// Horizontal alignment. 366cdf0e10cSrcweir ApiCellVertJustify meVerJustify; /// Vertical alignment. 367cdf0e10cSrcweir ApiCellOrientation meOrientation; /// Normal or stacked text. 368cdf0e10cSrcweir sal_Int32 mnRotation; /// Text rotation angle. 369cdf0e10cSrcweir sal_Int16 mnWritingMode; /// CTL text direction. 370cdf0e10cSrcweir sal_Int16 mnIndent; /// Indentation. 371cdf0e10cSrcweir bool mbWrapText; /// True = multi-line text. 372cdf0e10cSrcweir bool mbShrink; /// True = shrink to fit cell size. 373cdf0e10cSrcweir 374cdf0e10cSrcweir explicit ApiAlignmentData(); 375cdf0e10cSrcweir }; 376cdf0e10cSrcweir 377cdf0e10cSrcweir bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight ); 378cdf0e10cSrcweir 379cdf0e10cSrcweir // ============================================================================ 380cdf0e10cSrcweir 381cdf0e10cSrcweir class Alignment : public WorkbookHelper 382cdf0e10cSrcweir { 383cdf0e10cSrcweir public: 384cdf0e10cSrcweir explicit Alignment( const WorkbookHelper& rHelper ); 385cdf0e10cSrcweir 386cdf0e10cSrcweir /** Sets all attributes from the alignment element. */ 387cdf0e10cSrcweir void importAlignment( const AttributeList& rAttribs ); 388cdf0e10cSrcweir 389cdf0e10cSrcweir /** Sets the alignment attributes from the passed BIFF12 XF record data. */ 390cdf0e10cSrcweir void setBiff12Data( sal_uInt32 nFlags ); 391cdf0e10cSrcweir /** Sets the alignment attributes from the passed BIFF2 XF record data. */ 392cdf0e10cSrcweir void setBiff2Data( sal_uInt8 nFlags ); 393cdf0e10cSrcweir /** Sets the alignment attributes from the passed BIFF3 XF record data. */ 394cdf0e10cSrcweir void setBiff3Data( sal_uInt16 nAlign ); 395cdf0e10cSrcweir /** Sets the alignment attributes from the passed BIFF4 XF record data. */ 396cdf0e10cSrcweir void setBiff4Data( sal_uInt16 nAlign ); 397cdf0e10cSrcweir /** Sets the alignment attributes from the passed BIFF5 XF record data. */ 398cdf0e10cSrcweir void setBiff5Data( sal_uInt16 nAlign ); 399cdf0e10cSrcweir /** Sets the alignment attributes from the passed BIFF8 XF record data. */ 400cdf0e10cSrcweir void setBiff8Data( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib ); 401cdf0e10cSrcweir 402cdf0e10cSrcweir /** Final processing after import of all style settings. */ 403cdf0e10cSrcweir void finalizeImport(); 404cdf0e10cSrcweir 405cdf0e10cSrcweir /** Returns the alignment model structure. */ getModel() const406cdf0e10cSrcweir inline const AlignmentModel& getModel() const { return maModel; } 407cdf0e10cSrcweir /** Returns the converted API alignment data struct. */ getApiData() const408cdf0e10cSrcweir inline const ApiAlignmentData& getApiData() const { return maApiData; } 409cdf0e10cSrcweir 410cdf0e10cSrcweir /** Writes all alignment attributes to the passed property map. */ 411cdf0e10cSrcweir void writeToPropertyMap( PropertyMap& rPropMap ) const; 412cdf0e10cSrcweir 413cdf0e10cSrcweir private: 414cdf0e10cSrcweir AlignmentModel maModel; /// Alignment model data. 415cdf0e10cSrcweir ApiAlignmentData maApiData; /// Alignment data converted to API constants. 416cdf0e10cSrcweir }; 417cdf0e10cSrcweir 418cdf0e10cSrcweir typedef ::boost::shared_ptr< Alignment > AlignmentRef; 419cdf0e10cSrcweir 420cdf0e10cSrcweir // ============================================================================ 421cdf0e10cSrcweir 422cdf0e10cSrcweir /** Contains all XML cell protection attributes, e.g. from a protection element. */ 423cdf0e10cSrcweir struct ProtectionModel 424cdf0e10cSrcweir { 425cdf0e10cSrcweir bool mbLocked; /// True = locked against editing. 426cdf0e10cSrcweir bool mbHidden; /// True = formula is hidden. 427cdf0e10cSrcweir 428cdf0e10cSrcweir explicit ProtectionModel(); 429cdf0e10cSrcweir }; 430cdf0e10cSrcweir 431cdf0e10cSrcweir // ---------------------------------------------------------------------------- 432cdf0e10cSrcweir 433cdf0e10cSrcweir /** Contains all API cell protection attributes. */ 434cdf0e10cSrcweir struct ApiProtectionData 435cdf0e10cSrcweir { 436cdf0e10cSrcweir typedef ::com::sun::star::util::CellProtection ApiCellProtection; 437cdf0e10cSrcweir 438cdf0e10cSrcweir ApiCellProtection maCellProt; 439cdf0e10cSrcweir 440cdf0e10cSrcweir explicit ApiProtectionData(); 441cdf0e10cSrcweir }; 442cdf0e10cSrcweir 443cdf0e10cSrcweir bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight ); 444cdf0e10cSrcweir 445cdf0e10cSrcweir // ============================================================================ 446cdf0e10cSrcweir 447cdf0e10cSrcweir class Protection : public WorkbookHelper 448cdf0e10cSrcweir { 449cdf0e10cSrcweir public: 450cdf0e10cSrcweir explicit Protection( const WorkbookHelper& rHelper ); 451cdf0e10cSrcweir 452cdf0e10cSrcweir /** Sets all attributes from the protection element. */ 453cdf0e10cSrcweir void importProtection( const AttributeList& rAttribs ); 454cdf0e10cSrcweir 455cdf0e10cSrcweir /** Sets the protection attributes from the passed BIFF12 XF record data. */ 456cdf0e10cSrcweir void setBiff12Data( sal_uInt32 nFlags ); 457cdf0e10cSrcweir /** Sets the protection attributes from the passed BIFF2 XF record data. */ 458cdf0e10cSrcweir void setBiff2Data( sal_uInt8 nNumFmt ); 459cdf0e10cSrcweir /** Sets the protection attributes from the passed BIFF3-BIFF8 XF record data. */ 460cdf0e10cSrcweir void setBiff3Data( sal_uInt16 nProt ); 461cdf0e10cSrcweir 462cdf0e10cSrcweir /** Final processing after import of all style settings. */ 463cdf0e10cSrcweir void finalizeImport(); 464cdf0e10cSrcweir 465cdf0e10cSrcweir /** Returns the protection model structure. */ getModel() const466cdf0e10cSrcweir inline const ProtectionModel& getModel() const { return maModel; } 467cdf0e10cSrcweir /** Returns the converted API protection data struct. */ getApiData() const468cdf0e10cSrcweir inline const ApiProtectionData& getApiData() const { return maApiData; } 469cdf0e10cSrcweir 470cdf0e10cSrcweir /** Writes all protection attributes to the passed property map. */ 471cdf0e10cSrcweir void writeToPropertyMap( PropertyMap& rPropMap ) const; 472cdf0e10cSrcweir 473cdf0e10cSrcweir private: 474cdf0e10cSrcweir ProtectionModel maModel; /// Protection model data. 475cdf0e10cSrcweir ApiProtectionData maApiData; /// Protection data converted to API constants. 476cdf0e10cSrcweir }; 477cdf0e10cSrcweir 478cdf0e10cSrcweir typedef ::boost::shared_ptr< Protection > ProtectionRef; 479cdf0e10cSrcweir 480cdf0e10cSrcweir // ============================================================================ 481cdf0e10cSrcweir 482cdf0e10cSrcweir /** Contains XML attributes of a single border line. */ 483cdf0e10cSrcweir struct BorderLineModel 484cdf0e10cSrcweir { 485cdf0e10cSrcweir Color maColor; /// Borderline color. 486cdf0e10cSrcweir sal_Int32 mnStyle; /// Border line style. 487cdf0e10cSrcweir bool mbUsed; /// True = line format used. 488cdf0e10cSrcweir 489cdf0e10cSrcweir explicit BorderLineModel( bool bDxf ); 490cdf0e10cSrcweir 491cdf0e10cSrcweir /** Sets the passed BIFF line style. */ 492cdf0e10cSrcweir void setBiffStyle( sal_Int32 nLineStyle ); 493cdf0e10cSrcweir /** Sets line style and line color from the passed BIFF data. */ 494cdf0e10cSrcweir void setBiffData( sal_uInt8 nLineStyle, sal_uInt16 nLineColor ); 495cdf0e10cSrcweir }; 496cdf0e10cSrcweir 497cdf0e10cSrcweir // ---------------------------------------------------------------------------- 498cdf0e10cSrcweir 499cdf0e10cSrcweir /** Contains XML attributes of a complete cell border. */ 500cdf0e10cSrcweir struct BorderModel 501cdf0e10cSrcweir { 502cdf0e10cSrcweir BorderLineModel maLeft; /// Left line format. 503cdf0e10cSrcweir BorderLineModel maRight; /// Right line format. 504cdf0e10cSrcweir BorderLineModel maTop; /// Top line format. 505cdf0e10cSrcweir BorderLineModel maBottom; /// Bottom line format. 506cdf0e10cSrcweir BorderLineModel maDiagonal; /// Diagonal line format. 507cdf0e10cSrcweir bool mbDiagTLtoBR; /// True = top-left to bottom-right on. 508cdf0e10cSrcweir bool mbDiagBLtoTR; /// True = bottom-left to top-right on. 509cdf0e10cSrcweir 510cdf0e10cSrcweir explicit BorderModel( bool bDxf ); 511cdf0e10cSrcweir }; 512cdf0e10cSrcweir 513cdf0e10cSrcweir // ---------------------------------------------------------------------------- 514cdf0e10cSrcweir 515cdf0e10cSrcweir /** Contains API attributes of a complete cell border. */ 516cdf0e10cSrcweir struct ApiBorderData 517cdf0e10cSrcweir { 518cdf0e10cSrcweir typedef ::com::sun::star::table::TableBorder ApiTableBorder; 519cdf0e10cSrcweir typedef ::com::sun::star::table::BorderLine ApiBorderLine; 520cdf0e10cSrcweir 521cdf0e10cSrcweir ApiTableBorder maBorder; /// Left/right/top/bottom line format. 522cdf0e10cSrcweir ApiBorderLine maTLtoBR; /// Diagonal top-left to bottom-right line format. 523cdf0e10cSrcweir ApiBorderLine maBLtoTR; /// Diagonal bottom-left to top-right line format. 524cdf0e10cSrcweir bool mbBorderUsed; /// True = left/right/top/bottom line format used. 525cdf0e10cSrcweir bool mbDiagUsed; /// True = diagonal line format used. 526cdf0e10cSrcweir 527cdf0e10cSrcweir explicit ApiBorderData(); 528cdf0e10cSrcweir 529cdf0e10cSrcweir /** Returns true, if any of the outer border lines is visible. */ 530cdf0e10cSrcweir bool hasAnyOuterBorder() const; 531cdf0e10cSrcweir }; 532cdf0e10cSrcweir 533cdf0e10cSrcweir bool operator==( const ApiBorderData& rLeft, const ApiBorderData& rRight ); 534cdf0e10cSrcweir 535cdf0e10cSrcweir // ============================================================================ 536cdf0e10cSrcweir 537cdf0e10cSrcweir class Border : public WorkbookHelper 538cdf0e10cSrcweir { 539cdf0e10cSrcweir public: 540cdf0e10cSrcweir explicit Border( const WorkbookHelper& rHelper, bool bDxf ); 541cdf0e10cSrcweir 542cdf0e10cSrcweir /** Sets global border attributes from the border element. */ 543cdf0e10cSrcweir void importBorder( const AttributeList& rAttribs ); 544cdf0e10cSrcweir /** Sets border attributes for the border line with the passed element identifier. */ 545cdf0e10cSrcweir void importStyle( sal_Int32 nElement, const AttributeList& rAttribs ); 546cdf0e10cSrcweir /** Sets color attributes for the border line with the passed element identifier. */ 547cdf0e10cSrcweir void importColor( sal_Int32 nElement, const AttributeList& rAttribs ); 548cdf0e10cSrcweir 549cdf0e10cSrcweir /** Imports the BORDER record from the passed stream. */ 550cdf0e10cSrcweir void importBorder( SequenceInputStream& rStrm ); 551cdf0e10cSrcweir /** Imports a border from a DXF record from the passed stream. */ 552cdf0e10cSrcweir void importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm ); 553cdf0e10cSrcweir 554cdf0e10cSrcweir /** Sets the border attributes from the passed BIFF2 XF record data. */ 555cdf0e10cSrcweir void setBiff2Data( sal_uInt8 nFlags ); 556cdf0e10cSrcweir /** Sets the border attributes from the passed BIFF3/BIFF4 XF record data. */ 557cdf0e10cSrcweir void setBiff3Data( sal_uInt32 nBorder ); 558cdf0e10cSrcweir /** Sets the border attributes from the passed BIFF5 XF record data. */ 559cdf0e10cSrcweir void setBiff5Data( sal_uInt32 nBorder, sal_uInt32 nArea ); 560cdf0e10cSrcweir /** Sets the border attributes from the passed BIFF8 XF record data. */ 561cdf0e10cSrcweir void setBiff8Data( sal_uInt32 nBorder1, sal_uInt32 nBorder2 ); 562cdf0e10cSrcweir /** Sets the border attributes from the border block of a CFRULE record. */ 563cdf0e10cSrcweir void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); 564cdf0e10cSrcweir 565cdf0e10cSrcweir /** Final processing after import of all style settings. */ 566cdf0e10cSrcweir void finalizeImport(); 567cdf0e10cSrcweir 568cdf0e10cSrcweir /** Returns the border model structure. */ getModel() const569cdf0e10cSrcweir inline const BorderModel& getModel() const { return maModel; } 570cdf0e10cSrcweir /** Returns the converted API border data struct. */ getApiData() const571cdf0e10cSrcweir inline const ApiBorderData& getApiData() const { return maApiData; } 572cdf0e10cSrcweir 573cdf0e10cSrcweir /** Writes all border attributes to the passed property map. */ 574cdf0e10cSrcweir void writeToPropertyMap( PropertyMap& rPropMap ) const; 575cdf0e10cSrcweir 576cdf0e10cSrcweir private: 577cdf0e10cSrcweir /** Returns the border line struct specified by the passed XML token identifier. */ 578cdf0e10cSrcweir BorderLineModel* getBorderLine( sal_Int32 nElement ); 579cdf0e10cSrcweir 580cdf0e10cSrcweir /** Converts border line data to an API struct, returns true, if the line is marked as used. */ 581cdf0e10cSrcweir bool convertBorderLine( 582cdf0e10cSrcweir ::com::sun::star::table::BorderLine& rBorderLine, 583cdf0e10cSrcweir const BorderLineModel& rModel ); 584cdf0e10cSrcweir 585cdf0e10cSrcweir private: 586cdf0e10cSrcweir BorderModel maModel; 587cdf0e10cSrcweir ApiBorderData maApiData; 588cdf0e10cSrcweir bool mbDxf; 589cdf0e10cSrcweir }; 590cdf0e10cSrcweir 591cdf0e10cSrcweir typedef ::boost::shared_ptr< Border > BorderRef; 592cdf0e10cSrcweir 593cdf0e10cSrcweir // ============================================================================ 594cdf0e10cSrcweir 595cdf0e10cSrcweir /** Contains XML pattern fill attributes from the patternFill element. */ 596cdf0e10cSrcweir struct PatternFillModel 597cdf0e10cSrcweir { 598cdf0e10cSrcweir Color maPatternColor; /// Pattern foreground color. 599cdf0e10cSrcweir Color maFillColor; /// Background fill color. 600cdf0e10cSrcweir sal_Int32 mnPattern; /// Pattern identifier (e.g. solid). 601cdf0e10cSrcweir bool mbPattColorUsed; /// True = pattern foreground color used. 602cdf0e10cSrcweir bool mbFillColorUsed; /// True = background fill color used. 603cdf0e10cSrcweir bool mbPatternUsed; /// True = pattern used. 604cdf0e10cSrcweir 605cdf0e10cSrcweir explicit PatternFillModel( bool bDxf ); 606cdf0e10cSrcweir 607cdf0e10cSrcweir /** Sets the passed BIFF pattern identifier. */ 608cdf0e10cSrcweir void setBiffPattern( sal_Int32 nPattern ); 609cdf0e10cSrcweir /** Sets the pattern and pattern colors from the passed BIFF data. */ 610cdf0e10cSrcweir void setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillColor, sal_uInt8 nPattern ); 611cdf0e10cSrcweir }; 612cdf0e10cSrcweir 613cdf0e10cSrcweir // ---------------------------------------------------------------------------- 614cdf0e10cSrcweir 615cdf0e10cSrcweir /** Contains XML gradient fill attributes from the gradientFill element. */ 616cdf0e10cSrcweir struct GradientFillModel 617cdf0e10cSrcweir { 618cdf0e10cSrcweir typedef ::std::map< double, Color > ColorMap; 619cdf0e10cSrcweir 620cdf0e10cSrcweir sal_Int32 mnType; /// Gradient type, linear or path. 621cdf0e10cSrcweir double mfAngle; /// Rotation angle for type linear. 622cdf0e10cSrcweir double mfLeft; /// Left convergence for type path. 623cdf0e10cSrcweir double mfRight; /// Right convergence for type path. 624cdf0e10cSrcweir double mfTop; /// Top convergence for type path. 625cdf0e10cSrcweir double mfBottom; /// Bottom convergence for type path. 626cdf0e10cSrcweir ColorMap maColors; /// Gradient colors. 627cdf0e10cSrcweir 628cdf0e10cSrcweir explicit GradientFillModel(); 629cdf0e10cSrcweir 630cdf0e10cSrcweir /** Reads BIFF12 gradient settings from a FILL or DXF record. */ 631cdf0e10cSrcweir void readGradient( SequenceInputStream& rStrm ); 632cdf0e10cSrcweir /** Reads BIFF12 gradient stop settings from a FILL or DXF record. */ 633cdf0e10cSrcweir void readGradientStop( SequenceInputStream& rStrm, bool bDxf ); 634cdf0e10cSrcweir }; 635cdf0e10cSrcweir 636cdf0e10cSrcweir // ---------------------------------------------------------------------------- 637cdf0e10cSrcweir 638cdf0e10cSrcweir /** Contains API fill attributes. */ 639cdf0e10cSrcweir struct ApiSolidFillData 640cdf0e10cSrcweir { 641cdf0e10cSrcweir sal_Int32 mnColor; /// Fill color. 642cdf0e10cSrcweir bool mbTransparent; /// True = transparent area. 643cdf0e10cSrcweir bool mbUsed; /// True = fill data is valid. 644cdf0e10cSrcweir 645cdf0e10cSrcweir explicit ApiSolidFillData(); 646cdf0e10cSrcweir }; 647cdf0e10cSrcweir 648cdf0e10cSrcweir bool operator==( const ApiSolidFillData& rLeft, const ApiSolidFillData& rRight ); 649cdf0e10cSrcweir 650cdf0e10cSrcweir // ============================================================================ 651cdf0e10cSrcweir 652cdf0e10cSrcweir /** Contains cell fill attributes, either a pattern fill or a gradient fill. */ 653cdf0e10cSrcweir class Fill : public WorkbookHelper 654cdf0e10cSrcweir { 655cdf0e10cSrcweir public: 656cdf0e10cSrcweir explicit Fill( const WorkbookHelper& rHelper, bool bDxf ); 657cdf0e10cSrcweir 658cdf0e10cSrcweir /** Sets attributes of a patternFill element. */ 659cdf0e10cSrcweir void importPatternFill( const AttributeList& rAttribs ); 660cdf0e10cSrcweir /** Sets the pattern color from the fgColor element. */ 661cdf0e10cSrcweir void importFgColor( const AttributeList& rAttribs ); 662cdf0e10cSrcweir /** Sets the background color from the bgColor element. */ 663cdf0e10cSrcweir void importBgColor( const AttributeList& rAttribs ); 664cdf0e10cSrcweir /** Sets attributes of a gradientFill element. */ 665cdf0e10cSrcweir void importGradientFill( const AttributeList& rAttribs ); 666cdf0e10cSrcweir /** Sets a color from the color element in a gradient fill. */ 667cdf0e10cSrcweir void importColor( const AttributeList& rAttribs, double fPosition ); 668cdf0e10cSrcweir 669cdf0e10cSrcweir /** Imports the FILL record from the passed stream. */ 670cdf0e10cSrcweir void importFill( SequenceInputStream& rStrm ); 671cdf0e10cSrcweir /** Imports the fill pattern from a DXF record. */ 672cdf0e10cSrcweir void importDxfPattern( SequenceInputStream& rStrm ); 673cdf0e10cSrcweir /** Imports the pattern color from a DXF record. */ 674cdf0e10cSrcweir void importDxfFgColor( SequenceInputStream& rStrm ); 675cdf0e10cSrcweir /** Imports the background color from a DXF record. */ 676cdf0e10cSrcweir void importDxfBgColor( SequenceInputStream& rStrm ); 677cdf0e10cSrcweir /** Imports gradient settings from a DXF record. */ 678cdf0e10cSrcweir void importDxfGradient( SequenceInputStream& rStrm ); 679cdf0e10cSrcweir /** Imports gradient stop settings from a DXF record. */ 680cdf0e10cSrcweir void importDxfStop( SequenceInputStream& rStrm ); 681cdf0e10cSrcweir 682cdf0e10cSrcweir /** Sets the fill attributes from the passed BIFF2 XF record data. */ 683cdf0e10cSrcweir void setBiff2Data( sal_uInt8 nFlags ); 684cdf0e10cSrcweir /** Sets the fill attributes from the passed BIFF3/BIFF4 XF record data. */ 685cdf0e10cSrcweir void setBiff3Data( sal_uInt16 nArea ); 686cdf0e10cSrcweir /** Sets the fill attributes from the passed BIFF5 XF record data. */ 687cdf0e10cSrcweir void setBiff5Data( sal_uInt32 nArea ); 688cdf0e10cSrcweir /** Sets the fill attributes from the passed BIFF8 XF record data. */ 689cdf0e10cSrcweir void setBiff8Data( sal_uInt32 nBorder2, sal_uInt16 nArea ); 690cdf0e10cSrcweir /** Sets the fill attributes from the fill block of a CFRULE record. */ 691cdf0e10cSrcweir void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); 692cdf0e10cSrcweir 693cdf0e10cSrcweir /** Final processing after import of all style settings. */ 694cdf0e10cSrcweir void finalizeImport(); 695cdf0e10cSrcweir 696cdf0e10cSrcweir /** Returns the fill pattern model structure, if extant. */ getPatternModel() const697cdf0e10cSrcweir inline const PatternFillModel* getPatternModel() const { return mxPatternModel.get(); } 698cdf0e10cSrcweir /** Returns the fill gradient model structure, if extant. */ getGradientModel() const699cdf0e10cSrcweir inline const GradientFillModel* getGradientModel() const { return mxGradientModel.get(); } 700cdf0e10cSrcweir /** Returns the converted API fill data struct. */ getApiData() const701cdf0e10cSrcweir inline const ApiSolidFillData& getApiData() const { return maApiData; } 702cdf0e10cSrcweir 703cdf0e10cSrcweir /** Writes all fill attributes to the passed property map. */ 704cdf0e10cSrcweir void writeToPropertyMap( PropertyMap& rPropMap ) const; 705cdf0e10cSrcweir 706cdf0e10cSrcweir private: 707cdf0e10cSrcweir typedef ::boost::shared_ptr< PatternFillModel > PatternModelRef; 708cdf0e10cSrcweir typedef ::boost::shared_ptr< GradientFillModel > GradientModelRef; 709cdf0e10cSrcweir 710cdf0e10cSrcweir PatternModelRef mxPatternModel; 711cdf0e10cSrcweir GradientModelRef mxGradientModel; 712cdf0e10cSrcweir ApiSolidFillData maApiData; 713cdf0e10cSrcweir bool mbDxf; 714cdf0e10cSrcweir }; 715cdf0e10cSrcweir 716cdf0e10cSrcweir typedef ::boost::shared_ptr< Fill > FillRef; 717cdf0e10cSrcweir 718cdf0e10cSrcweir // ============================================================================ 719cdf0e10cSrcweir 720cdf0e10cSrcweir /** Contains all data for a cell format or cell style. */ 721cdf0e10cSrcweir struct XfModel 722cdf0e10cSrcweir { 723cdf0e10cSrcweir sal_Int32 mnStyleXfId; /// Index to parent style XF. 724cdf0e10cSrcweir sal_Int32 mnFontId; /// Index to font data list. 725cdf0e10cSrcweir sal_Int32 mnNumFmtId; /// Index to number format list. 726cdf0e10cSrcweir sal_Int32 mnBorderId; /// Index to list of cell borders. 727cdf0e10cSrcweir sal_Int32 mnFillId; /// Index to list of cell areas. 728cdf0e10cSrcweir bool mbCellXf; /// True = cell XF, false = style XF. 729cdf0e10cSrcweir bool mbFontUsed; /// True = font index used. 730cdf0e10cSrcweir bool mbNumFmtUsed; /// True = number format used. 731cdf0e10cSrcweir bool mbAlignUsed; /// True = alignment used. 732cdf0e10cSrcweir bool mbProtUsed; /// True = cell protection used. 733cdf0e10cSrcweir bool mbBorderUsed; /// True = border data used. 734cdf0e10cSrcweir bool mbAreaUsed; /// True = area data used. 735cdf0e10cSrcweir 736cdf0e10cSrcweir explicit XfModel(); 737cdf0e10cSrcweir }; 738cdf0e10cSrcweir 739cdf0e10cSrcweir // ============================================================================ 740cdf0e10cSrcweir 741cdf0e10cSrcweir /** Represents a cell format or a cell style (called XF, extended format). 742cdf0e10cSrcweir 743cdf0e10cSrcweir This class stores the type (cell/style), the index to the parent style (if 744cdf0e10cSrcweir it is a cell format) and all "attribute used" flags, which reflect the 745cdf0e10cSrcweir state of specific attribute groups (true = user has changed the attributes) 746cdf0e10cSrcweir and all formatting data. 747cdf0e10cSrcweir */ 748cdf0e10cSrcweir class Xf : public WorkbookHelper 749cdf0e10cSrcweir { 750cdf0e10cSrcweir public: 751cdf0e10cSrcweir explicit Xf( const WorkbookHelper& rHelper ); 752cdf0e10cSrcweir 753cdf0e10cSrcweir /** Sets all "attribute used" flags to the passed state. */ 754cdf0e10cSrcweir void setAllUsedFlags( bool bUsed ); 755cdf0e10cSrcweir 756cdf0e10cSrcweir /** Sets all attributes from the xf element. */ 757cdf0e10cSrcweir void importXf( const AttributeList& rAttribs, bool bCellXf ); 758cdf0e10cSrcweir /** Sets all attributes from the alignment element. */ 759cdf0e10cSrcweir void importAlignment( const AttributeList& rAttribs ); 760cdf0e10cSrcweir /** Sets all attributes from the protection element. */ 761cdf0e10cSrcweir void importProtection( const AttributeList& rAttribs ); 762cdf0e10cSrcweir 763cdf0e10cSrcweir /** Imports the XF record from the passed stream. */ 764cdf0e10cSrcweir void importXf( SequenceInputStream& rStrm, bool bCellXf ); 765cdf0e10cSrcweir 766cdf0e10cSrcweir /** Imports the XF record from the passed stream. */ 767cdf0e10cSrcweir void importXf( BiffInputStream& rStrm ); 768cdf0e10cSrcweir 769cdf0e10cSrcweir /** Final processing after import of all style settings. */ 770cdf0e10cSrcweir void finalizeImport(); 771cdf0e10cSrcweir 772cdf0e10cSrcweir /** Returns true, if the XF is a cell XF, and false, if it is a style XF. */ isCellXf() const773cdf0e10cSrcweir inline bool isCellXf() const { return maModel.mbCellXf; } 774cdf0e10cSrcweir 775cdf0e10cSrcweir /** Returns the referred font object. */ 776cdf0e10cSrcweir FontRef getFont() const; 777cdf0e10cSrcweir /** Returns the alignment data of this style. */ getAlignment() const778cdf0e10cSrcweir inline const Alignment& getAlignment() const { return maAlignment; } 779cdf0e10cSrcweir /** Returns the cell protection data of this style. */ getProtection() const780cdf0e10cSrcweir inline const Protection& getProtection() const { return maProtection; } 781cdf0e10cSrcweir /** Returns true, if any "attribute used" flags are ste in this XF. */ 782cdf0e10cSrcweir bool hasAnyUsedFlags() const; 783cdf0e10cSrcweir 784cdf0e10cSrcweir /** Writes all formatting attributes to the passed property map. */ 785cdf0e10cSrcweir void writeToPropertyMap( PropertyMap& rPropMap ) const; 786cdf0e10cSrcweir /** Writes all formatting attributes to the passed property set. */ 787cdf0e10cSrcweir void writeToPropertySet( PropertySet& rPropSet ) const; 788cdf0e10cSrcweir 789cdf0e10cSrcweir /** Converts formatting information from BIFF2 cell record data directly. */ 790cdf0e10cSrcweir static void writeBiff2CellFormatToPropertySet( 791cdf0e10cSrcweir const WorkbookHelper& rHelper, PropertySet& rPropSet, 792cdf0e10cSrcweir sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 ); 793cdf0e10cSrcweir 794cdf0e10cSrcweir private: 795cdf0e10cSrcweir /** Sets 'attribute used' flags from the passed BIFF bit field. */ 796cdf0e10cSrcweir void setBiffUsedFlags( sal_uInt8 nUsedFlags ); 797cdf0e10cSrcweir 798cdf0e10cSrcweir private: 799cdf0e10cSrcweir XfModel maModel; /// Cell XF or style XF model data. 800cdf0e10cSrcweir Alignment maAlignment; /// Cell alignment data. 801cdf0e10cSrcweir Protection maProtection; /// Cell protection data. 802cdf0e10cSrcweir ::com::sun::star::table::CellVertJustify 803cdf0e10cSrcweir meRotationRef; /// Rotation reference dependent on border. 804cdf0e10cSrcweir }; 805cdf0e10cSrcweir 806cdf0e10cSrcweir typedef ::boost::shared_ptr< Xf > XfRef; 807cdf0e10cSrcweir 808cdf0e10cSrcweir // ============================================================================ 809cdf0e10cSrcweir 810cdf0e10cSrcweir class Dxf : public WorkbookHelper 811cdf0e10cSrcweir { 812cdf0e10cSrcweir public: 813cdf0e10cSrcweir explicit Dxf( const WorkbookHelper& rHelper ); 814cdf0e10cSrcweir 815cdf0e10cSrcweir /** Creates a new empty font object. */ 816cdf0e10cSrcweir FontRef createFont( bool bAlwaysNew = true ); 817cdf0e10cSrcweir /** Creates a new empty border object. */ 818cdf0e10cSrcweir BorderRef createBorder( bool bAlwaysNew = true ); 819cdf0e10cSrcweir /** Creates a new empty fill object. */ 820cdf0e10cSrcweir FillRef createFill( bool bAlwaysNew = true ); 821cdf0e10cSrcweir 822cdf0e10cSrcweir /** Inserts a new number format code. */ 823cdf0e10cSrcweir void importNumFmt( const AttributeList& rAttribs ); 824cdf0e10cSrcweir /** Sets all attributes from the alignment element. */ 825cdf0e10cSrcweir void importAlignment( const AttributeList& rAttribs ); 826cdf0e10cSrcweir /** Sets all attributes from the protection element. */ 827cdf0e10cSrcweir void importProtection( const AttributeList& rAttribs ); 828cdf0e10cSrcweir 829cdf0e10cSrcweir /** Imports the DXF record from the passed stream. */ 830cdf0e10cSrcweir void importDxf( SequenceInputStream& rStrm ); 831cdf0e10cSrcweir 832cdf0e10cSrcweir /** Imports font, border, and fill settings from the CFRULE record. */ 833cdf0e10cSrcweir void importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags ); 834cdf0e10cSrcweir 835cdf0e10cSrcweir /** Final processing after import of all style settings. */ 836cdf0e10cSrcweir void finalizeImport(); 837cdf0e10cSrcweir 838cdf0e10cSrcweir /** Writes all formatting attributes to the passed property map. */ 839cdf0e10cSrcweir void writeToPropertyMap( PropertyMap& rPropMap ) const; 840cdf0e10cSrcweir /** Writes all formatting attributes to the passed property set. */ 841cdf0e10cSrcweir void writeToPropertySet( PropertySet& rPropSet ) const; 842cdf0e10cSrcweir 843cdf0e10cSrcweir private: 844cdf0e10cSrcweir FontRef mxFont; /// Font data. 845cdf0e10cSrcweir NumberFormatRef mxNumFmt; /// Number format data. 846cdf0e10cSrcweir AlignmentRef mxAlignment; /// Alignment data. 847cdf0e10cSrcweir ProtectionRef mxProtection; /// Protection data. 848cdf0e10cSrcweir BorderRef mxBorder; /// Border data. 849cdf0e10cSrcweir FillRef mxFill; /// Fill data. 850cdf0e10cSrcweir }; 851cdf0e10cSrcweir 852cdf0e10cSrcweir typedef ::boost::shared_ptr< Dxf > DxfRef; 853cdf0e10cSrcweir 854cdf0e10cSrcweir // ============================================================================ 855cdf0e10cSrcweir 856cdf0e10cSrcweir /** Contains attributes of a cell style, e.g. from the cellStyle element. */ 857cdf0e10cSrcweir struct CellStyleModel 858cdf0e10cSrcweir { 859cdf0e10cSrcweir ::rtl::OUString maName; /// Cell style name. 860cdf0e10cSrcweir sal_Int32 mnXfId; /// Formatting for this cell style. 861cdf0e10cSrcweir sal_Int32 mnBuiltinId; /// Identifier for builtin styles. 862cdf0e10cSrcweir sal_Int32 mnLevel; /// Level for builtin column/row styles. 863cdf0e10cSrcweir bool mbBuiltin; /// True = builtin style. 864cdf0e10cSrcweir bool mbCustom; /// True = customized builtin style. 865cdf0e10cSrcweir bool mbHidden; /// True = style not visible in GUI. 866cdf0e10cSrcweir 867cdf0e10cSrcweir explicit CellStyleModel(); 868cdf0e10cSrcweir 869cdf0e10cSrcweir /** Returns true, if this style is a builtin style. */ 870cdf0e10cSrcweir bool isBuiltin() const; 871cdf0e10cSrcweir /** Returns true, if this style represents the default document cell style. */ 872cdf0e10cSrcweir bool isDefaultStyle() const; 873cdf0e10cSrcweir }; 874cdf0e10cSrcweir 875cdf0e10cSrcweir // ============================================================================ 876cdf0e10cSrcweir 877cdf0e10cSrcweir class CellStyle : public WorkbookHelper 878cdf0e10cSrcweir { 879cdf0e10cSrcweir public: 880cdf0e10cSrcweir explicit CellStyle( const WorkbookHelper& rHelper ); 881cdf0e10cSrcweir 882cdf0e10cSrcweir /** Imports passed attributes from the cellStyle element. */ 883cdf0e10cSrcweir void importCellStyle( const AttributeList& rAttribs ); 884cdf0e10cSrcweir /** Imports style settings from a CELLSTYLE record. */ 885cdf0e10cSrcweir void importCellStyle( SequenceInputStream& rStrm ); 886cdf0e10cSrcweir /** Imports style settings from a STYLE record. */ 887cdf0e10cSrcweir void importStyle( BiffInputStream& rStrm ); 888cdf0e10cSrcweir 889cdf0e10cSrcweir /** Creates the style sheet in the document described by this cell style object. */ 890cdf0e10cSrcweir void createCellStyle(); 891cdf0e10cSrcweir /** Stores tha passed final style name and creates the cell style, if it is 892cdf0e10cSrcweir user-defined or modified built-in. */ 893cdf0e10cSrcweir void finalizeImport( const ::rtl::OUString& rFinalName ); 894cdf0e10cSrcweir 895cdf0e10cSrcweir /** Returns the cell style model structure. */ getModel() const896cdf0e10cSrcweir inline const CellStyleModel& getModel() const { return maModel; } 897cdf0e10cSrcweir /** Returns the final style name used in the document. */ getFinalStyleName() const898cdf0e10cSrcweir inline const ::rtl::OUString& getFinalStyleName() const { return maFinalName; } 899cdf0e10cSrcweir 900cdf0e10cSrcweir private: 901cdf0e10cSrcweir CellStyleModel maModel; 902cdf0e10cSrcweir ::rtl::OUString maFinalName; /// Final style name used in API. 903cdf0e10cSrcweir bool mbCreated; /// True = style sheet created. 904cdf0e10cSrcweir }; 905cdf0e10cSrcweir 906cdf0e10cSrcweir typedef ::boost::shared_ptr< CellStyle > CellStyleRef; 907cdf0e10cSrcweir 908cdf0e10cSrcweir // ============================================================================ 909cdf0e10cSrcweir 910cdf0e10cSrcweir class CellStyleBuffer : public WorkbookHelper 911cdf0e10cSrcweir { 912cdf0e10cSrcweir public: 913cdf0e10cSrcweir explicit CellStyleBuffer( const WorkbookHelper& rHelper ); 914cdf0e10cSrcweir 915cdf0e10cSrcweir /** Appends and returns a new named cell style object. */ 916cdf0e10cSrcweir CellStyleRef importCellStyle( const AttributeList& rAttribs ); 917cdf0e10cSrcweir /** Imports the CELLSTYLE record from the passed stream. */ 918cdf0e10cSrcweir CellStyleRef importCellStyle( SequenceInputStream& rStrm ); 919cdf0e10cSrcweir /** Imports the STYLE record from the passed stream. */ 920cdf0e10cSrcweir CellStyleRef importStyle( BiffInputStream& rStrm ); 921cdf0e10cSrcweir 922cdf0e10cSrcweir /** Final processing after import of all style settings. */ 923cdf0e10cSrcweir void finalizeImport(); 924cdf0e10cSrcweir 925cdf0e10cSrcweir /** Returns the XF identifier associated to the default cell style. */ 926cdf0e10cSrcweir sal_Int32 getDefaultXfId() const; 927cdf0e10cSrcweir /** Returns the default style sheet for unused cells. */ 928cdf0e10cSrcweir ::rtl::OUString getDefaultStyleName() const; 929cdf0e10cSrcweir /** Creates the style sheet described by the style XF with the passed identifier. */ 930cdf0e10cSrcweir ::rtl::OUString createCellStyle( sal_Int32 nXfId ) const; 931cdf0e10cSrcweir 932cdf0e10cSrcweir private: 933cdf0e10cSrcweir /** Inserts the passed cell style object into the internal maps. */ 934cdf0e10cSrcweir void insertCellStyle( CellStyleRef xCellStyle ); 935cdf0e10cSrcweir /** Creates the style sheet described by the passed cell style object. */ 936cdf0e10cSrcweir ::rtl::OUString createCellStyle( const CellStyleRef& rxCellStyle ) const; 937cdf0e10cSrcweir 938cdf0e10cSrcweir private: 939cdf0e10cSrcweir typedef RefVector< CellStyle > CellStyleVector; 940cdf0e10cSrcweir typedef RefMap< sal_Int32, CellStyle > CellStyleXfIdMap; 941cdf0e10cSrcweir 942cdf0e10cSrcweir CellStyleVector maBuiltinStyles; /// All built-in cell styles. 943cdf0e10cSrcweir CellStyleVector maUserStyles; /// All user defined cell styles. 944cdf0e10cSrcweir CellStyleXfIdMap maStylesByXf; /// All cell styles, mapped by XF identifier. 945cdf0e10cSrcweir CellStyleRef mxDefStyle; /// Default cell style. 946cdf0e10cSrcweir }; 947cdf0e10cSrcweir 948cdf0e10cSrcweir // ============================================================================ 949cdf0e10cSrcweir 950cdf0e10cSrcweir struct AutoFormatModel 951cdf0e10cSrcweir { 952cdf0e10cSrcweir sal_Int32 mnAutoFormatId; /// Index of predefined autoformatting. 953cdf0e10cSrcweir bool mbApplyNumFmt; /// True = apply number format from autoformatting. 954cdf0e10cSrcweir bool mbApplyFont; /// True = apply font from autoformatting. 955cdf0e10cSrcweir bool mbApplyAlignment; /// True = apply alignment from autoformatting. 956cdf0e10cSrcweir bool mbApplyBorder; /// True = apply border from autoformatting. 957cdf0e10cSrcweir bool mbApplyFill; /// True = apply fill from autoformatting. 958cdf0e10cSrcweir bool mbApplyProtection; /// True = apply protection from autoformatting. 959cdf0e10cSrcweir 960cdf0e10cSrcweir explicit AutoFormatModel(); 961cdf0e10cSrcweir }; 962cdf0e10cSrcweir 963cdf0e10cSrcweir // ============================================================================ 964cdf0e10cSrcweir 965cdf0e10cSrcweir class StylesBuffer : public WorkbookHelper 966cdf0e10cSrcweir { 967cdf0e10cSrcweir public: 968cdf0e10cSrcweir explicit StylesBuffer( const WorkbookHelper& rHelper ); 969cdf0e10cSrcweir 970cdf0e10cSrcweir /** Creates a new empty font object. 971cdf0e10cSrcweir @param opnFontId (out-param) The identifier of the new font object. */ 972cdf0e10cSrcweir FontRef createFont( sal_Int32* opnFontId = 0 ); 973cdf0e10cSrcweir /** Creates a number format. */ 974cdf0e10cSrcweir NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const ::rtl::OUString& rFmtCode ); 975cdf0e10cSrcweir /** Creates a new empty border object. 976cdf0e10cSrcweir @param opnBorderId (out-param) The identifier of the new border object. */ 977cdf0e10cSrcweir BorderRef createBorder( sal_Int32* opnBorderId = 0 ); 978cdf0e10cSrcweir /** Creates a new empty fill object. 979cdf0e10cSrcweir @param opnFillId (out-param) The identifier of the new fill object. */ 980cdf0e10cSrcweir FillRef createFill( sal_Int32* opnFillId = 0 ); 981cdf0e10cSrcweir /** Creates a new empty cell formatting object. 982cdf0e10cSrcweir @param opnXfId (out-param) The identifier of the new XF object. */ 983cdf0e10cSrcweir XfRef createCellXf( sal_Int32* opnXfId = 0 ); 984cdf0e10cSrcweir /** Creates a new empty style formatting object. 985cdf0e10cSrcweir @param opnXfId (out-param) The identifier of the new XF object. */ 986cdf0e10cSrcweir XfRef createStyleXf( sal_Int32* opnXfId = 0 ); 987cdf0e10cSrcweir /** Creates a new empty differential formatting object. 988cdf0e10cSrcweir @param opnDxfId (out-param) The identifier of the new DXF object. */ 989cdf0e10cSrcweir DxfRef createDxf( sal_Int32* opnDxfId = 0 ); 990cdf0e10cSrcweir 991cdf0e10cSrcweir /** Appends a new color to the color palette. */ 992cdf0e10cSrcweir void importPaletteColor( const AttributeList& rAttribs ); 993cdf0e10cSrcweir /** Inserts a new number format code. */ 994cdf0e10cSrcweir NumberFormatRef importNumFmt( const AttributeList& rAttribs ); 995cdf0e10cSrcweir /** Appends and returns a new named cell style object. */ 996cdf0e10cSrcweir CellStyleRef importCellStyle( const AttributeList& rAttribs ); 997cdf0e10cSrcweir 998cdf0e10cSrcweir /** Appends a new color to the color palette. */ 999cdf0e10cSrcweir void importPaletteColor( SequenceInputStream& rStrm ); 1000cdf0e10cSrcweir /** Imports the NUMFMT record from the passed stream. */ 1001cdf0e10cSrcweir void importNumFmt( SequenceInputStream& rStrm ); 1002cdf0e10cSrcweir /** Imports the CELLSTYLE record from the passed stream. */ 1003cdf0e10cSrcweir void importCellStyle( SequenceInputStream& rStrm ); 1004cdf0e10cSrcweir 1005cdf0e10cSrcweir /** Imports the PALETTE record from the passed stream. */ 1006cdf0e10cSrcweir void importPalette( BiffInputStream& rStrm ); 1007cdf0e10cSrcweir /** Imports the FONT record from the passed stream. */ 1008cdf0e10cSrcweir void importFont( BiffInputStream& rStrm ); 1009cdf0e10cSrcweir /** Imports the FONTCOLOR record from the passed stream. */ 1010cdf0e10cSrcweir void importFontColor( BiffInputStream& rStrm ); 1011cdf0e10cSrcweir /** Imports the FORMAT record from the passed stream. */ 1012cdf0e10cSrcweir void importFormat( BiffInputStream& rStrm ); 1013cdf0e10cSrcweir /** Imports the XF record from the passed stream. */ 1014cdf0e10cSrcweir void importXf( BiffInputStream& rStrm ); 1015cdf0e10cSrcweir /** Imports the STYLE record from the passed stream. */ 1016cdf0e10cSrcweir void importStyle( BiffInputStream& rStrm ); 1017cdf0e10cSrcweir 1018cdf0e10cSrcweir /** Imports a color palette from a UNO sequence in the passed any. */ 1019cdf0e10cSrcweir void importPalette( const ::com::sun::star::uno::Any& rPalette ); 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir /** Final processing after import of all style settings. */ 1022cdf0e10cSrcweir void finalizeImport(); 1023cdf0e10cSrcweir 1024cdf0e10cSrcweir /** Returns the palette color with the specified index. */ 1025cdf0e10cSrcweir sal_Int32 getPaletteColor( sal_Int32 nIndex ) const; 1026cdf0e10cSrcweir /** Returns the specified font object. */ 1027cdf0e10cSrcweir FontRef getFont( sal_Int32 nFontId ) const; 1028cdf0e10cSrcweir /** Returns the specified border object. */ 1029cdf0e10cSrcweir BorderRef getBorder( sal_Int32 nBorderId ) const; 1030cdf0e10cSrcweir /** Returns the specified cell format object. */ 1031cdf0e10cSrcweir XfRef getCellXf( sal_Int32 nXfId ) const; 1032cdf0e10cSrcweir /** Returns the specified style format object. */ 1033cdf0e10cSrcweir XfRef getStyleXf( sal_Int32 nXfId ) const; 1034cdf0e10cSrcweir /** Returns the specified diferential cell format object. */ 1035cdf0e10cSrcweir DxfRef getDxf( sal_Int32 nDxfId ) const; 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir /** Returns the font object of the specified cell XF. */ 1038cdf0e10cSrcweir FontRef getFontFromCellXf( sal_Int32 nXfId ) const; 1039cdf0e10cSrcweir /** Returns the default application font (used in the "Normal" cell style). */ 1040cdf0e10cSrcweir FontRef getDefaultFont() const; 1041cdf0e10cSrcweir /** Returns the model of the default application font (used in the "Normal" cell style). */ 1042cdf0e10cSrcweir const FontModel& getDefaultFontModel() const; 1043cdf0e10cSrcweir 1044cdf0e10cSrcweir /** Returns true, if the specified borders are equal. */ 1045cdf0e10cSrcweir bool equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 ) const; 1046cdf0e10cSrcweir /** Returns true, if the specified fills are equal. */ 1047cdf0e10cSrcweir bool equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 ) const; 1048cdf0e10cSrcweir 1049cdf0e10cSrcweir /** Returns the default style sheet for unused cells. */ 1050cdf0e10cSrcweir ::rtl::OUString getDefaultStyleName() const; 1051cdf0e10cSrcweir /** Creates the style sheet described by the style XF with the passed identifier. */ 1052cdf0e10cSrcweir ::rtl::OUString createCellStyle( sal_Int32 nXfId ) const; 1053cdf0e10cSrcweir /** Creates the style sheet described by the DXF with the passed identifier. */ 1054cdf0e10cSrcweir ::rtl::OUString createDxfStyle( sal_Int32 nDxfId ) const; 1055cdf0e10cSrcweir 1056cdf0e10cSrcweir /** Writes the font attributes of the specified font data to the passed property map. */ 1057cdf0e10cSrcweir void writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const; 1058cdf0e10cSrcweir /** Writes the specified number format to the passed property map. */ 1059cdf0e10cSrcweir void writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const; 1060cdf0e10cSrcweir /** Writes the border attributes of the specified border data to the passed property map. */ 1061cdf0e10cSrcweir void writeBorderToPropertyMap( PropertyMap& rPropMap, sal_Int32 nBorderId ) const; 1062cdf0e10cSrcweir /** Writes the fill attributes of the specified fill data to the passed property map. */ 1063cdf0e10cSrcweir void writeFillToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFillId ) const; 1064cdf0e10cSrcweir /** Writes the cell formatting attributes of the specified XF to the passed property map. */ 1065cdf0e10cSrcweir void writeCellXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const; 1066cdf0e10cSrcweir /** Writes the cell formatting attributes of the specified style XF to the passed property map. */ 1067cdf0e10cSrcweir void writeStyleXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const; 1068cdf0e10cSrcweir 1069cdf0e10cSrcweir /** Writes the cell formatting attributes of the specified XF to the passed property set. */ 1070cdf0e10cSrcweir void writeCellXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const; 1071cdf0e10cSrcweir /** Writes the cell formatting attributes of the specified style XF to the passed property set. */ 1072cdf0e10cSrcweir void writeStyleXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const; 1073cdf0e10cSrcweir 1074cdf0e10cSrcweir private: 1075cdf0e10cSrcweir typedef RefVector< Font > FontVector; 1076cdf0e10cSrcweir typedef RefVector< Border > BorderVector; 1077cdf0e10cSrcweir typedef RefVector< Fill > FillVector; 1078cdf0e10cSrcweir typedef RefVector< Xf > XfVector; 1079cdf0e10cSrcweir typedef RefVector< Dxf > DxfVector; 1080cdf0e10cSrcweir typedef ::std::map< sal_Int32, ::rtl::OUString > DxfStyleMap; 1081cdf0e10cSrcweir 1082cdf0e10cSrcweir ColorPalette maPalette; /// Color palette. 1083cdf0e10cSrcweir FontVector maFonts; /// List of font objects. 1084cdf0e10cSrcweir NumberFormatsBuffer maNumFmts; /// List of all number format codes. 1085cdf0e10cSrcweir BorderVector maBorders; /// List of cell border objects. 1086cdf0e10cSrcweir FillVector maFills; /// List of cell area fill objects. 1087cdf0e10cSrcweir XfVector maCellXfs; /// List of cell formats. 1088cdf0e10cSrcweir XfVector maStyleXfs; /// List of cell styles. 1089cdf0e10cSrcweir CellStyleBuffer maCellStyles; /// All built-in and user defined cell styles. 1090cdf0e10cSrcweir DxfVector maDxfs; /// List of differential cell styles. 1091cdf0e10cSrcweir mutable DxfStyleMap maDxfStyles; /// Maps DXF identifiers to Calc style sheet names. 1092cdf0e10cSrcweir }; 1093cdf0e10cSrcweir 1094cdf0e10cSrcweir // ============================================================================ 1095cdf0e10cSrcweir 1096cdf0e10cSrcweir } // namespace xls 1097cdf0e10cSrcweir } // namespace oox 1098cdf0e10cSrcweir 1099cdf0e10cSrcweir #endif 1100