LibreOffice Module oox (master) 1
|
#include <color.hxx>
Classes | |
struct | Transformation |
Public Member Functions | |
Color () | |
void | setUnused () |
Sets the color to unused state. More... | |
void | setSrgbClr (sal_Int32 nRgb) |
Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. More... | |
void | setSrgbClr (::Color nRgb) |
void | setScrgbClr (sal_Int32 nR, sal_Int32 nG, sal_Int32 nB) |
Sets the percentual RGB values from the a:scrgbClr element. More... | |
void | setHslClr (sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum) |
Sets the HSL values from the a:hslClr element. More... | |
void | setPrstClr (sal_Int32 nToken) |
Sets a predefined color from the a:prstClr element. More... | |
void | setHighlight (sal_Int32 nToken) |
Sets a predefined color from the w:highlight element. More... | |
void | setSchemeClr (sal_Int32 nToken) |
Sets a scheme color from the a:schemeClr element. More... | |
void | setSchemeName (const OUString &sSchemeName) |
Sets the scheme name from the a:schemeClr element for interoperability purposes. More... | |
void | setSysClr (sal_Int32 nToken, sal_Int32 nLastRgb) |
Sets a system color from the a:sysClr element. More... | |
void | setPaletteClr (sal_Int32 nPaletteIdx) |
Sets a palette color index. More... | |
void | addTransformation (sal_Int32 nElement, sal_Int32 nValue=-1) |
Inserts the passed color transformation. More... | |
void | addChartTintTransformation (double fTint) |
Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). More... | |
void | addExcelTintTransformation (double fTint) |
Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). More... | |
void | clearTransformations () |
Removes all color transformations. More... | |
void | clearTransparence () |
Removes transparence from the color. More... | |
void | assignIfUsed (const Color &rColor) |
Overwrites this color with the passed color, if it is used. More... | |
bool | isUsed () const |
Returns true, if the color is initialized. More... | |
bool | isPlaceHolder () const |
Returns true, if the color is a placeholder color in theme style lists. More... | |
::Color | getColor (const GraphicHelper &rGraphicHelper, ::Color nPhClr=API_RGB_TRANSPARENT) const |
Returns the final RGB color value. More... | |
bool | hasTransparency () const |
Returns true, if the color is transparent. More... | |
sal_Int16 | getTransparency () const |
Returns the transparency of the color (0 = opaque, 100 = full transparent). More... | |
const OUString & | getSchemeColorName () const |
Returns the scheme name from the a:schemeClr element for interoperability purposes. More... | |
sal_Int16 | getSchemeColorIndex () const |
sal_Int16 | getTintOrShade () const |
sal_Int16 | getLumMod () const |
sal_Int16 | getLumOff () const |
model::ThemeColorType | getThemeColorType () const |
model::ComplexColor | createComplexColor (const GraphicHelper &rGraphicHelper, sal_Int16 nPhClrTheme) const |
const css::uno::Sequence< css::beans::PropertyValue > & | getTransformations () const |
Returns the unaltered list of transformations for interoperability purposes. More... | |
bool | equals (const Color &rOther, const GraphicHelper &rGraphicHelper, ::Color nPhClr) const |
Compares this color with rOther. More... | |
model::ComplexColor | getComplexColor () const |
Static Public Member Functions | |
::Color | getDmlPresetColor (sal_Int32 nToken, ::Color nDefaultRgb) |
Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. More... | |
::Color | getVmlPresetColor (sal_Int32 nToken, ::Color nDefaultRgb) |
Returns the RGB value for the passed VML color token, or nDefaultRgb on error. More... | |
::Color | getHighlightColor (sal_Int32 nToken, ::Color nDefaultRgb) |
Returns the RGB value for the passed VML color token, or nDefaultRgb on error. More... | |
static OUString | getColorTransformationName (sal_Int32 nElement) |
Translates between color transformation tokens and their names. More... | |
static sal_Int32 | getColorTransformationToken (std::u16string_view sName) |
Translates between color transformation token names and the corresponding token. More... | |
Private Types | |
enum | ColorMode { COLOR_UNUSED , COLOR_RGB , COLOR_CRGB , COLOR_HSL , COLOR_SCHEME , COLOR_PALETTE , COLOR_SYSTEM , COLOR_PH , COLOR_FINAL } |
Private Member Functions | |
void | setResolvedRgb (::Color nRgb) const |
Internal helper for getColor(). More... | |
void | toRgb () const |
Converts the color components to RGB values. More... | |
void | toCrgb () const |
Converts the color components to CRGB values (gamma corrected percentage). More... | |
void | toHsl () const |
Converts the color components to HSL values. More... | |
Private Attributes | |
ColorMode | meMode |
std::vector< Transformation > | maTransforms |
Current color mode. More... | |
sal_Int32 | mnC1 |
Color transformations. More... | |
sal_Int32 | mnC2 |
Red, red%, hue, scheme token, palette index, system token, or final RGB. More... | |
sal_Int32 | mnC3 |
Green, green%, saturation, or system default RGB. More... | |
sal_Int32 | mnAlpha |
Blue, blue%, or luminance. More... | |
OUString | msSchemeName |
Alpha value (color opacity). More... | |
model::ThemeColorType | meThemeColorType |
Scheme name from the a:schemeClr element for interoperability purposes. More... | |
css::uno::Sequence< css::beans::PropertyValue > | maInteropTransformations |
|
private |
Enumerator | |
---|---|
COLOR_UNUSED | |
COLOR_RGB | Color is not used, or undefined. |
COLOR_CRGB | Absolute RGB (r/g/b: 0...255). |
COLOR_HSL | Relative RGB (r/g/b: 0...100000). |
COLOR_SCHEME | HSL (hue: 0...21600000, sat/lum: 0...100000). |
COLOR_PALETTE | Color from scheme. |
COLOR_SYSTEM | Color from application defined palette. |
COLOR_PH | Color from system palette. |
COLOR_FINAL | Placeholder color in theme style lists. Finalized RGB color. |
Color::Color | ( | ) |
Definition at line 292 of file color.cxx.
References meMode, and Unknown.
Referenced by oox::drawingml::table::applyLineAttributes().
void Color::addChartTintTransformation | ( | double | fTint | ) |
Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint).
Definition at line 428 of file color.cxx.
References maTransforms, oox::drawingml::MAX_PERCENT, and nValue.
void Color::addExcelTintTransformation | ( | double | fTint | ) |
Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint).
Definition at line 437 of file color.cxx.
References maTransforms, and nValue.
void Color::addTransformation | ( | sal_Int32 | nElement, |
sal_Int32 | nValue = -1 |
||
) |
Inserts the passed color transformation.
Definition at line 408 of file color.cxx.
References getColorTransformationName(), maInteropTransformations, maTransforms, mnAlpha, nToken, and nValue.
Referenced by oox::drawingml::ColorValueContext::onCreateContext(), and oox::drawingml::TextCharacterProperties::pushToPropMap().
|
inline |
Overwrites this color with the passed color, if it is used.
Definition at line 89 of file color.hxx.
References isUsed().
Referenced by oox::drawingml::BlipFillProperties::assignUsed(), oox::drawingml::EffectGlowProperties::assignUsed(), oox::drawingml::EffectShadowProperties::assignUsed(), oox::drawingml::FillProperties::assignUsed(), oox::drawingml::PatternFillProperties::assignUsed(), and oox::drawingml::TextCharacterProperties::assignUsed().
void Color::clearTransformations | ( | ) |
Removes all color transformations.
Definition at line 451 of file color.cxx.
References clearTransparence(), maInteropTransformations, and maTransforms.
Referenced by oox::drawingml::Shape::createAndInsert(), and oox::drawingml::table::TableCell::pushToXCell().
void Color::clearTransparence | ( | ) |
Removes transparence from the color.
Definition at line 566 of file color.cxx.
References oox::drawingml::MAX_PERCENT, and mnAlpha.
Referenced by clearTransformations(), and oox::drawingml::ColorChangeContext::~ColorChangeContext().
model::ComplexColor Color::createComplexColor | ( | const GraphicHelper & | rGraphicHelper, |
sal_Int16 | nPhClrTheme | ||
) | const |
Definition at line 815 of file color.cxx.
References model::ComplexColor::addTransformation(), model::convertToThemeColorType(), model::LumMod, model::LumOff, meMode, nValue, model::ComplexColor::setSchemeColor(), model::Shade, and model::Tint.
bool Color::equals | ( | const Color & | rOther, |
const GraphicHelper & | rGraphicHelper, | ||
::Color | nPhClr | ||
) | const |
Compares this color with rOther.
Definition at line 558 of file color.cxx.
References getColor(), and getTransparency().
Color Color::getColor | ( | const GraphicHelper & | rGraphicHelper, |
::Color | nPhClr = API_RGB_TRANSPARENT |
||
) | const |
Returns the final RGB color value.
nPhClr | Actual color for the phClr placeholder color used in theme style lists. |
Definition at line 644 of file color.cxx.
References oox::API_RGB_TRANSPARENT, ColorTransparency, oox::GraphicHelper::getPaletteColor(), oox::GraphicHelper::getSchemeColor(), oox::GraphicHelper::getSystemColor(), oox::drawingml::MAX_DEGREE, oox::drawingml::MAX_PERCENT, meMode, and oox::drawingml::PER_DEGREE.
Referenced by oox::drawingml::table::applyBorder(), oox::drawingml::table::applyLineAttributes(), oox::drawingml::table::applyTableStylePart(), oox::drawingml::chart::TypeGroupConverter::convertMarker(), oox::drawingml::Shape::createAndInsert(), oox::ppt::SlidePersist::createBackground(), equals(), oox::drawingml::Generic3DProperties::getColorAttributes(), oox::drawingml::TextParagraph::insertAt(), oox::ppt::AnimVariantContext::onEndElement(), oox::vml::ShadowModel::pushToPropMap(), oox::drawingml::TextCharacterProperties::pushToPropMap(), oox::drawingml::LineProperties::pushToPropMap(), oox::drawingml::FillProperties::pushToPropMap(), oox::drawingml::TextParagraphProperties::pushToPropSet(), oox::drawingml::table::TableCell::pushToXCell(), and oox::drawingml::clrSchemeColorContext::~clrSchemeColorContext().
|
static |
Translates between color transformation tokens and their names.
Definition at line 458 of file color.cxx.
References SAL_WARN.
Referenced by addTransformation().
|
static |
Translates between color transformation token names and the corresponding token.
Definition at line 495 of file color.cxx.
References SAL_WARN, sName, u, and XML_TOKEN_INVALID.
Referenced by oox::drawingml::DrawingML::WriteColorTransformations().
model::ComplexColor Color::getComplexColor | ( | ) | const |
Definition at line 620 of file color.cxx.
References model::ComplexColor::addTransformation(), model::convertToThemeColorType(), getLumMod(), getLumOff(), getSchemeColorIndex(), getTintOrShade(), model::LumMod, model::LumOff, model::ComplexColor::setSchemeColor(), model::Shade, and model::Tint.
Referenced by oox::drawingml::TextCharacterProperties::pushToPropMap(), and oox::drawingml::FillProperties::pushToPropMap().
Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error.
Definition at line 302 of file color.cxx.
References nToken.
Referenced by oox::drawingml::ColorValueContext::onStartElement(), and setPrstClr().
Returns the RGB value for the passed VML color token, or nDefaultRgb on error.
Definition at line 320 of file color.cxx.
References nToken.
Referenced by setHighlight().
sal_Int16 Color::getLumMod | ( | ) | const |
Definition at line 588 of file color.cxx.
References maTransforms.
Referenced by getComplexColor(), and oox::drawingml::LineProperties::pushToPropMap().
sal_Int16 Color::getLumOff | ( | ) | const |
Definition at line 604 of file color.cxx.
References maTransforms.
Referenced by getComplexColor(), and oox::drawingml::LineProperties::pushToPropMap().
sal_Int16 Color::getSchemeColorIndex | ( | ) | const |
Definition at line 809 of file color.cxx.
References oox::drawingml::schemeNameToThemeColorType().
Referenced by getComplexColor(), and oox::drawingml::LineProperties::pushToPropMap().
|
inline |
Returns the scheme name from the a:schemeClr element for interoperability purposes.
Definition at line 105 of file color.hxx.
Referenced by oox::drawingml::Shape::createAndInsert(), and oox::drawingml::Generic3DProperties::getColorAttributes().
|
inline |
sal_Int16 Color::getTintOrShade | ( | ) | const |
Definition at line 571 of file color.cxx.
References maTransforms.
Referenced by getComplexColor(), and oox::drawingml::LineProperties::pushToPropMap().
|
inline |
Returns the unaltered list of transformations for interoperability purposes.
Definition at line 119 of file color.hxx.
Referenced by oox::drawingml::Shape::createAndInsert(), and oox::drawingml::Generic3DProperties::getColorAttributes().
sal_Int16 Color::getTransparency | ( | ) | const |
Returns the transparency of the color (0 = opaque, 100 = full transparent).
Definition at line 804 of file color.cxx.
References oox::drawingml::MAX_PERCENT, and oox::drawingml::PER_PERCENT.
Referenced by oox::drawingml::Shape::createAndInsert(), equals(), oox::drawingml::Generic3DProperties::getColorAttributes(), oox::drawingml::TextCharacterProperties::pushToPropMap(), oox::drawingml::LineProperties::pushToPropMap(), oox::drawingml::FillProperties::pushToPropMap(), and oox::drawingml::table::TableCell::pushToXCell().
bool Color::hasTransparency | ( | ) | const |
Returns true, if the color is transparent.
Definition at line 799 of file color.cxx.
References oox::drawingml::MAX_PERCENT.
Referenced by oox::drawingml::TextCharacterProperties::pushToPropMap(), oox::drawingml::LineProperties::pushToPropMap(), and oox::drawingml::FillProperties::pushToPropMap().
|
inline |
Returns true, if the color is a placeholder color in theme style lists.
Definition at line 94 of file color.hxx.
References meMode.
Referenced by oox::drawingml::Shape::createAndInsert().
|
inline |
Returns true, if the color is initialized.
Definition at line 92 of file color.hxx.
References meMode.
Referenced by oox::drawingml::table::applyTableStylePart(), assignIfUsed(), oox::ppt::SlidePersist::createBackground(), oox::drawingml::FillProperties::getBestSolidColor(), oox::drawingml::Generic3DProperties::getShape3DAttributes(), oox::drawingml::TextRun::insertAt(), oox::drawingml::lcl_copyCharPropsToShape(), oox::drawingml::ShapeStyleContext::onCreateContext(), oox::ppt::AnimVariantContext::onEndElement(), oox::drawingml::TextCharacterProperties::pushToPropMap(), oox::drawingml::LineProperties::pushToPropMap(), oox::drawingml::FillProperties::pushToPropMap(), and oox::drawingml::table::TableCell::pushToXCell().
void Color::setHighlight | ( | sal_Int32 | nToken | ) |
Sets a predefined color from the w:highlight element.
Definition at line 376 of file color.cxx.
References oox::API_RGB_TRANSPARENT, getHighlightColor(), nToken, and setSrgbClr().
Referenced by oox::AttributeList::getHighlightColor().
void Color::setHslClr | ( | sal_Int32 | nHue, |
sal_Int32 | nSat, | ||
sal_Int32 | nLum | ||
) |
Sets the HSL values from the a:hslClr element.
Definition at line 357 of file color.cxx.
References COLOR_HSL, oox::drawingml::MAX_DEGREE, oox::drawingml::MAX_PERCENT, meMode, mnC1, mnC2, and mnC3.
Referenced by oox::drawingml::ColorValueContext::onStartElement().
void Color::setPaletteClr | ( | sal_Int32 | nPaletteIdx | ) |
Sets a palette color index.
Definition at line 393 of file color.cxx.
References COLOR_PALETTE, meMode, and mnC1.
void Color::setPrstClr | ( | sal_Int32 | nToken | ) |
Sets a predefined color from the a:prstClr element.
Definition at line 368 of file color.cxx.
References oox::API_RGB_TRANSPARENT, getDmlPresetColor(), nToken, and setSrgbClr().
Referenced by oox::drawingml::ColorValueContext::onStartElement().
|
private |
void Color::setSchemeClr | ( | sal_Int32 | nToken | ) |
Sets a scheme color from the a:schemeClr element.
Definition at line 384 of file color.cxx.
References COLOR_PH, COLOR_SCHEME, meMode, meThemeColorType, mnC1, nToken, oox::drawingml::schemeTokenToThemeColorType(), and XML_TOKEN_INVALID.
Referenced by CreateTableStyle(), oox::drawingml::TextRun::insertAt(), oox::drawingml::lcl_copyCharPropsToShape(), oox::drawingml::ShapeStyleContext::onCreateContext(), and oox::drawingml::ColorValueContext::onStartElement().
|
inline |
Sets the scheme name from the a:schemeClr element for interoperability purposes.
Definition at line 71 of file color.hxx.
Referenced by oox::drawingml::ColorValueContext::onStartElement().
void Color::setScrgbClr | ( | sal_Int32 | nR, |
sal_Int32 | nG, | ||
sal_Int32 | nB | ||
) |
Sets the percentual RGB values from the a:scrgbClr element.
Definition at line 346 of file color.cxx.
References COLOR_CRGB, oox::drawingml::MAX_PERCENT, meMode, mnC1, mnC2, and mnC3.
Referenced by oox::drawingml::ColorValueContext::onStartElement().
void Color::setSrgbClr | ( | ::Color | nRgb | ) |
Definition at line 334 of file color.cxx.
References setSrgbClr().
void Color::setSrgbClr | ( | sal_Int32 | nRgb | ) |
Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element.
Definition at line 339 of file color.cxx.
References COLOR_RGB, ColorTransparency, meMode, mnC1, mnC2, and mnC3.
Referenced by oox::drawingml::table::applyBorder(), oox::drawingml::table::applyTableStylePart(), oox::drawingml::TextCharacterPropertiesContext::onCreateContext(), oox::drawingml::ColorValueContext::onStartElement(), oox::drawingml::table::TableCell::pushToXCell(), setHighlight(), setPrstClr(), and setSrgbClr().
void Color::setSysClr | ( | sal_Int32 | nToken, |
sal_Int32 | nLastRgb | ||
) |
Sets a system color from the a:sysClr element.
Definition at line 400 of file color.cxx.
References COLOR_SYSTEM, meMode, mnC1, mnC2, and nToken.
Referenced by oox::drawingml::ColorValueContext::onStartElement().
void Color::setUnused | ( | ) |
Sets the color to unused state.
Definition at line 329 of file color.cxx.
References COLOR_UNUSED, and meMode.
Referenced by oox::drawingml::ColorChangeContext::ColorChangeContext(), oox::drawingml::DuotoneContext::DuotoneContext(), and oox::drawingml::table::TableProperties::TableProperties().
|
private |
|
private |
Converts the color components to HSL values.
Definition at line 956 of file color.cxx.
References oox::drawingml::MAX_DEGREE, oox::drawingml::MAX_PERCENT, meMode, oox::drawingml::PER_DEGREE, and oox::drawingml::PER_PERCENT.
|
private |
Converts the color components to RGB values.
Definition at line 870 of file color.cxx.
References oox::drawingml::MAX_DEGREE, oox::drawingml::MAX_PERCENT, and meMode.
|
private |
Definition at line 174 of file color.hxx.
Referenced by addTransformation(), and clearTransformations().
|
mutableprivate |
Current color mode.
Definition at line 166 of file color.hxx.
Referenced by addChartTintTransformation(), addExcelTintTransformation(), addTransformation(), clearTransformations(), getLumMod(), getLumOff(), and getTintOrShade().
|
mutableprivate |
Definition at line 164 of file color.hxx.
Referenced by setHslClr(), setPaletteClr(), setSchemeClr(), setScrgbClr(), setSrgbClr(), setSysClr(), and setUnused().
|
private |
Scheme name from the a:schemeClr element for interoperability purposes.
Definition at line 172 of file color.hxx.
Referenced by setSchemeClr().
|
private |
Blue, blue%, or luminance.
Definition at line 170 of file color.hxx.
Referenced by addTransformation(), and clearTransparence().
|
mutableprivate |
Color transformations.
Definition at line 167 of file color.hxx.
Referenced by setHslClr(), setPaletteClr(), setSchemeClr(), setScrgbClr(), setSrgbClr(), and setSysClr().
|
mutableprivate |
Red, red%, hue, scheme token, palette index, system token, or final RGB.
Definition at line 168 of file color.hxx.
Referenced by setHslClr(), setScrgbClr(), setSrgbClr(), and setSysClr().
|
mutableprivate |
Green, green%, saturation, or system default RGB.
Definition at line 169 of file color.hxx.
Referenced by setHslClr(), setScrgbClr(), and setSrgbClr().
|
private |