20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XESTYLE_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XESTYLE_HXX
99 sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx,
sal_uInt8& rnXclPattern,
100 sal_uInt32 nForeColorId, sal_uInt32 nBackColorId )
const;
198 virtual bool Equals(
const XclFontData& rFontData, sal_uInt32 nHash )
const override;
260 explicit XclExpNumFmt( sal_uInt32 nScNumFmt, sal_uInt16 nXclNumFmt,
const OUString& rFrmt ) :
261 mnScNumFmt( nScNumFmt ), mnXclNumFmt( nXclNumFmt ), maNumFmtString( rFrmt ) {}
281 sal_uInt16
Insert( sal_uInt32 nScNumFmt );
316 void FillToXF3( sal_uInt16& rnProt )
const;
330 bool bForceLineBreak,
XclBiff eBiff,
bool bStyle =
false );
333 void FillToXF5( sal_uInt16& rnAlign )
const;
335 void FillToXF8( sal_uInt16& rnAlign, sal_uInt16& rnMiscAttrib )
const;
361 void FillToXF5( sal_uInt32& rnBorder, sal_uInt32& rnArea )
const;
363 void FillToXF8( sal_uInt32& rnBorder1, sal_uInt32& rnBorder2 )
const;
366 void FillToCF8( sal_uInt16& rnLine, sal_uInt32& rnColor )
const;
389 void FillToXF5( sal_uInt32& rnArea )
const;
391 void FillToXF8( sal_uInt32& rnBorder2, sal_uInt16& rnArea )
const;
394 void FillToCF8( sal_uInt16& rnPattern, sal_uInt16& rnColor )
const;
434 bool bForceLineBreak =
false );
453 sal_uInt32 nScForceNumFmt,
454 sal_uInt16 nForceXclFont,
455 bool bForceLineBreak )
const;
467 void SetXmlIds( sal_uInt32 nBorderId, sal_uInt32 nFillId );
503 sal_uInt32 nForceScNumFmt,
504 sal_uInt16 nForceXclFont,
505 bool bForceLineBreak,
528 void SetFont( sal_uInt16 nXclFont );
538 explicit XclExpStyle( sal_uInt32 nXFId,
const OUString& rStyleName );
591 sal_uInt16 nForceXclFont,
592 bool bForceLineBreak );
602 sal_uInt32 nForceScNumFmt,
603 bool bForceLineBreak );
619 sal_uInt16
GetXFIndex( sal_uInt32 nXFId )
const;
635 sal_uInt16 nForceXclFont,
bool bForceLineBreak )
const;
645 sal_uInt32 nForceScNumFmt,
646 sal_uInt16 nForceXclFont,
bool bForceLineBreak );
708 std::map<FindKey, std::vector<sal_uInt32>>
725 XclExpDxf(
const XclExpRoot& rRoot, std::unique_ptr<XclExpCellAlign> pAlign, std::unique_ptr<XclExpCellBorder> pBorder,
726 std::unique_ptr<XclExpDxfFont> pFont, std::unique_ptr<XclExpNumFmt> pNumberFmt,
727 std::unique_ptr<XclExpCellProt> pProt, std::unique_ptr<XclExpColor> pColor);
747 sal_Int32
GetDxfId(
const OUString& rName);
sal_uInt16 GetXclFont() const
std::unique_ptr< XclExpNumFmt > mpNumberFmt
virtual void SaveXml(XclExpXmlStream &rStrm) override
void FillToXF8(sal_uInt16 &rnAlign, sal_uInt16 &rnMiscAttrib) const
Fills the data to the passed fields of a BIFF8 XF record.
void SaveXml(XclExpXmlStream &rStrm) const
XclExpBuiltInMap maBuiltInMap
List of all STYLE records.
Stores all XF records (cell formats and cell styles) in the document.
virtual void Save(XclExpStream &rStrm) override
Writes all FORMAT records contained in this buffer.
vcl::Font GetFontFromItemSet(const XclExpRoot &rRoot, const SfxItemSet &rItemSet, sal_Int16 nScript)
Returns a VCL font object filled from the passed item set.
XclExpColorType
For internal use only. TODO:moggi: find a better/correct value.
XclBiff
An enumeration for all Excel file format types (BIFF types).
XclExpDxf(const XclExpRoot &rRoot, std::unique_ptr< XclExpCellAlign > pAlign, std::unique_ptr< XclExpCellBorder > pBorder, std::unique_ptr< XclExpDxfFont > pFont, std::unique_ptr< XclExpNumFmt > pNumberFmt, std::unique_ptr< XclExpCellProt > pProt, std::unique_ptr< XclExpColor > pColor)
sal_uInt32 mnStdFmt
Replacement table.
sal_uInt16 mnXclFont
Calc number format index.
XclExpXFList::RecordRefType XclExpXFRef
static FindKey ToFindKey(XclExpXF const &)
sal_uInt32 GetStandardFormat() const
Returns the core index of the current standard number format.
virtual ~XclExpNumFmtBuffer() override
This class is used to export Excel record streams.
XclExpXFId maXFId
Name of the cell style.
Background area of a cell.
XclExpRecordList< XclExpXF > XclExpXFList
const size_t EXC_FONTLIST_NOTFOUND
XclExpNumFmtVec maFormatMap
Special number formatter for conversion.
std::map< OUString, sal_Int32 > maStyleNameToDxfId
void SaveXml(XclExpXmlStream &rStrm) const
virtual void Save(XclExpStream &rStrm) override
Writes all FONT records contained in this buffer.
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpPaletteImplRef mxImpl
virtual void SaveXml(XclExpXmlStream &rStrm) override
sal_uInt32 FindXF(const ScPatternAttr &rPattern, sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak) const
Returns the XF ID of the cell XF containing the passed format.
void SaveXml(XclExpXmlStream &rStrm) const
const XclExpCellBorder & GetBorderData() const
Returns the cell border settings of this XF.
OUString maNumFmtString
Resulting Excel format index.
const XclExpCellArea & GetAreaData() const
Returns the cell fill settings of this XF.
XclExpPalette(const XclExpRoot &rRoot)
sal_uInt16 Insert(const XclFontData &rFontData, XclExpColorType eColorType, bool bAppFont=false)
Inserts a new font with the passed font data into the buffer if not present.
const SfxItemSet * GetItemSet() const
void FillToXF3(sal_uInt16 &rnProt) const
Fills the data to the passed fields of a BIFF3-BIFF8 XF record.
This struct helps reading and writing Excel fonts.
bool FillFromItemSet(const SfxItemSet &rItemSet, XclExpPalette &rPalette, bool bStyle)
Fills the area attributes from the passed item set.
void GetMixedColors(sal_uInt16 &rnXclForeIx, sal_uInt16 &rnXclBackIx, sal_uInt8 &rnXclPattern, sal_uInt32 nForeColorId, sal_uInt32 nBackColorId) const
Returns a foreground and background color for the two passed color IDs.
::std::vector< XclExpNumFmt > XclExpNumFmtVec
XclExpCellAlign maAlignment
Cell protection flags.
void SetXmlIds(sal_uInt32 nBorderId, sal_uInt32 nFillId)
OUString GetFormatCode(sal_uInt32 nScNumFmt)
sal_uInt32 GetFontColorId() const
Returns the font color identifier.
void InsertUserStyles()
Inserts an XF and a STYLE record for all user defined style sheets.
Stores all default colors for a specific BIFF version.
void SaveXml(XclExpXmlStream &rStrm) const
XclExpXFBuffer(const XclExpRoot &rRoot)
const sal_uInt16 EXC_ID_DXFS
For internal use only.
sal_uInt32 mnTopColorId
Color ID for right line.
sal_uInt32 mnBottomColorId
Color ID for top line.
ScfUInt16Vec maXFIndexVec
Contained elements describe built-in XFs.
std::unique_ptr< NfKeywordTable > mpKeywordTable
XclExpFontBuffer(const XclExpRoot &rRoot)
XclExpXFId()
Real Excel XF index.
void FillToXF5(sal_uInt16 &rnAlign) const
Fills the data to the passed fields of a BIFF5/BIFF7 XF record.
sal_uInt32 mnParentXFId
Background area style.
XclExpCellArea maArea
Border line style.
std::shared_ptr< XclExpPaletteImpl > XclExpPaletteImplRef
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the STYLE record.
const XclExpXF * GetXFById(sal_uInt32 nXFId) const
Returns an XF record by its unique identifier.
const sal_uInt8 EXC_STYLE_USERDEF
"Followed_Hyperlink" style.
::std::vector< XclExpCellBorder > XclExpBorderList
static sal_uInt32 GetXFIdFromIndex(sal_uInt16 nXFIndex)
Returns the XF identifier representing a fixed Excel XF index (e.g.
XclExpNumFmt(sal_uInt32 nScNumFmt, sal_uInt16 nXclNumFmt, const OUString &rFrmt)
format string
virtual void Save(XclExpStream &rStrm) override
Saves the PALETTE record, if it differs from the default palette.
XclExpFontList maFontList
void SetFinalColors()
Sets the resulting Excel palette index from all used color IDs (border and area). ...
const XclExpCellProt & GetProtectionData() const
Returns the cell protection settings of this XF.
Extends the XclCellArea struct for export.
const XclExpFont * GetFont(sal_uInt16 nXclFont) const
Returns the specified font from font list.
ScfUInt16Vec maStyleIndexes
Maps XF IDs to XF indexes.
sal_uInt32 InsertCellXF(const ScPatternAttr *pPattern, sal_Int16 nScript, sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak)
Tries to find the XF record containing the passed format or inserts a new record. ...
sal_uInt16 mnXclNumFmt
Excel font index.
sal_uInt32 AppendBuiltInXF(XclExpXFRef const &xXF, sal_uInt8 nStyleId, sal_uInt8 nLevel=EXC_STYLE_NOLEVEL)
Inserts a built-in XF record without a STYLE record and returns the XF ID.
void FillToXF5(sal_uInt32 &rnArea) const
Fills the data to the passed fields of a BIFF5/BIFF7 XF record.
Access to global data from other classes.
sal_uInt32 InsertStyle(const SfxStyleSheetBase *pStyleSheet)
Inserts the passed cell style.
::std::vector< XclExpCellArea > XclExpFillList
bool Equals(const ScPatternAttr &rPattern, sal_uInt32 nScForceNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak) const
Returns true, if this XF record represents the passed cell formatting.
const sal_uInt16 EXC_FONT_NOTFOUND
Application font index.
virtual bool Equals(const XclFontData &rFontData, sal_uInt32 nHash) const
Compares this font with the passed font data.
sal_Int32 GetXmlCellIndex(sal_uInt32 nXFId) const
size_t mnXclMaxSize
List of all FONT records.
constexpr sal_uInt32 NUMBERFORMAT_ENTRY_NOT_FOUND
void Init(const SfxItemSet &rItemSet, sal_Int16 nScript, sal_uInt32 nForceScNumFmt, sal_uInt16 nForceXclFont, bool bForceLineBreak, bool bDefStyle)
Fills all members from the passed item set.
void FillToXF5(sal_uInt32 &rnBorder, sal_uInt32 &rnArea) const
Fills the data to the passed fields of a BIFF5/BIFF7 XF record.
sal_uInt32 mnScNumFmt
XF ID of parent XF record.
bool operator<(const FindKey &other) const
virtual void SaveXml(XclExpXmlStream &rStrm) override
Base class for all Excel records.
void ConvertXFIndex(const XclExpRoot &rRoot)
Converts the XF identifier in mnXFId to an Excel XF index and stores it in mnXFIndex.
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the FONT record.
Stores all number formats used in the document.
Extends the XclCellAlign struct for export.
sal_uInt32 InsertColor(const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
Inserts the color into the list and updates weighting.
Helper functions for font export.
XclExpFont(const XclExpRoot &rRoot, const XclFontData &rFontData, XclExpColorType eColorType)
bool FillFromItemSet(const SfxItemSet &rItemSet, bool bStyle=false)
Fills the protection attributes from the passed item set.
void InitDefaultFonts()
Initializes the default fonts for the current BIFF version.
std::vector< std::unique_ptr< XclExpDxf > > DxfContainer
XclExpCellBorder()
Color ID for diagonal line(s).
sal_uInt32 AppendBuiltInXFWithStyle(XclExpXFRef const &xXF, sal_uInt8 nStyleId, sal_uInt8 nLevel=EXC_STYLE_NOLEVEL)
Inserts a built-in XF and STYLE record and returns the XF ID.
sal_uInt32 mnColorId
All font attributes.
void SetFinalColors(const XclExpPalette &rPalette)
Fills the mn***Color base members from the mn***ColorId members.
virtual void Save(XclExpStream &rStrm) override
Writes all XF records contained in this buffer.
const XclFontData & GetFontData() const
Returns read-only access to font data.
::std::unique_ptr< SvNumberFormatter > SvNumberFormatterPtr
XclExpXmlStyleSheet(const XclExpRoot &rRoot)
composite key for the find-map, so we can do partial key searching
Stores all data of an Excel font and provides export of FONT records.
Represents a default XF record.
sal_uInt32 GetScNumFmt() const
Extends the XclCellBorder struct for export.
Contains all cell protection attributes.
virtual void SaveXml(XclExpXmlStream &rStrm) override
sal_uInt16 GetColorIndex(sal_uInt32 nColorId) const
Returns the Excel palette index of the color with passed color ID.
std::unique_ptr< XclExpCellProt > mpProt
sal_uInt32 mnDiagColorId
Color ID for bottom line.
Contains all cell alignment attributes.
XclExpNumFmtBuffer(const XclExpRoot &rRoot)
std::unique_ptr< XclExpDxfFont > mpFont
const sal_uInt16 EXC_ID_FONTLIST
sal_uInt32 InsertStyleXF(const SfxStyleSheetBase &rStyleSheet)
Inserts the passed cell style.
sal_uInt16 Insert(sal_uInt32 nScNumFmt)
Inserts a number format into the format buffer.
bool mbPredefined
Level for RowLevel/ColLevel styles.
XclExpFillList maFills
List of borders used by XF records.
void Finalize()
Reduces the XF record list to the maximum allowed number of records.
void SetNumFmt(sal_uInt16 nXclNumFmt)
Sets the Excel number format index.
const XclFontData & GetAppFontData() const
Returns the application font data of this file, needed e.g.
Represents an XF record which contains all formatting data of a cell or cell style.
sal_uInt32 mnHash
Unique color ID for text color.
Stores all used colors in the document.
void WriteFormatRecord(XclExpStream &rStrm, sal_uInt16 nXclNumFmt, const OUString &rFormatStr)
Writes the FORMAT record with index nXclIx and format string rFormatStr.
std::unique_ptr< NfKeywordTable > mpKeywordTable
Maps core formats to Excel indexes.
void SaveXFXml(XclExpXmlStream &rStrm, XclExpXF &rXF)
sal_uInt32 FindBuiltInXF(sal_uInt8 nStyleId, sal_uInt8 nLevel) const
Returns the XF ID of a built-in style XF, searches by style identifier.
sal_uInt8 mnLevel
Built-in style identifier.
std::unique_ptr< XclExpCellAlign > mpAlign
const sal_uInt8 EXC_STYLE_NOLEVEL
Number of outline level styles.
virtual ~XclExpDxf() override
void InsertDefaultRecords()
Inserts all default XF and STYLE records.
void FillToCF8(sal_uInt16 &rnPattern, sal_uInt16 &rnColor) const
Fills the data to the passed fields of a BIFF8 CF (conditional format) record.
const SfxItemSet * mpItemSet
XclExpBorderList maBorders
List of XF records in XF index order.
virtual bool Equals(const XclFontData &rFontData, sal_uInt32 nHash) const override
Returns always false to never find this font while searching the font list.
virtual ~XclExpPalette() override
virtual void Save(XclExpStream &rStrm) override
Skips writing this record.
ScfUInt16Vec maCellIndexes
Maps XF IDs to OOXML Style indexes.
sal_uInt8 GetUsedFlags() const
Returns the bits specifying the used attributes.
void Finalize()
Reduces the color list to the maximum count of the current BIFF version.
XclExpCellArea()
Background color ID.
void FillToCF8(sal_uInt16 &rnLine, sal_uInt32 &rnColor) const
Fills the data to the passed fields of a BIFF8 CF (conditional format) record.
sal_uInt8 mnLevel
Built-in style identifier.
void SaveXml(XclExpXmlStream &rStrm)
const sal_uInt16 EXC_ID_XFLIST
For internal use only.
bool FillFromItemSet(const SfxItemSet &rItemSet, XclExpPalette &rPalette, XclBiff eBiff, bool bStyle=false)
Fills the border attributes from the passed item set.
Stores a core number format index with corresponding Excel format index.
void WriteBody8(XclExpStream &rStrm)
bool IsBuiltIn() const
Returns true, if this record represents an Excel built-in style.
sal_uInt32 InsertWithNumFmt(const ScPatternAttr *pPattern, sal_Int16 nScript, sal_uInt32 nForceScNumFmt, bool bForceLineBreak)
Finds or creates a cell XF record for the passed item set, with custom number format.
sal_uInt16 mnXclNumFmt
Core index of the number format.
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the XF record.
Extends the XclCellProt struct for export.
bool FillFromItemSet(const SfxItemSet &rItemSet)
Contains color and line style for each cell border line.
bool CheckItems(const XclExpRoot &rRoot, const SfxItemSet &rItemSet, sal_Int16 nScript, bool bDeep)
Returns true, if at least one font related item is set in the passed item set.
XclExpXFList maSortedXFList
Maps XF IDs to OOXML Cell indexes.
sal_uInt32 mnRightColorId
Color ID for left line.
static sal_uInt32 GetDefCellXFId()
Returns the XF identifier representing the default cell XF.
void Initialize()
Inserts predefined built-in styles and user-defined styles.
sal_Int32 mnFillId
OOXML Border Index.
std::unique_ptr< XclExpColor > mpColor
XclExpBuiltInInfo()
true = STYLE record created.
const XclExpCellAlign & GetAlignmentData() const
Returns the alignment settings of this XF.
std::map< FindKey, std::vector< sal_uInt32 > > maXFFindMap
List of all XF records.
bool FillFromItemSet(const SfxItemSet &rItemSet, bool bForceLineBreak, XclBiff eBiff, bool bStyle=false)
Fills the alignment attributes from the passed item set.
Represents a STYLE record containing the data of a cell style.
void SetFinalColors(const XclExpPalette &rPalette)
Fills the mn***Color base members from the mn***ColorId members.
virtual void SaveXml(XclExpXmlStream &rStrm) override
size_t Find(const XclFontData &rFontData)
Tries to find the passed font and returns the current list index.
void FillToXF8(sal_uInt32 &rnBorder2, sal_uInt16 &rnArea) const
Fills the data to the passed fields of a BIFF8 XF record.
void FillToXF8(sal_uInt32 &rnBorder1, sal_uInt32 &rnBorder2) const
Fills the data to the passed fields of a BIFF8 XF record.
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpStyle(sal_uInt32 nXFId, const OUString &rStyleName)
sal_uInt16 mnXclOffset
Key for standard number format.
XclExpDefaultXF(const XclExpRoot &rRoot, bool bCellXF)
::std::map< sal_uInt32, XclExpBuiltInInfo > XclExpBuiltInMap
Stores the data of all fonts used in the document.
void SaveXml(XclExpXmlStream &rStrm) const
A combination of unique XF identifier with real Excel XF index.
XclExpCellProt maProtection
Pointer to the item set (we do not own it).
sal_Int32 mnBorderId
Excel number format index.
sal_uInt32 mnBackColorId
Foreground color ID.
sal_uInt32 Insert(const ScPatternAttr *pPattern, sal_Int16 nScript)
Finds or creates a cell XF record for the passed item set.
Used as placeholder for font index 4, which is not used in Excel.
Contains background colors and pattern for a cell.
Extended info about a built-in XF.
SvNumberFormatterPtr mxFormatter
sal_uInt16 mnXFIndex
Temporary XF identifier.
virtual void WriteBody(XclExpStream &rStrm) override
Writes the contents of the PALETTE record.
XclExpRecordList< XclExpStyle > maStyleList
map of itemset to vector of positions, to speed up find
bool Equals(const XclXFBase &rCmp) const
Returns true, if this object is equal to the passed.
void WriteBody5(XclExpStream &rStrm)
XclExpRecordList< XclExpFont > XclExpFontList
virtual void SaveXml(XclExpXmlStream &rStrm) override
virtual void SaveXml(XclExpXmlStream &rStrm) override
sal_Int32 GetXmlStyleIndex(sal_uInt32 nXFId) const
const sal_uInt16 EXC_ID_FORMATLIST
For internal use only.
bool mbHasStyleRec
true = XF still predefined.
void SaveXmlExt(XclExpXmlStream &rStrm)
sal_uInt8 mnStyleId
XF identifier for style formatting.
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpBlindFont(const XclExpRoot &rRoot)
const SfxItemSet * mpItemSet
static sal_uInt32 GetColorIdFromIndex(sal_uInt16 nIndex)
Returns the color ID representing a fixed Excel palette index (i.e.
sal_Int32 GetDxfId(const OUString &rName)
ScDxfFont GetDxfFontFromItemSet(const XclExpRoot &rRoot, const SfxItemSet &rSet)
Get a dxf related font object from the item set.
void InitDefault()
Initializes with default values.
Color GetColor(sal_uInt16 nXclIndex) const
Returns the color for a (non-zero-based) Excel palette entry.
Contains base members for XF record import/export.
virtual void SaveXml(XclExpXmlStream &rStrm) override
void SetFont(sal_uInt16 nXclFont)
Sets the Excel font index.
void AddBorderAndFill(const XclExpXF &rXF)
XclExpFontList::RecordRefType XclExpFontRef
sal_uInt32 InsertWithFont(const ScPatternAttr *pPattern, sal_Int16 nScript, sal_uInt16 nForceXclFont, bool bForceLineBreak)
Finds or creates a cell XF record for the passed item set.
XclExpDxfs(const XclExpRoot &rRoot)
Base class for single records with any content.
Text color in a form control.
XclExpCellBorder maBorder
All alignment attributes.
void AppendXFIndex(sal_uInt32 nXFId)
Appends a XF index to the internal ID<->index maps.
sal_Int16 GetFirstUsedScript(const XclExpRoot &rRoot, const SfxItemSet &rItemSet)
Returns the script type of the first font item found in the item set and its parents.
sal_uInt16 GetXFIndex(sal_uInt32 nXFId) const
Returns the Excel XF index of the XF record with passed XF ID.
XclExpDxfFont(const XclExpRoot &rRoot, const SfxItemSet &rItemSet)
XclExpXF(const XclExpRoot &rRoot, const ScPatternAttr &rPattern, sal_Int16 nScript, sal_uInt32 nScForceNumFmt=NUMBERFORMAT_ENTRY_NOT_FOUND, sal_uInt16 nForceXclFont=EXC_FONT_NOTFOUND, bool bForceLineBreak=false)
Constructs a cell XF record from the passed Calc cell formatting.
std::unique_ptr< XclExpCellBorder > mpBorder