23#include <osl/diagnose.h>
26#include <com/sun/star/ui/ItemStyle.hpp>
27#include <com/sun/star/ui/XStatusbarItem.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/awt/ImageDrawMode.hpp>
30#include <com/sun/star/awt/XGraphics2.hpp>
31#include <com/sun/star/graphic/GraphicType.hpp>
33using namespace ::
cppu;
43 const Reference< XComponentContext >& rxContext,
44 const Reference< XFrame >& rxFrame,
45 const Reference< ui::XStatusbarItem >& rxItem,
47 :
svt::StatusbarController( rxContext, rxFrame, OUString(), 0 )
49 , m_bOwnerDraw( false )
50 , m_pItemData( pItemData )
80 const FeatureStateEvent& rEvent)
90 Reference< graphic::XGraphic > aGraphic;
92 if ( rEvent.State >>= aStrValue )
98 if ( aStrValue.getLength() )
104 else if ( ( rEvent.State >>= aGraphic ) &&
m_bOwnerDraw )
118 const Reference< awt::XGraphics >& xGraphics,
119 const awt::Rectangle& rOutputRectangle,
124 const Reference< awt::XGraphics2 > xGraphics2(xGraphics, UNO_QUERY);
129 Reference< beans::XPropertySet > xGraphicProps(
m_xGraphic, UNO_QUERY );
131 if ( xGraphicProps.is() &&
m_xGraphic->getType() != graphic::GraphicType::EMPTY )
133 awt::Size aGraphicSize;
134 xGraphicProps->getPropertyValue(
"SizePixel" ) >>= aGraphicSize;
135 OSL_ENSURE( aGraphicSize.Height > 0 && aGraphicSize.Width > 0,
"Empty status bar graphic!" );
139 aPos.X = ( rOutputRectangle.Width + nOffset ) / 2 - aGraphicSize.Width / 2;
140 aPos.Y = rOutputRectangle.Height / 2 - aGraphicSize.Height / 2;
142 xGraphics2->drawImage( rOutputRectangle.X + aPos.X,
143 rOutputRectangle.Y + aPos.Y,
146 m_bEnabled ? awt::ImageDrawMode::NONE : awt::ImageDrawMode::DISABLE,
151 xGraphics2->clear( rOutputRectangle );
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent &Event) override
css::uno::Reference< css::graphic::XGraphic > m_xGraphic
virtual void SAL_CALL paint(const css::uno::Reference< css::awt::XGraphics > &xGraphics, const css::awt::Rectangle &rOutputRectangle, ::sal_Int32 nStyle) override
virtual ~GenericStatusbarController() override
GenericStatusbarController(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XFrame > &rFrame, const css::uno::Reference< css::ui::XStatusbarItem > &rxItem, AddonStatusbarItemData *pItemData)
AddonStatusbarItemData * m_pItemData
virtual void SAL_CALL dispose() override
css::uno::Reference< css::ui::XStatusbarItem > m_xStatusbarItem
virtual void SAL_CALL dispose() override