LibreOffice Module oox (master) 1
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
oox::GraphicHelper Class Reference

Provides helper functions for colors, device measurement conversion, graphics, and graphic objects handling. More...

#include <graphichelper.hxx>

Collaboration diagram for oox::GraphicHelper:
[legend]

Public Member Functions

 GraphicHelper (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XFrame > &rxTargetFrame, StorageRef xStorage)
 
virtual ~GraphicHelper ()
 
 GraphicHelper (const GraphicHelper &)=delete
 
 GraphicHelper (GraphicHelper &&)=delete
 
GraphicHelperoperator= (const GraphicHelper &)=delete
 
GraphicHelperoperator= (GraphicHelper &&)=delete
 
::Color getSystemColor (sal_Int32 nToken, ::Color nDefaultRgb=API_RGB_TRANSPARENT) const
 Returns a system color specified by the passed XML token identifier. More...
 
virtual ::Color getSchemeColor (sal_Int32 nToken) const
 Derived classes may implement to resolve a scheme color from the passed XML token identifier. More...
 
virtual ::Color getPaletteColor (sal_Int32 nPaletteIdx) const
 Derived classes may implement to resolve a palette index to an RGB color. More...
 
virtual sal_Int32 getDefaultChartAreaFillStyle () const
 
const css::awt::DeviceInfo & getDeviceInfo () const
 Returns information about the output device. More...
 
sal_Int32 convertScreenPixelXToHmm (double fPixelX) const
 Converts the passed value from horizontal screen pixels to 1/100 mm. More...
 
sal_Int32 convertScreenPixelYToHmm (double fPixelY) const
 Converts the passed value from vertical screen pixels to 1/100 mm. More...
 
css::awt::Size convertScreenPixelToHmm (const css::awt::Size &rPixel) const
 Converts the passed size from screen pixels to 1/100 mm. More...
 
double convertHmmToScreenPixelX (sal_Int32 nHmmX) const
 Converts the passed value from 1/100 mm to horizontal screen pixels. More...
 
double convertHmmToScreenPixelY (sal_Int32 nHmmY) const
 Converts the passed value from 1/100 mm to vertical screen pixels. More...
 
css::awt::Point convertHmmToScreenPixel (const css::awt::Point &rHmm) const
 Converts the passed point from 1/100 mm to screen pixels. More...
 
css::awt::Size convertHmmToScreenPixel (const css::awt::Size &rHmm) const
 Converts the passed size from 1/100 mm to screen pixels. More...
 
css::awt::Point convertHmmToAppFont (const css::awt::Point &rHmm) const
 Converts the passed point from 1/100 mm to AppFont units. More...
 
css::awt::Size convertHmmToAppFont (const css::awt::Size &rHmm) const
 Converts the passed size from 1/100 mm to AppFont units. More...
 
css::uno::Reference< css::graphic::XGraphic > importGraphic (const css::uno::Reference< css::io::XInputStream > &rxInStrm, const WmfExternal *pExtHeader=nullptr) const
 Imports a graphic from the passed input stream. More...
 
css::uno::Reference< css::graphic::XGraphic > importGraphic (const StreamDataSequence &rGraphicData) const
 Imports a graphic from the passed binary memory block. More...
 
css::uno::Reference< css::graphic::XGraphic > importEmbeddedGraphic (const OUString &rStreamName, const WmfExternal *pExtHeader=nullptr) const
 Imports a graphic from the storage stream with the passed path and name. More...
 
css::awt::Size getOriginalSize (const css::uno::Reference< css::graphic::XGraphic > &rxGraphic) const
 calculates the original size of a graphic which is necessary to be able to calculate cropping values More...
 
void setGraphicMapper (css::uno::Reference< css::graphic::XGraphicMapper > const &rxGraphicMapper)
 
void initializeGraphicMapperIfNeeded () const
 

Static Public Member Functions

static sal_Int32 getDefaultChartAreaLineStyle ()
 Returns chartspace automatic default border style. More...
 
static sal_Int16 getDefaultChartAreaLineWidth ()
 Returns chartspace automatic default border width in Emu. More...
 

Private Attributes

css::uno::Reference< css::uno::XComponentContext > mxContext
 
css::uno::Reference< css::graphic::XGraphicProvider2 > mxGraphicProvider
 
VclPtr< OutputDevicemxDefaultOutputDevice
 
css::awt::DeviceInfo maDeviceInfo
 Current output device info. More...
 
::std::map< sal_Int32, ::ColormaSystemPalette
 Maps system colors (XML tokens) to RGB color values. More...
 
StorageRef mxStorage
 Storage containing embedded graphics. More...
 
double mfPixelPerHmmX
 Number of screen pixels per 1/100 mm in X direction. More...
 
double mfPixelPerHmmY
 Number of screen pixels per 1/100 mm in Y direction. More...
 
