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 #pragma once
21 
22 #include <tools/solar.h>
23 #include <vector>
24 #include <memory>
25 #include <rangelst.hxx>
26 #include "xlstyle.hxx"
27 #include "xiroot.hxx"
28 
29 class ScPatternAttr;
30 
31 struct XclRange;
32 struct ScAttrEntry;
33 enum class SvxBoxItemLine;
34 
35 /* ============================================================================
36 - Buffers for style records (PALETTE, FONT, FORMAT, XF)
37  and a container for XF indexes for every used cell in a sheet.
38 ============================================================================ */
39 
40 // PALETTE record - color information =========================================
41 
45 {
46 public:
47  explicit XclImpPalette( const XclImpRoot& rRoot );
48 
50  void Initialize();
51 
55  Color GetColor( sal_uInt16 nXclIndex ) const;
56 
59 
60 private:
61  void ExportPalette();
62  typedef ::std::vector< Color > ColorVec;
63  ColorVec maColorTable;
65 };
66 
67 // FONT record - font information =============================================
68 
70 class XclImpFont : protected XclImpRoot
71 {
72 public:
73  explicit XclImpFont( const XclImpRoot& rRoot );
74 
78  explicit XclImpFont( const XclImpRoot& rRoot, const XclFontData& rFontData );
79 
81  void SetAllUsedFlags( bool bUsed );
83  void SetFontData( const XclFontData& rFontData, bool bHasCharSet );
84 
86  const XclFontData& GetFontData() const { return maData; }
88  bool HasCharSet() const { return mbHasCharSet; }
90  bool HasEscapement() const { return maData.mnEscapem != EXC_FONTESC_NONE; }
92  rtl_TextEncoding GetFontEncoding() const;
93 
95  bool HasAsianChars() const { return mbHasAsian; }
96 
98  void ReadFont( XclImpStream& rStrm );
100  void ReadEfont( XclImpStream& rStrm );
102  void ReadCFFontBlock( XclImpStream& rStrm );
103 
108  void FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType,
109  bool bSkipPoolDefs = false ) const;
112  void WriteFontProperties( ScfPropertySet& rPropSet,
113  XclFontPropSetType eType, const Color* pFontColor = nullptr ) const;
114 
115 private:
117  void ReadFontData2( XclImpStream& rStrm );
119  void ReadFontData5( XclImpStream& rStrm );
120 
122  void ReadFontColor( XclImpStream& rStrm );
123 
125  void ReadFontName2( XclImpStream& rStrm );
127  void ReadFontName8( XclImpStream& rStrm );
128 
131  void GuessScriptType();
132 
133 private:
136  bool mbHasWstrn;
137  bool mbHasAsian;
138  bool mbHasCmplx;
141  bool mbColorUsed;
149 };
150 
152 class XclImpFontBuffer : protected XclImpRoot
153 {
154 public:
156  XclImpFontBuffer(const XclImpFontBuffer&) = delete;
158  const XclImpFontBuffer& operator=(const XclImpFontBuffer&) = delete;
159 
160  explicit XclImpFontBuffer( const XclImpRoot& rRoot );
161 
163  void Initialize();
164 
166  const XclImpFont* GetFont( sal_uInt16 nFontIndex ) const;
168  const XclFontData& GetAppFontData() const { return maAppFont; }
169 
171  void ReadFont( XclImpStream& rStrm );
173  void ReadEfont( XclImpStream& rStrm );
174 
180  void FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType,
181  sal_uInt16 nFontIdx, bool bSkipPoolDefs = false ) const;
184  void WriteFontProperties(
185  ScfPropertySet& rPropSet, XclFontPropSetType eType,
186  sal_uInt16 nFontIdx, const Color* pFontColor = nullptr ) const;
188  void WriteDefaultCtrlFontProperties( ScfPropertySet& rPropSet ) const;
189 
190 private:
192  void UpdateAppFont( const XclFontData& rFontData, bool bHasCharSet );
193 
194 private:
195  std::vector< XclImpFont > maFontList;
199 };
200 
201 // FORMAT record - number formats =============================================
202 
205 {
206 public:
207  explicit XclImpNumFmtBuffer( const XclImpRoot& rRoot );
208 
210  void Initialize();
211 
213  void ReadFormat( XclImpStream& rStrm );
214 
216  sal_uInt16 ReadCFFormat( XclImpStream& rStrm, bool bIFmt );
217 
219  void CreateScFormats();
220 
222  sal_uInt32 GetScFormat( sal_uInt16 nXclNumFmt ) const;
223 
228  void FillToItemSet(
229  SfxItemSet& rItemSet, sal_uInt16 nXclNumFmt,
230  bool bSkipPoolDefs = false ) const;
235  void FillScFmtToItemSet(
236  SfxItemSet& rItemSet, sal_uInt32 nScNumFmt,
237  bool bSkipPoolDefs = false ) const;
238 
239 private:
240  typedef ::std::map< sal_uInt16, sal_uLong > XclImpIndexMap;
241 
242  XclImpIndexMap maIndexMap;
243  sal_uInt16 mnNextXclIdx;
244 };
245 
246 // XF, STYLE record - Cell formatting =========================================
247 
251 {
253  void FillFromXF2( sal_uInt8 nNumFmt );
255  void FillFromXF3( sal_uInt16 nProt );
256 
259  void FillToItemSet( SfxItemSet& rItemSet, bool bSkipPoolDefs = false ) const;
260 };
261 
265 {
267  void FillFromXF2( sal_uInt8 nFlags );
269  void FillFromXF3( sal_uInt16 nAlign );
271  void FillFromXF4( sal_uInt16 nAlign );
273  void FillFromXF5( sal_uInt16 nAlign );
275  void FillFromXF8( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib );
277  void FillFromCF( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib );
278 
281  void FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFont, bool bSkipPoolDefs = false ) const;
282 };
283 
287 {
288  bool mbLeftUsed;
289  bool mbRightUsed;
290  bool mbTopUsed;
292  bool mbDiagUsed;
293 
294  explicit XclImpCellBorder();
295 
297  void SetUsedFlags( bool bOuterUsed, bool bDiagUsed );
298 
300  void FillFromXF2( sal_uInt8 nFlags );
302  void FillFromXF3( sal_uInt32 nBorder );
304  void FillFromXF5( sal_uInt32 nBorder, sal_uInt32 nArea );
306  void FillFromXF8( sal_uInt32 nBorder1, sal_uInt32 nBorder2 );
307 
309  void FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags );
310 
312  bool HasAnyOuterBorder() const;
313 
316  void FillToItemSet(
317  SfxItemSet& rItemSet,
318  const XclImpPalette& rPalette,
319  bool bSkipPoolDefs = false ) const;
320 };
321 
325 {
326  bool mbForeUsed;
327  bool mbBackUsed;
328  bool mbPattUsed;
329 
330  explicit XclImpCellArea();
331 
333  void SetUsedFlags( bool bUsed );
334 
336  void FillFromXF2( sal_uInt8 nFlags );
338  void FillFromXF3( sal_uInt16 nArea );
340  void FillFromXF5( sal_uInt32 nArea );
342  void FillFromXF8( sal_uInt32 nBorder2, sal_uInt16 nArea );
343 
345  void FillFromCF8( sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags );
346 
349  void FillToItemSet(
350  SfxItemSet& rItemSet,
351  const XclImpPalette& rPalette,
352  bool bSkipPoolDefs = false ) const;
353 };
354 
357 {
358 public:
359  explicit XclImpXFIndex( sal_uInt16 nXFIndex, bool bBoolCell = false ) :
360  mnXFIndex( nXFIndex ), mbBoolCell( bBoolCell ) {}
361 
362  sal_uInt16 GetXFIndex() const { return mnXFIndex; }
363  bool IsBoolCell() const { return mbBoolCell; }
364 
365 private:
366  sal_uInt16 mnXFIndex;
367  bool mbBoolCell;
368 };
369 
370 inline bool operator==( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight )
371 { return (rLeft.GetXFIndex() == rRight.GetXFIndex()) && (rLeft.IsBoolCell() == rRight.IsBoolCell()); }
372 
373 inline bool operator!=( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight )
374 { return !(rLeft == rRight); }
375 
377 class XclImpXF : public XclXFBase, protected XclImpRoot
378 {
379 public:
381  XclImpXF(const XclImpXF&) = delete;
382  const XclImpXF& operator=(const XclImpXF&) = delete;
383 
384  explicit XclImpXF( const XclImpRoot& rRoot );
385  virtual ~XclImpXF() override;
386 
388  void ReadXF( XclImpStream& rStrm );
389 
391  sal_uInt16 GetFontIndex() const { return mnXclFont; }
392 
396  const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false );
397 
399  ::std::vector<ScAttrEntry>& rAttrs, SCROW nRow1, SCROW nRow2,
400  sal_uInt32 nForceScNumFmt);
401 
405  void ApplyPattern(
406  SCCOL nScCol1, SCROW nScRow1,
407  SCCOL nScCol2, SCROW nScRow2,
408  SCTAB nScTab );
409 
411  static void ApplyPatternForBiff2CellFormat(
412  const XclImpRoot& rRoot, const ScAddress& rScPos,
413  sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 );
414 
415 private:
416  void ReadXF2( XclImpStream& rStrm );
417  void ReadXF3( XclImpStream& rStrm );
418  void ReadXF4( XclImpStream& rStrm );
419  void ReadXF5( XclImpStream& rStrm );
420  void ReadXF8( XclImpStream& rStrm );
421 
425  void SetUsedFlags( sal_uInt8 nUsedFlags );
426 
427 private:
428  typedef ::std::unique_ptr< ScPatternAttr > ScPatternAttrPtr;
429 
430  ScPatternAttrPtr mpPattern;
432 
437  sal_uInt16 mnXclNumFmt;
438  sal_uInt16 mnXclFont;
439 };
440 
442 class XclImpStyle : protected XclImpRoot
443 {
444 public:
445  explicit XclImpStyle( const XclImpRoot& rRoot );
446 
448  void ReadStyle( XclImpStream& rStrm );
449 
450  const OUString& GetName() const { return maName; }
451  sal_uInt16 GetXfId() const { return mnXfId; }
452  bool IsBuiltin() const { return mbBuiltin && (mnBuiltinId != EXC_STYLE_USERDEF); }
453  sal_uInt8 GetBuiltinId() const { return mnBuiltinId; }
454  sal_uInt8 GetLevel() const { return mnLevel; }
455 
460  void CreateUserStyle( const OUString& rFinalName );
461 
462 private:
463  OUString maName;
464  sal_uInt16 mnXfId;
467  bool mbBuiltin;
468  bool mbCustom;
469  bool mbHidden;
470 
471  OUString maFinalName;
473 };
474 
477 class XclImpXFBuffer : protected XclImpRoot
478 {
479 public:
481  XclImpXFBuffer(const XclImpXFBuffer&) = delete;
482  const XclImpXFBuffer& operator=(const XclImpXFBuffer&) = delete;
483 
484  explicit XclImpXFBuffer( const XclImpRoot& rRoot );
485 
487  void Initialize();
488 
490  void ReadXF( XclImpStream& rStrm );
492  void ReadStyle( XclImpStream& rStrm );
493 
495  XclImpXF* GetXF( sal_uInt16 nXFIndex )
496  { return (nXFIndex >= maXFList.size()) ? nullptr : maXFList.at(nXFIndex).get(); }
497 
498  const XclImpXF* GetXF( sal_uInt16 nXFIndex ) const
499  { return (nXFIndex >= maXFList.size()) ? nullptr : maXFList.at(nXFIndex).get(); }
500 
502  sal_uInt16 GetFontIndex( sal_uInt16 nXFIndex ) const;
504  const XclImpFont* GetFont( sal_uInt16 nXFIndex ) const;
505 
507  void CreateUserStyles();
510  ScStyleSheet* CreateStyleSheet( sal_uInt16 nXFIndex );
511 
512 private:
513  typedef std::vector< std::unique_ptr<XclImpStyle> > XclImpStyleList;
514  typedef ::std::map< sal_uInt16, XclImpStyle* > XclImpStyleMap;
515 
516  std::vector< std::unique_ptr<XclImpXF> > maXFList;
517  XclImpStyleList maBuiltinStyles;
518  XclImpStyleList maUserStyles;
519  XclImpStyleMap maStylesByXf;
520 };
521 
522 // Buffer for XF indexes in cells =============================================
523 
526 {
527 public:
531 
532  inline explicit XclImpXFRange( SCROW nScRow, const XclImpXFIndex& rXFIndex );
533  inline explicit XclImpXFRange( SCROW nFirstScRow, SCROW nLastScRow, const XclImpXFIndex& rXFIndex );
534 
536  inline bool Contains( SCROW nScRow ) const;
537 
539  bool Expand( SCROW nScRow, const XclImpXFIndex& rXFIndex );
541  bool Expand( const XclImpXFRange& rNextRange );
542 };
543 
544 inline XclImpXFRange::XclImpXFRange( SCROW nScRow, const XclImpXFIndex& rXFIndex ) :
545  mnScRow1( nScRow ),
546  mnScRow2( nScRow ),
547  maXFIndex( rXFIndex )
548 {
549 }
550 
551 inline XclImpXFRange::XclImpXFRange( SCROW nFirstScRow, SCROW nLastScRow, const XclImpXFIndex& rXFIndex ) :
552  mnScRow1( nFirstScRow ),
553  mnScRow2( nLastScRow ),
554  maXFIndex( rXFIndex )
555 {
556 }
557 
558 inline bool XclImpXFRange::Contains( SCROW nScRow ) const
559 {
560  return (mnScRow1 <= nScRow) && (nScRow <= mnScRow2);
561 }
562 
565 {
566 public:
568  XclImpXFRangeColumn(const XclImpXFRangeColumn&) = delete;
569  const XclImpXFRangeColumn& operator=(const XclImpXFRangeColumn&) = delete;
570 
571  typedef std::vector< std::unique_ptr<XclImpXFRange> > IndexList;
572 
573  explicit XclImpXFRangeColumn() {}
574 
575  IndexList::iterator begin() { return maIndexList.begin(); }
576  IndexList::iterator end() { return maIndexList.end(); }
577 
579  void SetDefaultXF( const XclImpXFIndex& rXFIndex );
580 
582  void SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex );
583 
584 private:
587  void Find(
588  XclImpXFRange*& rpPrevRange,
589  XclImpXFRange*& rpNextRange,
590  sal_uLong& rnNextIndex,
591  SCROW nScRow );
592 
596  void TryConcatPrev( sal_uLong nIndex );
597 
599  void Insert(XclImpXFRange* pXFRange, sal_uLong nIndex);
600 
601 private:
602  IndexList maIndexList;
603 };
604 
607 {
608 public:
610  XclImpXFRangeBuffer(const XclImpXFRangeBuffer&) = delete;
611  const XclImpXFRangeBuffer& operator=(const XclImpXFRangeBuffer&) = delete;
612 
613  explicit XclImpXFRangeBuffer( const XclImpRoot& rRoot );
614  virtual ~XclImpXFRangeBuffer() override;
615 
617  void Initialize();
618 
620  void SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex );
622  void SetBlankXF( const ScAddress& rScPos, sal_uInt16 nXFIndex );
624  void SetBoolXF( const ScAddress& rScPos, sal_uInt16 nXFIndex );
626  void SetRowDefXF( SCROW nScRow, sal_uInt16 nXFIndex );
628  void SetColumnDefXF( SCCOL nScCol, sal_uInt16 nXFIndex );
629 
631  void SetHyperlink( const XclRange& rXclRange, const OUString& rUrl );
632 
634  void SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2 );
635 
637  void Finalize();
638 
639 private:
642  {
647  };
648 
649 private:
651  void SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, XclImpXFInsertMode eMode );
652 
658  void SetBorderLine( const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine );
659 
660 private:
661 
662  std::vector< std::shared_ptr< XclImpXFRangeColumn > >
664  std::vector< std::pair< XclRange, OUString > >
667 };
668 
669 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool mbCustom
True = builtin style.
Definition: xistyle.hxx:468
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:860
XclFontPropSetType
Enumerates different types for objects with font settings (using different property names)...
Definition: xlstyle.hxx:395
::std::unique_ptr< ScPatternAttr > ScPatternAttrPtr
Definition: xistyle.hxx:428
ScStyleSheet * CreateStyleSheet(sal_uInt16 nXFIndex)
Creates a cell style sheet of the passed XF and inserts it into the Calc document.
Definition: xistyle.cxx:1680
bool Expand(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Returns true, if the range has been expanded.
Definition: xistyle.cxx:1688
void GuessScriptType()
Tests whether the font contains CJK or CTL characters.
Definition: xistyle.cxx:470
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1572
bool mbDiagUsed
true = Bottom line style used.
Definition: xistyle.hxx:292
Represents an XF record index with additional information.
Definition: xistyle.hxx:356
void FillFromCF(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with CF record data.
Definition: xistyle.cxx:802
void ReadFontName8(XclImpStream &rStrm)
Reads and sets a Unicode string as font name.
Definition: xistyle.cxx:465
const XclImpFont * GetFont(sal_uInt16 nXFIndex) const
Returns the Excel font used in the specified XF record.
Definition: xistyle.cxx:1596
void Finalize()
Applies styles and cell merging to the current sheet in the document.
Definition: xistyle.cxx:1984
void FillFromXF3(sal_uInt16 nArea)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:1031
std::vector< std::unique_ptr< XclImpStyle > > XclImpStyleList
Definition: xistyle.hxx:513
Contains all XF records occurred in the file.
Definition: xistyle.hxx:477
void ReadCFFontBlock(XclImpStream &rStrm)
Reads the font block from a CF (conditional format) record.
Definition: xistyle.cxx:282
XclImpXF(const XclImpXF &)=delete
make noncopyable
bool operator!=(const XclImpXFIndex &rLeft, const XclImpXFIndex &rRight)
Definition: xistyle.hxx:373
SCROW mnScRow2
The first row of an equal-formatted range.
Definition: xistyle.hxx:529
XclFontData maAppFont
List of all FONT records in the Excel file.
Definition: xistyle.hxx:196
Stores all data of an Excel font and provides import of FONT records.
Definition: xistyle.hxx:70
XclImpCellBorder maBorder
All alignment attributes.
Definition: xistyle.hxx:435
Extends the XclCellBorder struct for import.
Definition: xistyle.hxx:286
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:665
void SetUsedFlags(bool bOuterUsed, bool bDiagUsed)
Sets outer line states and diagonal line states to used or unused.
Definition: xistyle.cxx:854
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:1799
ScRangeList maMergeList
Maps URLs to hyperlink cells.
Definition: xistyle.hxx:666
bool mbHidden
True = customized builtin style.
Definition: xistyle.hxx:469
std::vector< std::unique_ptr< XclImpXF > > maXFList
Definition: xistyle.hxx:516
IndexList::iterator end()
Definition: xistyle.hxx:576
OUString maName
Definition: xistyle.hxx:463
bool IsBuiltin() const
Definition: xistyle.hxx:452
const XclImpRoot & mrRoot
Colors read from file.
Definition: xistyle.hxx:64
bool IsBoolCell() const
Definition: xistyle.hxx:363
ColorVec maColorTable
Definition: xistyle.hxx:63
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:760
bool mbPattUsed
true = Background color used.
Definition: xistyle.hxx:328
void FillFromXF3(sal_uInt32 nBorder)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:870
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:285
sal_uInt16 mnXclNumFmt
Background area style.
Definition: xistyle.hxx:437
void FillFromXF8(sal_uInt32 nBorder1, sal_uInt32 nBorder2)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:896
bool HasAsianChars() const
Returns true, if this font contains characters for Asian scripts (CJK).
Definition: xistyle.hxx:95
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:636
sal_uInt16 mnNextXclIdx
Maps Excel format indexes to Calc formats.
Definition: xistyle.hxx:243
Contains the XF indexes for every used cell in a single sheet.
Definition: xistyle.hxx:606
void FillFromXF8(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:791
XclFontData maData
Definition: xistyle.hxx:134
bool mbWeightUsed
true = Color used.
Definition: xistyle.hxx:142
Stores all default colors for a specific BIFF version.
Definition: xlstyle.hxx:250
sal_uInt16 mnXclFont
Index to number format.
Definition: xistyle.hxx:438
Contains an (encoded) XF index for a range of rows in a single column.
Definition: xistyle.hxx:525
sal_uInt16 mnXFIndex
Definition: xistyle.hxx:366
bool HasCharSet() const
Returns true, if the font character set is valid.
Definition: xistyle.hxx:88
Extends the XclCellArea struct for import.
Definition: xistyle.hxx:324
sal_uInt16 mnXfId
Cell style name.
Definition: xistyle.hxx:464
virtual ~XclImpXFRangeBuffer() override
Definition: xistyle.cxx:1883
bool mbItalicUsed
true = Underline style used.
Definition: xistyle.hxx:145
ScStyleSheet * mpStyleSheet
Calc item set.
Definition: xistyle.hxx:431
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:724
bool HasEscapement() const
Returns true, if the font contains superscript or subscript.
Definition: xistyle.hxx:90
void SetDefaultXF(const XclImpXFIndex &rXFIndex)
Inserts a single row range into the list.
Definition: xistyle.cxx:1718
SCROW mnScRow1
Definition: xistyle.hxx:528
void CreateScFormats()
Creates the number formats in the Calc document.
Definition: xistyle.cxx:699
sal_uInt16 GetXfId() const
Definition: xistyle.hxx:451
const sal_uInt8 EXC_STYLE_USERDEF
"Followed_Hyperlink" style.
Definition: xlstyle.hxx:234
void FillToItemSet(SfxItemSet &rItemSet, XclFontItemType eType, bool bSkipPoolDefs=false) const
Fills all font properties to the item set.
Definition: xistyle.cxx:316
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1579
rtl_TextEncoding GetFontEncoding() const
Returns the text encoding for strings used with this font.
Definition: xistyle.cxx:239
sal_uInt8 mnBuiltinId
Formatting for this cell style.
Definition: xistyle.hxx:465
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:595
void ReadFontColor(XclImpStream &rStrm)
Reads and sets the font color.
Definition: xistyle.cxx:455
void SetMerge(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2)
Inserts a complete merged cell range.
Definition: xistyle.cxx:1978
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:765
XclImpCellProt maProtection
Calc cell style sheet.
Definition: xistyle.hxx:433
const ScPatternAttr & CreatePattern(bool bSkipPoolDefs=false)
Creates a Calc item set containing an item set with all cell properties.
Definition: xistyle.cxx:1244
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:1410
::std::map< sal_uInt16, XclImpStyle * > XclImpStyleMap
Definition: xistyle.hxx:514
XclImpFont(const XclImpRoot &rRoot)
Definition: xistyle.cxx:192
ScStyleSheet * CreateStyleSheet()
Creates a cell style sheet and inserts it into the Calc document.
Definition: xistyle.cxx:1513
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:1426
Contains all data of a cell style associated with an XF record.
Definition: xistyle.hxx:442
bool mbHasAsian
true = Font contains Western script characters.
Definition: xistyle.hxx:137
void ReadXF4(XclImpStream &rStrm)
Definition: xistyle.cxx:1157
Contains the XF indexes for every used cell in a column.
Definition: xistyle.hxx:564
void FillFromXF8(sal_uInt32 nBorder2, sal_uInt16 nArea)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:1047
bool operator==(const XclImpXFIndex &rLeft, const XclImpXFIndex &rRight)
Definition: xistyle.hxx:370
void SetXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index.
Definition: xistyle.cxx:1925
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:980
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1477
virtual ~XclImpXF() override
Definition: xistyle.cxx:1107
void SetHyperlink(const XclRange &rXclRange, const OUString &rUrl)
Inserts a range of hyperlink cells.
Definition: xistyle.cxx:1973
const sal_uInt16 EXC_FONTESC_NONE
Definition: xlstyle.hxx:125
Extends the XclCellProt struct for import.
Definition: xistyle.hxx:250
sal_uInt16 ReadCFFormat(XclImpStream &rStrm, bool bIFmt)
Read NumFmt from conditional format record.
Definition: xistyle.cxx:680
bool mbOutlineUsed
true = Strikeout used.
Definition: xistyle.hxx:147
XclImpXFBuffer(const XclImpXFBuffer &)=delete
make noncopyable
const XclFontData & GetFontData() const
Returns read-only access to font data.
Definition: xistyle.hxx:86
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:558
Extends the XclCellAlign struct for import.
Definition: xistyle.hxx:264
const XclFontData & GetAppFontData() const
Returns the application font data of this file, needed i.e.
Definition: xistyle.hxx:168
::std::vector< Color > ColorVec
Definition: xistyle.hxx:62
bool mbHasCmplx
true = Font contains Asian script characters.
Definition: xistyle.hxx:138
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1231
XclFontItemType
Enumerates different types of Which-IDs for font items.
Definition: xlstyle.hxx:387
sal_uInt16 mnEscapem
Boldness: 400=normal, 700=bold.
Definition: xlstyle.hxx:292
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:1076
void FillFromCF8(sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:916
void SetBlankXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for blank cells.
Definition: xistyle.cxx:1930
IndexList maIndexList
Definition: xistyle.hxx:602
XclImpNumFmtBuffer(const XclImpRoot &rRoot)
Definition: xistyle.cxx:629
bool mbUnderlUsed
true = Escapement type used.
Definition: xistyle.hxx:144
Contains all cell protection attributes.
Definition: xlstyle.hxx:476
sal_uInt8 GetLevel() const
Definition: xistyle.hxx:454
Contains all cell alignment attributes.
Definition: xlstyle.hxx:487
void CreateUserStyles()
Creates all user defined style sheets.
Definition: xistyle.cxx:1612
XclImpStyleList maBuiltinStyles
List of contents of all XF record.
Definition: xistyle.hxx:517
void FillToItemSet(SfxItemSet &rItemSet, const XclImpFont *pFont, bool bSkipPoolDefs=false) const
Inserts items representing this alignment style into the item set.
Definition: xistyle.cxx:813
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:1023
const OUString & GetName() const
Definition: xistyle.hxx:450
sal_uInt8 mnLevel
Identifier for builtin styles.
Definition: xistyle.hxx:466
void FillFromXF5(sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:1039
sal_Int16 SCCOL
Definition: types.hxx:21
XclImpPalette(const XclImpRoot &rRoot)
Definition: xistyle.cxx:146
void ReadXF3(XclImpStream &rStrm)
Definition: xistyle.cxx:1131
void SetAllUsedFlags(bool bUsed)
Sets all font attributes to used or unused.
Definition: xistyle.cxx:208
XclImpXFIndex maXFIndex
The last row of an equal-formatted range.
Definition: xistyle.hxx:530
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:603
void ReadFontData2(XclImpStream &rStrm)
Reads and sets height and flags.
Definition: xistyle.cxx:419
sal_uInt8 mnHorAlign
Definition: xlstyle.hxx:489
void FillScFmtToItemSet(SfxItemSet &rItemSet, sal_uInt32 nScNumFmt, bool bSkipPoolDefs=false) const
Fills a Calc number format to the passed item set.
Definition: xistyle.cxx:738
sal_uInt8 GetHorAlign() const
Definition: xistyle.hxx:390
bool mbBackUsed
true = Foreground color used.
Definition: xistyle.hxx:327
Stores all user defined number formats occurred in the file.
Definition: xistyle.hxx:204
XclImpCellArea maArea
Border line style.
Definition: xistyle.hxx:436
const XclImpXF * GetXF(sal_uInt16 nXFIndex) const
Definition: xistyle.hxx:498
void SetUsedFlags(sal_uInt8 nUsedFlags)
Sets all "attribute used" flags according to the passed mask.
Definition: xistyle.cxx:1448
sal_uInt16 GetFontIndex() const
Definition: xistyle.hxx:391
void ReadFontData5(XclImpStream &rStrm)
Reads and sets height, flags, color, boldness, script, family and charset.
Definition: xistyle.cxx:434
void SetXF(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Inserts a new (encoded) XF index (first try to expand the last range).
Definition: xistyle.cxx:1728
bool mbFontNameUsed
true = Font contains Complex script characters.
Definition: xistyle.hxx:139
void SetRowDefXF(SCROW nScRow, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a row.
Definition: xistyle.cxx:1940
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:589
bool mbBottomUsed
true = Top line style used.
Definition: xistyle.hxx:291
Contains all data of a XF record and a Calc item set.
Definition: xistyle.hxx:377
void ReadXF8(XclImpStream &rStrm)
Definition: xistyle.cxx:1206
void ReadFont(XclImpStream &rStrm)
Reads a FONT record for all BIFF versions.
Definition: xistyle.cxx:247
bool HasAnyOuterBorder() const
Returns true, if any of the outer border lines is visible.
Definition: xistyle.cxx:933
void ReadXF2(XclImpStream &rStrm)
Definition: xistyle.cxx:1111
void ReadPalette(XclImpStream &rStrm)
Reads a PALETTE record.
Definition: xistyle.cxx:167
XclImpStyleList maUserStyles
List of built-in cell styles.
Definition: xistyle.hxx:518
XclImpCellBorder()
true = Diagonal line style used.
Definition: xistyle.cxx:849
XclImpCellArea()
true = Pattern used.
Definition: xistyle.cxx:1013
void FillFromXF3(sal_uInt16 nAlign)
Fills this struct with BIFF3 XF record data.
Definition: xistyle.cxx:770
std::vector< XclImpFont > maFontList
Definition: xistyle.hxx:195
void TryConcatPrev(sal_uLong nIndex)
Tries to concatenate a range with its predecessor.
Definition: xistyle.cxx:1866
void CreateUserStyle(const OUString &rFinalName)
Creates the Calc style sheet, if this is a user-defined style.
Definition: xistyle.cxx:1552
Color GetColor(sal_uInt16 nXclIndex) const
Returns the color for a (non-zero-based) Excel palette entry.
Definition: xistyle.cxx:156
XclImpXF * GetXF(sal_uInt16 nXFIndex)
Returns the object that stores all contents of an XF record.
Definition: xistyle.hxx:495
void FillToItemSet(SfxItemSet &rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs=false) const
Fills an Excel number format to the passed item set.
Definition: xistyle.cxx:730
Contains color and line style for each cell border line.
Definition: xlstyle.hxx:522
XclImpFont maFont4
Application font (for column width).
Definition: xistyle.hxx:197
void FillFromXF5(sal_uInt32 nBorder, sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:883
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:277
void ReadFontName2(XclImpStream &rStrm)
Reads and sets a byte string as font name.
Definition: xistyle.cxx:460
A wrapper for a UNO property set.
Definition: fapihelper.hxx:103
const XclImpXFRangeColumn & operator=(const XclImpXFRangeColumn &)=delete
sal_Int32 SCROW
Definition: types.hxx:17
void ReadFormat(XclImpStream &rStrm)
Reads a FORMAT record.
Definition: xistyle.cxx:643
void SetBoolXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for boolean cells.
Definition: xistyle.cxx:1935
bool mbHasCharSet
All font attributes.
Definition: xistyle.hxx:135
ScPatternAttrPtr mpPattern
Definition: xistyle.hxx:430
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, const Color *pFontColor=nullptr) const
Writes all font properties to the passed property set.
Definition: xistyle.cxx:412
bool mbHasWstrn
true = Font contains own character set info.
Definition: xistyle.hxx:136
void ExportPalette()
Definition: xistyle.cxx:123
void ReadFont(XclImpStream &rStrm)
Reads a FONT record.
Definition: xistyle.cxx:577
void UpdateAppFont(const XclFontData &rFontData, bool bHasCharSet)
Updates the application default font.
Definition: xistyle.cxx:615
void FillFromXF5(sal_uInt16 nAlign)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:783
void ReadXF5(XclImpStream &rStrm)
Definition: xistyle.cxx:1183
IndexList::iterator begin()
Definition: xistyle.hxx:575
void FillFromCF8(sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:1055
unsigned char sal_uInt8
bool mbStrikeUsed
true = Italic used.
Definition: xistyle.hxx:146
void SetColumnDefXF(SCCOL nScCol, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a column.
Definition: xistyle.cxx:1946
XclImpCellAlign maAlignment
Cell protection flags.
Definition: xistyle.hxx:434
bool mbHeightUsed
true = Font name, family, charset used.
Definition: xistyle.hxx:140
bool mbColorUsed
true = Font height used.
Definition: xistyle.hxx:141
SvxBoxItemLine
XclImpXFRange(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Extended XF index.
Definition: xistyle.hxx:544
bool mbRightUsed
true = Left line style used.
Definition: xistyle.hxx:289
bool mbBoolCell
The XF record index.
Definition: xistyle.hxx:367
void SetUsedFlags(bool bUsed)
Sets colors and pattern state to used or unused.
Definition: xistyle.cxx:1018
Stores the data of all fonts occurred in an Excel file.
Definition: xistyle.hxx:152
sal_uInt16 GetFontIndex(sal_uInt16 nXFIndex) const
Returns the index to the Excel font used in the specified XF record.
Definition: xistyle.cxx:1590
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:151
Contains background colors and pattern for a cell.
Definition: xlstyle.hxx:543
void FillFromXF2(sal_uInt8 nNumFmt)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:748
Cell with a single Boolean value.
Definition: xistyle.hxx:645
bool mbEscapemUsed
true = Weight used.
Definition: xistyle.hxx:143
bool mbBuiltin
Level for builtin column/row styles.
Definition: xistyle.hxx:467
bool mbTopUsed
true = Right line style used.
Definition: xistyle.hxx:290
Stores the default colors for the current BIFF version and the contents of a PALETTE record...
Definition: xistyle.hxx:44
std::vector< std::unique_ptr< XclImpXFRange > > IndexList
Definition: xistyle.hxx:571
XclImpIndexMap maIndexMap
Definition: xistyle.hxx:242
XclImpFont maCtrlFont
Built-in font with index 4.
Definition: xistyle.hxx:198
OUString maFinalName
True = style not visible in GUI.
Definition: xistyle.hxx:471
sal_uInt16 GetXFIndex() const
Definition: xistyle.hxx:362
void SetFontData(const XclFontData &rFontData, bool bHasCharSet)
Sets the passed font data and all used flags to 'used'.
Definition: xistyle.cxx:214
void ApplyPatternToAttrVector(::std::vector< ScAttrEntry > &rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt)
Definition: xistyle.cxx:1338
This class is used to import record oriented streams.
Definition: xistream.hxx:277
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1564
XclImpStyle(const XclImpRoot &rRoot)
Definition: xistyle.cxx:1465
const XclImpFontBuffer & operator=(const XclImpFontBuffer &)=delete
delete copy-assignment operator
XclImpStyleMap maStylesByXf
List of user defined cell styles.
Definition: xistyle.hxx:519
void SvStream & rStrm
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1887
bool Contains(SCROW nScRow) const
Returns true, if nScRow is contained in own row range.
Definition: xistyle.hxx:558
Access to global data from other classes.
Definition: xiroot.hxx:125
::std::map< sal_uInt16, sal_uLong > XclImpIndexMap
Definition: xistyle.hxx:240
sal_uInt8 GetBuiltinId() const
Definition: xistyle.hxx:453
const XclImpXF & operator=(const XclImpXF &)=delete
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:546
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:1794
ScStyleSheet * mpStyleSheet
Final name used in the Calc document.
Definition: xistyle.hxx:472
void FillFromXF4(sal_uInt16 nAlign)
Fills this struct with BIFF4 XF record data.
Definition: xistyle.cxx:776
void FillFromXF3(sal_uInt16 nProt)
Fills this struct with BIFF3-BIFF8 XF record data.
Definition: xistyle.cxx:754
XclImpXFInsertMode
Insertion mode of an XF index.
Definition: xistyle.hxx:641
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:58
sal_Int16 SCTAB
Definition: types.hxx:22
void WriteDefaultCtrlFontProperties(ScfPropertySet &rPropSet) const
Writes default font properties for form controls to the passed property set.
Definition: xistyle.cxx:610
XclImpXFIndex(sal_uInt16 nXFIndex, bool bBoolCell=false)
Definition: xistyle.hxx:359
bool mbShadowUsed
true = Outlined used.
Definition: xistyle.hxx:148
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:1957
std::vector< std::shared_ptr< XclImpXFRangeColumn > > maColumns
Definition: xistyle.hxx:663