LibreOffice Module sc (master) 1
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
XclExpPalette Class Reference

Stores all used colors in the document. More...

#include <xestyle.hxx>

Inheritance diagram for XclExpPalette:
[legend]
Collaboration diagram for XclExpPalette:
[legend]

Public Member Functions

 XclExpPalette (const XclExpRoot &rRoot)
 
virtual ~XclExpPalette () override
 
sal_uInt32 InsertColor (const Color &rColor, XclExpColorType eType, sal_uInt16 nAutoDefault=0)
 Inserts the color into the list and updates weighting. More...
 
void Finalize ()
 Reduces the color list to the maximum count of the current BIFF version. More...
 
sal_uInt16 GetColorIndex (sal_uInt32 nColorId) const
 Returns the Excel palette index of the color with passed color ID. More...
 
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. More...
 
Color GetColor (sal_uInt16 nXclIndex) const
 Returns the color for a (non-zero-based) Excel palette entry. More...
 
virtual void Save (XclExpStream &rStrm) override
 Saves the PALETTE record, if it differs from the default palette. More...
 
virtual void SaveXml (XclExpXmlStream &rStrm) override
 
- Public Member Functions inherited from XclDefaultPalette
 XclDefaultPalette (const XclRoot &rRoot)
 
sal_uInt32 GetColorCount () const
 Returns the color count in the current palette. More...
 
Color GetDefColor (sal_uInt16 nXclIndex) const
 Returns the default color for a (non-zero-based) Excel color or COL_AUTO on error. More...
 
bool IsSystemColor (sal_uInt16 nXclIndex) const
 Returns true, if the passed Excel color index is a system color. More...
 
- Public Member Functions inherited from XclExpRecord
 XclExpRecord (sal_uInt16 nRecId=EXC_ID_UNKNOWN, std::size_t nRecSize=0)
 
 XclExpRecord (XclExpRecord const &)=default
 
virtual ~XclExpRecord () override
 
sal_uInt16 GetRecId () const
 Returns the current record ID. More...
 
std::size_t GetRecSize () const
 Returns the current record size prediction. More...
 
void SetRecId (sal_uInt16 nRecId)
 Sets a new record ID. More...
 
void SetRecSize (std::size_t nRecSize)
 Sets a new record size prediction. More...
 
void AddRecSize (std::size_t nRecSize)
 Adds a size value to the record size prediction. More...
 
void SetRecHeader (sal_uInt16 nRecId, std::size_t nRecSize)
 Sets record ID and size with one call. More...
 
virtual void Save (XclExpStream &rStrm) override
 Writes the record header and calls WriteBody(). More...
 
- Public Member Functions inherited from XclExpRecordBase
 XclExpRecordBase ()
 
 XclExpRecordBase (XclExpRecordBase const &)
 
 XclExpRecordBase (XclExpRecordBase &&)
 
XclExpRecordBaseoperator= (XclExpRecordBase const &)
 
XclExpRecordBaseoperator= (XclExpRecordBase &&) noexcept
 
virtual ~XclExpRecordBase ()
 
virtual void Save (XclExpStream &rStrm)
 Overwrite this method to do any operation while saving the record. More...
 
virtual void SaveXml (XclExpXmlStream &rStrm)
 
- Public Member Functions inherited from salhelper::SimpleReferenceObject
 SimpleReferenceObject ()
 
void acquire ()
 
void release ()
 

Static Public Member Functions

