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, const StorageRef &rxStorage)
 
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

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

Definition at line 118 of file graphichelper.cxx.

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

Member Function Documentation

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

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

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

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

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

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

double GraphicHelper::convertHmmToScreenPixelX ( sal_Int32  nHmmX) const

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

Definition at line 174 of file graphichelper.cxx.

References mfPixelPerHmmX.

double GraphicHelper::convertHmmToScreenPixelY ( sal_Int32  nHmmY) const

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

Definition at line 179 of file graphichelper.cxx.

References mfPixelPerHmmY.

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

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

Definition at line 169 of file graphichelper.cxx.

References convertScreenPixelXToHmm(), and convertScreenPixelYToHmm().

Referenced by getOriginalSize().

sal_Int32 GraphicHelper::convertScreenPixelXToHmm ( double  fPixelX) const

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

Definition at line 159 of file graphichelper.cxx.

References mfPixelPerHmmX.

Referenced by convertScreenPixelToHmm(), and oox::vml::ConversionHelper::decodeMeasureToEmu().

sal_Int32 GraphicHelper::convertScreenPixelYToHmm ( double  fPixelY) const

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

Definition at line 164 of file graphichelper.cxx.

References mfPixelPerHmmY.

Referenced by convertScreenPixelToHmm(), and oox::vml::ConversionHelper::decodeMeasureToEmu().

sal_Int32 GraphicHelper::getDefaultChartAreaFillStyle ( ) const
virtual

Definition at line 141 of file graphichelper.cxx.

sal_Int32 GraphicHelper::getDefaultChartAreaLineStyle ( )
static

Returns chartspace automatic default border style.

Definition at line 146 of file graphichelper.cxx.

sal_Int16 GraphicHelper::getDefaultChartAreaLineWidth ( )
static

Returns chartspace automatic default border width in Emu.

Definition at line 151 of file graphichelper.cxx.

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

Returns information about the output device.

Definition at line 94 of file graphichelper.hxx.

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 299 of file graphichelper.cxx.

References convertScreenPixelToHmm(), and oox::PropertySet::getProperty().

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

Color GraphicHelper::getPaletteColor ( sal_Int32  nPaletteIdx) const

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

Definition at line 135 of file graphichelper.cxx.

References oox::API_RGB_TRANSPARENT.

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

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 129 of file graphichelper.cxx.

References oox::API_RGB_TRANSPARENT.

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

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 124 of file graphichelper.cxx.

References oox::ContainerHelper::getMapElement(), and maSystemPalette.

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

Reference< XGraphic > GraphicHelper::importEmbeddedGraphic ( const OUString &  rStreamName,
const WmfExternal pExtHeader = nullptr 
) const
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(), importEmbeddedGraphic(), and importGraphic().

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

Imports a graphic from the passed binary memory block.

Definition at line 265 of file graphichelper.cxx.

References importGraphic().

void GraphicHelper::initializeGraphicMapperIfNeeded ( ) const

Definition at line 317 of file graphichelper.cxx.

References mxContext, and mxGraphicMapper.

Referenced by importEmbeddedGraphic().

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

Definition at line 312 of file graphichelper.cxx.

References mxGraphicMapper.

Referenced by oox::shape::ShapeFilterBase::implCreateGraphicHelper().

Member Data Documentation

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

Current output device info.

Definition at line 148 of file graphichelper.hxx.

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

Referenced by getSystemColor().

double oox::GraphicHelper::mfPixelPerHmmX
private

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

Definition at line 151 of file graphichelper.hxx.

Referenced by convertHmmToScreenPixelX(), and convertScreenPixelXToHmm().

double oox::GraphicHelper::mfPixelPerHmmY
private

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

Definition at line 152 of file graphichelper.hxx.

Referenced by convertHmmToScreenPixelY(), and convertScreenPixelYToHmm().

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

Definition at line 145 of file graphichelper.hxx.

Referenced by initializeGraphicMapperIfNeeded().

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

Definition at line 147 of file graphichelper.hxx.

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

Definition at line 146 of file graphichelper.hxx.

StorageRef oox::GraphicHelper::mxStorage
private

Storage containing embedded graphics.

Definition at line 150 of file graphichelper.hxx.

Referenced by importEmbeddedGraphic().


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