LibreOffice Module sc (master)  1
xistyle.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_XISTYLE_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XISTYLE_HXX
22 
23 #include <tools/solar.h>
24 #include <vector>
25 #include <memory>
26 #include <rangelst.hxx>
27 #include "xlstyle.hxx"
28 #include "xiroot.hxx"
29 
30 class ScPatternAttr;
31 
32 struct XclRange;
33 struct ScAttrEntry;
34 enum class SvxBoxItemLine;
35 
36 /* ============================================================================
37 - Buffers for style records (PALETTE, FONT, FORMAT, XF)
38  and a container for XF indexes for every used cell in a sheet.
39 ============================================================================ */
40 
41 // PALETTE record - color information =========================================
42 
46 {
47 public:
48  explicit XclImpPalette( const XclImpRoot& rRoot );
49 
51  void Initialize();
52 
56  Color GetColor( sal_uInt16 nXclIndex ) const;
57 
60 
61 private:
62  void ExportPalette();
63  typedef ::std::vector< Color > ColorVec;
64  ColorVec maColorTable;
66 };
67 
68 // FONT record - font information =============================================
69 
71 class XclImpFont : protected XclImpRoot
72 {
73 public:
74  explicit XclImpFont( const XclImpRoot& rRoot );
75 
79  explicit XclImpFont( const XclImpRoot& rRoot, const XclFontData& rFontData );
80 
82  void SetAllUsedFlags( bool bUsed );
84  void SetFontData( const XclFontData& rFontData, bool bHasCharSet );
85 
87  const XclFontData& GetFontData() const { return maData; }
89  bool HasCharSet() const { return mbHasCharSet; }
91  bool HasEscapement() const { return maData.mnEscapem != EXC_FONTESC_NONE; }
93  rtl_TextEncoding GetFontEncoding() const;
94 
96  bool HasAsianChars() const { return mbHasAsian; }
97 
99  void ReadFont( XclImpStream& rStrm );
101  void ReadEfont( XclImpStream& rStrm );
103  void ReadCFFontBlock( XclImpStream& rStrm );
104 
109  void FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType,
110  bool bSkipPoolDefs = false ) const;
113  void WriteFontProperties( ScfPropertySet& rPropSet,
114  XclFontPropSetType eType, const Color* pFontColor = nullptr ) const;
115 
116 private:
118  void ReadFontData2( XclImpStream& rStrm );
120  void ReadFontData5( XclImpStream& rStrm );
121 
123  void ReadFontColor( XclImpStream& rStrm );
124 
126  void ReadFontName2( XclImpStream& rStrm );
128  void ReadFontName8( XclImpStream& rStrm );
129 
132  void GuessScriptType();
133 
134 private:
137  bool mbHasWstrn;
138  bool mbHasAsian;
139  bool mbHasCmplx;
142  bool mbColorUsed;
150 };
151 
153 class XclImpFontBuffer : protected XclImpRoot
154 {
155 public:
157  XclImpFontBuffer(const XclImpFontBuffer&) = delete;
159  const XclImpFontBuffer& operator=(const XclImpFontBuffer&) = delete;
160 
161  explicit XclImpFontBuffer( const XclImpRoot& rRoot );
162 
164  void Initialize();
165 
167  const XclImpFont* GetFont( sal_uInt16 nFontIndex ) const;
169  const XclFontData& GetAppFontData() const { return maAppFont; }
170 
172  void ReadFont( XclImpStream& rStrm );
174  void ReadEfont( XclImpStream& rStrm );
175 
181  void FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType,
182  sal_uInt16 nFontIdx, bool bSkipPoolDefs = false ) const;
185  void WriteFontProperties(
186  ScfPropertySet& rPropSet, XclFontPropSetType eType,
187  sal_uInt16 nFontIdx, const Color* pFontColor = nullptr ) const;
189  void WriteDefaultCtrlFontProperties( ScfPropertySet& rPropSet ) const;
190 
191 private:
193  void UpdateAppFont( const XclFontData& rFontData, bool bHasCharSet );
194 
195 private:
196  std::vector< XclImpFont > maFontList;
200 };
201 
202 // FORMAT record - number formats =============================================
203 
206 {
207 public:
208  explicit XclImpNumFmtBuffer( const XclImpRoot& rRoot );
209 
211  void Initialize();
212 
214  void ReadFormat( XclImpStream& rStrm );
215 
217  sal_uInt16 ReadCFFormat( XclImpStream& rStrm, bool bIFmt );
218 
220  void CreateScFormats();
221 
223  sal_uInt32 GetScFormat( sal_uInt16 nXclNumFmt ) const;
224 
229  void FillToItemSet(
230  SfxItemSet& rItemSet, sal_uInt16 nXclNumFmt,
231  bool bSkipPoolDefs = false ) const;
236  void FillScFmtToItemSet(
237  SfxItemSet& rItemSet, sal_uInt32 nScNumFmt,
238  bool bSkipPoolDefs = false ) const;
239 
240 private:
241  typedef ::std::map< sal_uInt16, sal_uLong > XclImpIndexMap;
242 
243  XclImpIndexMap maIndexMap;
244  sal_uInt16 mnNextXclIdx;
245 };
246 
247 // XF, STYLE record - Cell formatting =========================================
248 
252 {
254  void FillFromXF2( sal_uInt8 nNumFmt );
256  void FillFromXF3( sal_uInt16 nProt );
257 
260  void FillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
261 };
262 
266 {
268  void FillFromXF2( sal_uInt8 nFlags );
270  void FillFromXF3( sal_uInt16 nAlign );
272  void FillFromXF4( sal_uInt16 nAlign );
274  void FillFromXF5( sal_uInt16 nAlign );
276  void FillFromXF8( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib );
278  void FillFromCF( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib );
279 
282  void FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFont, bool bSkipPoolDefs = false ) const;
283 };
284 
288 {
289  bool mbLeftUsed;
290  bool mbRightUsed;
291  bool mbTopUsed;
293  bool mbDiagUsed;
294 
295  explicit XclImpCellBorder();
296 
298  void SetUsedFlags( bool bOuterUsed, bool bDiagUsed );
299 
301  void FillFromXF2( sal_uInt8 nFlags );
303  void FillFromXF3( sal_uInt32 nBorder );
305  void FillFromXF5( sal_uInt32 nBorder, sal_uInt32 nArea );
307  void FillFromXF8( sal_uInt32 nBorder1, sal_uInt32 nBorder2 );
308 
310  void FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags );
311 
313  bool HasAnyOuterBorder() const;
314 
317  void FillToItemSet(
318  SfxItemSet& rItemSet,
319  const XclImpPalette& rPalette,
320  bool bSkipPoolDefs = false ) const;
321 };
322 
326 {
327  bool mbForeUsed;
328  bool mbBackUsed;
329  bool mbPattUsed;
330 
331  explicit XclImpCellArea();
332 
334  void SetUsedFlags( bool bUsed );
335 
337  void FillFromXF2( sal_uInt8 nFlags );
339  void FillFromXF3( sal_uInt16 nArea );
341  void FillFromXF5( sal_uInt32 nArea );
343  void FillFromXF8( sal_uInt32 nBorder2, sal_uInt16 nArea );
344 
346  void FillFromCF8( sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags );
347 
350  void FillToItemSet(
351  SfxItemSet& rItemSet,
352  const XclImpPalette& rPalette,
353  bool bSkipPoolDefs = false ) const;
354 };
355 
358 {
359 public:
360  explicit XclImpXFIndex( sal_uInt16 nXFIndex, bool bBoolCell = false ) :
361  mnXFIndex( nXFIndex ), mbBoolCell( bBoolCell ) {}
362 
363  sal_uInt16 GetXFIndex() const { return mnXFIndex; }
364  bool IsBoolCell() const { return mbBoolCell; }
365 
366 private:
367  sal_uInt16 mnXFIndex;
368  bool mbBoolCell;
369 };
370 
371 inline bool operator==( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight )
372 { return (rLeft.GetXFIndex() == rRight.GetXFIndex()) && (rLeft.IsBoolCell() == rRight.IsBoolCell()); }
373 
374 inline bool operator!=( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight )
375 { return !(rLeft == rRight); }
376 
378 class XclImpXF : public XclXFBase, protected XclImpRoot
379 {
380 public:
382  XclImpXF(const XclImpXF&) = delete;
383  const XclImpXF& operator=(const XclImpXF&) = delete;
384 
385  explicit XclImpXF( const XclImpRoot& rRoot );
386  virtual ~XclImpXF() override;
387 
389  void ReadXF( XclImpStream& rStrm );
390 
392  sal_uInt16 GetFontIndex() const { return mnXclFont; }
393 
397  const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false );
398 
400  ::std::vector<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2,
401  sal_uInt32 nForceScNumFmt);
402 
406  void ApplyPattern(
407  SCCOL nScCol1, SCROW nScRow1,
408  SCCOL nScCol2, SCROW nScRow2,
409  SCTAB nScTab );
410 
412  static void ApplyPatternForBiff2CellFormat(
413  const XclImpRoot& rRoot, const ScAddress& rScPos,
414  sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 );
415 
416 private:
417  void ReadXF2( XclImpStream& rStrm );
418  void ReadXF3( XclImpStream& rStrm );
419  void ReadXF4( XclImpStream& rStrm );
420  void ReadXF5( XclImpStream& rStrm );
421  void ReadXF8( XclImpStream& rStrm );
422 
426  void SetUsedFlags( sal_uInt8 nUsedFlags );
427 
428 private:
429  typedef ::std::unique_ptr< ScPatternAttr > ScPatternAttrPtr;
430 
431  ScPatternAttrPtr mpPattern;
433 
438  sal_uInt16 mnXclNumFmt;
439  sal_uInt16 mnXclFont;
440 };
441 
443 class XclImpStyle : protected XclImpRoot
444 {
445 public:
446  explicit XclImpStyle( const XclImpRoot& rRoot );
447 
449  void ReadStyle( XclImpStream& rStrm );
450 
451  const OUString& GetName() const { return maName; }
452  sal_uInt16 GetXfId() const { return mnXfId; }
453  bool IsBuiltin() const { return mbBuiltin && (mnBuiltinId != EXC_STYLE_USERDEF); }
454  sal_uInt8 GetBuiltinId() const { return mnBuiltinId; }
455  sal_uInt8 GetLevel() const { return mnLevel; }
456 
461  void CreateUserStyle( const OUString& rFinalName );
462 
463 private:
464  OUString maName;
465  sal_uInt16 mnXfId;
468  bool mbBuiltin;
469  bool mbCustom;
470  bool mbHidden;
471 
472  OUString maFinalName;
474 };
475 
478 class XclImpXFBuffer : protected XclImpRoot
479 {
480 public:
482  XclImpXFBuffer(const XclImpXFBuffer&) = delete;
483  const XclImpXFBuffer& operator=(const XclImpXFBuffer&) = delete;
484 
485  explicit XclImpXFBuffer( const XclImpRoot& rRoot );
486 
488  void Initialize();
489 
491  void ReadXF( XclImpStream& rStrm );
493  void ReadStyle( XclImpStream& rStrm );
494 
496  XclImpXF* GetXF( sal_uInt16 nXFIndex )
497  { return (nXFIndex >= maXFList.size()) ? nullptr : maXFList.at(nXFIndex).get(); }
498 
499  const XclImpXF* GetXF( sal_uInt16 nXFIndex ) const
500  { return (nXFIndex >= maXFList.size()) ? nullptr : maXFList.at(nXFIndex).get(); }
501 
503  sal_uInt16 GetFontIndex( sal_uInt16 nXFIndex ) const;
505  const XclImpFont* GetFont( sal_uInt16 nXFIndex ) const;
506 
508  void CreateUserStyles();
511  ScStyleSheet* CreateStyleSheet( sal_uInt16 nXFIndex );
512 
513 private:
514  typedef std::vector< std::unique_ptr<XclImpStyle> > XclImpStyleList;
515  typedef ::std::map< sal_uInt16, XclImpStyle* > XclImpStyleMap;
516 
517  std::vector< std::unique_ptr<XclImpXF> > maXFList;
518  XclImpStyleList maBuiltinStyles;
519  XclImpStyleList maUserStyles;
520  XclImpStyleMap maStylesByXf;
521 };
522 
523 // Buffer for XF indexes in cells =============================================
524 
527 {
528 public:
532 
533  inline explicit XclImpXFRange( SCROW nScRow, const XclImpXFIndex& rXFIndex );
534  inline explicit XclImpXFRange( SCROW nFirstScRow, SCROW nLastScRow, const XclImpXFIndex& rXFIndex );
535 
537  inline bool Contains( SCROW nScRow ) const;
538 
540  bool Expand( SCROW nScRow, const XclImpXFIndex& rXFIndex );
542  bool Expand( const XclImpXFRange& rNextRange );
543 };
544 
545 inline XclImpXFRange::XclImpXFRange( SCROW nScRow, const XclImpXFIndex& rXFIndex ) :
546  mnScRow1( nScRow ),
547  mnScRow2( nScRow ),
548  maXFIndex( rXFIndex )
549 {
550 }
551 
552 inline XclImpXFRange::XclImpXFRange( SCROW nFirstScRow, SCROW nLastScRow, const XclImpXFIndex& rXFIndex ) :
553  mnScRow1( nFirstScRow ),
554  mnScRow2( nLastScRow ),
555  maXFIndex( rXFIndex )
556 {
557 }
558 
559 inline bool XclImpXFRange::Contains( SCROW nScRow ) const
560 {
561  return (mnScRow1 <= nScRow) && (nScRow <= mnScRow2);
562 }
563 
566 {
567 public:
569  XclImpXFRangeColumn(const XclImpXFRangeColumn&) = delete;
570  const XclImpXFRangeColumn& operator=(const XclImpXFRangeColumn&) = delete;
571 
572  typedef std::vector< std::unique_ptr<XclImpXFRange> > IndexList;
573 
574  explicit XclImpXFRangeColumn() {}
575 
576  IndexList::iterator begin() { return maIndexList.begin(); }
577  IndexList::iterator end() { return maIndexList.end(); }
578 
580  void SetDefaultXF( const XclImpXFIndex& rXFIndex );
581 
583  void SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex );
584 
585 private:
588  void Find(
589  XclImpXFRange*& rpPrevRange,
590  XclImpXFRange*& rpNextRange,
591  sal_uLong& rnNextIndex,
592  SCROW nScRow );
593 
597  void TryConcatPrev( sal_uLong nIndex );
598 
600  void Insert(XclImpXFRange* pXFRange, sal_uLong nIndex);
601 
602 private:
603  IndexList maIndexList;
604 };
605 
608 {
609 public:
611  XclImpXFRangeBuffer(const XclImpXFRangeBuffer&) = delete;
612  const XclImpXFRangeBuffer& operator=(const XclImpXFRangeBuffer&) = delete;
613 
614  explicit XclImpXFRangeBuffer( const XclImpRoot& rRoot );
615  virtual ~XclImpXFRangeBuffer() override;
616 
618  void Initialize();
619 
621  void SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex );
623  void SetBlankXF( const ScAddress& rScPos, sal_uInt16 nXFIndex );
625  void SetBoolXF( const ScAddress& rScPos, sal_uInt16 nXFIndex );
627  void SetRowDefXF( SCROW nScRow, sal_uInt16 nXFIndex );
629  void SetColumnDefXF( SCCOL nScCol, sal_uInt16 nXFIndex );
630 
632  void SetHyperlink( const XclRange& rXclRange, const OUString& rUrl );
633 
635  void SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2 );
636 
638  void Finalize();
639 
640 private:
643  {
648  };
649 
650 private:
652  void SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, XclImpXFInsertMode eMode );
653 
659  void SetBorderLine( const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine );
660 
661 private:
662 
663  std::vector< std::shared_ptr< XclImpXFRangeColumn > >
665  std::vector< std::pair< XclRange, OUString > >
668 };
669 
670 #endif
671 
672 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbCustom
True = builtin style.
Definition: xistyle.hxx:469
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:858
XclFontPropSetType
Enumerates different types for objects with font settings (using different property names)...
Definition: xlstyle.hxx:396
::std::unique_ptr< ScPatternAttr > ScPatternAttrPtr
Definition: xistyle.hxx:429
ScStyleSheet * CreateStyleSheet(sal_uInt16 nXFIndex)
Creates a cell style sheet of the passed XF and inserts it into the Calc document.
Definition: xistyle.cxx:1676
bool Expand(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Returns true, if the range has been expanded.
Definition: xistyle.cxx:1684
void GuessScriptType()
Tests whether the font contains CJK or CTL characters.
Definition: xistyle.cxx:468
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1570
bool mbDiagUsed
true = Bottom line style used.
Definition: xistyle.hxx:293
Represents an XF record index with additional information.
Definition: xistyle.hxx:357
void FillFromCF(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with CF record data.
Definition: xistyle.cxx:800
void ReadFontName8(XclImpStream &rStrm)
Reads and sets a Unicode string as font name.
Definition: xistyle.cxx:463
const XclImpFont * GetFont(sal_uInt16 nXFIndex) const
Returns the Excel font used in the specified XF record.
Definition: xistyle.cxx:1592
void Finalize()
Applies styles and cell merging to the current sheet in the document.
Definition: xistyle.cxx:1980
void FillFromXF3(sal_uInt16 nArea)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:1029
std::vector< std::unique_ptr< XclImpStyle > > XclImpStyleList
Definition: xistyle.hxx:514
Contains all XF records occurred in the file.
Definition: xistyle.hxx:478
void ReadCFFontBlock(XclImpStream &rStrm)
Reads the font block from a CF (conditional format) record.
Definition: xistyle.cxx:280
XclImpXF(const XclImpXF &)=delete
make noncopyable
bool operator!=(const XclImpXFIndex &rLeft, const XclImpXFIndex &rRight)
Definition: xistyle.hxx:374
SCROW mnScRow2
The first row of an equal-formatted range.
Definition: xistyle.hxx:530
XclFontData maAppFont
List of all FONT records in the Excel file.
Definition: xistyle.hxx:197
Stores all data of an Excel font and provides import of FONT records.
Definition: xistyle.hxx:71
XclImpCellBorder maBorder
All alignment attributes.
Definition: xistyle.hxx:436
Extends the XclCellBorder struct for import.
Definition: xistyle.hxx:287
XclImpFontBuffer(const XclImpFontBuffer &)=delete
delete copy constructor
XclImpXFRangeBuffer(const XclImpXFRangeBuffer &)=delete
make noncopyable
std::vector< std::pair< XclRange, OUString > > maHyperlinks
Array of column XF index buffers.
Definition: xistyle.hxx:666
void SetUsedFlags(bool bOuterUsed, bool bDiagUsed)
Sets outer line states and diagonal line states to used or unused.
Definition: xistyle.cxx:852
const XclImpXFBuffer & operator=(const XclImpXFBuffer &)=delete
void Find(XclImpXFRange *&rpPrevRange, XclImpXFRange *&rpNextRange, sal_uLong &rnNextIndex, SCROW nScRow)
Finds the previous and next row range from row position nScRow.
Definition: xistyle.cxx:1795
ScRangeList maMergeList
Maps URLs to hyperlink cells.
Definition: xistyle.hxx:667
bool mbHidden
True = customized builtin style.
Definition: xistyle.hxx:470
std::vector< std::unique_ptr< XclImpXF > > maXFList
Definition: xistyle.hxx:517
IndexList::iterator end()
Definition: xistyle.hxx:577
OUString maName
Definition: xistyle.hxx:464
bool IsBuiltin() const
Definition: xistyle.hxx:453
const XclImpRoot & mrRoot
Colors read from file.
Definition: xistyle.hxx:65
bool IsBoolCell() const
Definition: xistyle.hxx:364
ColorVec maColorTable
Definition: xistyle.hxx:64
sal_uIntPtr sal_uLong
void FillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
Inserts items representing this protection style into the item set.
Definition: xistyle.cxx:758
bool mbPattUsed
true = Background color used.
Definition: xistyle.hxx:329
void FillFromXF3(sal_uInt32 nBorder)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:868
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:286
sal_uInt16 mnXclNumFmt
Background area style.
Definition: xistyle.hxx:438
void FillFromXF8(sal_uInt32 nBorder1, sal_uInt32 nBorder2)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:894
bool HasAsianChars() const
Returns true, if this font contains characters for Asian scripts (CJK).
Definition: xistyle.hxx:96
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:634
sal_uInt16 mnNextXclIdx
Maps Excel format indexes to Calc formats.
Definition: xistyle.hxx:244
Contains the XF indexes for every used cell in a single sheet.
Definition: xistyle.hxx:607
void FillFromXF8(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:789
XclFontData maData
Definition: xistyle.hxx:135
bool mbWeightUsed
true = Color used.
Definition: xistyle.hxx:143
Stores all default colors for a specific BIFF version.
Definition: xlstyle.hxx:251
sal_uInt16 mnXclFont
Index to number format.
Definition: xistyle.hxx:439
Contains an (encoded) XF index for a range of rows in a single column.
Definition: xistyle.hxx:526
sal_uInt16 mnXFIndex
Definition: xistyle.hxx:367
bool HasCharSet() const
Returns true, if the font character set is valid.
Definition: xistyle.hxx:89
Extends the XclCellArea struct for import.
Definition: xistyle.hxx:325
sal_uInt16 mnXfId
Cell style name.
Definition: xistyle.hxx:465
virtual ~XclImpXFRangeBuffer() override
Definition: xistyle.cxx:1879
bool mbItalicUsed
true = Underline style used.
Definition: xistyle.hxx:146
ScStyleSheet * mpStyleSheet
Calc item set.
Definition: xistyle.hxx:432
sal_uInt32 GetScFormat(sal_uInt16 nXclNumFmt) const
Returns the format key with the passed Excel index or NUMBERFORMAT_ENTRY_NOT_FOUND on error...
Definition: xistyle.cxx:722
bool HasEscapement() const
Returns true, if the font contains superscript or subscript.
Definition: xistyle.hxx:91
void SetDefaultXF(const XclImpXFIndex &rXFIndex)
Inserts a single row range into the list.
Definition: xistyle.cxx:1714
SCROW mnScRow1
Definition: xistyle.hxx:529
void CreateScFormats()
Creates the number formats in the Calc document.
Definition: xistyle.cxx:697
sal_uInt16 GetXfId() const
Definition: xistyle.hxx:452
const sal_uInt8 EXC_STYLE_USERDEF
"Followed_Hyperlink" style.
Definition: xlstyle.hxx:235
void FillToItemSet(SfxItemSet &rItemSet, XclFontItemType eType, bool bSkipPoolDefs=false) const
Fills all font properties to the item set.
Definition: xistyle.cxx:314
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1577
rtl_TextEncoding GetFontEncoding() const
Returns the text encoding for strings used with this font.
Definition: xistyle.cxx:237
sal_uInt8 mnBuiltinId
Formatting for this cell style.
Definition: xistyle.hxx:466
void FillToItemSet(SfxItemSet &rItemSet, XclFontItemType eType, sal_uInt16 nFontIdx, bool bSkipPoolDefs=false) const
Fills all font properties from a FONT record to the item set.
Definition: xistyle.cxx:593
void ReadFontColor(XclImpStream &rStrm)
Reads and sets the font color.
Definition: xistyle.cxx:453
void SetMerge(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2)
Inserts a complete merged cell range.
Definition: xistyle.cxx:1974
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:763
XclImpCellProt maProtection
Calc cell style sheet.
Definition: xistyle.hxx:434
const ScPatternAttr & CreatePattern(bool bSkipPoolDefs=false)
Creates a Calc item set containing an item set with all cell properties.
Definition: xistyle.cxx:1242
void ApplyPattern(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2, SCTAB nScTab)
Inserts all formatting attributes to the specified area in the Calc document.
Definition: xistyle.cxx:1408
::std::map< sal_uInt16, XclImpStyle * > XclImpStyleMap
Definition: xistyle.hxx:515
XclImpFont(const XclImpRoot &rRoot)
Definition: xistyle.cxx:190
ScStyleSheet * CreateStyleSheet()
Creates a cell style sheet and inserts it into the Calc document.
Definition: xistyle.cxx:1511
static void ApplyPatternForBiff2CellFormat(const XclImpRoot &rRoot, const ScAddress &rScPos, sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3)
Converts formatting information from BIFF2 cell record data directly.
Definition: xistyle.cxx:1424
Contains all data of a cell style associated with an XF record.
Definition: xistyle.hxx:443
bool mbHasAsian
true = Font contains Western script characters.
Definition: xistyle.hxx:138
void ReadXF4(XclImpStream &rStrm)
Definition: xistyle.cxx:1155
Contains the XF indexes for every used cell in a column.
Definition: xistyle.hxx:565
void FillFromXF8(sal_uInt32 nBorder2, sal_uInt16 nArea)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:1045
bool operator==(const XclImpXFIndex &rLeft, const XclImpXFIndex &rRight)
Definition: xistyle.hxx:371
void SetXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index.
Definition: xistyle.cxx:1921
void FillToItemSet(SfxItemSet &rItemSet, const XclImpPalette &rPalette, bool bSkipPoolDefs=false) const
Inserts a box item representing this border style into the item set.
Definition: xistyle.cxx:978
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1475
virtual ~XclImpXF() override
Definition: xistyle.cxx:1105
void SetHyperlink(const XclRange &rXclRange, const OUString &rUrl)
Inserts a range of hyperlink cells.
Definition: xistyle.cxx:1969
const sal_uInt16 EXC_FONTESC_NONE
Definition: xlstyle.hxx:126
Extends the XclCellProt struct for import.
Definition: xistyle.hxx:251
sal_uInt16 ReadCFFormat(XclImpStream &rStrm, bool bIFmt)
Read NumFmt from conditional format record.
Definition: xistyle.cxx:678
bool mbOutlineUsed
true = Strikeout used.
Definition: xistyle.hxx:148
XclImpXFBuffer(const XclImpXFBuffer &)=delete
make noncopyable
const XclFontData & GetFontData() const
Returns read-only access to font data.
Definition: xistyle.hxx:87
const XclImpXFRangeBuffer & operator=(const XclImpXFRangeBuffer &)=delete
const XclImpFont * GetFont(sal_uInt16 nFontIndex) const
Returns the object that stores all contents of a FONT record.
Definition: xistyle.cxx:556
Extends the XclCellAlign struct for import.
Definition: xistyle.hxx:265
const XclFontData & GetAppFontData() const
Returns the application font data of this file, needed i.e.
Definition: xistyle.hxx:169
::std::vector< Color > ColorVec
Definition: xistyle.hxx:63
bool mbHasCmplx
true = Font contains Asian script characters.
Definition: xistyle.hxx:139
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1229
XclFontItemType
Enumerates different types of Which-IDs for font items.
Definition: xlstyle.hxx:388
sal_uInt16 mnEscapem
Boldness: 400=normal, 700=bold.
Definition: xlstyle.hxx:293
void FillToItemSet(SfxItemSet &rItemSet, const XclImpPalette &rPalette, bool bSkipPoolDefs=false) const
Inserts a brush item representing this area style into the item set.
Definition: xistyle.cxx:1074
void FillFromCF8(sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:914
void SetBlankXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for blank cells.
Definition: xistyle.cxx:1926
IndexList maIndexList
Definition: xistyle.hxx:603
XclImpNumFmtBuffer(const XclImpRoot &rRoot)
Definition: xistyle.cxx:627
bool mbUnderlUsed
true = Escapement type used.
Definition: xistyle.hxx:145
Contains all cell protection attributes.
Definition: xlstyle.hxx:477
sal_uInt8 GetLevel() const
Definition: xistyle.hxx:455
Contains all cell alignment attributes.
Definition: xlstyle.hxx:488
void CreateUserStyles()
Creates all user defined style sheets.
Definition: xistyle.cxx:1608
XclImpStyleList maBuiltinStyles
List of contents of all XF record.
Definition: xistyle.hxx:518
void FillToItemSet(SfxItemSet &rItemSet, const XclImpFont *pFont, bool bSkipPoolDefs=false) const
Inserts items representing this alignment style into the item set.
Definition: xistyle.cxx:811
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:1021
const OUString & GetName() const
Definition: xistyle.hxx:451
sal_uInt8 mnLevel
Identifier for builtin styles.
Definition: xistyle.hxx:467
void FillFromXF5(sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:1037
sal_Int16 SCCOL
Definition: types.hxx:22
XclImpPalette(const XclImpRoot &rRoot)
Definition: xistyle.cxx:144
void ReadXF3(XclImpStream &rStrm)
Definition: xistyle.cxx:1129
void SetAllUsedFlags(bool bUsed)
Sets all font attributes to used or unused.
Definition: xistyle.cxx:206
XclImpXFIndex maXFIndex
The last row of an equal-formatted range.
Definition: xistyle.hxx:531
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, sal_uInt16 nFontIdx, const Color *pFontColor=nullptr) const
Writes all font properties to the passed property set.
Definition: xistyle.cxx:601
void ReadFontData2(XclImpStream &rStrm)
Reads and sets height and flags.
Definition: xistyle.cxx:417
sal_uInt8 mnHorAlign
Definition: xlstyle.hxx:490
void FillScFmtToItemSet(SfxItemSet &rItemSet, sal_uInt32 nScNumFmt, bool bSkipPoolDefs=false) const
Fills a Calc number format to the passed item set.
Definition: xistyle.cxx:736
sal_uInt8 GetHorAlign() const
Definition: xistyle.hxx:391
bool mbBackUsed
true = Foreground color used.
Definition: xistyle.hxx:328
Stores all user defined number formats occurred in the file.
Definition: xistyle.hxx:205
XclImpCellArea maArea
Border line style.
Definition: xistyle.hxx:437
const XclImpXF * GetXF(sal_uInt16 nXFIndex) const
Definition: xistyle.hxx:499
void SetUsedFlags(sal_uInt8 nUsedFlags)
Sets all "attribute used" flags according to the passed mask.
Definition: xistyle.cxx:1446
sal_uInt16 GetFontIndex() const
Definition: xistyle.hxx:392
void ReadFontData5(XclImpStream &rStrm)
Reads and sets height, flags, color, boldness, script, family and charset.
Definition: xistyle.cxx:432
void SetXF(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Inserts a new (encoded) XF index (first try to expand the last range).
Definition: xistyle.cxx:1724
bool mbFontNameUsed
true = Font contains Complex script characters.
Definition: xistyle.hxx:140
void SetRowDefXF(SCROW nScRow, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a row.
Definition: xistyle.cxx:1936
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:587
bool mbBottomUsed
true = Top line style used.
Definition: xistyle.hxx:292
Contains all data of a XF record and a Calc item set.
Definition: xistyle.hxx:378
void ReadXF8(XclImpStream &rStrm)
Definition: xistyle.cxx:1204
void ReadFont(XclImpStream &rStrm)
Reads a FONT record for all BIFF versions.
Definition: xistyle.cxx:245
bool HasAnyOuterBorder() const
Returns true, if any of the outer border lines is visible.
Definition: xistyle.cxx:931
void ReadXF2(XclImpStream &rStrm)
Definition: xistyle.cxx:1109
void ReadPalette(XclImpStream &rStrm)
Reads a PALETTE record.
Definition: xistyle.cxx:165
XclImpStyleList maUserStyles
List of built-in cell styles.
Definition: xistyle.hxx:519
XclImpCellBorder()
true = Diagonal line style used.
Definition: xistyle.cxx:847
XclImpCellArea()
true = Pattern used.
Definition: xistyle.cxx:1011
void FillFromXF3(sal_uInt16 nAlign)
Fills this struct with BIFF3 XF record data.
Definition: xistyle.cxx:768
std::vector< XclImpFont > maFontList
Definition: xistyle.hxx:196
void TryConcatPrev(sal_uLong nIndex)
Tries to concatenate a range with its predecessor.
Definition: xistyle.cxx:1862
void CreateUserStyle(const OUString &rFinalName)
Creates the Calc style sheet, if this is a user-defined style.
Definition: xistyle.cxx:1550
Color GetColor(sal_uInt16 nXclIndex) const
Returns the color for a (non-zero-based) Excel palette entry.
Definition: xistyle.cxx:154
XclImpXF * GetXF(sal_uInt16 nXFIndex)
Returns the object that stores all contents of an XF record.
Definition: xistyle.hxx:496
void FillToItemSet(SfxItemSet &rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs=false) const
Fills an Excel number format to the passed item set.
Definition: xistyle.cxx:728
Contains color and line style for each cell border line.
Definition: xlstyle.hxx:523
XclImpFont maFont4
Application font (for column width).
Definition: xistyle.hxx:198
void FillFromXF5(sal_uInt32 nBorder, sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:881
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:275
void ReadFontName2(XclImpStream &rStrm)
Reads and sets a byte string as font name.
Definition: xistyle.cxx:458
A wrapper for a UNO property set.
Definition: fapihelper.hxx:104
const XclImpXFRangeColumn & operator=(const XclImpXFRangeColumn &)=delete
sal_Int32 SCROW
Definition: types.hxx:18
void ReadFormat(XclImpStream &rStrm)
Reads a FORMAT record.
Definition: xistyle.cxx:641
void SetBoolXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for boolean cells.
Definition: xistyle.cxx:1931
bool mbHasCharSet
All font attributes.
Definition: xistyle.hxx:136
ScPatternAttrPtr mpPattern
Definition: xistyle.hxx:431
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, const Color *pFontColor=nullptr) const
Writes all font properties to the passed property set.
Definition: xistyle.cxx:410
bool mbHasWstrn
true = Font contains own character set info.
Definition: xistyle.hxx:137
void ExportPalette()
Definition: xistyle.cxx:121
void ReadFont(XclImpStream &rStrm)
Reads a FONT record.
Definition: xistyle.cxx:575
void UpdateAppFont(const XclFontData &rFontData, bool bHasCharSet)
Updates the application default font.
Definition: xistyle.cxx:613
void FillFromXF5(sal_uInt16 nAlign)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:781
void ReadXF5(XclImpStream &rStrm)
Definition: xistyle.cxx:1181
IndexList::iterator begin()
Definition: xistyle.hxx:576
void FillFromCF8(sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:1053
unsigned char sal_uInt8
bool mbStrikeUsed
true = Italic used.
Definition: xistyle.hxx:147
void SetColumnDefXF(SCCOL nScCol, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a column.
Definition: xistyle.cxx:1942
XclImpCellAlign maAlignment
Cell protection flags.
Definition: xistyle.hxx:435
bool mbHeightUsed
true = Font name, family, charset used.
Definition: xistyle.hxx:141
bool mbColorUsed
true = Font height used.
Definition: xistyle.hxx:142
SvxBoxItemLine
XclImpXFRange(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Extended XF index.
Definition: xistyle.hxx:545
bool mbRightUsed
true = Left line style used.
Definition: xistyle.hxx:290
bool mbBoolCell
The XF record index.
Definition: xistyle.hxx:368
void SetUsedFlags(bool bUsed)
Sets colors and pattern state to used or unused.
Definition: xistyle.cxx:1016
Stores the data of all fonts occurred in an Excel file.
Definition: xistyle.hxx:153
sal_uInt16 GetFontIndex(sal_uInt16 nXFIndex) const
Returns the index to the Excel font used in the specified XF record.
Definition: xistyle.cxx:1586
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:149
Contains background colors and pattern for a cell.
Definition: xlstyle.hxx:544
void FillFromXF2(sal_uInt8 nNumFmt)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:746
Cell with a single Boolean value.
Definition: xistyle.hxx:646
bool mbEscapemUsed
true = Weight used.
Definition: xistyle.hxx:144
bool mbBuiltin
Level for builtin column/row styles.
Definition: xistyle.hxx:468
bool mbTopUsed
true = Right line style used.
Definition: xistyle.hxx:291
Stores the default colors for the current BIFF version and the contents of a PALETTE record...
Definition: xistyle.hxx:45
std::vector< std::unique_ptr< XclImpXFRange > > IndexList
Definition: xistyle.hxx:572
XclImpIndexMap maIndexMap
Definition: xistyle.hxx:243
XclImpFont maCtrlFont
Built-in font with index 4.
Definition: xistyle.hxx:199
OUString maFinalName
True = style not visible in GUI.
Definition: xistyle.hxx:472
sal_uInt16 GetXFIndex() const
Definition: xistyle.hxx:363
void SetFontData(const XclFontData &rFontData, bool bHasCharSet)
Sets the passed font data and all used flags to 'used'.
Definition: xistyle.cxx:212
void ApplyPatternToAttrVector(::std::vector< ScAttrEntry > &rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt)
Definition: xistyle.cxx:1336
This class is used to import record oriented streams.
Definition: xistream.hxx:278
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1562
XclImpStyle(const XclImpRoot &rRoot)
Definition: xistyle.cxx:1463
const XclImpFontBuffer & operator=(const XclImpFontBuffer &)=delete
delete copy-assignment operator
XclImpStyleMap maStylesByXf
List of user defined cell styles.
Definition: xistyle.hxx:520
void SvStream & rStrm
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1883
bool Contains(SCROW nScRow) const
Returns true, if nScRow is contained in own row range.
Definition: xistyle.hxx:559
Access to global data from other classes.
Definition: xiroot.hxx:126
::std::map< sal_uInt16, sal_uLong > XclImpIndexMap
Definition: xistyle.hxx:241
sal_uInt8 GetBuiltinId() const
Definition: xistyle.hxx:454
const XclImpXF & operator=(const XclImpXF &)=delete
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:544
Contains base members for XF record import/export.
Definition: xlstyle.hxx:562
void Insert(XclImpXFRange *pXFRange, sal_uLong nIndex)
Insert a range into the list at the specified index.
Definition: xistyle.cxx:1790
ScStyleSheet * mpStyleSheet
Final name used in the Calc document.
Definition: xistyle.hxx:473
void FillFromXF4(sal_uInt16 nAlign)
Fills this struct with BIFF4 XF record data.
Definition: xistyle.cxx:774
void FillFromXF3(sal_uInt16 nProt)
Fills this struct with BIFF3-BIFF8 XF record data.
Definition: xistyle.cxx:752
XclImpXFInsertMode
Insertion mode of an XF index.
Definition: xistyle.hxx:642
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:58
sal_Int16 SCTAB
Definition: types.hxx:23
void WriteDefaultCtrlFontProperties(ScfPropertySet &rPropSet) const
Writes default font properties for form controls to the passed property set.
Definition: xistyle.cxx:608
XclImpXFIndex(sal_uInt16 nXFIndex, bool bBoolCell=false)
Definition: xistyle.hxx:360
bool mbShadowUsed
true = Outlined used.
Definition: xistyle.hxx:149
void SetBorderLine(const ScRange &rRange, SCTAB nScTab, SvxBoxItemLine nLine)
Copies border of the last cell of the range to the first cell to keep it visible when the range is me...
Definition: xistyle.cxx:1953
std::vector< std::shared_ptr< XclImpXFRangeColumn > > maColumns
Definition: xistyle.hxx:664