static sal_uInt32 GetColorIdFromIndex (sal_uInt16 nIndex)
 Returns the color ID representing a fixed Excel palette index (i.e. More...
 
- Static Public Member Functions inherited from salhelper::SimpleReferenceObject
static void * operator new (std::size_t nSize)
 
static void * operator new (std::size_t nSize, std::nothrow_t const &rNothrow)
 
static void operator delete (void *pPtr)
 
static void operator delete (void *pPtr, std::nothrow_t const &rNothrow)
 

Private Types

typedef std::shared_ptr< XclExpPaletteImplXclExpPaletteImplRef
 

Private Member Functions

virtual void WriteBody (XclExpStream &rStrm) override
 Writes the contents of the PALETTE record. More...
 

Private Attributes

XclExpPaletteImplRef mxImpl
 

Additional Inherited Members

virtual void WriteBody (XclExpStream &rStrm)
 Writes the body of the record (without record header). More...
 
- Protected Member Functions inherited from salhelper::SimpleReferenceObject
virtual ~SimpleReferenceObject () COVERITY_NOEXCEPT_FALSE
 
- Protected Attributes inherited from salhelper::SimpleReferenceObject
oslInterlockedCount m_nCount
 

Detailed Description

Stores all used colors in the document.

Supports color reduction to the maximum count of the current BIFF version. An instance of this class collects all colors in the conversion phase of the export, using the InsertColor() function. It returns a unique identifier for each passed color.

After the entire document is converted, the Finalize() function will reduce the palette to the number of colors supported by the current BIFF version.

Then, in the streaming phase, the functions GetColorIndex() and GetMixedColors() return the real Excel palette index for all color identifiers.

Definition at line 76 of file xestyle.hxx.

Member Typedef Documentation

◆ XclExpPaletteImplRef

typedef std::shared_ptr< XclExpPaletteImpl > XclExpPalette::XclExpPaletteImplRef
private

Definition at line 116 of file xestyle.hxx.

Constructor & Destructor Documentation

◆ XclExpPalette()

XclExpPalette::XclExpPalette ( const XclExpRoot rRoot)
explicit

◆ ~XclExpPalette()

XclExpPalette::~XclExpPalette ( )
overridevirtual

Definition at line 764 of file xestyle.cxx.

Member Function Documentation

◆ Finalize()

void XclExpPalette::Finalize ( )

Reduces the color list to the maximum count of the current BIFF version.

Definition at line 778 of file xestyle.cxx.

References mxImpl.

Referenced by XclExpRoot::InitializeSave().

◆ GetColor()

Color XclExpPalette::GetColor ( sal_uInt16  nXclIndex) const

Returns the color for a (non-zero-based) Excel palette entry.

Returns
The color from current or default palette or COL_AUTO, if nothing else found.

Definition at line 795 of file xestyle.cxx.

References mxImpl.

Referenced by XclExpCellBorder::SaveXml(), and XclExpCellArea::SaveXml().

◆ GetColorIdFromIndex()

sal_uInt32 XclExpPalette::GetColorIdFromIndex ( sal_uInt16  nIndex)
static

◆ GetColorIndex()

sal_uInt16 XclExpPalette::GetColorIndex ( sal_uInt32  nColorId) const

◆ GetMixedColors()

void XclExpPalette::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.

@descr If rnXclPattern contains a solid pattern, this function tries to find the two best fitting colors and a mix pattern (25%, 50% or 75%) for nForeColorId. This will result in a better approximation to the passed foreground color.

Definition at line 788 of file xestyle.cxx.

References mxImpl.

Referenced by XclExpCellArea::SetFinalColors().

◆ InsertColor()

sal_uInt32 XclExpPalette::InsertColor ( const Color rColor,
XclExpColorType  eType,
sal_uInt16  nAutoDefault = 0 
)

Inserts the color into the list and updates weighting.

Parameters
nAutoDefaultThe Excel palette index for automatic color.
Returns
A unique ID for this color.

Definition at line 768 of file xestyle.cxx.

References eType, and mxImpl.

Referenced by XclExpChLineFormat::Convert(), XclExpChAreaFormat::Convert(), XclExpCellArea::FillFromItemSet(), XclExpChEscherFormat::RegisterColor(), XclExpChMarkerFormat::RegisterColors(), XclExpCFImpl::XclExpCFImpl(), XclExpFont::XclExpFont(), and XclExpTabViewSettings::XclExpTabViewSettings().

◆ Save()

void XclExpPalette::Save ( XclExpStream rStrm)
overridevirtual

Saves the PALETTE record, if it differs from the default palette.

Reimplemented from XclExpRecord.

Definition at line 800 of file xestyle.cxx.

References mxImpl, rStrm, and XclExpRecord::Save().

◆ SaveXml()

void XclExpPalette::SaveXml ( XclExpXmlStream rStrm)
overridevirtual

Reimplemented from XclExpRecordBase.

Definition at line 806 of file xestyle.cxx.

References mxImpl, and rStrm.

◆ WriteBody()

void XclExpPalette::WriteBody ( XclExpStream rStrm)
overrideprivatevirtual

Writes the contents of the PALETTE record.

Reimplemented from XclExpRecord.

Definition at line 812 of file xestyle.cxx.

References mxImpl, and rStrm.

Member Data Documentation

◆ mxImpl

XclExpPaletteImplRef XclExpPalette::mxImpl
private

The documentation for this class was generated from the following files: