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...
 
- Public Member Functions inherited from XclExpRecordBase
 XclExpRecordBase ()
 
 XclExpRecordBase (XclExpRecordBase const &)
 
 XclExpRecordBase (XclExpRecordBase &&)
 
XclExpRecordBaseoperator= (XclExpRecordBase const &)
 
XclExpRecordBaseoperator= (XclExpRecordBase &&) noexcept
 
virtual ~XclExpRecordBase ()
 
- 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 voidoperator new (std::size_t nSize)
 
static voidoperator 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

- 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

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

Definition at line 116 of file xestyle.hxx.

Constructor & Destructor Documentation

XclExpPalette::XclExpPalette ( const XclExpRoot rRoot)
explicit
XclExpPalette::~XclExpPalette ( )
overridevirtual

Definition at line 759 of file xestyle.cxx.

Member Function Documentation

void XclExpPalette::Finalize ( )

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

Definition at line 773 of file xestyle.cxx.

References mxImpl.

Referenced by XclExpRoot::InitializeSave().

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 790 of file xestyle.cxx.

References mxImpl.

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

sal_uInt32 XclExpPalette::GetColorIdFromIndex ( sal_uInt16  nIndex)
static
sal_uInt16 XclExpPalette::GetColorIndex ( sal_uInt32  nColorId) const
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.

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 783 of file xestyle.cxx.

References mxImpl.

Referenced by XclExpCellArea::SetFinalColors().

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 763 of file xestyle.cxx.

References mxImpl.

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

void XclExpPalette::Save ( XclExpStream rStrm)
overridevirtual

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

Reimplemented from XclExpRecord.

Definition at line 795 of file xestyle.cxx.

References mxImpl, and XclExpRecord::Save().

void XclExpPalette::SaveXml ( XclExpXmlStream rStrm)
overridevirtual

Reimplemented from XclExpRecordBase.

Definition at line 801 of file xestyle.cxx.

References mxImpl.

void XclExpPalette::WriteBody ( XclExpStream rStrm)
overrideprivatevirtual

Writes the contents of the PALETTE record.

Reimplemented from XclExpRecord.

Definition at line 807 of file xestyle.cxx.

References mxImpl.

Member Data Documentation

XclExpPaletteImplRef XclExpPalette::mxImpl
private

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