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 #pragma once
21 
22 #include <memory>
23 #include <com/sun/star/awt/FontDescriptor.hpp>
24 #include <com/sun/star/table/CellHoriJustify.hpp>
25 #include <com/sun/star/table/CellOrientation.hpp>
26 #include <com/sun/star/table/BorderLine2.hpp>
27 #include <com/sun/star/util/CellProtection.hpp>
28 #include <oox/drawingml/color.hxx>
30 #include <oox/helper/refmap.hxx>
31 #include <oox/helper/refvector.hxx>
32 #include "numberformatsbuffer.hxx"
33 #include <editeng/svxenum.hxx>
34 #include <editeng/frmdir.hxx>
35 #include <attarray.hxx>
36 #include <vector>
37 
38 namespace oox { class SequenceInputStream; }
39 
40 namespace oox { class PropertySet;
41  class PropertyMap;
42  class AttributeList; }
43 
44 namespace oox::xls {
45 
46 const sal_Int32 OOX_COLOR_WINDOWTEXT3 = 24;
47 const sal_Int32 OOX_COLOR_WINDOWBACK3 = 25;
48 const sal_Int32 OOX_COLOR_WINDOWTEXT = 64;
49 const sal_Int32 OOX_COLOR_WINDOWBACK = 65;
50 const sal_Int32 OOX_COLOR_BUTTONBACK = 67;
51 const sal_Int32 OOX_COLOR_CHWINDOWTEXT = 77;
52 const sal_Int32 OOX_COLOR_CHWINDOWBACK = 78;
53 const sal_Int32 OOX_COLOR_CHBORDERAUTO = 79;
54 const sal_Int32 OOX_COLOR_NOTEBACK = 80;
55 const sal_Int32 OOX_COLOR_NOTETEXT = 81;
56 const sal_Int32 OOX_COLOR_FONTAUTO = 0x7FFF;
57 
58 const sal_Int16 API_LINE_NONE = 0;
59 const sal_Int16 API_LINE_HAIR = 1;
60 const sal_Int16 API_LINE_THIN = 15;
61 const sal_Int16 API_LINE_MEDIUM = 35;
62 const sal_Int16 API_LINE_THICK = 50;
63 
64 const sal_Int16 API_ESCAPE_NONE = 0;
65 const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101;
66 const sal_Int16 API_ESCAPE_SUBSCRIPT = -101;
67 
70 
75 {
76 public:
77  explicit ExcelGraphicHelper( const WorkbookHelper& rHelper );
78 
80  virtual ::Color getSchemeColor( sal_Int32 nToken ) const override;
82  virtual ::Color getPaletteColor( sal_Int32 nPaletteIdx ) const override;
83 };
84 
86 {
87 public:
89  void setAuto();
91  void setRgb( ::Color nRgbValue, double fTint = 0.0 );
93  void setTheme( sal_Int32 nThemeIdx, double fTint = 0.0 );
95  void setIndexed( sal_Int32 nPaletteIdx, double fTint = 0.0 );
96 
98  void importColor( const AttributeList& rAttribs );
99 
103  void importColorId( SequenceInputStream& rStrm );
104 
106  bool isAuto() const { return isPlaceHolder(); }
107 };
108 
110 
113 {
114 public:
116  explicit ColorPalette( const WorkbookHelper& rHelper );
117 
119  void importPaletteColor( const AttributeList& rAttribs );
122 
124  ::Color getColor( sal_Int32 nPaletteIdx ) const;
125 
126 private:
128  void appendColor( ::Color nRGBValue );
129 
130 private:
131  ::std::vector< ::Color > maColors;
132  size_t mnAppendIndex;
133 };
134 
136 struct FontModel
137 {
138  OUString maName;
140  sal_Int32 mnScheme;
141  sal_Int32 mnFamily;
142  sal_Int32 mnCharSet;
143  double mfHeight;
144  sal_Int32 mnUnderline;
145  sal_Int32 mnEscapement;
146  bool mbBold;
147  bool mbItalic;
148  bool mbStrikeout;
149  bool mbOutline;
150  bool mbShadow;
151 
152  explicit FontModel();
153 
154  void setBiff12Scheme( sal_uInt8 nScheme );
155  void setBiffHeight( sal_uInt16 nHeight );
156  void setBiffWeight( sal_uInt16 nWeight );
157  void setBiffUnderline( sal_uInt16 nUnderline );
158  void setBiffEscapement( sal_uInt16 nEscapement );
159 };
160 
163 {
164  bool mbNameUsed;
165  bool mbColorUsed;
175 
176  explicit ApiFontUsedFlags( bool bAllUsed );
177 };
178 
181 {
182  OUString maName;
183  sal_Int16 mnFamily;
184  sal_Int16 mnTextEnc;
185 
186  explicit ApiScriptFontName();
187 };
188 
191 {
195  css::awt::FontDescriptor maDesc;
197  sal_Int16 mnEscapement;
199  bool mbOutline;
200  bool mbShadow;
201 
202  explicit ApiFontData();
203 };
204 
205 class Font : public WorkbookHelper
206 {
207 public:
208  explicit Font( const WorkbookHelper& rHelper, bool bDxf );
209  explicit Font( const WorkbookHelper& rHelper, const FontModel& rModel );
210 
212  void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
213 
217  void importDxfName( SequenceInputStream& rStrm );
219  void importDxfColor( SequenceInputStream& rStrm );
221  void importDxfScheme( SequenceInputStream& rStrm );
223  void importDxfHeight( SequenceInputStream& rStrm );
225  void importDxfWeight( SequenceInputStream& rStrm );
231  void importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm );
232 
235  const FontModel& getModel() const { return maModel; }
236 
238  void finalizeImport();
239 
241  const css::awt::FontDescriptor& getFontDescriptor() const { return maApiData.maDesc;}
245  bool needsRichTextFormat() const;
246 
247  void fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkipPoolDefs = false ) const;
249  void writeToPropertyMap(
250  PropertyMap& rPropMap ) const;
252  void writeToPropertySet(
253  PropertySet& rPropSet ) const;
254 
255 private:
259  bool mbDxf;
260 };
261 
262 typedef std::shared_ptr< Font > FontRef;
263 
266 {
267  sal_Int32 mnHorAlign;
268  sal_Int32 mnVerAlign;
269  sal_Int32 mnTextDir;
270  sal_Int32 mnRotation;
271  sal_Int32 mnIndent;
272  bool mbWrapText;
273  bool mbShrink;
275 
276  explicit AlignmentModel();
277 
279  void setBiffHorAlign( sal_uInt8 nHorAlign );
281  void setBiffVerAlign( sal_uInt8 nVerAlign );
282 };
283 
286 {
287  css::table::CellHoriJustify meHorJustify;
289  sal_Int32 mnVerJustify;
291  css::table::CellOrientation meOrientation;
293  sal_Int16 mnWritingMode;
294  sal_Int16 mnIndent;
295  bool mbWrapText;
296  bool mbShrink;
297 
298  explicit ApiAlignmentData();
299 };
300 
301 bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight );
302 
303 class Alignment : public WorkbookHelper
304 {
305 public:
306  explicit Alignment( const WorkbookHelper& rHelper );
307 
309  void importAlignment( const AttributeList& rAttribs );
310 
312  void setBiff12Data( sal_uInt32 nFlags );
313 
315  void finalizeImport();
316 
318  const AlignmentModel& getModel() const { return maModel; }
320  const ApiAlignmentData& getApiData() const { return maApiData; }
321 
322  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
323 
324 private:
330 };
331 
334 {
335  bool mbLocked;
336  bool mbHidden;
337 
338  explicit ProtectionModel();
339 };
340 
343 {
344  typedef css::util::CellProtection ApiCellProtection;
345 
346  ApiCellProtection maCellProt;
347 
348  explicit ApiProtectionData();
349 };
350 
351 bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight );
352 
354 {
355 public:
356  explicit Protection( const WorkbookHelper& rHelper );
357 
359  void importProtection( const AttributeList& rAttribs );
360 
362  void setBiff12Data( sal_uInt32 nFlags );
363 
365  void finalizeImport();
366 
368  const ApiProtectionData& getApiData() const { return maApiData; }
369 
370  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
371 private:
374 };
375 
378 {
380  sal_Int32 mnStyle;
381  bool mbUsed;
382 
383  explicit BorderLineModel( bool bDxf );
384 
386  void setBiffStyle( sal_Int32 nLineStyle );
387 };
388 
391 {
399 
400  explicit BorderModel( bool bDxf );
401 };
402 
405 {
406  typedef css::table::BorderLine2 ApiBorderLine;
407 
408  ApiBorderLine maLeft;
409  ApiBorderLine maRight;
410  ApiBorderLine maTop;
411  ApiBorderLine maBottom;
412  ApiBorderLine maTLtoBR;
413  ApiBorderLine maBLtoTR;
415  bool mbDiagUsed;
416 
417  explicit ApiBorderData();
418 
420  bool hasAnyOuterBorder() const;
421 };
422 
423 class Border : public WorkbookHelper
424 {
425 public:
426  explicit Border( const WorkbookHelper& rHelper, bool bDxf );
427 
429  void importBorder( const AttributeList& rAttribs );
431  void importStyle( sal_Int32 nElement, const AttributeList& rAttribs );
433  void importColor( sal_Int32 nElement, const AttributeList& rAttribs );
434 
438  void importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm );
439 
441  void finalizeImport( bool bRTL );
442 
444  const ApiBorderData& getApiData() const { return maApiData; }
445 
446  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
447 
448 private:
450  BorderLineModel* getBorderLine( sal_Int32 nElement );
451 
453  bool convertBorderLine(
454  css::table::BorderLine2& rBorderLine,
455  const BorderLineModel& rModel );
456 
457 private:
460  bool mbDxf;
461 };
462 
463 typedef std::shared_ptr< Border > BorderRef;
464 
467 {
470  sal_Int32 mnPattern;
474 
475  explicit PatternFillModel( bool bDxf );
476 
478  void setBiffPattern( sal_Int32 nPattern );
479 };
480 
483 {
484  typedef ::std::map< double, Color > ColorMap;
485 
486  sal_Int32 mnType;
487  double mfAngle;
488  double mfLeft;
489  double mfRight;
490  double mfTop;
491  double mfBottom;
492  ColorMap maColors;
493 
494  explicit GradientFillModel();
495 
497  void readGradient( SequenceInputStream& rStrm );
499  void readGradientStop( SequenceInputStream& rStrm, bool bDxf );
500 };
501 
504 {
507  bool mbUsed;
508 
509  explicit ApiSolidFillData();
510 };
511 
513 class Fill : public WorkbookHelper
514 {
515 public:
516  explicit Fill( const WorkbookHelper& rHelper, bool bDxf );
517 
519  void importPatternFill( const AttributeList& rAttribs );
521  void importFgColor( const AttributeList& rAttribs );
523  void importBgColor( const AttributeList& rAttribs );
525  void importGradientFill( const AttributeList& rAttribs );
527  void importColor( const AttributeList& rAttribs, double fPosition );
528 
532  void importDxfPattern( SequenceInputStream& rStrm );
534  void importDxfFgColor( SequenceInputStream& rStrm );
536  void importDxfBgColor( SequenceInputStream& rStrm );
538  void importDxfGradient( SequenceInputStream& rStrm );
540  void importDxfStop( SequenceInputStream& rStrm );
541 
543  void finalizeImport();
544 
545  void fillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
546 
547 private:
548  typedef std::shared_ptr< PatternFillModel > PatternModelRef;
549  typedef std::shared_ptr< GradientFillModel > GradientModelRef;
550 
551  PatternModelRef mxPatternModel;
552  GradientModelRef mxGradientModel;
554  bool mbDxf;
555 };
556 
557 typedef std::shared_ptr< Fill > FillRef;
558 
560 struct XfModel
561 {
562  sal_Int32 mnStyleXfId;
563  sal_Int32 mnFontId;
564  sal_Int32 mnNumFmtId;
565  sal_Int32 mnBorderId;
566  sal_Int32 mnFillId;
567  bool mbCellXf;
568  bool mbFontUsed;
570  bool mbAlignUsed;
571  bool mbProtUsed;
573  bool mbAreaUsed;
574 
575  explicit XfModel();
576 };
577 
578 bool operator==( const XfModel& rXfModel1, const XfModel& rXfModel2 );
579 
587 class Xf : public WorkbookHelper
588 {
589  friend bool operator==( const Xf& rXf1, const Xf& rXf2 );
590 public:
591  struct AttrList
592  {
593  std::vector<ScAttrEntry> maAttrs;
596 
597  AttrList(const ScPatternAttr* pDefPatternAttr);
598  };
599 
600  explicit Xf( const WorkbookHelper& rHelper );
601 
603  void importXf( const AttributeList& rAttribs, bool bCellXf );
605  void importAlignment( const AttributeList& rAttribs );
607  void importProtection( const AttributeList& rAttribs );
608 
610  void importXf( SequenceInputStream& rStrm, bool bCellXf );
611 
613  void finalizeImport();
614 
616  bool isCellXf() const { return maModel.mbCellXf; }
617 
619  FontRef getFont() const;
621  const Alignment& getAlignment() const { return maAlignment; }
622 
624  AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal_Int32 nForceScNumFmt );
625 
626  void writeToDoc( ScDocumentImport& rDoc, const ScRange& rRange );
627 
628  const ::ScPatternAttr& createPattern( bool bSkipPoolDefs = false );
629 
630 private:
631  typedef ::std::unique_ptr< ::ScPatternAttr > ScPatternAttrPtr;
632 
633  ScPatternAttrPtr mpPattern;
634  sal_uInt32 mnScNumFmt;
635 
639  sal_Int32 meRotationRef;
641 };
642 
643 bool operator==( const Xf& rXf1, const Xf& rXf2 );
644 
645 typedef std::shared_ptr< Xf > XfRef;
646 
647 class Dxf : public WorkbookHelper
648 {
649 public:
650  explicit Dxf( const WorkbookHelper& rHelper );
651 
653  FontRef const & createFont( bool bAlwaysNew = true );
655  BorderRef const & createBorder( bool bAlwaysNew = true );
657  FillRef const & createFill( bool bAlwaysNew = true );
658 
660  void importNumFmt( const AttributeList& rAttribs );
661 
664 
666  void finalizeImport();
667 
668  void fillToItemSet( SfxItemSet& rSet ) const;
669 
670 private:
671  FontRef mxFont;
673  std::shared_ptr< Alignment >
675  std::shared_ptr< Protection >
677  BorderRef mxBorder;
678  FillRef mxFill;
679 };
680 
681 typedef std::shared_ptr< Dxf > DxfRef;
682 
685 {
686  OUString maName;
687  sal_Int32 mnXfId;
688  sal_Int32 mnBuiltinId;
689  sal_Int32 mnLevel;
690  bool mbBuiltin;
691  bool mbCustom;
692  bool mbHidden;
693 
694  explicit CellStyleModel();
695 
697  bool isBuiltin() const;
699  bool isDefaultStyle() const;
700 };
701 
702 class CellStyle : public WorkbookHelper
703 {
704 public:
705  explicit CellStyle( const WorkbookHelper& rHelper );
706 
708  void importCellStyle( const AttributeList& rAttribs );
711 
713  void createCellStyle();
716  void finalizeImport( const OUString& rFinalName );
717 
719  const CellStyleModel& getModel() const { return maModel; }
721  const OUString& getFinalStyleName() const { return maFinalName; }
723 private:
725  OUString maFinalName;
726  bool mbCreated;
728 
729 };
730 
731 typedef std::shared_ptr< CellStyle > CellStyleRef;
732 
734 {
735 public:
736  explicit CellStyleBuffer( const WorkbookHelper& rHelper );
737 
739  CellStyleRef importCellStyle( const AttributeList& rAttribs );
741  CellStyleRef importCellStyle( SequenceInputStream& rStrm );
742 
744  void finalizeImport();
745 
747  sal_Int32 getDefaultXfId() const;
749  OUString getDefaultStyleName() const;
751  OUString createCellStyle( sal_Int32 nXfId ) const;
752  ::ScStyleSheet* getCellStyleSheet( sal_Int32 nXfId ) const;
753 
754 private:
756  void insertCellStyle( CellStyleRef const & xCellStyle );
758  static OUString createCellStyle( const CellStyleRef& rxCellStyle );
759  static ::ScStyleSheet* getCellStyleSheet( const CellStyleRef& rxCellStyle );
760 
761 private:
764 
765  CellStyleVector maBuiltinStyles;
766  CellStyleVector maUserStyles;
767  CellStyleXfIdMap maStylesByXf;
768  CellStyleRef mxDefStyle;
769 };
770 
772 {
773  sal_Int32 mnAutoFormatId;
775  bool mbApplyFont;
778  bool mbApplyFill;
780 
781  explicit AutoFormatModel();
782 };
783 
785 {
786 public:
787  explicit StylesBuffer( const WorkbookHelper& rHelper );
788 
790  FontRef createFont();
792  NumberFormatRef createNumFmt( sal_Int32 nNumFmtId, const OUString& rFmtCode );
793  sal_Int32 nextFreeNumFmtId();
795  BorderRef createBorder();
797  FillRef createFill();
799  XfRef createCellXf();
801  XfRef createStyleXf();
803  DxfRef createDxf();
804  DxfRef createExtDxf();
805 
807  void importPaletteColor( const AttributeList& rAttribs );
809  NumberFormatRef importNumFmt( const AttributeList& rAttribs );
811  CellStyleRef importCellStyle( const AttributeList& rAttribs );
812 
816  void importNumFmt( SequenceInputStream& rStrm );
818  void importCellStyle( SequenceInputStream& rStrm );
819 
821  void finalizeImport();
822 
824  ::Color getPaletteColor( sal_Int32 nIndex ) const;
826  FontRef getFont( sal_Int32 nFontId ) const;
828  BorderRef getBorder( sal_Int32 nBorderId ) const;
830  XfRef getCellXf( sal_Int32 nXfId ) const;
832  XfRef getStyleXf( sal_Int32 nXfId ) const;
833 
835  FontRef getFontFromCellXf( sal_Int32 nXfId ) const;
837  FontRef getDefaultFont() const;
839  const FontModel& getDefaultFontModel() const;
840 
842  static bool equalBorders( sal_Int32 nBorderId1, sal_Int32 nBorderId2 );
844  static bool equalFills( sal_Int32 nFillId1, sal_Int32 nFillId2 );
845 
847  OUString getDefaultStyleName() const;
849  OUString createCellStyle( sal_Int32 nXfId ) const;
850  ::ScStyleSheet* getCellStyleSheet( sal_Int32 nXfId ) const;
852  OUString createDxfStyle( sal_Int32 nDxfId ) const;
853  OUString createExtDxfStyle( sal_Int32 nDxfId ) const;
854 
855  void writeFontToItemSet( SfxItemSet& rItemSet, sal_Int32 nFontId, bool bSkipPoolDefs ) const;
856  sal_uInt32 writeNumFmtToItemSet( SfxItemSet& rItemSet, sal_uInt32 nNumFmtId, bool bSkipPoolDefs ) const;
858  void writeBorderToItemSet( SfxItemSet& rItemSet, sal_Int32 nBorderId, bool bSkipPoolDefs ) const;
860  void writeFillToItemSet( SfxItemSet& rItemSet, sal_Int32 nFillId, bool bSkipPoolDefs ) const;
861 
863  void writeCellXfToDoc( ScDocumentImport& rDoc, const ScRange& rRange, sal_Int32 nXfId ) const;
864  const RefVector< Dxf >& getExtDxfs() const { return maExtDxfs; }
865 
866 private:
872  typedef ::std::map< sal_Int32, OUString > DxfStyleMap;
873 
875  FontVector maFonts;
877  BorderVector maBorders;
878  FillVector maFills;
879  XfVector maCellXfs;
880  XfVector maStyleXfs;
882  DxfVector maDxfs;
883  DxfVector maExtDxfs;
884  mutable DxfStyleMap maDxfStyles;
885 };
886 
887 } // namespace oox::xls
888 
889 /* 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
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.
Degree100 mnRotation
Normal or stacked text.
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:17
DefTokenId nToken
Definition: qproform.cxx:399
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.