css::uno::Reference< css::graphic::XGraphicMapper > mxGraphicMapper
 

Detailed Description

Provides helper functions for colors, device measurement conversion, graphics, and graphic objects handling.

Definition at line 58 of file graphichelper.hxx.

Constructor & Destructor Documentation

◆ GraphicHelper() [1/3]

oox::GraphicHelper::GraphicHelper ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
const css::uno::Reference< css::frame::XFrame > &  rxTargetFrame,
StorageRef  xStorage 
)
explicit

◆ ~GraphicHelper()

GraphicHelper::~GraphicHelper ( )
virtual

Definition at line 114 of file graphichelper.cxx.

◆ GraphicHelper() [2/3]

oox::GraphicHelper::GraphicHelper ( const GraphicHelper )
delete

◆ GraphicHelper() [3/3]

oox::GraphicHelper::GraphicHelper ( GraphicHelper &&  )
delete

Member Function Documentation

◆ convertHmmToAppFont() [1/2]

css::awt::Point oox::GraphicHelper::convertHmmToAppFont ( const css::awt::Point &  rHmm) const

◆ convertHmmToAppFont() [2/2]

css::awt::Size oox::GraphicHelper::convertHmmToAppFont ( const css::awt::Size &  rHmm) const

Converts the passed size from 1/100 mm to AppFont units.

◆ convertHmmToScreenPixel() [1/2]

css::awt::Point oox::GraphicHelper::convertHmmToScreenPixel ( const css::awt::Point &  rHmm) const

Converts the passed point from 1/100 mm to screen pixels.

◆ convertHmmToScreenPixel() [2/2]

css::awt::Size oox::GraphicHelper::convertHmmToScreenPixel ( const css::awt::Size &  rHmm) const

Converts the passed size from 1/100 mm to screen pixels.

◆ convertHmmToScreenPixelX()

double GraphicHelper::convertHmmToScreenPixelX ( sal_Int32  nHmmX) const

Converts the passed value from 1/100 mm to horizontal screen pixels.

Definition at line 170 of file graphichelper.cxx.

◆ convertHmmToScreenPixelY()

double GraphicHelper::convertHmmToScreenPixelY ( sal_Int32  nHmmY) const

Converts the passed value from 1/100 mm to vertical screen pixels.

Definition at line 175 of file graphichelper.cxx.

◆ convertScreenPixelToHmm()

awt::Size GraphicHelper::convertScreenPixelToHmm ( const css::awt::Size &  rPixel) const

Converts the passed size from screen pixels to 1/100 mm.

Definition at line 165 of file graphichelper.cxx.

◆ convertScreenPixelXToHmm()

sal_Int32 GraphicHelper::convertScreenPixelXToHmm ( double  fPixelX) const

Converts the passed value from horizontal screen pixels to 1/100 mm.

Definition at line 155 of file graphichelper.cxx.

Referenced by oox::vml::ConversionHelper::decodeMeasureToEmu().

◆ convertScreenPixelYToHmm()

sal_Int32 GraphicHelper::convertScreenPixelYToHmm ( double  fPixelY) const

Converts the passed value from vertical screen pixels to 1/100 mm.

Definition at line 160 of file graphichelper.cxx.

Referenced by oox::vml::ConversionHelper::decodeMeasureToEmu().

◆ getDefaultChartAreaFillStyle()

sal_Int32 GraphicHelper::getDefaultChartAreaFillStyle ( ) const
virtual

Definition at line 137 of file graphichelper.cxx.

◆ getDefaultChartAreaLineStyle()

sal_Int32 GraphicHelper::getDefaultChartAreaLineStyle ( )
static

Returns chartspace automatic default border style.

Definition at line 142 of file graphichelper.cxx.

◆ getDefaultChartAreaLineWidth()

sal_Int16 GraphicHelper::getDefaultChartAreaLineWidth ( )
static

Returns chartspace automatic default border width in Emu.

Definition at line 147 of file graphichelper.cxx.

◆ getDeviceInfo()

const css::awt::DeviceInfo & oox::GraphicHelper::getDeviceInfo ( ) const
inline

Returns information about the output device.

Definition at line 94 of file graphichelper.hxx.

◆ getOriginalSize()

awt::Size GraphicHelper::getOriginalSize ( const css::uno::Reference< css::graphic::XGraphic > &  rxGraphic) const

calculates the original size of a graphic which is necessary to be able to calculate cropping values

Returns
The original Graphic size in 100thmm

Definition at line 295 of file graphichelper.cxx.

References oox::PropertySet::getProperty().

Referenced by oox::vml::SimpleShape::createPictureObject(), oox::drawingml::GraphicProperties::pushToPropMap(), and oox::drawingml::FillProperties::pushToPropMap().

◆ getPaletteColor()

Color GraphicHelper::getPaletteColor ( sal_Int32  nPaletteIdx) const

