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
29class ScPatternAttr;
30
31struct XclRange;
32struct ScAttrEntry;
33enum 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{
46public:
47 explicit XclImpPalette( const XclImpRoot& rRoot );
48
50 void Initialize();
51
55 Color GetColor( sal_uInt16 nXclIndex ) const;
56
59
60private:
61 void ExportPalette();
62 typedef ::std::vector< Color > ColorVec;
65};
66
67// FONT record - font information =============================================
68
70class XclImpFont : protected XclImpRoot
71{
72public:
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
115private:
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
133private:
149};
150
153{
154public:
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;
185 ScfPropertySet& rPropSet, XclFontPropSetType eType,
186 sal_uInt16 nFontIdx, const Color* pFontColor = nullptr ) const;
188 void WriteDefaultCtrlFontProperties( ScfPropertySet& rPropSet ) const;
189
190private:
192 void UpdateAppFont( const XclFontData& rFontData, bool bHasCharSet );
193
194private:
195 std::vector< XclImpFont > maFontList;
199};
200
201// FORMAT record - number formats =============================================
202
205{
206public:
207 explicit XclImpNumFmtBuffer( const XclImpRoot& rRoot );
208
210 void Initialize();
211
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;
236 SfxItemSet& rItemSet, sal_uInt32 nScNumFmt,
237 bool bSkipPoolDefs = false ) const;
238
239private:
240 typedef ::std::map< sal_uInt16, sal_uLong > XclImpIndexMap;
241
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{
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{
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{
358public:
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
365private:
366 sal_uInt16 mnXFIndex;
368};
369
370inline bool operator==( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight )
371{ return (rLeft.GetXFIndex() == rRight.GetXFIndex()) && (rLeft.IsBoolCell() == rRight.IsBoolCell()); }
372
373inline bool operator!=( const XclImpXFIndex& rLeft, const XclImpXFIndex& rRight )
374{ return !(rLeft == rRight); }
375
377class XclImpXF : public XclXFBase, protected XclImpRoot
378{
379public:
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
390 bool GetLineBreak() const { return maAlignment.mbLineBreak; }
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
413 const XclImpRoot& rRoot, const ScAddress& rScPos,
414 sal_uInt8 nFlags1, sal_uInt8 nFlags2, sal_uInt8 nFlags3 );
415
416private:
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
428private:
429 typedef ::std::unique_ptr< ScPatternAttr > ScPatternAttrPtr;
430
433
438 sal_uInt16 mnXclNumFmt;
439 sal_uInt16 mnXclFont;
440};
441
443class XclImpStyle : protected XclImpRoot
444{
445public:
446 explicit XclImpStyle( const XclImpRoot& rRoot );
447
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); }
455 sal_uInt8 GetLevel() const { return mnLevel; }
456
461 void CreateUserStyle( const OUString& rFinalName );
462
463private:
464 OUString maName;
465 sal_uInt16 mnXfId;
469 bool mbCustom;
470 bool mbHidden;
471
472 OUString maFinalName;
474};
475
478class XclImpXFBuffer : protected XclImpRoot
479{
480public:
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
513private:
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;
521};
522
523// Buffer for XF indexes in cells =============================================
524
527{
528public:
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
545inline XclImpXFRange::XclImpXFRange( SCROW nScRow, const XclImpXFIndex& rXFIndex ) :
546 mnScRow1( nScRow ),
547 mnScRow2( nScRow ),
548 maXFIndex( rXFIndex )
549{
550}
551
552inline XclImpXFRange::XclImpXFRange( SCROW nFirstScRow, SCROW nLastScRow, const XclImpXFIndex& rXFIndex ) :
553 mnScRow1( nFirstScRow ),
554 mnScRow2( nLastScRow ),
555 maXFIndex( rXFIndex )
556{
557}
558
559inline bool XclImpXFRange::Contains( SCROW nScRow ) const
560{
561 return (mnScRow1 <= nScRow) && (nScRow <= mnScRow2);
562}
563
566{
567public:
571
572 typedef std::vector< std::unique_ptr<XclImpXFRange> > IndexList;
573
575
576 IndexList::iterator begin() { return maIndexList.begin(); }
577 IndexList::iterator end() { return maIndexList.end(); }
578
580 void SetDefaultXF( const XclImpXFIndex& rXFIndex, const XclImpRoot& rRoot );
581
583 void SetXF( SCROW nScRow, const XclImpXFIndex& rXFIndex );
584
585private:
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
602private:
604};
605
608{
609public:
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
640private:
643 {
648 };
649
650private:
652 void SetXF( const ScAddress& rScPos, sal_uInt16 nXFIndex, XclImpXFInsertMode eMode );
653
659 void SetBorderLine( const ScRange& rRange, SCTAB nScTab, SvxBoxItemLine nLine );
660
661private:
662
663 std::vector< std::shared_ptr< XclImpXFRangeColumn > >
665 std::vector< std::pair< XclRange, OUString > >
668};
669
670/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxBoxItemLine
A wrapper for a UNO property set.
Definition: fapihelper.hxx:104
Stores all default colors for a specific BIFF version.
Definition: xlstyle.hxx:252
Stores the data of all fonts occurred in an Excel file.
Definition: xistyle.hxx:153
const XclFontData & GetAppFontData() const
Returns the application font data of this file, needed i.e.
Definition: xistyle.hxx:168
const XclImpFontBuffer & operator=(const XclImpFontBuffer &)=delete
delete copy-assignment operator
XclImpFontBuffer(const XclImpFontBuffer &)=delete
delete copy constructor
XclImpFont maFont4
Application font (for column width).
Definition: xistyle.hxx:197
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:547
void WriteDefaultCtrlFontProperties(ScfPropertySet &rPropSet) const
Writes default font properties for form controls to the passed property set.
Definition: xistyle.cxx:611
const XclImpFont * GetFont(sal_uInt16 nFontIndex) const
Returns the object that stores all contents of a FONT record.
Definition: xistyle.cxx:559
void UpdateAppFont(const XclFontData &rFontData, bool bHasCharSet)
Updates the application default font.
Definition: xistyle.cxx:616
void ReadFont(XclImpStream &rStrm)
Reads a FONT record.
Definition: xistyle.cxx:578
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:596
XclImpFont maCtrlFont
Built-in font with index 4.
Definition: xistyle.hxx:198
XclFontData maAppFont
List of all FONT records in the Excel file.
Definition: xistyle.hxx:196
std::vector< XclImpFont > maFontList
Definition: xistyle.hxx:195
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:590
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:604
Stores all data of an Excel font and provides import of FONT records.
Definition: xistyle.hxx:71
void SetFontData(const XclFontData &rFontData, bool bHasCharSet)
Sets the passed font data and all used flags to 'used'.
Definition: xistyle.cxx:215
XclImpFont(const XclImpRoot &rRoot)
Definition: xistyle.cxx:193
const XclFontData & GetFontData() const
Returns read-only access to font data.
Definition: xistyle.hxx:86
bool HasAsianChars() const
Returns true, if this font contains characters for Asian scripts (CJK).
Definition: xistyle.hxx:95
bool mbHasCmplx
true = Font contains Asian script characters.
Definition: xistyle.hxx:138
void ReadFont(XclImpStream &rStrm)
Reads a FONT record for all BIFF versions.
Definition: xistyle.cxx:248
bool mbWeightUsed
true = Color used.
Definition: xistyle.hxx:142
rtl_TextEncoding GetFontEncoding() const
Returns the text encoding for strings used with this font.
Definition: xistyle.cxx:240
bool mbUnderlUsed
true = Escapement type used.
Definition: xistyle.hxx:144
void GuessScriptType()
Tests whether the font contains CJK or CTL characters.
Definition: xistyle.cxx:471
bool mbEscapemUsed
true = Weight used.
Definition: xistyle.hxx:143
bool mbItalicUsed
true = Underline style used.
Definition: xistyle.hxx:145
void ReadFontColor(XclImpStream &rStrm)
Reads and sets the font color.
Definition: xistyle.cxx:456
bool mbHasCharSet
All font attributes.
Definition: xistyle.hxx:135
bool mbHeightUsed
true = Font name, family, charset used.
Definition: xistyle.hxx:140
void ReadFontData5(XclImpStream &rStrm)
Reads and sets height, flags, color, boldness, script, family and charset.
Definition: xistyle.cxx:435
void ReadCFFontBlock(XclImpStream &rStrm)
Reads the font block from a CF (conditional format) record.
Definition: xistyle.cxx:283
bool mbHasWstrn
true = Font contains own character set info.
Definition: xistyle.hxx:136
void SetAllUsedFlags(bool bUsed)
Sets all font attributes to used or unused.
Definition: xistyle.cxx:209
void ReadFontData2(XclImpStream &rStrm)
Reads and sets height and flags.
Definition: xistyle.cxx:420
void ReadFontName8(XclImpStream &rStrm)
Reads and sets a Unicode string as font name.
Definition: xistyle.cxx:466
void WriteFontProperties(ScfPropertySet &rPropSet, XclFontPropSetType eType, const Color *pFontColor=nullptr) const
Writes all font properties to the passed property set.
Definition: xistyle.cxx:413
bool mbOutlineUsed
true = Strikeout used.
Definition: xistyle.hxx:147
bool HasCharSet() const
Returns true, if the font character set is valid.
Definition: xistyle.hxx:88
void ReadEfont(XclImpStream &rStrm)
Reads an EFONT record (BIFF2 font color).
Definition: xistyle.cxx:278
bool mbHasAsian
true = Font contains Western script characters.
Definition: xistyle.hxx:137
XclFontData maData
Definition: xistyle.hxx:134
bool HasEscapement() const
Returns true, if the font contains superscript or subscript.
Definition: xistyle.hxx:90
bool mbColorUsed
true = Font height used.
Definition: xistyle.hxx:141
bool mbStrikeUsed
true = Italic used.
Definition: xistyle.hxx:146
bool mbFontNameUsed
true = Font contains Complex script characters.
Definition: xistyle.hxx:139
void FillToItemSet(SfxItemSet &rItemSet, XclFontItemType eType, bool bSkipPoolDefs=false) const
Fills all font properties to the item set.
Definition: xistyle.cxx:317
bool mbShadowUsed
true = Outlined used.
Definition: xistyle.hxx:148
void ReadFontName2(XclImpStream &rStrm)
Reads and sets a byte string as font name.
Definition: xistyle.cxx:461
Stores all user defined number formats occurred in the file.
Definition: xistyle.hxx:205
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:637
void FillScFmtToItemSet(SfxItemSet &rItemSet, sal_uInt32 nScNumFmt, bool bSkipPoolDefs=false) const
Fills a Calc number format to the passed item set.
Definition: xistyle.cxx:739
sal_uInt16 mnNextXclIdx
Maps Excel format indexes to Calc formats.
Definition: xistyle.hxx:243
sal_uInt16 ReadCFFormat(XclImpStream &rStrm, bool bIFmt)
Read NumFmt from conditional format record.
Definition: xistyle.cxx:681
XclImpNumFmtBuffer(const XclImpRoot &rRoot)
Definition: xistyle.cxx:630
void FillToItemSet(SfxItemSet &rItemSet, sal_uInt16 nXclNumFmt, bool bSkipPoolDefs=false) const
Fills an Excel number format to the passed item set.
Definition: xistyle.cxx:731
void CreateScFormats()
Creates the number formats in the Calc document.
Definition: xistyle.cxx:700
::std::map< sal_uInt16, sal_uLong > XclImpIndexMap
Definition: xistyle.hxx:240
void ReadFormat(XclImpStream &rStrm)
Reads a FORMAT record.
Definition: xistyle.cxx:644
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:725
XclImpIndexMap maIndexMap
Definition: xistyle.hxx:242
Stores the default colors for the current BIFF version and the contents of a PALETTE record.
Definition: xistyle.hxx:45
XclImpPalette(const XclImpRoot &rRoot)
Definition: xistyle.cxx:147
void ExportPalette()
Definition: xistyle.cxx:124
void ReadPalette(XclImpStream &rStrm)
Reads a PALETTE record.
Definition: xistyle.cxx:168
const XclImpRoot & mrRoot
Colors read from file.
Definition: xistyle.hxx:64
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:152
Color GetColor(sal_uInt16 nXclIndex) const
Returns the color for a (non-zero-based) Excel palette entry.
Definition: xistyle.cxx:157
ColorVec maColorTable
Definition: xistyle.hxx:63
::std::vector< Color > ColorVec
Definition: xistyle.hxx:62
Access to global data from other classes.
Definition: xiroot.hxx:129
This class is used to import record oriented streams.
Definition: xistream.hxx:278
Contains all data of a cell style associated with an XF record.
Definition: xistyle.hxx:444
XclImpStyle(const XclImpRoot &rRoot)
Definition: xistyle.cxx:1466
ScStyleSheet * mpStyleSheet
Final name used in the Calc document.
Definition: xistyle.hxx:473
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1478
OUString maFinalName
True = style not visible in GUI.
Definition: xistyle.hxx:472
const OUString & GetName() const
Definition: xistyle.hxx:451
sal_uInt16 mnXfId
Cell style name.
Definition: xistyle.hxx:465
sal_uInt16 GetXfId() const
Definition: xistyle.hxx:452
bool IsBuiltin() const
Definition: xistyle.hxx:453
bool mbHidden
True = customized builtin style.
Definition: xistyle.hxx:470
bool mbBuiltin
Level for builtin column/row styles.
Definition: xistyle.hxx:468
sal_uInt8 mnLevel
Identifier for builtin styles.
Definition: xistyle.hxx:467
ScStyleSheet * CreateStyleSheet()
Creates a cell style sheet and inserts it into the Calc document.
Definition: xistyle.cxx:1514
sal_uInt8 GetLevel() const
Definition: xistyle.hxx:455
sal_uInt8 mnBuiltinId
Formatting for this cell style.
Definition: xistyle.hxx:466
void CreateUserStyle(const OUString &rFinalName)
Creates the Calc style sheet, if this is a user-defined style.
Definition: xistyle.cxx:1553
OUString maName
Definition: xistyle.hxx:464
sal_uInt8 GetBuiltinId() const
Definition: xistyle.hxx:454
bool mbCustom
True = builtin style.
Definition: xistyle.hxx:469
Contains all XF records occurred in the file.
Definition: xistyle.hxx:479
sal_uInt16 GetFontIndex(sal_uInt16 nXFIndex) const
Returns the index to the Excel font used in the specified XF record.
Definition: xistyle.cxx:1591
const XclImpXF * GetXF(sal_uInt16 nXFIndex) const
Definition: xistyle.hxx:499
XclImpXFBuffer(const XclImpXFBuffer &)=delete
make noncopyable
::std::map< sal_uInt16, XclImpStyle * > XclImpStyleMap
Definition: xistyle.hxx:515
XclImpStyleList maBuiltinStyles
List of contents of all XF record.
Definition: xistyle.hxx:518
void ReadStyle(XclImpStream &rStrm)
Reads a STYLE record.
Definition: xistyle.cxx:1580
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1565
const XclImpXFBuffer & operator=(const XclImpXFBuffer &)=delete
XclImpXF * GetXF(sal_uInt16 nXFIndex)
Returns the object that stores all contents of an XF record.
Definition: xistyle.hxx:496
const XclImpFont * GetFont(sal_uInt16 nXFIndex) const
Returns the Excel font used in the specified XF record.
Definition: xistyle.cxx:1597
void CreateUserStyles()
Creates all user defined style sheets.
Definition: xistyle.cxx:1613
XclImpStyleMap maStylesByXf
List of user defined cell styles.
Definition: xistyle.hxx:520
std::vector< std::unique_ptr< XclImpStyle > > XclImpStyleList
Definition: xistyle.hxx:514
XclImpStyleList maUserStyles
List of built-in cell styles.
Definition: xistyle.hxx:519
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1573
ScStyleSheet * CreateStyleSheet(sal_uInt16 nXFIndex)
Creates a cell style sheet of the passed XF and inserts it into the Calc document.
Definition: xistyle.cxx:1681
std::vector< std::unique_ptr< XclImpXF > > maXFList
Definition: xistyle.hxx:517
Represents an XF record index with additional information.
Definition: xistyle.hxx:357
bool IsBoolCell() const
Definition: xistyle.hxx:363
XclImpXFIndex(sal_uInt16 nXFIndex, bool bBoolCell=false)
Definition: xistyle.hxx:359
sal_uInt16 mnXFIndex
Definition: xistyle.hxx:366
sal_uInt16 GetXFIndex() const
Definition: xistyle.hxx:362
bool mbBoolCell
The XF record index.
Definition: xistyle.hxx:367
Contains the XF indexes for every used cell in a single sheet.
Definition: xistyle.hxx:608
void SetBoolXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for boolean cells.
Definition: xistyle.cxx:1936
XclImpXFRangeBuffer(const XclImpXFRangeBuffer &)=delete
make noncopyable
void SetColumnDefXF(SCCOL nScCol, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a column.
Definition: xistyle.cxx:1947
virtual ~XclImpXFRangeBuffer() override
Definition: xistyle.cxx:1884
void SetHyperlink(const XclRange &rXclRange, const OUString &rUrl)
Inserts a range of hyperlink cells.
Definition: xistyle.cxx:1974
std::vector< std::pair< XclRange, OUString > > maHyperlinks
Array of column XF index buffers.
Definition: xistyle.hxx:666
void SetBlankXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index for blank cells.
Definition: xistyle.cxx:1931
void Finalize()
Applies styles and cell merging to the current sheet in the document.
Definition: xistyle.cxx:1985
void SetXF(const ScAddress &rScPos, sal_uInt16 nXFIndex)
Inserts a new XF index.
Definition: xistyle.cxx:1926
XclImpXFInsertMode
Insertion mode of an XF index.
Definition: xistyle.hxx:643
@ xlXFModeBlank
Cell with a single Boolean value.
Definition: xistyle.hxx:646
@ xlXFModeRow
Blank cell.
Definition: xistyle.hxx:647
@ xlXFModeBoolCell
Filled cell.
Definition: xistyle.hxx:645
const XclImpXFRangeBuffer & operator=(const XclImpXFRangeBuffer &)=delete
void SetRowDefXF(SCROW nScRow, sal_uInt16 nXFIndex)
Inserts a new XF index for all cells in a row.
Definition: xistyle.cxx:1941
ScRangeList maMergeList
Maps URLs to hyperlink cells.
Definition: xistyle.hxx:667
std::vector< std::shared_ptr< XclImpXFRangeColumn > > maColumns
Definition: xistyle.hxx:664
void Initialize()
Clears all buffered data, used to set up for a new sheet.
Definition: xistyle.cxx:1888
void SetMerge(SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2)
Inserts a complete merged cell range.
Definition: xistyle.cxx:1979
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:1958
Contains the XF indexes for every used cell in a column.
Definition: xistyle.hxx:566
IndexList::iterator end()
Definition: xistyle.hxx:577
std::vector< std::unique_ptr< XclImpXFRange > > IndexList
Definition: xistyle.hxx:572
XclImpXFRangeColumn(const XclImpXFRangeColumn &)=delete
make noncopyable
void SetXF(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Inserts a new (encoded) XF index (first try to expand the last range).
Definition: xistyle.cxx:1729
const XclImpXFRangeColumn & operator=(const XclImpXFRangeColumn &)=delete
void Insert(XclImpXFRange *pXFRange, sal_uLong nIndex)
Insert a range into the list at the specified index.
Definition: xistyle.cxx:1795
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:1800
void TryConcatPrev(sal_uLong nIndex)
Tries to concatenate a range with its predecessor.
Definition: xistyle.cxx:1867
void SetDefaultXF(const XclImpXFIndex &rXFIndex, const XclImpRoot &rRoot)
Inserts a single row range into the list.
Definition: xistyle.cxx:1719
IndexList maIndexList
Definition: xistyle.hxx:603
IndexList::iterator begin()
Definition: xistyle.hxx:576
Contains an (encoded) XF index for a range of rows in a single column.
Definition: xistyle.hxx:527
bool Contains(SCROW nScRow) const
Returns true, if nScRow is contained in own row range.
Definition: xistyle.hxx:559
bool Expand(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Returns true, if the range has been expanded.
Definition: xistyle.cxx:1689
XclImpXFIndex maXFIndex
The last row of an equal-formatted range.
Definition: xistyle.hxx:531
SCROW mnScRow1
Definition: xistyle.hxx:529
SCROW mnScRow2
The first row of an equal-formatted range.
Definition: xistyle.hxx:530
XclImpXFRange(SCROW nScRow, const XclImpXFIndex &rXFIndex)
Extended XF index.
Definition: xistyle.hxx:545
Contains all data of a XF record and a Calc item set.
Definition: xistyle.hxx:378
const ScPatternAttr & CreatePattern(bool bSkipPoolDefs=false)
Creates a Calc item set containing an item set with all cell properties.
Definition: xistyle.cxx:1245
XclImpCellBorder maBorder
All alignment attributes.
Definition: xistyle.hxx:436
bool GetLineBreak() const
Definition: xistyle.hxx:390
XclImpCellProt maProtection
Calc cell style sheet.
Definition: xistyle.hxx:434
sal_uInt16 mnXclFont
Index to number format.
Definition: xistyle.hxx:439
ScStyleSheet * mpStyleSheet
Calc item set.
Definition: xistyle.hxx:432
virtual ~XclImpXF() override
Definition: xistyle.cxx:1108
XclImpCellArea maArea
Border line style.
Definition: xistyle.hxx:437
ScPatternAttrPtr mpPattern
Definition: xistyle.hxx:431
void ReadXF8(XclImpStream &rStrm)
Definition: xistyle.cxx:1207
void ReadXF3(XclImpStream &rStrm)
Definition: xistyle.cxx:1132
void SetUsedFlags(sal_uInt8 nUsedFlags)
Sets all "attribute used" flags according to the passed mask.
Definition: xistyle.cxx:1449
sal_uInt8 GetHorAlign() const
Definition: xistyle.hxx:391
void ReadXF2(XclImpStream &rStrm)
Definition: xistyle.cxx:1112
sal_uInt16 GetFontIndex() const
Definition: xistyle.hxx:392
void ReadXF(XclImpStream &rStrm)
Reads an XF record.
Definition: xistyle.cxx:1232
void ApplyPatternToAttrVector(::std::vector< ScAttrEntry > &rAttrs, SCROW nRow1, SCROW nRow2, sal_uInt32 nForceScNumFmt)
Definition: xistyle.cxx:1339
void ReadXF5(XclImpStream &rStrm)
Definition: xistyle.cxx:1184
XclImpCellAlign maAlignment
Cell protection flags.
Definition: xistyle.hxx:435
::std::unique_ptr< ScPatternAttr > ScPatternAttrPtr
Definition: xistyle.hxx:429
const XclImpXF & operator=(const XclImpXF &)=delete
XclImpXF(const XclImpXF &)=delete
make noncopyable
void ReadXF4(XclImpStream &rStrm)
Definition: xistyle.cxx:1158
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:1411
sal_uInt16 mnXclNumFmt
Background area style.
Definition: xistyle.hxx:438
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:1427
Contains base members for XF record import/export.
Definition: xlstyle.hxx:563
void SvStream & rStrm
sal_uIntPtr sal_uLong
Contains all cell alignment attributes.
Definition: xlstyle.hxx:488
sal_uInt8 mnHorAlign
Definition: xlstyle.hxx:489
bool mbLineBreak
Indentation.
Definition: xlstyle.hxx:495
Contains background colors and pattern for a cell.
Definition: xlstyle.hxx:544
Contains color and line style for each cell border line.
Definition: xlstyle.hxx:523
Contains all cell protection attributes.
Definition: xlstyle.hxx:477
This struct helps reading and writing Excel fonts.
Definition: xlstyle.hxx:285
sal_uInt16 mnEscapem
Boldness: 400=normal, 700=bold.
Definition: xlstyle.hxx:290
Extends the XclCellAlign struct for import.
Definition: xistyle.hxx:265
void FillFromCF(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with CF record data.
Definition: xistyle.cxx:803
void FillFromXF8(sal_uInt16 nAlign, sal_uInt16 nMiscAttrib)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:792
void FillToItemSet(SfxItemSet &rItemSet, const XclImpFont *pFont, bool bSkipPoolDefs=false) const
Inserts items representing this alignment style into the item set.
Definition: xistyle.cxx:814
void FillFromXF4(sal_uInt16 nAlign)
Fills this struct with BIFF4 XF record data.
Definition: xistyle.cxx:777
void FillFromXF3(sal_uInt16 nAlign)
Fills this struct with BIFF3 XF record data.
Definition: xistyle.cxx:771
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:766
void FillFromXF5(sal_uInt16 nAlign)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:784
Extends the XclCellArea struct for import.
Definition: xistyle.hxx:325
bool mbPattUsed
true = Background color used.
Definition: xistyle.hxx:328
void FillFromXF5(sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:1040
bool mbBackUsed
true = Foreground color used.
Definition: xistyle.hxx:327
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:1024
void FillFromXF3(sal_uInt16 nArea)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:1032
void FillFromXF8(sal_uInt32 nBorder2, sal_uInt16 nArea)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:1048
void FillFromCF8(sal_uInt16 nPattern, sal_uInt16 nColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:1056
void SetUsedFlags(bool bUsed)
Sets colors and pattern state to used or unused.
Definition: xistyle.cxx:1019
XclImpCellArea()
true = Pattern used.
Definition: xistyle.cxx:1014
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:1077
Extends the XclCellBorder struct for import.
Definition: xistyle.hxx:287
void FillFromXF3(sal_uInt32 nBorder)
Fills this struct with BIFF3/BIFF4 XF record data.
Definition: xistyle.cxx:871
XclImpCellBorder()
true = Diagonal line style used.
Definition: xistyle.cxx:850
void FillFromXF5(sal_uInt32 nBorder, sal_uInt32 nArea)
Fills this struct with BIFF5/BIFF7 XF record data.
Definition: xistyle.cxx:884
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:981
void FillFromXF2(sal_uInt8 nFlags)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:861
void FillFromCF8(sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags)
Fills this struct with BIFF8 CF (conditional format) record data.
Definition: xistyle.cxx:917
void FillFromXF8(sal_uInt32 nBorder1, sal_uInt32 nBorder2)
Fills this struct with BIFF8 XF record data.
Definition: xistyle.cxx:897
bool HasAnyOuterBorder() const
Returns true, if any of the outer border lines is visible.
Definition: xistyle.cxx:934
void SetUsedFlags(bool bOuterUsed, bool bDiagUsed)
Sets outer line states and diagonal line states to used or unused.
Definition: xistyle.cxx:855
bool mbDiagUsed
true = Bottom line style used.
Definition: xistyle.hxx:292
bool mbRightUsed
true = Left line style used.
Definition: xistyle.hxx:289
bool mbBottomUsed
true = Top line style used.
Definition: xistyle.hxx:291
bool mbTopUsed
true = Right line style used.
Definition: xistyle.hxx:290
Extends the XclCellProt struct for import.
Definition: xistyle.hxx:251
void FillFromXF3(sal_uInt16 nProt)
Fills this struct with BIFF3-BIFF8 XF record data.
Definition: xistyle.cxx:755
void FillFromXF2(sal_uInt8 nNumFmt)
Fills this struct with BIFF2 XF record data.
Definition: xistyle.cxx:749
void FillToItemSet(SfxItemSet &rItemSet, bool bSkipPoolDefs=false) const
Inserts items representing this protection style into the item set.
Definition: xistyle.cxx:761
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:59
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
bool operator!=(const XclImpXFIndex &rLeft, const XclImpXFIndex &rRight)
Definition: xistyle.hxx:373
bool operator==(const XclImpXFIndex &rLeft, const XclImpXFIndex &rRight)
Definition: xistyle.hxx:370
XclFontItemType
Enumerates different types of Which-IDs for font items.
Definition: xlstyle.hxx:388
XclFontPropSetType
Enumerates different types for objects with font settings (using different property names).
Definition: xlstyle.hxx:396
const sal_uInt16 EXC_FONTESC_NONE
Definition: xlstyle.hxx:126
const sal_uInt8 EXC_STYLE_USERDEF
"Followed_Hyperlink" style.
Definition: xlstyle.hxx:235