22#include <com/sun/star/awt/ImageScaleMode.hpp>
23#include <osl/diagnose.h>
25namespace ImageScaleMode = css::awt::ImageScaleMode;
29 ,mnScaleMode( ImageScaleMode::ANISOTROPIC )
33void ImageControl::SetScaleMode( const ::sal_Int16 _nMode )
35 if ( _nMode != mnScaleMode )
42void ImageControl::Resize()
53 const double nRatioX = 1.0 * aPaintSize.
Width() / _rBitmapSize.
Width();
54 const double nRatioY = 1.0 * aPaintSize.
Height() / _rBitmapSize.
Height();
55 const double nRatioMin = ::std::min( nRatioX, nRatioY );
63 aPos.AdjustX(( _rArea.
GetWidth() - _rObjectSize.
Width() ) / 2 );
75 const Image& rImage( GetModeImage() );
79 OUString sText( GetText() );
80 if ( sText.isEmpty() )
88 rDev.
DrawText( aDrawRect, sText, nTextStyle );
92 const Size& rBitmapSize = rImage.GetSizePixel();
94 switch ( mnScaleMode )
96 case ImageScaleMode::NONE:
98 rDev.
DrawImage(lcl_centerWithin( aDrawRect, rBitmapSize ), rImage, nStyle);
102 case ImageScaleMode::ISOTROPIC:
104 const Size aPaintSize = lcl_calcPaintSize( aDrawRect, rBitmapSize );
105 rDev.
DrawImage(lcl_centerWithin(aDrawRect, aPaintSize), aPaintSize, rImage, nStyle);
109 case ImageScaleMode::ANISOTROPIC:
119 OSL_ENSURE(
false,
"ImageControl::ImplDraw: unhandled scale mode!" );
127 ImplDraw(rRenderContext,
Point(), GetOutputSizePixel());
141 aRect.AdjustLeft( 1 );
142 aRect.AdjustRight( -1 );
143 aRect.AdjustTop( 1 );
144 aRect.AdjustBottom( -1 );
155 const Size aSize = GetSizePixel();
164 ImplDrawFrame( pDev, aRect );
167 ImplDraw( *pDev, aRect.TopLeft(), aRect.GetSize() );
172void ImageControl::GetFocus()
178void ImageControl::LoseFocus()
static SAL_DLLPRIVATE DrawTextFlags ImplGetTextStyle(WinBits nWinBits)
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
void DrawRect(const tools::Rectangle &rRect)
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
This is an overloaded member function, provided for convenience. It differs from the above function o...
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const Color & GetLineColor() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
void IntersectClipRegion(const tools::Rectangle &rRect)
const Color & GetFillColor() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
::OutputDevice const * GetOutDev() const
Size GetOutputSizePixel() const