Derived classes may implement to resolve a palette index to an RGB color.

Definition at line 131 of file graphichelper.cxx.

References oox::API_RGB_TRANSPARENT.

Referenced by oox::ole::OleHelper::decodeOleColor(), and oox::drawingml::Color::getColor().

◆ getSchemeColor()

Color GraphicHelper::getSchemeColor ( sal_Int32  nToken) const

Derived classes may implement to resolve a scheme color from the passed XML token identifier.

Definition at line 125 of file graphichelper.cxx.

References oox::API_RGB_TRANSPARENT.

Referenced by oox::drawingml::Color::getColor().

◆ getSystemColor()

Color GraphicHelper::getSystemColor ( sal_Int32  nToken,
::Color  nDefaultRgb = API_RGB_TRANSPARENT 
) const

Returns a system color specified by the passed XML token identifier.

Definition at line 120 of file graphichelper.cxx.

References nToken.

Referenced by oox::vml::ConversionHelper::decodeColor(), oox::ole::OleHelper::decodeOleColor(), and oox::drawingml::Color::getColor().

◆ importEmbeddedGraphic()

Reference< XGraphic > GraphicHelper::importEmbeddedGraphic ( const OUString &  rStreamName,
const WmfExternal pExtHeader = nullptr 
) const

Imports a graphic from the storage stream with the passed path and name.

Definition at line 272 of file graphichelper.cxx.

References mxStorage, SAL_WARN_IF, and xStream.

Referenced by oox::drawingml::BlipContext::BlipContext(), oox::vml::SimpleShape::createEmbeddedPictureObject(), oox::drawingml::Shape::finalizeServiceName(), and oox::vml::FillModel::pushToPropMap().

◆ importGraphic() [1/2]

css::uno::Reference< css::graphic::XGraphic > oox::GraphicHelper::importGraphic ( const css::uno::Reference< css::io::XInputStream > &  rxInStrm,
const WmfExternal pExtHeader = nullptr 
) const

Imports a graphic from the passed input stream.

Referenced by oox::ole::ControlConverter::convertPicture().

◆ importGraphic() [2/2]

Reference< XGraphic > GraphicHelper::importGraphic ( const StreamDataSequence rGraphicData) const

Imports a graphic from the passed binary memory block.

Definition at line 261 of file graphichelper.cxx.

◆ initializeGraphicMapperIfNeeded()

void GraphicHelper::initializeGraphicMapperIfNeeded ( ) const

Definition at line 313 of file graphichelper.cxx.

References mxContext, and mxGraphicMapper.

◆ operator=() [1/2]

GraphicHelper & oox::GraphicHelper::operator= ( const GraphicHelper )
delete

◆ operator=() [2/2]

GraphicHelper & oox::GraphicHelper::operator= ( GraphicHelper &&  )
delete

◆ setGraphicMapper()

void GraphicHelper::setGraphicMapper ( css::uno::Reference< css::graphic::XGraphicMapper > const &  rxGraphicMapper)

Member Data Documentation

◆ maDeviceInfo

css::awt::DeviceInfo oox::GraphicHelper::maDeviceInfo
private

Current output device info.

Definition at line 148 of file graphichelper.hxx.

◆ maSystemPalette

::std::map< sal_Int32, ::Color > oox::GraphicHelper::maSystemPalette
private

Maps system colors (XML tokens) to RGB color values.

Definition at line 149 of file graphichelper.hxx.

◆ mfPixelPerHmmX

double oox::GraphicHelper::mfPixelPerHmmX
private

Number of screen pixels per 1/100 mm in X direction.

Definition at line 151 of file graphichelper.hxx.

◆ mfPixelPerHmmY

double oox::GraphicHelper::mfPixelPerHmmY
private

Number of screen pixels per 1/100 mm in Y direction.

Definition at line 152 of file graphichelper.hxx.

◆ mxContext

css::uno::Reference< css::uno::XComponentContext > oox::GraphicHelper::mxContext
private

Definition at line 145 of file graphichelper.hxx.

◆ mxDefaultOutputDevice

VclPtr<OutputDevice> oox::GraphicHelper::mxDefaultOutputDevice
private

Definition at line 147 of file graphichelper.hxx.

◆ mxGraphicMapper

css::uno::Reference<css::graphic::XGraphicMapper> oox::GraphicHelper::mxGraphicMapper
private

Definition at line 153 of file graphichelper.hxx.

Referenced by initializeGraphicMapperIfNeeded().

◆ mxGraphicProvider

css::uno::Reference< css::graphic::XGraphicProvider2 > oox::GraphicHelper::mxGraphicProvider
private

Definition at line 146 of file graphichelper.hxx.

◆ mxStorage

StorageRef oox::GraphicHelper::mxStorage
private

Storage containing embedded graphics.

Definition at line 150 of file graphichelper.hxx.


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