LibreOffice Module sc (master) 1
|
Public Member Functions | |
XclExpPaletteImpl (const XclDefaultPalette &rDefPal) | |
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 RGB color for a (non-zero-based) Excel palette entry. More... | |
bool | IsDefaultPalette () const |
Returns true, if all colors of the palette are equal to default palette colors. More... | |
void | WriteBody (XclExpStream &rStrm) |
Writes the color list (contents of the palette record) to the passed stream. More... | |
void | SaveXml (XclExpXmlStream &rStrm) |
Static Public Member Functions | |
static sal_uInt32 | GetColorIdFromIndex (sal_uInt16 nIndex) |
Returns the color ID representing a fixed Excel palette index (i.e. More... | |
Private Types | |
typedef std::vector< std::unique_ptr< XclListColor > > | XclListColorList |
typedef std::shared_ptr< XclListColorList > | XclListColorListRef |
Private Member Functions | |
const Color & | GetOriginalColor (sal_uInt32 nColorId) const |
Returns the original inserted color represented by the color ID nColorId. More... | |
XclListColor * | SearchListEntry (const Color &rColor, sal_uInt32 &rnIndex) |
Searches for rColor, returns the ordered insertion index for rColor in rnIndex. More... | |
XclListColor * | CreateListEntry (const Color &rColor, sal_uInt32 nIndex) |
Creates and inserts a new color list entry at the specified list position. More... | |
void | RawReducePalette (sal_uInt32 nPass) |
Raw and fast reduction of the palette. More... | |
void | ReduceLeastUsedColor () |
Reduction of one color using advanced color merging based on color weighting. More... | |
sal_uInt32 | GetLeastUsedListColor () const |
Finds the least used color and returns its current list index. More... | |
sal_uInt32 | GetNearestListColor (const Color &rColor, sal_uInt32 nIgnore) const |
Returns the list index of the color nearest to rColor. More... | |
sal_uInt32 | GetNearestListColor (sal_uInt32 nIndex) const |
Returns the list index of the color nearest to the color with list index nIndex. More... | |
sal_Int32 | GetNearestPaletteColor (sal_uInt32 &rnIndex, const Color &rColor) const |
Returns in rnIndex the palette index of the color nearest to rColor. More... | |
sal_Int32 | GetNearPaletteColors (sal_uInt32 &rnFirst, sal_uInt32 &rnSecond, const Color &rColor) const |
Returns in rnFirst and rnSecond the palette indexes of the two colors nearest to rColor. More... | |
Static Private Member Functions | |
static sal_uInt16 | GetXclIndex (sal_uInt32 nIndex) |
Returns the Excel index of a 0-based color index. More... | |
Private Attributes | |
const XclDefaultPalette & | mrDefPal |
XclListColorListRef | mxColorList |
The default palette for the current BIFF version. More... | |
std::vector< XclColorIdData > | maColorIdDataVec |
Working color list. More... | |
std::vector< XclPaletteColor > | maPalette |
Data of all CIDs. More... | |
sal_uInt32 | mnLastIdx |
Contains resulting colors to export. More... | |
Definition at line 224 of file xestyle.cxx.
|
private |
Definition at line 300 of file xestyle.cxx.
|
private |
Definition at line 301 of file xestyle.cxx.
|
explicit |
Definition at line 315 of file xestyle.cxx.
References COL_BLACK(), EXC_COLOR_CELLTEXT, XclDefaultPalette::GetColorCount(), XclDefaultPalette::GetDefColor(), GetXclIndex(), InsertColor(), make_shared(), maPalette, mrDefPal, and nCount.
|
private |
Creates and inserts a new color list entry at the specified list position.
Definition at line 553 of file xestyle.cxx.
References mxColorList, and nIndex.
Referenced by InsertColor(), and RawReducePalette().
void XclExpPaletteImpl::Finalize | ( | ) |
Reduces the color list to the maximum count of the current BIFF version.
Definition at line 348 of file xestyle.cxx.
References EXC_PAL_MAXRAWSIZE, XclDefaultPalette::GetColorCount(), GetNearestPaletteColor(), maColorIdDataVec, maPalette, mrDefPal, mxColorList, nCount, nIndex, RawReducePalette(), ReduceLeastUsedColor(), and SAL_MAX_INT32.
Color XclExpPaletteImpl::GetColor | ( | sal_uInt16 | nXclIndex | ) | const |
Returns the RGB color for a (non-zero-based) Excel palette entry.
Definition at line 460 of file xestyle.cxx.
References EXC_COLOR_USEROFFSET, XclDefaultPalette::GetDefColor(), maPalette, and mrDefPal.
|
static |
Returns the color ID representing a fixed Excel palette index (i.e.
for auto colors).
Definition at line 343 of file xestyle.cxx.
References EXC_PAL_INDEXBASE, and nIndex.
Referenced by XclExpPalette::GetColorIdFromIndex(), and InsertColor().
sal_uInt16 XclExpPaletteImpl::GetColorIndex | ( | sal_uInt32 | nColorId | ) | const |
Returns the Excel palette index of the color with passed color ID.
Definition at line 402 of file xestyle.cxx.
References EXC_PAL_INDEXBASE, GetXclIndex(), maColorIdDataVec, and mnIndex.
Referenced by GetMixedColors().
|
private |
Finds the least used color and returns its current list index.
Definition at line 656 of file xestyle.cxx.
References mxColorList, nCount, and SAL_MAX_UINT32.
Referenced by ReduceLeastUsedColor().
void XclExpPaletteImpl::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 412 of file xestyle.cxx.
References EXC_PATT_25_PERC, EXC_PATT_50_PERC, EXC_PATT_75_PERC, EXC_PATT_SOLID, GetColorIndex(), GetNearPaletteColors(), GetOriginalColor(), GetXclIndex(), maColorIdDataVec, and maPalette.
|
private |
Returns the list index of the color nearest to rColor.
nIgnore | List index of a color which will be ignored. |
Definition at line 674 of file xestyle.cxx.
References mxColorList, nCount, and SAL_MAX_INT32.
Referenced by GetNearestListColor(), and ReduceLeastUsedColor().
|
private |
Returns the list index of the color nearest to the color with list index nIndex.
Definition at line 697 of file xestyle.cxx.
References GetNearestListColor(), mxColorList, and nIndex.
|
private |
Returns in rnIndex the palette index of the color nearest to rColor.
Searches for default colors only (colors never replaced).
Definition at line 705 of file xestyle.cxx.
References maPalette, and SAL_MAX_INT32.
Referenced by Finalize().
|
private |
Returns in rnFirst and rnSecond the palette indexes of the two colors nearest to rColor.
Definition at line 728 of file xestyle.cxx.
References maPalette, and SAL_MAX_INT32.
Referenced by GetMixedColors().
|
private |
Returns the original inserted color represented by the color ID nColorId.
Definition at line 500 of file xestyle.cxx.
References maColorIdDataVec, and maPalette.
Referenced by GetMixedColors().
|
inlinestaticprivate |
Returns the Excel index of a 0-based color index.
Definition at line 262 of file xestyle.cxx.
References EXC_COLOR_USEROFFSET, and nIndex.
Referenced by GetColorIndex(), GetMixedColors(), IsDefaultPalette(), and XclExpPaletteImpl().
sal_uInt32 XclExpPaletteImpl::InsertColor | ( | const Color & | rColor, |
XclExpColorType | eType, | ||
sal_uInt16 | nAutoDefault = 0 |
||
) |
Inserts the color into the list and updates weighting.
nAutoDefault | The Excel palette index for automatic color. |
Definition at line 329 of file xestyle.cxx.
References COL_AUTO(), CreateListEntry(), eType, GetColorIdFromIndex(), and SearchListEntry().
Referenced by XclExpPaletteImpl().
bool XclExpPaletteImpl::IsDefaultPalette | ( | ) | const |
Returns true, if all colors of the palette are equal to default palette colors.
Definition at line 471 of file xestyle.cxx.
References XclDefaultPalette::GetDefColor(), GetXclIndex(), maPalette, and mrDefPal.
|
private |
Raw and fast reduction of the palette.
Definition at line 560 of file xestyle.cxx.
References CreateListEntry(), maColorIdDataVec, mxColorList, and SearchListEntry().
Referenced by Finalize().
|
private |
Reduction of one color using advanced color merging based on color weighting.
Definition at line 625 of file xestyle.cxx.
References GetLeastUsedListColor(), GetNearestListColor(), maColorIdDataVec, and mxColorList.
Referenced by Finalize().
void XclExpPaletteImpl::SaveXml | ( | XclExpXmlStream & | rStrm | ) |
Definition at line 486 of file xestyle.cxx.
References maPalette, rStrm, and XclXmlUtils::ToOString().
|
private |
Searches for rColor, returns the ordered insertion index for rColor in rnIndex.
Definition at line 507 of file xestyle.cxx.
References mnLastIdx, mxColorList, and size.
Referenced by InsertColor(), and RawReducePalette().
void XclExpPaletteImpl::WriteBody | ( | XclExpStream & | rStrm | ) |
Writes the color list (contents of the palette record) to the passed stream.
Definition at line 479 of file xestyle.cxx.
|
private |
Working color list.
Definition at line 306 of file xestyle.cxx.
Referenced by Finalize(), GetColorIndex(), GetMixedColors(), GetOriginalColor(), RawReducePalette(), and ReduceLeastUsedColor().
|
private |
Data of all CIDs.
Definition at line 308 of file xestyle.cxx.
Referenced by Finalize(), GetColor(), GetMixedColors(), GetNearestPaletteColor(), GetNearPaletteColors(), GetOriginalColor(), IsDefaultPalette(), SaveXml(), WriteBody(), and XclExpPaletteImpl().
|
private |
Contains resulting colors to export.
Definition at line 309 of file xestyle.cxx.
Referenced by SearchListEntry().
|
private |
Definition at line 303 of file xestyle.cxx.
Referenced by Finalize(), GetColor(), IsDefaultPalette(), and XclExpPaletteImpl().
|
private |
The default palette for the current BIFF version.
Definition at line 304 of file xestyle.cxx.
Referenced by CreateListEntry(), Finalize(), GetLeastUsedListColor(), GetNearestListColor(), RawReducePalette(), ReduceLeastUsedColor(), and SearchListEntry().