LibreOffice Module sc (master)  1
stylesbuffer.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_STYLESBUFFER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_STYLESBUFFER_HXX
22 
23 #include <memory>
24 #include <com/sun/star/awt/FontDescriptor.hpp>
25 #include <com/sun/star/table/CellHoriJustify.hpp>
26 #include <com/sun/star/table/CellOrientation.hpp>
27 #include <com/sun/star/table/BorderLine2.hpp>
28 #include <com/sun/star/util/CellProtection.hpp>
29 #include <oox/drawingml/color.hxx>
31 #include <oox/helper/refmap.hxx>
32 #include <oox/helper/refvector.hxx>
33 #include "numberformatsbuffer.hxx"
34 #include <editeng/svxenum.hxx>
35 #include <editeng/frmdir.hxx>
36 #include <attarray.hxx>
37 #include <vector>
38 
39 namespace oox { class SequenceInputStream; }
40 
41 namespace oox { class PropertySet;
42  class PropertyMap;
43  class AttributeList; }
44 
45 namespace oox::xls {
46 
47 const sal_Int32 OOX_COLOR_WINDOWTEXT3 = 24;
48 const sal_Int32 OOX_COLOR_WINDOWBACK3 = 25;
49 const sal_Int32 OOX_COLOR_WINDOWTEXT = 64;
50 const sal_Int32 OOX_COLOR_WINDOWBACK = 65;
51 const sal_Int32 OOX_COLOR_BUTTONBACK = 67;
52 const sal_Int32 OOX_COLOR_CHWINDOWTEXT = 77;
53 const sal_Int32 OOX_COLOR_CHWINDOWBACK = 78;
54 const sal_Int32 OOX_COLOR_CHBORDERAUTO = 79;
55 const sal_Int32 OOX_COLOR_NOTEBACK = 80;
56 const sal_Int32 OOX_COLOR_NOTETEXT = 81;
57 const sal_Int32 OOX_COLOR_FONTAUTO = 0x7FFF;
58 
59 const sal_Int16 API_LINE_NONE = 0;
60 const sal_Int16 API_LINE_HAIR = 1;
61 const sal_Int16 API_LINE_THIN = 15;
62 const sal_Int16 API_LINE_MEDIUM = 35;
63 const sal_Int16 API_LINE_THICK = 50;
64 
65 const sal_Int16 API_ESCAPE_NONE = 0;
66 const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101;
67 const sal_Int16 API_ESCAPE_SUBSCRIPT = -101;
68 
71 
76 {
77 public:
78  explicit ExcelGraphicHelper( const WorkbookHelper& rHelper );
79 
81  virtual ::Color getSchemeColor( sal_Int32 nToken ) const override;
83  virtual ::Color getPaletteColor( sal_Int32 nPaletteIdx ) const override;
84 };
85 
87 {
88 public:
90  void setAuto();
92  void setRgb( ::Color nRgbValue, double fTint = 0.0 );
94  void setTheme( sal_Int32 nThemeIdx, double fTint = 0.0 );
96  void setIndexed( sal_Int32 nPaletteIdx, double fTint = 0.0 );
97 
99  void importColor( const AttributeList& rAttribs );
100 
104  void importColorId( SequenceInputStream& rStrm );
105 
107  bool isAuto() const { return isPlaceHolder(); }
108 };
109 
111 
114 {
115 public:
117  explicit ColorPalette( const WorkbookHelper& rHelper );
118 
120  void importPaletteColor( const AttributeList& rAttribs );
123 
125  ::Color getColor( sal_Int32 nPaletteIdx ) const;
126 
127 private:
129  void appendColor( ::Color nRGBValue );
130 
131 private:
132  ::std::vector< ::Color > maColors;
133  size_t mnAppendIndex;
134 };
135 
137 struct FontModel
138 {
139  OUString maName;
141  sal_Int32 mnScheme;
142  sal_Int32 mnFamily;
143  sal_Int32 mnCharSet;
144  double mfHeight;
145  sal_Int32 mnUnderline;
146  sal_Int32 mnEscapement;
147  bool mbBold;
148  bool mbItalic;
149  bool mbStrikeout;
150  bool mbOutline;
151  bool mbShadow;
152 
153  explicit FontModel();
154 
155  void setBiff12Scheme( sal_uInt8 nScheme );
156  void setBiffHeight( sal_uInt16 nHeight );
157  void setBiffWeight( sal_uInt16 nWeight );
158  void setBiffUnderline( sal_uInt16 nUnderline );
159  void setBiffEscapement( sal_uInt16 nEscapement );
160 };
161 
164 {
165  bool mbNameUsed;
166  bool mbColorUsed;
176 
177  explicit ApiFontUsedFlags( bool bAllUsed );
178 };
179 
182 {
183  OUString maName;
184  sal_Int16 mnFamily;
185  sal_Int16 mnTextEnc;
186 
187  explicit ApiScriptFontName();
188 };
189 
192 {
196  css::awt::FontDescriptor maDesc;
198  sal_Int16 mnEscapement;
200  bool mbOutline;
201  bool mbShadow;
202 
203  explicit ApiFontData();
204 };
205 
206 class Font : public WorkbookHelper
207 {
208 public:
209  explicit Font( const WorkbookHelper& rHelper, bool bDxf );
210  explicit Font( const WorkbookHelper& rHelper, const FontModel& rModel );
211 
213  void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
214 
218  void importDxfName( SequenceInputStream& rStrm );
220  void importDxfColor( SequenceInputStream& rStrm );
222  void importDxfScheme( SequenceInputStream& rStrm );
224  void importDxfHeight( SequenceInputStream& rStrm );
226  void importDxfWeight( SequenceInputStream& rStrm );
232  void importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm );
233 
236  const FontModel& getModel() const { return maModel; }
237 
239  void finalizeImport();
240 
242  const css::awt::FontDescriptor& getFontDescriptor() const { return maApiData.maDesc;}
246  bool needsRichTextFormat() const;
247 
248  void fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkipPoolDefs = false ) const;
250  void writeToPropertyMap(
251  PropertyMap& rPropMap ) const;
253  void writeToPropertySet(
254  PropertySet& rPropSet ) const;
255 
256 private:
260  bool mbDxf;
261 };
262 
263 typedef std::shared_ptr< Font > FontRef;
264 
267 {
268  sal_Int32 mnHorAlign;
269  sal_Int32 mnVerAlign;
270  sal_Int32 mnTextDir;
271  sal_Int32 mnRotation;
272  sal_Int32 mnIndent;
273  bool mbWrapText;
274  bool mbShrink;
276 
277  explicit AlignmentModel();
278 
280  void setBiffHorAlign( sal_uInt8 nHorAlign );
282  void setBiffVerAlign( sal_uInt8 nVerAlign );
283 };
284 
287 {
288  css::table::CellHoriJustify meHorJustify;
290  sal_Int32 mnVerJustify;
292  css::table::CellOrientation meOrientation;
293  sal_Int32 mnRotation;
294  sal_Int16 mnWritingMode;
295  sal_Int16 mnIndent;
296  bool mbWrapText;
297  bool mbShrink;
298 
299  explicit ApiAlignmentData();
300 };
301 
302 bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight );
303 
304 class Alignment : public WorkbookHelper
305 {
306 public:
307  explicit Alignment( const WorkbookHelper& rHelper );
308 
310  void importAlignment( const AttributeList& rAttribs );
311 
313  void setBiff12Data( sal_uInt32 nFlags );
314 
316  void finalizeImport();
317 
319  const AlignmentModel& getModel() const { return maModel; }
321  const ApiAlignmentData& getApiData() const { return maApiData; }
322 
323  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
324 
325 private:
331 };
332 
335 {
336  bool mbLocked;
337  bool mbHidden;
338 
339  explicit ProtectionModel();
340 };
341 
344 {
345  typedef css::util::CellProtection ApiCellProtection;
346 
347  ApiCellProtection maCellProt;
348 
349  explicit ApiProtectionData();
350 };
351 
352 bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight );
353 
355 {
356 public:
357  explicit Protection( const WorkbookHelper& rHelper );
358 
360  void importProtection( const AttributeList& rAttribs );
361 
363  void setBiff12Data( sal_uInt32 nFlags );
364 
366  void finalizeImport();
367 
369  const ApiProtectionData& getApiData() const { return maApiData; }
370 
371  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
372 private:
375 };
376 
379 {
381  sal_Int32 mnStyle;
382  bool mbUsed;
383 
384  explicit BorderLineModel( bool bDxf );
385 
387  void setBiffStyle( sal_Int32 nLineStyle );
388 };
389 
392 {
400 
401  explicit BorderModel( bool bDxf );
402 };
403 
406 {
407  typedef css::table::BorderLine2 ApiBorderLine;
408 
409  ApiBorderLine maLeft;
410  ApiBorderLine maRight;
411  ApiBorderLine maTop;
412  ApiBorderLine maBottom;
413  ApiBorderLine maTLtoBR;
414  ApiBorderLine maBLtoTR;
416  bool mbDiagUsed;
417 
418  explicit ApiBorderData();
419 
421  bool hasAnyOuterBorder() const;
422 };
423 
424 class Border : public WorkbookHelper
425 {
426 public:
427  explicit Border( const WorkbookHelper& rHelper, bool bDxf );
428 
430  void importBorder( const AttributeList& rAttribs );
432  void importStyle( sal_Int32 nElement, const AttributeList& rAttribs );
434  void importColor( sal_Int32 nElement, const AttributeList& rAttribs );
435 
439  void importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm );
440 
442  void finalizeImport( bool bRTL );
443 
445  const ApiBorderData& getApiData() const { return maApiData; }
446 
447  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
448 
449 private:
451  BorderLineModel* getBorderLine( sal_Int32 nElement );
452 
454  bool convertBorderLine(
455  css::table::BorderLine2& rBorderLine,
456  const BorderLineModel& rModel );
457 
458 private:
461  bool mbDxf;
462 };
463 
464 typedef std::shared_ptr< Border > BorderRef;
465 
468 {
471  sal_Int32 mnPattern;
475 
476  explicit PatternFillModel( bool bDxf );
477 
479  void setBiffPattern( sal_Int32 nPattern );
480 };
481 
484 {
485  typedef ::std::map< double, Color > ColorMap;
486 
487  sal_Int32 mnType;
488  double mfAngle;
489  double mfLeft;
490  double mfRight;
491  double mfTop;
492  double mfBottom;
493  ColorMap maColors;
494 
495  explicit GradientFillModel();
496 
498  void readGradient( SequenceInputStream& rStrm );
500  void readGradientStop( SequenceInputStream& rStrm, bool bDxf );
501 };
502 
505 {
508  bool mbUsed;
509 
510  explicit ApiSolidFillData();
511 };
512 
514 class Fill : public WorkbookHelper
515 {
516 public:
517  explicit Fill( const WorkbookHelper& rHelper, bool bDxf );
518 
520  void importPatternFill( const AttributeList& rAttribs );
522  void importFgColor( const AttributeList& rAttribs );
524  void importBgColor( const AttributeList& rAttribs );
526  void importGradientFill( const AttributeList& rAttribs );
528  void importColor( const AttributeList& rAttribs, double fPosition );
529 
533  void importDxfPattern( SequenceInputStream& rStrm );
535  void importDxfFgColor( SequenceInputStream& rStrm );
537  void importDxfBgColor( SequenceInputStream& rStrm );
539  void importDxfGradient( SequenceInputStream& rStrm );
541  void importDxfStop( SequenceInputStream& rStrm );
542 
544  void finalizeImport();
545 
546  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
547 
548 private:
549  typedef std::shared_ptr< PatternFillModel > PatternModelRef;
550  typedef std::shared_ptr< GradientFillModel > GradientModelRef;
551 
552  PatternModelRef mxPatternModel;
553  GradientModelRef mxGradientModel;
555  bool mbDxf;
556 };
557 
558 typedef std::shared_ptr< Fill > FillRef;
559 
561 struct XfModel
562 {
563  sal_Int32 mnStyleXfId;
564  sal_Int32 mnFontId;
565  sal_Int32 mnNumFmtId;
566  sal_Int32 mnBorderId;
567  sal_Int32 mnFillId;
568  bool mbCellXf;
569  bool mbFontUsed;
571  bool mbAlignUsed;
572  bool mbProtUsed;
574  bool mbAreaUsed;
575 
576  explicit XfModel();
577 };
578 
579 bool operator==( const XfModel& rXfModel1, const XfModel& rXfModel2 );
580 
588 class Xf : public WorkbookHelper
589 {
590  friend bool operator==( const Xf& rXf1, const Xf& rXf2 );
591 public:
592  struct AttrList
593  {
594  std::vector<ScAttrEntry> maAttrs;
597 
598  AttrList(const ScPatternAttr* pDefPatternAttr);
599  };
600 
601  explicit Xf( const WorkbookHelper& rHelper );
602 
604  void importXf( const AttributeList& rAttribs, bool bCellXf );
606  void importAlignment( const AttributeList& rAttribs );
608  void importProtection( const AttributeList& rAttribs );
609 
611  void importXf( SequenceInputStream& rStrm, bool bCellXf );
612 
614  void finalizeImport();
615 
617  bool isCellXf() const { return maModel.mbCellXf; }
618 
620  FontRef getFont() const;
622  const Alignment& getAlignment() const { return maAlignment; }
623 
625  AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nForceScNumFmt );
626 
627  void writeToDoc( ScDocumentImport& rDoc, const ScRange& rRange );
628 
629  const ::ScPatternAttr& createPattern( bool bSkipPoolDefs = false );
630 
631 private:
632  typedef ::std::unique_ptr< ::ScPatternAttr > ScPatternAttrPtr;
633 
634  ScPatternAttrPtr mpPattern;
635  sal_uInt32 mnScNumFmt;
636 
640  sal_Int32 meRotationRef;
642 };
643 
644 bool operator==( const Xf& rXf1, const Xf& rXf2 );
645 
646 typedef std::shared_ptr< Xf > XfRef;
647 
648 class Dxf : public WorkbookHelper
649 {
650 public:
651  explicit Dxf( const WorkbookHelper& rHelper );
652 
654  FontRef const & createFont( bool bAlwaysNew = true );
656  BorderRef const & createBorder( bool bAlwaysNew = true );
658  FillRef const & createFill( bool bAlwaysNew = true );
659 
661  void importNumFmt( const AttributeList& rAttribs );
662 
665 
667  void finalizeImport();
668 
669  void fillToItemSet( SfxItemSet& rSet ) const;
670 
671 private:
672  FontRef mxFont;
674  std::shared_ptr< Alignment >
676  std::shared_ptr< Protection >
678  BorderRef mxBorder;
679  FillRef mxFill;
680 };
681 
682 typedef std::shared_ptr< Dxf > DxfRef;
683 
686 {
687  OUString maName;
688  sal_Int32 mnXfId;
689  sal_Int32 mnBuiltinId;
690  sal_Int32 mnLevel;
691  bool mbBuiltin;
692  bool mbCustom;
693  bool mbHidden;
694 
695  explicit CellStyleModel();
696 
698  bool isBuiltin() const;
700  bool isDefaultStyle() const;
701 };
702 
703 class CellStyle : public WorkbookHelper
704 {
705 public:
706  explicit CellStyle( const WorkbookHelper& rHelper );
707 
709  void importCellStyle( const AttributeList& rAttribs );
712 
714  void createCellStyle();
717  void finalizeImport( const OUString& rFinalName );
718 
720  const CellStyleModel& getModel() const { return maModel; }
722  const OUString& getFinalStyleName() const { return maFinalName; }
724 private:
726  OUString maFinalName;
727  bool mbCreated;
729 
730 };
731 
732 typedef std::shared_ptr< CellStyle > CellStyleRef;
733 
735 {
736 public:
737  explicit CellStyleBuffer( const WorkbookHelper& rHelper );
738 
740  CellStyleRef importCellStyle( const AttributeList& rAttribs );
742  CellStyleRef importCellStyle( SequenceInputStream& rStrm );
743 
745  void finalizeImport();
746 
748  sal_Int32 getDefaultXfId() const;
750  OUString getDefaultStyleName() const;
752  OUString createCellStyle( sal_Int32 nXfId ) const;
753  ::ScStyleSheet* getCellStyleSheet( sal_Int32 nXfId ) const;
754 
755 private:
757  void insertCellStyle( CellStyleRef const & xCellStyle );
759  static OUString createCellStyle( const CellStyleRef& rxCellStyle );
760  static ::ScStyleSheet* getCellStyleSheet( const CellStyleRef& rxCellStyle );
761 
762 private:
765 
766  CellStyleVector maBuiltinStyles;
767  CellStyleVector maUserStyles;
768  CellStyleXfIdMap maStylesByXf;
769  CellStyleRef mxDefStyle;
770 };
771 
773 {
774  sal_Int32 mnAutoFormatId;
776  bool mbApplyFont;
779  bool mbApplyFill;
781 
782  explicit AutoFormatModel();
783 };
784 
786 {
787 public:
788  explicit StylesBuffer( const WorkbookHelper& rHelper );
789 
791  FontRef createFont();
793  NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode );
794  sal_Int32 nextFreeNumFmtId();
796  BorderRef createBorder();
798  FillRef createFill();
800  XfRef createCellXf();
802  XfRef createStyleXf();
804  DxfRef createDxf();
805  DxfRef createExtDxf();
806 
808  void importPaletteColor( const AttributeList& rAttribs );
810  NumberFormatRef importNumFmt( const AttributeList& rAttribs );
812  CellStyleRef importCellStyle( const AttributeList& rAttribs );
813 
817  void importNumFmt( SequenceInputStream& rStrm );
819  void importCellStyle( SequenceInputStream& rStrm );
820 
822  void finalizeImport();
823 
825  ::Color getPaletteColor( sal_Int32 nIndex ) const;
827  FontRef getFont( sal_Int32 nFontId ) const;
829  BorderRef getBorder( sal_Int32 nBorderId ) const;
831  XfRef getCellXf( sal_Int32 nXfId ) const;
833  XfRef getStyleXf( sal_Int32 nXfId ) const;
834 
836  FontRef getFontFromCellXf( sal_Int32 nXfId ) const;
838  FontRef getDefaultFont() const;
840  const FontModel& getDefaultFontModel() const;
841 
843  static bool equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 );
845  static bool equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 );
846 
848  OUString getDefaultStyleName() const;
850  OUString createCellStyle( sal_Int32 nXfId ) const;
851  ::ScStyleSheet* getCellStyleSheet( sal_Int32 nXfId ) const;
853  OUString createDxfStyle( sal_Int32 nDxfId ) const;
854  OUString createExtDxfStyle( sal_Int32 nDxfId ) const;
855 
856  void writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs ) const;
857  sal_uInt32 writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
859  void writeBorderToItemSet( SfxItemSet& rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs ) const;
861  void writeFillToItemSet( SfxItemSet& rItemSet, sal_Int32 nFillId, bool bSkipPoolDefs ) const;
862 
864  void writeCellXfToDoc( ScDocumentImport& rDoc, const ScRange& rRange, sal_Int32 nXfId ) const;
865  const RefVector< Dxf >& getExtDxfs() const { return maExtDxfs; }
866 
867 private:
873  typedef ::std::map< sal_Int32, OUString > DxfStyleMap;
874 
876  FontVector maFonts;
878  BorderVector maBorders;
879  FillVector maFills;
880  XfVector maCellXfs;
881  XfVector maStyleXfs;
883  DxfVector maDxfs;
884  DxfVector maExtDxfs;
885  mutable DxfStyleMap maDxfStyles;
886 };
887 
888 } // namespace oox::xls
889 
890 #endif
891 
892 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbApplyAlignment
True = apply font from autoformatting.
Helper class to provide access to global workbook data.
::SvxFrameDirection GetScFrameDir() const
bool mbProtUsed
True = alignment used.
BorderRef const & createBorder(bool bAlwaysNew=true)
Creates a new empty border object.
void setAuto()
Sets the color to automatic.
double mfHeight
Windows font character set.
Contains all API cell alignment attributes.
sal_uInt32 mnScNumFmt
Calc item set.
Color maColor
Font name.
PatternModelRef mxPatternModel
bool mbShrink
True = multi-line text.
bool mbAreaUsed
True = border data used.
::Color getPaletteColor(sal_Int32 nIndex) const
Returns the palette color with the specified index.
SvxCellHorJustify
void importColor(sal_Int32 nElement, const AttributeList &rAttribs)
Sets color attributes for the border line with the passed element identifier.
bool mbColorUsed
True = font name/family/char set are used.
CellStyleRef importCellStyle(const AttributeList &rAttribs)
Appends and returns a new named cell style object.
const sal_Int32 OOX_COLOR_NOTETEXT
Note background color.
CellStyleModel maModel
sal_Int32 mnRotation
Normal or stacked text.
Contains all XML font attributes, e.g.
const sal_Int16 API_LINE_THIN
sal_Int32 nIndex
bool mbHeightUsed
True = font scheme is used.
const sal_Int32 OOX_COLOR_WINDOWBACK
System window text color (BIFF5+).
ApiBorderLine maTLtoBR
Bottom line format.
RefVector< Border > BorderVector
FillRef createFill()
Creates a new empty fill object.
::Color getColor(sal_Int32 nPaletteIdx) const
Returns the RGB value of the color with the passed index.
void setBiffEscapement(sal_uInt16 nEscapement)
const sal_Int32 OOX_COLOR_WINDOWBACK3
System window text color (BIFF3-BIFF4).
sal_Int32 getDefaultXfId() const
Returns the XF identifier associated to the default cell style.
GradientFillModel()
Gradient colors.
Protection(const WorkbookHelper &rHelper)
std::shared_ptr< Fill > FillRef
::Color mnColor
Font descriptor (height in twips, weight in %).
void finalizeImport()
Final processing after import of all style settings.
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
Font(const WorkbookHelper &rHelper, bool bDxf)
ApiBorderLine maTop
Right line format.
const ApiBorderData & getApiData() const
Returns the converted API border data struct.
bool mbHidden
True = locked against editing.
RefVector< Font > FontVector
void writeFontToItemSet(SfxItemSet &rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs) const
double mfLeft
Rotation angle for type linear.
CellStyle(const WorkbookHelper &rHelper)
double mfTop
Right convergence for type path.
DxfVector maExtDxfs
List of differential cell styles.
CellStyleXfIdMap maStylesByXf
All user defined cell styles.
void importDxfHeight(SequenceInputStream &rStrm)
Imports the font height from a DXF record.
void importDxfEscapement(SequenceInputStream &rStrm)
Imports the font escapement style from a DXF record.
void writeToDoc(ScDocumentImport &rDoc, const ScRange &rRange)
NumberFormatRef createNumFmt(sal_Int32 nNumFmtId, const OUString &rFmtCode)
Creates a number format.
void writeToPropertyMap(PropertyMap &rPropMap) const
Writes all font attributes to the passed property map.
void setBiffUnderline(sal_uInt16 nUnderline)
signed char sal_Int8
sal_Int32 mnStyle
Borderline color.
sal_Int32 mnFamily
Major/minor scheme font.
sal_Int16 mnIndent
CTL text direction.
::std::vector< ::Color > maColors
void setBiffHorAlign(sal_uInt8 nHorAlign)
Sets horizontal alignment from the passed BIFF data.
bool mbOutline
Escapement font height.
void importProtection(const AttributeList &rAttribs)
Sets all attributes from the protection element.
void importFont(SequenceInputStream &rStrm)
Imports the FONT record from the passed stream.
const sal_Int32 OOX_COLOR_WINDOWTEXT
System window background color (BIFF3-BIFF4).
const CellStyleModel & getModel() const
Returns the cell style model structure.
Dxf(const WorkbookHelper &rHelper)
const sal_Int32 OOX_COLOR_CHBORDERAUTO
System window background color (BIFF8 charts).
void importDxfBorder(sal_Int32 nElement, SequenceInputStream &rStrm)
Imports a border from a DXF record from the passed stream.
sal_Int32 mnNumFmtId
Index to font data list.
bool mbPattColorUsed
Pattern identifier (e.g. solid).
XfRef getCellXf(sal_Int32 nXfId) const
Returns the specified cell format object.
void importDxfColor(SequenceInputStream &rStrm)
Imports the font color from a DXF record.
bool mbUsed
Border line style.
sal_Int32 mnVerAlign
Horizontal alignment.
void setBiff12Data(sal_uInt32 nFlags)
Sets the protection attributes from the passed BIFF12 XF record data.
const sal_Int8 API_ESCAPEHEIGHT_NONE
Subscript: lower characters automatically (magic value -101).
void importBgColor(const AttributeList &rAttribs)
Sets the background color from the bgColor element.
Fill(const WorkbookHelper &rHelper, bool bDxf)
XfRef getStyleXf(sal_Int32 nXfId) const
Returns the specified style format object.
const sal_Int16 API_LINE_HAIR
sal_Int32 mnUnderline
Font height in points.
bool mbWeightUsed
True = escapement style is used.
const ApiProtectionData & getApiData() const
Returns the converted API protection data struct.
XfRef createCellXf()
Creates a new empty cell formatting object.
ApiBorderLine maBottom
Top line format.
const sal_Int16 API_ESCAPE_SUBSCRIPT
Superscript: raise characters automatically (magic value 101).
BorderLineModel maLeft
virtual ::Color getSchemeColor(sal_Int32 nToken) const override
Derived classes may implement to resolve a scheme color from the passed XML token identifier...
SvxFrameDirection
void setBiffVerAlign(sal_uInt8 nVerAlign)
Sets vertical alignment from the passed BIFF data.
CellStyleRef mxDefStyle
All cell styles, mapped by XF identifier.
void importDxfScheme(SequenceInputStream &rStrm)
Imports the font scheme from a DXF record.
OUString createDxfStyle(sal_Int32 nDxfId) const
Creates the style sheet described by the DXF with the passed identifier.
const sal_Int32 OOX_COLOR_BUTTONBACK
System window background color (BIFF5+).
static bool equalFills(sal_Int32 nFillId1, sal_Int32 nFillId2)
Returns true, if the specified fills are equal.
CellStyleModel()
True = style not visible in GUI.
Xf(const WorkbookHelper &rHelper)
Accessor class to ScDocument.
Contains XML attributes of a complete cell border.
CellStyleBuffer maCellStyles
List of cell styles.
void finalizeImport()
Final processing after import of all style settings.
ApiSolidFillData()
True = fill data is valid.
std::shared_ptr< Xf > XfRef
OUString createCellStyle(sal_Int32 nXfId) const
Creates the style sheet described by the style XF with the passed identifier.
Contains XML pattern fill attributes from the patternFill element.
XfVector maCellXfs
List of cell area fill objects.
std::shared_ptr< Dxf > DxfRef
bool mbBold
Escapement style.
PatternFillModel(bool bDxf)
True = pattern used.
Contains all API font attributes.
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
ApiSolidFillData maApiData
::std::unique_ptr< ::ScPatternAttr > ScPatternAttrPtr
void importDxfFlag(sal_Int32 nElement, SequenceInputStream &rStrm)
Imports a font style flag from a DXF record.
Contains XML gradient fill attributes from the gradientFill element.
void fillToItemSet(SfxItemSet &rSet) const
void importPaletteColor(const AttributeList &rAttribs)
Appends a new color to the color palette.
void importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
void importColor(const AttributeList &rAttribs, double fPosition)
Sets a color from the color element in a gradient fill.
NumberFormatsBuffer maNumFmts
List of font objects.
std::shared_ptr< Border > BorderRef
Contains API font name, family, and charset for a script type.
bool mbEscapementUsed
True = underline style is used.
void setBiff12Data(sal_uInt32 nFlags)
Sets the alignment attributes from the passed BIFF12 XF record data.
const sal_Int32 OOX_COLOR_WINDOWTEXT3
ColorMap maColors
Bottom convergence for type path.
sal_Int32 mnLevel
Identifier for builtin styles.
std::shared_ptr< PatternFillModel > PatternModelRef
RefVector< Dxf > DxfVector
sal_Int32 mnRotation
CTL text direction.
const FontModel & getModel() const
Returns the font model structure.
BorderModel(bool bDxf)
True = bottom-left to top-right on.
void importAttribs(sal_Int32 nElement, const AttributeList &rAttribs)
Sets font formatting attributes for the passed element.
CellStyleVector maBuiltinStyles
SvxCellVerJustify
Alignment maAlignment
Cell XF or style XF model data.
bool mbShrink
True = multi-line text.
void finalizeImport(bool bRTL)
Final processing after import of all style settings.
std::shared_ptr< CellStyle > CellStyleRef
RefMap< sal_Int32, CellStyle > CellStyleXfIdMap
static bool equalBorders(sal_Int32 nBorderId1, sal_Int32 nBorderId2)
Returns true, if the specified borders are equal.
ScPatternAttrPtr mpPattern
BorderVector maBorders
List of all number format codes.
::std::map< double, Color > ColorMap
Contains used flags for all API font attributes.
DxfVector maDxfs
All built-in and user defined cell styles.
void importDxfBgColor(SequenceInputStream &rStrm)
Imports the background color from a DXF record.
bool mbUsed
True = transparent area.
Stores all colors of the color palette.
const RefVector< Dxf > & getExtDxfs() const
void importDxfUnderline(SequenceInputStream &rStrm)
Imports the font underline style from a DXF record.
AttrList(const ScPatternAttr *pDefPatternAttr)
NumberFormatRef mxNumFmt
Font data.
bool mbStrikeoutUsed
True = font posture (italic) is used.
void setBiffWeight(sal_uInt16 nWeight)
ApiFontUsedFlags maUsedFlags
const sal_Int32 OOX_COLOR_CHWINDOWBACK
System window text color (BIFF8 charts).
void insertCellStyle(CellStyleRef const &xCellStyle)
Inserts the passed cell style object into the internal maps.
void importBorder(const AttributeList &rAttribs)
Sets global border attributes from the border element.
XfRef createStyleXf()
Creates a new empty style formatting object.
Contains cell fill attributes, either a pattern fill or a gradient fill.
RefVector< Xf > XfVector
FillRef const & createFill(bool bAlwaysNew=true)
Creates a new empty fill object.
BorderLineModel maBottom
Top line format.
sal_Int16 mnEscapement
Font color.
void applyPatternToAttrList(AttrList &rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nForceScNumFmt)
sal_Int32 mnXfId
Cell style name.
ExcelGraphicHelper(const WorkbookHelper &rHelper)
ProtectionModel()
True = formula is hidden.
std::map< sal_Int32, STLPropertyMapEntry > PropertyMap
XfModel maModel
Calc number format.
sal_Int16 mnWritingMode
Text rotation angle.
void importStyle(sal_Int32 nElement, const AttributeList &rAttribs)
Sets border attributes for the border line with the passed element identifier.
css::table::CellOrientation meOrientation
AlignmentModel()
True = justify last line in block text.
css::util::CellProtection ApiCellProtection
Contains attributes of a cell style, e.g.
sal_Int32 meRotationRef
Cell protection data.
::ScStyleSheet * getCellStyleSheet(sal_Int32 nXfId) const
Color maFillColor
Pattern foreground color.
BorderRef mxBorder
Protection data.
FontVector maFonts
Color palette.
void importGradientFill(const AttributeList &rAttribs)
Sets attributes of a gradientFill element.
sal_Int32 mnFillId
Index to list of cell borders.
bool mbUnderlineUsed
True = font height is used.
std::shared_ptr< NumberFormat > NumberFormatRef
::SvxCellVerJustify GetScVerAlign() const
bool mbStrikeout
True = italic characters.
ApiScriptFontName maAsianFont
Font name for latin scripts.
bool mbBorderUsed
Diagonal bottom-left to top-right line format.
bool needsRichTextFormat() const
Returns true, if the font requires rich text formatting in Calc.
ApiFontUsedFlags(bool bAllUsed)
True = shadow style is used.
void setBiffPattern(sal_Int32 nPattern)
Sets the passed BIFF pattern identifier.
SequenceInputStream & operator>>(SequenceInputStream &rStrm, BinAddress &orPos)
BorderRef getBorder(sal_Int32 nBorderId) const
Returns the specified border object.
void importColor(const AttributeList &rAttribs)
Imports the color from the passed attribute list.
bool mbDiagUsed
True = left/right/top/bottom line format used.
AutoFormatModel()
True = apply protection from autoformatting.
sal_Int16 mnFamily
Font name.
BorderLineModel maRight
Left line format.
std::shared_ptr< Alignment > mxAlignment
Number format data.
const ScPatternAttr * mpDefPattern
bool mbDiagTLtoBR
Diagonal line format.
sal_Int8 mnEscapeHeight
Escapement style.
FontRef getFont(sal_Int32 nFontId) const
Returns the specified font object.
void writeFillToItemSet(SfxItemSet &rItemSet, sal_Int32 nFillId, bool bSkipPoolDefs) const
Writes the fill attributes of the specified fill data to the passed property map. ...
const FontModel & getDefaultFontModel() const
Returns the model of the default application font (used in the "Normal" cell style).
void importDxf(SequenceInputStream &rStrm)
Imports the DXF record from the passed stream.
OUString getDefaultStyleName() const
Returns the default style sheet for unused cells.
XfModel()
True = area data used.
sal_Int32 mnIndent
Text rotation angle.
css::table::CellHoriJustify meHorJustify
Contains all XML cell protection attributes, e.g.
Relative character height if escaped.
bool mbItalic
True = bold characters.
void importDxfFgColor(SequenceInputStream &rStrm)
Imports the pattern color from a DXF record.
bool mbApplyFill
True = apply border from autoformatting.
bool mbOutlineUsed
True = strike out style is used.
bool mbApplyProtection
True = apply fill from autoformatting.
bool mbFontUsed
True = cell XF, false = style XF.
bool mbBorderUsed
True = cell protection used.
AlignmentModel maModel
void finalizeImport()
Final processing after import of all style settings.
std::shared_ptr< Font > FontRef
const Alignment & getAlignment() const
Returns the alignment data of this style.
ApiFontData()
True = shadowed chgaracters.
bool operator==(const ApiAlignmentData &rLeft, const ApiAlignmentData &rRight)
const ApiAlignmentData & getApiData() const
Returns the converted API alignment data struct.
sal_Int32 mnFontId
Index to parent style XF.
void finalizeImport(const OUString &rFinalName)
Stores the passed final style name and creates the cell style, if it is user-defined or modified buil...
ApiBorderData maApiData
sal_Int32 mnCharSet
Font family.
ApiScriptFontName maCmplxFont
Font name for east-asian scripts.
NumberFormatRef importNumFmt(const AttributeList &rAttribs)
Inserts a new number format code.
void writeBorderToItemSet(SfxItemSet &rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs) const
Writes the specified number format to the passed property map.
double mfRight
Left convergence for type path.
::ScStyleSheet * mpStyleSheet
Rotation reference dependent on border.
void importDxfName(SequenceInputStream &rStrm)
Imports the font name from a DXF record.
bool mbShadow
True = outlined characters.
friend bool operator==(const Xf &rXf1, const Xf &rXf2)
FontRef getFontFromCellXf(sal_Int32 nXfId) const
Returns the font object of the specified cell XF.
sal_Int32 mnPattern
Background fill color.
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
void setBiffStyle(sal_Int32 nLineStyle)
Sets the passed BIFF line style.
bool isDefaultStyle() const
Returns true, if this style represents the default document cell style.
css::awt::FontDescriptor maDesc
Font name for complex scripts.
css::table::BorderLine2 ApiBorderLine
void importCellStyle(const AttributeList &rAttribs)
Imports passed attributes from the cellStyle element.
FontRef const & createFont(bool bAlwaysNew=true)
Creates a new empty font object.
Contains API fill attributes.
GradientModelRef mxGradientModel
void setBiff12Scheme(sal_uInt8 nScheme)
void importColorId(SequenceInputStream &rStrm)
Imports a 32-bit palette color identifier from the passed BIFF12 stream.
OUString createCellStyle(sal_Int32 nXfId) const
Creates the style sheet described by the style XF with the passed identifier.
bool mbOutline
True = Strike out characters.
bool mbApplyBorder
True = apply alignment from autoformatting.
void readGradientStop(SequenceInputStream &rStrm, bool bDxf)
Reads BIFF12 gradient stop settings from a FILL or DXF record.
void setTheme(sal_Int32 nThemeIdx, double fTint=0.0)
Sets the color to the passed theme index.
const css::awt::FontDescriptor & getFontDescriptor() const
Returns an API font descriptor with own font information.
double mfAngle
Gradient type, linear or path.
const AlignmentModel & getModel() const
Returns the alignment model structure.
void finalizeImport()
Final processing after import of all style settings.
const sal_Int16 API_LINE_MEDIUM
void fillToItemSet(SfxItemSet &rItemSet, bool bEditEngineText, bool bSkipPoolDefs=false) const
sal_Int32 SCROW
Definition: types.hxx:18
DefTokenId nToken
Definition: qproform.cxx:400
size_t mnAppendIndex
List of RGB values.
FillRef mxFill
Border data.
void fillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
ProtectionModel maModel
ApiBorderData()
True = diagonal line format used.
Protection maProtection
Cell alignment data.
virtual ::Color getPaletteColor(sal_Int32 nPaletteIdx) const override
Derived classes may implement to resolve a palette index to an RGB color.
void importDxfWeight(SequenceInputStream &rStrm)
Imports the font weight from a DXF record.
FillVector maFills
List of cell border objects.
void finalizeImport()
Final processing after import of all style settings.
bool hasAnyOuterBorder() const
Returns true, if any of the outer border lines is visible.
bool convertBorderLine(css::table::BorderLine2 &rBorderLine, const BorderLineModel &rModel)
Converts border line data to an API struct, returns true, if the line is marked as used...
const sal_Int16 API_LINE_THICK
DxfStyleMap maDxfStyles
List of differential extlst cell styles.
Contains XML attributes of a single border line.
bool mbWrapText
Indentation.
sal_uInt32 writeNumFmtToItemSet(SfxItemSet &rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs) const
ApiBorderLine maBLtoTR
Diagonal top-left to bottom-right line format.
BorderLineModel(bool bDxf)
True = line format used.
unsigned char sal_uInt8
void writeToPropertySet(PropertySet &rPropSet) const
Writes all font attributes to the passed property set.
sal_Int32 mnTextDir
Vertical alignment.
bool mbSchemeUsed
True = font color is used.
double mfBottom
Top convergence for type path.
sal_Int32 mnEscapement
Underline style.
bool mbCustom
True = builtin style.
void importDxfGradient(SequenceInputStream &rStrm)
Imports gradient settings from a DXF record.
bool mbHidden
True = customized builtin style.
BorderModel maModel
ApiAlignmentData maApiData
Alignment model data.
const sal_Int16 API_ESCAPE_SUPERSCRIPT
No escapement.
void importDxfStop(SequenceInputStream &rStrm)
Imports gradient stop settings from a DXF record.
bool mbJustLastLine
True = shrink to fit cell size.
ApiScriptFontName maLatinFont
ApiCellProtection maCellProt
void importProtection(const AttributeList &rAttribs)
Sets all attributes from the protection element.
bool mbCreated
Final style name used in API.
RefVector< CellStyle > CellStyleVector
Alignment(const WorkbookHelper &rHelper)
ApiBorderLine maRight
Left line format.
CellStyleVector maUserStyles
All built-in cell styles.
sal_Int32 mnVerJustifyMethod
Vertical alignment.
RefVector< Fill > FillVector
FontRef createFont()
Creates a new empty font object.
bool isPlaceHolder() const
sal_Int16 mnTextEnc
Font family.
bool mbPatternUsed
True = background fill color used.
Contains API attributes of a complete cell border.
ApiProtectionData maApiData
Protection model data.
Represents a cell format or a cell style (called XF, extended format).
void setIndexed(sal_Int32 nPaletteIdx, double fTint=0.0)
Sets the color to the passed palette index.
void setBiffHeight(sal_uInt16 nHeight)
void importPatternFill(const AttributeList &rAttribs)
Sets attributes of a patternFill element.
const sal_Int16 API_ESCAPE_NONE
const sal_Int8 API_ESCAPEHEIGHT_DEFAULT
Relative character height if not escaped.
FontRef getFont() const
Returns the referred font object.
Border(const WorkbookHelper &rHelper, bool bDxf)
bool mbPostureUsed
True = font weight (boldness) is used.
BorderLineModel maTop
Right line format.
Contains all API cell protection attributes.
ApiScriptFontName()
Font text encoding.
FontModel maModel
bool mbApplyFont
True = apply number format from autoformatting.
bool mbAlignUsed
True = number format used.
void importFill(SequenceInputStream &rStrm)
Imports the FILL record from the passed stream.
Contains all data for a cell format or cell style.
ApiFontData maApiData
const ::ScPatternAttr & createPattern(bool bSkipPoolDefs=false)
OUString createExtDxfStyle(sal_Int32 nDxfId) const
std::shared_ptr< GradientFillModel > GradientModelRef
void importAlignment(const AttributeList &rAttribs)
Sets all attributes from the alignment element.
void importPaletteColor(const AttributeList &rAttribs)
Appends a new color from the passed attributes.
void appendColor(::Color nRGBValue)
Appends the passed color.
void importDxfPattern(SequenceInputStream &rStrm)
Imports the fill pattern from a DXF record.
BorderLineModel maDiagonal
Bottom line format.
BorderLineModel * getBorderLine(sal_Int32 nElement)
Returns the border line struct specified by the passed XML token identifier.
FontModel()
True = shadowed chgaracters.
const sal_Int32 OOX_COLOR_FONTAUTO
Note text color.
bool mbShadowUsed
True = outline style is used.
CellStyleRef importCellStyle(const AttributeList &rAttribs)
Appends and returns a new named cell style object.
bool mbBuiltin
Level for builtin column/row styles.
sal_Int32 mnHorJustifyMethod
Horizontal alignment.
DxfRef createDxf()
Creates a new empty differential formatting object.
void finalizeImport()
Final processing after import of all style settings.
void writeCellXfToDoc(ScDocumentImport &rDoc, const ScRange &rRange, sal_Int32 nXfId) const
Writes the cell formatting attributes of the specified XF to the passed property set.
void importAlignment(const AttributeList &rAttribs)
Sets all attributes from the alignment element.
OUString getDefaultStyleName() const
Returns the default style sheet for unused cells.
::std::map< sal_Int32, OUString > DxfStyleMap
XfVector maStyleXfs
List of cell formats.
::ScStyleSheet * getCellStyleSheet(sal_Int32 nXfId) const
::ScStyleSheet * mpStyleSheet
True = style sheet created.
BorderRef createBorder()
Creates a new empty border object.
bool mbNumFmtUsed
True = font index used.
bool mbDiagBLtoTR
True = top-left to bottom-right on.
void importFgColor(const AttributeList &rAttribs)
Sets the pattern color from the fgColor element.
bool mbApplyNumFmt
Index of predefined autoformatting.
FontRef getDefaultFont() const
Returns the default application font (used in the "Normal" cell style).
const sal_Int32 OOX_COLOR_NOTEBACK
Automatic frame border (BIFF8 charts).
StylesBuffer(const WorkbookHelper &rHelper)
bool mbWrapText
Indentation.
sal_Int32 mnScheme
Font color.
sal_Int32 mnBuiltinId
Formatting for this cell style.
const OUString & getFinalStyleName() const
Returns the final style name used in the document.
void SvStream & rStrm
void finalizeImport()
Final processing after import of all style settings.
ColorPalette(const WorkbookHelper &rHelper)
Constructs the color palette with predefined color values.
bool isCellXf() const
Returns true, if the XF is a cell XF, and false, if it is a style XF.
sal_Int32 mnBorderId
Index to number format list.
CellStyleBuffer(const WorkbookHelper &rHelper)
bool mbTransparent
Fill color.
::ScStyleSheet * getStyleSheet()
std::shared_ptr< Protection > mxProtection
Alignment data.
void setRgb(::Color nRgbValue, double fTint=0.0)
Sets the color to the passed RGB value.
ApiAlignmentData()
True = shrink to fit cell size.
bool mbShadow
True = outlined characters.
bool mbFillColorUsed
True = pattern foreground color used.
Contains all XML cell alignment attributes, e.g.
::SvxCellHorJustify GetScHorAlign() const
void readGradient(SequenceInputStream &rStrm)
Reads BIFF12 gradient settings from a FILL or DXF record.
void createCellStyle()
Creates the style sheet in the document described by this cell style object.
void importXf(const AttributeList &rAttribs, bool bCellXf)
Sets all attributes from the xf element.
void finalizeImport()
Final processing after import of all style settings.
bool isBuiltin() const
Returns true, if this style is a builtin style.
const sal_Int32 OOX_COLOR_CHWINDOWTEXT
System button background color (face color).
bool mbCellXf
Index to list of cell areas.
std::vector< ScAttrEntry > maAttrs
const sal_Int16 API_LINE_NONE
Font auto color (system window text color).
bool isAuto() const
Returns true, if the color is set to automatic.