diff options
author | Keith Curtis <keithcu@gmail.com> | 2013-12-20 14:19:19 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-12-20 14:23:35 +0100 |
commit | 7347482cc360ad3dc9ed77047441c2e30476fed3 (patch) | |
tree | 7f56a9063dea777562d797ae720cd58d2b4e7de4 | |
parent | a130de7e00bb426b15ec3b0ffc6bffc652d174ab (diff) |
hidpi: Make many places Hi-DPI aware.
This also introduces a getter for the mnDPIScaleFactor variable.
Change-Id: I02ba6858fb1842f911d62976f4c54afc3bfa337f
-rw-r--r-- | cui/source/tabpages/align.cxx | 12 | ||||
-rw-r--r-- | cui/source/tabpages/border.cxx | 22 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/sidebar/LayoutMenu.cxx | 3 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/statusbar/statusbar.xml | 2 | ||||
-rw-r--r-- | sd/uiconfig/simpress/statusbar/statusbar.xml | 2 | ||||
-rw-r--r-- | svx/source/dialog/dialcontrol.cxx | 5 | ||||
-rw-r--r-- | svx/source/stbctrls/modctrl.cxx | 14 | ||||
-rw-r--r-- | svx/source/stbctrls/pszctrl.cxx | 11 | ||||
-rw-r--r-- | svx/source/stbctrls/selctrl.cxx | 7 | ||||
-rw-r--r-- | svx/source/stbctrls/xmlsecctrl.cxx | 25 | ||||
-rw-r--r-- | svx/source/stbctrls/zoomsliderctrl.cxx | 39 | ||||
-rw-r--r-- | svx/source/tbxctrls/layctrl.cxx | 30 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.src | 2 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunocontroller.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/utlui/content.cxx | 16 | ||||
-rw-r--r-- | sw/source/ui/utlui/viewlayoutctrl.cxx | 45 | ||||
-rw-r--r-- | vcl/source/gdi/image.cxx | 9 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/msgbox.cxx | 15 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 56 | ||||
-rw-r--r-- | vcl/source/window/toolbox2.cxx | 23 |
22 files changed, 269 insertions, 75 deletions
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx index 9aa47e8566dc..5ba830af9521 100644 --- a/cui/source/tabpages/align.cxx +++ b/cui/source/tabpages/align.cxx @@ -319,12 +319,24 @@ void AlignmentTabPage::InitVsRefEgde() { // remember selection - is deleted in call to ValueSet::Clear() sal_uInt16 nSel = m_pVsRefEdge->GetSelectItemId(); ResId aResId( IL_LOCK_BMPS, CUI_MGR() ); ImageList aImageList( aResId ); + + if( GetDPIScaleFactor() > 1 ) + { + for (short i = 0; i < aImageList.GetImageCount(); i++) + { + OUString rImageName = aImageList.GetImageName(i); + BitmapEx b = aImageList.GetImage(rImageName).GetBitmapEx(); + b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); + aImageList.ReplaceImage(rImageName, Image(b)); + } + } + Size aItemSize( aImageList.GetImage( IID_BOTTOMLOCK ).GetSizePixel() ); m_pVsRefEdge->Clear(); m_pVsRefEdge->SetStyle( m_pVsRefEdge->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER ); m_pVsRefEdge->SetColCount( 3 ); diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 6713ee885ac6..0073a9ea59cd 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -84,15 +84,12 @@ static void lcl_SetDecimalDigitsTo1(MetricField& rField) SvxBorderTabPage::SvxBorderTabPage(Window* pParent, const SfxItemSet& rCoreAttrs) : SfxTabPage(pParent, "BorderPage", "cui/ui/borderpage.ui", rCoreAttrs) , - - - aShadowImgLst( CUI_RES(IL_SDW_BITMAPS)), aBorderImgLst( CUI_RES(IL_PRE_BITMAPS)), nMinValue(0), nSWMode(0), mbHorEnabled( false ), mbVerEnabled( false ), @@ -128,12 +125,31 @@ SvxBorderTabPage::SvxBorderTabPage(Window* pParent, const SfxItemSet& rCoreAttrs get(m_pLbShadowColor, "shadowcolorlb"); get(m_pPropertiesFrame, "properties"); get(m_pMergeWithNextCB, "mergewithnext"); get(m_pMergeAdjacentBordersCB, "mergeadjacent"); + if ( GetDPIScaleFactor() > 1 ) + { + for (short i = 0; i < aBorderImgLst.GetImageCount(); i++) + { + OUString rImageName = aBorderImgLst.GetImageName(i); + BitmapEx b = aBorderImgLst.GetImage(rImageName).GetBitmapEx(); + b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); + aBorderImgLst.ReplaceImage(rImageName, Image(b)); + } + + for (short i = 0; i < aShadowImgLst.GetImageCount(); i++) + { + OUString rImageName = aShadowImgLst.GetImageName(i); + BitmapEx b = aShadowImgLst.GetImage(rImageName).GetBitmapEx(); + b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); + aShadowImgLst.ReplaceImage(rImageName, Image(b)); + } + } + // this page needs ExchangeSupport SetExchangeSupport(); /* Use SvxMarginItem instead of margins from SvxBoxItem, if present. -> Remember this state in mbUseMarginItem, because other special handling is needed across various functions... */ diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 78f768e29b1f..6fd0331644be 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -556,12 +556,14 @@ public: @return true if operation supported, else false */ bool supportsOperation( OutDevSupportType ) const; + sal_Int32 GetDPIScaleFactor() const { return mnDPIScaleFactor; } + vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; } void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; } vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; } void DrawTextLine( const Point& rPos, long nWidth, diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index 11138d9c8ea8..5abb05ca0f5e 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -647,12 +647,15 @@ void LayoutMenu::Fill (void) for (sal_uInt16 i=1; pInfo!=NULL&&pInfo->mnBmpResId!=0; i++,pInfo++) { if ((WritingMode_TB_RL != pInfo->meWritingMode) || bVertical) { BitmapEx aBmp(SdResId(pInfo->mnBmpResId)); + if (GetDPIScaleFactor() > 1) + aBmp.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); + if (bRightToLeft && (WritingMode_TB_RL != pInfo->meWritingMode)) aBmp.Mirror (BMP_MIRROR_HORZ); InsertItem(i, Image(aBmp), SdResId (pInfo->mnStrResId)); SetItemData (i, new AutoLayout(pInfo->maAutoLayout)); n++; diff --git a/sd/uiconfig/sdraw/statusbar/statusbar.xml b/sd/uiconfig/sdraw/statusbar/statusbar.xml index 81eb908cdd6a..24224fe3cadb 100644 --- a/sd/uiconfig/sdraw/statusbar/statusbar.xml +++ b/sd/uiconfig/sdraw/statusbar/statusbar.xml @@ -16,13 +16,13 @@ * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink"> <statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:width="184"/> - <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="208"/> + <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="400"/> <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/> <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/> <statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124"/> <statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:width="54"/> <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/> <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="36"/> diff --git a/sd/uiconfig/simpress/statusbar/statusbar.xml b/sd/uiconfig/simpress/statusbar/statusbar.xml index 81eb908cdd6a..24224fe3cadb 100644 --- a/sd/uiconfig/simpress/statusbar/statusbar.xml +++ b/sd/uiconfig/simpress/statusbar/statusbar.xml @@ -16,13 +16,13 @@ * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . --> <statusbar:statusbar xmlns:statusbar="http://openoffice.org/2001/statusbar" xmlns:xlink="http://www.w3.org/1999/xlink"> <statusbar:statusbaritem xlink:href=".uno:Context" statusbar:align="left" statusbar:autosize="true" statusbar:width="184"/> - <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="208"/> + <statusbar:statusbaritem xlink:href=".uno:Size" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="400"/> <statusbar:statusbaritem xlink:href=".uno:ModifiedStatus" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="9"/> <statusbar:statusbaritem xlink:href=".uno:Signature" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="16"/> <statusbar:statusbaritem xlink:href=".uno:PageStatus" statusbar:align="left" statusbar:width="124"/> <statusbar:statusbaritem xlink:href=".uno:LayoutStatus" statusbar:align="left" statusbar:autosize="true" statusbar:width="54"/> <statusbar:statusbaritem xlink:href=".uno:ZoomSlider" statusbar:align="center" statusbar:ownerdraw="true" statusbar:width="130"/> <statusbar:statusbaritem xlink:href=".uno:Zoom" statusbar:align="center" statusbar:width="36"/> diff --git a/svx/source/dialog/dialcontrol.cxx b/svx/source/dialog/dialcontrol.cxx index 42e4e6f43d4e..4a780a6cf411 100644 --- a/svx/source/dialog/dialcontrol.cxx +++ b/svx/source/dialog/dialcontrol.cxx @@ -446,14 +446,19 @@ void DialControl::Init( const Size& rWinSize, const Font& rWinFont ) SetOutputSizePixel( mpImpl->maWinSize ); SetBackground(); } void DialControl::Init( const Size& rWinSize ) { + //hidpi TODO: GetDefaultFont() picks a font size too small, so fix it here. + Font aDefaultSize = GetFont(); + Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_UI_SANS, Application::GetSettings().GetUILanguageTag().getLanguageType(), DEFAULTFONT_FLAGS_ONLYONE ) ); + + aFont.SetHeight(aDefaultSize.GetHeight()); Init( rWinSize, aFont ); } void DialControl::InvalidateControl() { mpImpl->mpBmpBuffered->CopyBackground( IsEnabled() ? *mpImpl->mpBmpEnabled : *mpImpl->mpBmpDisabled ); diff --git a/svx/source/stbctrls/modctrl.cxx b/svx/source/stbctrls/modctrl.cxx index da2d40f44688..5f0168794769 100644 --- a/svx/source/stbctrls/modctrl.cxx +++ b/svx/source/stbctrls/modctrl.cxx @@ -61,23 +61,37 @@ struct SvxModifyControl::ImplData ImplData(): mnModState(MODIFICATION_STATE_NO) { maImages[MODIFICATION_STATE_NO] = Image(SVX_RES(RID_SVXBMP_DOC_MODIFIED_NO)); maImages[MODIFICATION_STATE_YES] = Image(SVX_RES(RID_SVXBMP_DOC_MODIFIED_YES)); maImages[MODIFICATION_STATE_FEEDBACK] = Image(SVX_RES(RID_SVXBMP_DOC_MODIFIED_FEEDBACK)); + maTimer.SetTimeout(_FEEDBACK_TIMEOUT); } }; SvxModifyControl::SvxModifyControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStb ) : SfxStatusBarControl( _nSlotId, _nId, rStb ), mpImpl(new ImplData) { + printf ("SvxModifyControl SF %d\n", rStb.GetDPIScaleFactor()); + printf ("SvxModifyControl DPIY %d\n", rStb.ImplGetDPIY()); + + if ( rStb.GetDPIScaleFactor() > 1 ) + { + for (int i = 0; i < mpImpl->MODIFICATION_STATE_SIZE; i++) + { + BitmapEx b = mpImpl->maImages[i].GetBitmapEx(); + b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BMP_SCALE_FAST); + mpImpl->maImages[i] = Image(b); + } + } + mpImpl->maTimer.SetTimeoutHdl( LINK(this, SvxModifyControl, OnTimer) ); } // ----------------------------------------------------------------------- void SvxModifyControl::StateChanged( sal_uInt16, SfxItemState eState, diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index 89b9c19ede4b..733b8e7221a4 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.cxx @@ -174,12 +174,23 @@ SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId, pImp->bTable = false; pImp->bHasMenu = false; pImp->nFunction = 0; pImp->aPosImage = Image( ResId( RID_SVXBMP_POSITION, DIALOG_MGR() ) ); pImp->aSizeImage = Image( ResId( RID_SVXBMP_SIZE, DIALOG_MGR() ) ); + if ( rStb.GetDPIScaleFactor() > 1) + { + BitmapEx b = pImp->aPosImage.GetBitmapEx(); + b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BMP_SCALE_FAST); + pImp->aPosImage = Image(b); + + b = pImp->aSizeImage.GetBitmapEx(); + b.Scale(rStb.GetDPIScaleFactor(), rStb.GetDPIScaleFactor(), BMP_SCALE_FAST); + pImp->aSizeImage = Image(b); + } + addStatusListener( OUString( STR_POSITION )); // SID_ATTR_POSITION addStatusListener( OUString( STR_TABLECELL )); // SID_TABLE_CELL addStatusListener( OUString( STR_FUNC )); // SID_PSZ_FUNCTION } // ----------------------------------------------------------------------- diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx index e54760d3a9b6..9b77972d74de 100644 --- a/svx/source/stbctrls/selctrl.cxx +++ b/svx/source/stbctrls/selctrl.cxx @@ -77,12 +77,19 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, StatusBar& rStb ) : SfxStatusBarControl( _nSlotId, _nId, rStb ), mnState( 0 ), maImage( SVX_RES( RID_SVXBMP_SELECTION ) ) { + if ( GetStatusBar().GetDPIScaleFactor() > 1 ) + { + BitmapEx b = maImage.GetBitmapEx(); + b.Scale(GetStatusBar().GetDPIScaleFactor(), GetStatusBar().GetDPIScaleFactor(), BMP_SCALE_FAST); + maImage = Image(b); + } + GetStatusBar().SetItemText( GetId(), "" ); } // ----------------------------------------------------------------------- void SvxSelectionModeControl::StateChanged( sal_uInt16, SfxItemState eState, diff --git a/svx/source/stbctrls/xmlsecctrl.cxx b/svx/source/stbctrls/xmlsecctrl.cxx index b2e2eb9a0b89..46ea35b8b167 100644 --- a/svx/source/stbctrls/xmlsecctrl.cxx +++ b/svx/source/stbctrls/xmlsecctrl.cxx @@ -57,12 +57,29 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16 { mpImpl->mnState = (sal_uInt16)SIGNATURESTATE_UNKNOWN; mpImpl->maImage = Image( SVX_RES( RID_SVXBMP_SIGNET ) ); mpImpl->maImageBroken = Image( SVX_RES( RID_SVXBMP_SIGNET_BROKEN ) ); mpImpl->maImageNotValidated = Image( SVX_RES( RID_SVXBMP_SIGNET_NOTVALIDATED ) ); + + if (_rStb.GetDPIScaleFactor() > 1) + { + Image arr[3] = {mpImpl->maImage, mpImpl->maImageBroken, mpImpl->maImageNotValidated}; + + for (int i = 0; i < 3; i++) + { + BitmapEx b = arr[i].GetBitmapEx(); + b.Scale(_rStb.GetDPIScaleFactor(), _rStb.GetDPIScaleFactor(), BMP_SCALE_FAST); + arr[i] = Image(b); + } + + mpImpl->maImage = arr[0]; + mpImpl->maImageBroken = arr[1]; + mpImpl->maImageNotValidated = arr[2]; + } + } XmlSecStatusBarControl::~XmlSecStatusBarControl() { delete mpImpl; } @@ -132,26 +149,28 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) Color aOldLineColor = pDev->GetLineColor(); Color aOldFillColor = pDev->GetFillColor(); pDev->SetLineColor(); pDev->SetFillColor( pDev->GetBackground().GetColor() ); + long yOffset = (aRect.GetHeight() - mpImpl->maImage.GetSizePixel().Height()) / 2; + if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_OK ) { - ++aRect.Top(); + aRect.Top() += yOffset; pDev->DrawImage( aRect.TopLeft(), mpImpl->maImage ); } else if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_BROKEN ) { - ++aRect.Top(); + aRect.Top() += yOffset; pDev->DrawImage( aRect.TopLeft(), mpImpl->maImageBroken ); } else if( mpImpl->mnState == SIGNATURESTATE_SIGNATURES_NOTVALIDATED || mpImpl->mnState == SIGNATURESTATE_SIGNATURES_PARTIAL_OK) { - ++aRect.Top(); + aRect.Top() += yOffset; pDev->DrawImage( aRect.TopLeft(), mpImpl->maImageNotValidated ); } else pDev->DrawRect( aRect ); pDev->SetLineColor( aOldLineColor ); diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index fc72cb621f8c..638a8505fb9a 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -63,18 +63,12 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl mbValuesSet( false ), mbOmitPaint( false ) {} }; // ----------------------------------------------------------------------- -const long nButtonWidth = 10; -const long nButtonHeight = 10; -const long nIncDecWidth = 10; -const long nIncDecHeight = 10; -const long nSliderHeight = 2; -const long nSnappingHeight = 4; const long nSliderXOffset = 20; const long nSnappingEpsilon = 5; // snapping epsilon in pixels const long nSnappingPointsMinDist = nSnappingEpsilon; // minimum distance of two adjacent snapping points // ----------------------------------------------------------------------- @@ -172,12 +166,29 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nI SfxStatusBarControl( _nSlotId, _nId, _rStb ), mpImpl( new SvxZoomSliderControl_Impl ) { mpImpl->maSliderButton = Image( SVX_RES( RID_SVXBMP_SLIDERBUTTON ) ); mpImpl->maIncreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERINCREASE ) ); mpImpl->maDecreaseButton = Image( SVX_RES( RID_SVXBMP_SLIDERDECREASE ) ); + + if ( _rStb.GetDPIScaleFactor() > 1) + { + Image arr[3] = {mpImpl->maSliderButton, mpImpl->maIncreaseButton, mpImpl->maDecreaseButton}; + + for (int i = 0; i < 3; i++) + { + BitmapEx b = arr[i].GetBitmapEx(); + //Use Lanczos scaling for the slider button because it does a better job with circles + b.Scale(_rStb.GetDPIScaleFactor(), _rStb.GetDPIScaleFactor(), i == 0 ? BMP_SCALE_LANCZOS : BMP_SCALE_FAST); + arr[i] = Image(b); + } + + mpImpl->maSliderButton = arr[0]; + mpImpl->maIncreaseButton = arr[1]; + mpImpl->maDecreaseButton = arr[2]; + } } // ----------------------------------------------------------------------- SvxZoomSliderControl::~SvxZoomSliderControl() { @@ -255,24 +266,28 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) const Rectangle aControlRect = getControlRect(); OutputDevice* pDev = rUsrEvt.GetDevice(); Rectangle aRect = rUsrEvt.GetRect(); Rectangle aSlider = aRect; + long nSliderHeight = 2 * pDev->GetDPIScaleFactor(); + long nSnappingHeight = 4 * pDev->GetDPIScaleFactor(); + aSlider.Top() += (aControlRect.GetHeight() - nSliderHeight)/2; aSlider.Bottom() = aSlider.Top() + nSliderHeight - 1; aSlider.Left() += nSliderXOffset; aSlider.Right() -= nSliderXOffset; Color aOldLineColor = pDev->GetLineColor(); Color aOldFillColor = pDev->GetFillColor(); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); pDev->SetLineColor( rStyleSettings.GetShadowColor() ); pDev->SetFillColor( rStyleSettings.GetShadowColor() ); + // draw snapping points: std::vector< long >::iterator aSnappingPointIter; for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin(); aSnappingPointIter != mpImpl->maSnappingPointOffsets.end(); ++aSnappingPointIter ) { @@ -285,24 +300,24 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) // draw slider pDev->DrawRect( aSlider ); // draw slider button Point aImagePoint = aRect.TopLeft(); aImagePoint.X() += Zoom2Offset( mpImpl->mnCurrentZoom ); - aImagePoint.X() -= nButtonWidth/2; - aImagePoint.Y() += (aControlRect.GetHeight() - nButtonHeight)/2; + aImagePoint.X() -= mpImpl->maSliderButton.GetSizePixel().Width()/2; + aImagePoint.Y() += (aControlRect.GetHeight() - mpImpl->maSliderButton.GetSizePixel().Height())/2; pDev->DrawImage( aImagePoint, mpImpl->maSliderButton ); // draw decrease button aImagePoint = aRect.TopLeft(); - aImagePoint.X() += (nSliderXOffset - nIncDecWidth)/2; - aImagePoint.Y() += (aControlRect.GetHeight() - nIncDecHeight)/2; + aImagePoint.X() += (nSliderXOffset - mpImpl->maDecreaseButton.GetSizePixel().Width())/2; + aImagePoint.Y() += (aControlRect.GetHeight() - mpImpl->maDecreaseButton.GetSizePixel().Height())/2; pDev->DrawImage( aImagePoint, mpImpl->maDecreaseButton ); // draw increase button - aImagePoint.X() = aRect.TopLeft().X() + aControlRect.GetWidth() - nIncDecWidth - (nSliderXOffset - nIncDecWidth)/2; + aImagePoint.X() = aRect.TopLeft().X() + aControlRect.GetWidth() - mpImpl->maIncreaseButton.GetSizePixel().Width() - (nSliderXOffset - mpImpl->maIncreaseButton.GetSizePixel().Height())/2; pDev->DrawImage( aImagePoint, mpImpl->maIncreaseButton ); pDev->SetLineColor( aOldLineColor ); pDev->SetFillColor( aOldFillColor ); } @@ -314,12 +329,14 @@ sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) return sal_True; const Rectangle aControlRect = getControlRect(); const Point aPoint = rEvt.GetPosPixel(); const sal_Int32 nXDiff = aPoint.X() - aControlRect.Left(); + long nIncDecWidth = mpImpl->maIncreaseButton.GetSizePixel().Width(); + const long nButtonLeftOffset = (nSliderXOffset - nIncDecWidth)/2; const long nButtonRightOffset = (nSliderXOffset + nIncDecWidth)/2; const long nOldZoom = mpImpl->mnCurrentZoom; // click to - button diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index f004fe310e1d..eb55215c723b 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -40,24 +40,12 @@ using namespace ::com::sun::star::frame; SFX_IMPL_TOOLBOX_CONTROL(SvxTableToolBoxControl,SfxUInt16Item); SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item); // class TableWindow ----------------------------------------------------- -const long TABLE_CELL_WIDTH = 15; -const long TABLE_CELL_HEIGHT = 15; - -const long TABLE_CELLS_HORIZ = 10; -const long TABLE_CELLS_VERT = 15; - -const long TABLE_POS_X = 2; -const long TABLE_POS_Y = 2; - -const long TABLE_WIDTH = TABLE_POS_X + TABLE_CELLS_HORIZ*TABLE_CELL_WIDTH; -const long TABLE_HEIGHT = TABLE_POS_Y + TABLE_CELLS_VERT*TABLE_CELL_HEIGHT; - class TableWindow : public SfxPopupWindow { private: PushButton aTableButton; ::Color aLineColor; ::Color aFillColor; @@ -68,12 +56,24 @@ private: bool bInitialKeyInput; bool m_bMod1; ToolBox& rTbx; Reference< XFrame > mxFrame; OUString maCommand; + long TABLE_CELL_WIDTH; + long TABLE_CELL_HEIGHT; + + const long TABLE_CELLS_HORIZ = 10; + const long TABLE_CELLS_VERT = 15; + + long TABLE_POS_X = 2; + long TABLE_POS_Y = 2; + + long TABLE_WIDTH; + long TABLE_HEIGHT; + DECL_LINK( SelectHdl, void * ); public: TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUString& rText, @@ -110,12 +110,18 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri nCol( 0 ), nLine( 0 ), rTbx(rParentTbx), mxFrame( rFrame ), maCommand( rCmd ) { + TABLE_CELL_WIDTH = 15 * GetDPIScaleFactor(); + TABLE_CELL_HEIGHT = 15 * GetDPIScaleFactor(); + + TABLE_WIDTH = TABLE_POS_X + TABLE_CELLS_HORIZ*TABLE_CELL_WIDTH; + TABLE_HEIGHT = TABLE_POS_Y + TABLE_CELLS_VERT*TABLE_CELL_HEIGHT; + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); svtools::ColorConfig aColorConfig; aLineColor = rStyles.GetShadowColor(); aFillColor = rStyles.GetWindowColor(); aHighlightFillColor = rStyles.GetHighlightColor(); diff --git a/svx/source/tbxctrls/tbcontrl.src b/svx/source/tbxctrls/tbcontrl.src index 4d2cfbc13a73..665f0fa5c2af 100644 --- a/svx/source/tbxctrls/tbcontrl.src +++ b/svx/source/tbxctrls/tbcontrl.src @@ -71,13 +71,13 @@ String RID_SVXSTR_FRAME_COLOR Text [ en-US ] = "Border Color" ; }; ComboBox RID_SVXTBX_STYLE { HelpId = HID_STYLE_LISTBOX ; - Size = MAP_APPFONT ( 67 , 86 ) ; + Size = MAP_APPFONT ( 50 , 86 ) ; DropDown = TRUE ; Sort = TRUE ; AutoHScroll = TRUE ; DDExtraWidth = TRUE ; Border = TRUE ; Hide = TRUE ; diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index 36e257e5d876..c34384466b6e 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -82,13 +82,13 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( const uno::Reference< frame::XFrame >& _xFrame, FontHeightToolBoxControl& _rCtrl ) : FontSizeBox( _pParent, WinBits( WB_DROPDOWN ) ), m_pCtrl ( &_rCtrl ), - m_aLogicalSize ( 30,100 ), + m_aLogicalSize ( 20,100 ), m_bRelease ( true ), m_xDispatchProvider ( _rDispatchProvider ), m_xFrame ( _xFrame ) { SetSizePixel( LogicToPixel( m_aLogicalSize, MAP_APPFONT )); SetValue( 0 ); diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index df288d45b88f..71d4a518c298 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -1558,12 +1558,25 @@ IMPL_LINK_NOARG(SwContentTree, ContentDoubleClickHdl) void SwContentTree::Display( bool bActive ) { if(!bIsImageListInitialized) { aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP)); + + if ( GetDPIScaleFactor() > 1 ) + { + for (short i = 0; i < aEntryImages.GetImageCount(); i++) + { + OUString rImageName = aEntryImages.GetImageName(i); + BitmapEx b = aEntryImages.GetImage(rImageName).GetBitmapEx(); + //Use Lanczos because it looks better with circles / diagonals + b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_LANCZOS); + aEntryImages.ReplaceImage(rImageName, Image(b)); + } + } + bIsImageListInitialized = true; } // First read the selected entry to select it later again if necessary // -> the user data here are no longer valid! SvTreeListEntry* pOldSelEntry = FirstSelected(); OUString sEntryName; // Name of the entry @@ -3475,14 +3488,15 @@ void SwContentLBoxString::Paint( void SwContentTree::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) ) { - aEntryImages = ImageList(SW_RES(IMG_NAVI_ENTRYBMP)); FindActiveTypeAndRemoveUserData(); + + bIsImageListInitialized = false; Display(true); } SvTreeListBox::DataChanged( rDCEvt ); } sal_Int32 SwContentTree::GetEntryRealChildrenNum( SvTreeListEntry* pParent ) const diff --git a/sw/source/ui/utlui/viewlayoutctrl.cxx b/sw/source/ui/utlui/viewlayoutctrl.cxx index 01a8985c6961..00d409e6c115 100644 --- a/sw/source/ui/utlui/viewlayoutctrl.cxx +++ b/sw/source/ui/utlui/viewlayoutctrl.cxx @@ -25,18 +25,12 @@ #include <svx/viewlayoutitem.hxx> #include <utlui.hrc> #include <swtypes.hxx> SFX_IMPL_STATUSBAR_CONTROL( SwViewLayoutControl, SvxViewLayoutItem ); -const long nImageWidthSingle = 14; -const long nImageWidthAuto = 24; -const long nImageWidthBook = 22; -const long nImageWidthSum = nImageWidthSingle + nImageWidthAuto + nImageWidthBook; -const long nImageHeight = 10; - struct SwViewLayoutControl::SwViewLayoutControl_Impl { sal_uInt16 mnState; // 0 = single, 1 = auto, 2 = book, 3 = none Image maImageSingleColumn; Image maImageSingleColumn_Active; Image maImageAutomatic; @@ -54,12 +48,36 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, mpImpl->maImageSingleColumn = Image( SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN) ); mpImpl->maImageSingleColumn_Active = Image( SW_RES(IMG_VIEWLAYOUT_SINGLECOLUMN_ACTIVE) ); mpImpl->maImageAutomatic = Image( SW_RES(IMG_VIEWLAYOUT_AUTOMATIC) ); mpImpl->maImageAutomatic_Active = Image( SW_RES(IMG_VIEWLAYOUT_AUTOMATIC_ACTIVE) ); mpImpl->maImageBookMode = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE) ); mpImpl->maImageBookMode_Active = Image( SW_RES(IMG_VIEWLAYOUT_BOOKMODE_ACTIVE) ); + + if ( rStb.GetDPIScaleFactor() > 1) + { + Image arr[6] = {mpImpl->maImageSingleColumn, mpImpl->maImageSingleColumn_Active, + mpImpl->maImageAutomatic, mpImpl->maImageAutomatic_Active, + mpImpl->maImageBookMode, mpImpl->maImageBookMode_Active}; + + for (int i = 0; i < 6; i++) + { + BitmapEx b = arr[i].GetBitmapEx(); + //Don't scale width, no space. + b.Scale(1.0, rStb.GetDPIScaleFactor(), BMP_SCALE_FAST); + arr[i] = Image(b); + } + + mpImpl->maImageSingleColumn = arr[0]; + mpImpl->maImageSingleColumn_Active = arr[1]; + + mpImpl->maImageAutomatic = arr[2]; + mpImpl->maImageAutomatic_Active = arr[3]; + + mpImpl->maImageBookMode = arr[4]; + mpImpl->maImageBookMode_Active = arr[5]; + } } SwViewLayoutControl::~SwViewLayoutControl() { delete mpImpl; } @@ -99,39 +117,48 @@ void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt ) const Rectangle aControlRect = getControlRect(); const bool bSingleColumn = 0 == mpImpl->mnState; const bool bAutomatic = 1 == mpImpl->mnState; const bool bBookMode = 2 == mpImpl->mnState; + const long nImageWidthSum = mpImpl->maImageSingleColumn.GetSizePixel().Width() + + mpImpl->maImageAutomatic.GetSizePixel().Width() + + mpImpl->maImageBookMode.GetSizePixel().Width(); + const long nXOffset = (aRect.GetWidth() - nImageWidthSum)/2; - const long nYOffset = (aControlRect.GetHeight() - nImageHeight)/2; + const long nYOffset = (aControlRect.GetHeight() - mpImpl->maImageSingleColumn.GetSizePixel().Height())/2; aRect.Left() = aRect.Left() + nXOffset; aRect.Top() = aRect.Top() + nYOffset; // draw single column image: pDev->DrawImage( aRect.TopLeft(), bSingleColumn ? mpImpl->maImageSingleColumn_Active : mpImpl->maImageSingleColumn ); // draw automatic image: - aRect.Left() += nImageWidthSingle; + aRect.Left() += mpImpl->maImageSingleColumn.GetSizePixel().Width(); pDev->DrawImage( aRect.TopLeft(), bAutomatic ? mpImpl->maImageAutomatic_Active : mpImpl->maImageAutomatic ); // draw bookmode image: - aRect.Left() += nImageWidthAuto; + aRect.Left() += mpImpl->maImageAutomatic.GetSizePixel().Width(); pDev->DrawImage( aRect.TopLeft(), bBookMode ? mpImpl->maImageBookMode_Active : mpImpl->maImageBookMode ); } sal_Bool SwViewLayoutControl::MouseButtonDown( const MouseEvent & rEvt ) { const Rectangle aRect = getControlRect(); const Point aPoint = rEvt.GetPosPixel(); const long nXDiff = aPoint.X() - aRect.Left(); sal_uInt16 nColumns = 1; bool bBookMode = false; + const long nImageWidthSingle = mpImpl->maImageSingleColumn.GetSizePixel().Width(); + const long nImageWidthAuto = mpImpl->maImageAutomatic.GetSizePixel().Width(); + const long nImageWidthBook = mpImpl->maImageBookMode.GetSizePixel().Width(); + const long nImageWidthSum = nImageWidthSingle + nImageWidthAuto + nImageWidthBook; + const long nXOffset = (aRect.GetWidth() - nImageWidthSum)/2; if ( nXDiff < nXOffset + nImageWidthSingle ) { mpImpl->mnState = 0; // single nColumns = 1; diff --git a/vcl/source/gdi/image.cxx b/vcl/source/gdi/image.cxx index 1384e0b1e14d..4b4b204ce4fe 100644 --- a/vcl/source/gdi/image.cxx +++ b/vcl/source/gdi/image.cxx @@ -510,17 +510,16 @@ void ImageList::AddImage( const OUString& rImageName, const Image& rImage ) void ImageList::ReplaceImage( const OUString& rImageName, const Image& rImage ) { const sal_uInt16 nId = ImplGetImageId( rImageName ); if( nId ) { - RemoveImage( nId ); - - if( !mpImplData ) - ImplInit( 0, rImage.GetSizePixel() ); - mpImplData->AddImage( rImageName, nId, rImage.GetBitmapEx()); + //Just replace the bitmap rather than doing RemoveImage / AddImage + //which breaks index-based iteration. + ImageAryData *pImg = mpImplData->maNameHash[ rImageName ]; + pImg->maBitmapEx = rImage.GetBitmapEx(); } } void ImageList::RemoveImage( sal_uInt16 nId ) { diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 850f63a10925..99b09db99195 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -392,12 +392,13 @@ static void ImplFontSubstitute( OUString& rFontName ) { rFontName = aSubstFontName; return; } } +//hidpi TODO: This routine has hard-coded font-sizes that break places such as DialControl Font OutputDevice::GetDefaultFont( sal_uInt16 nType, LanguageType eLang, sal_uLong nFlags, const OutputDevice* pOutDev ) { LanguageTag aLanguageTag( ( eLang == LANGUAGE_NONE || eLang == LANGUAGE_SYSTEM || eLang == LANGUAGE_DONTKNOW ) ? Application::GetSettings().GetUILanguageTag() : @@ -5296,12 +5297,13 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, nO /= F_PI1800; nOrientation = (short)nO; ImplRotatePos( nStartX, nStartY, nEndX, nEndY, -nOrientation ); } long nWaveHeight; + if ( nStyle == WAVE_NORMAL ) { nWaveHeight = 3; nStartY++; nEndY++; } diff --git a/vcl/source/window/msgbox.cxx b/vcl/source/window/msgbox.cxx index 82e216ade356..c733c03d6d67 100644 --- a/vcl/source/window/msgbox.cxx +++ b/vcl/source/window/msgbox.cxx @@ -246,18 +246,20 @@ void MessBox::ImplPosControls() { mbCheck = mpCheckBox->IsChecked(); delete mpCheckBox; mpCheckBox = NULL; } - // Message-Text um Tabs bereinigen + // Clean up message text with tabs OUString aMessText(maMessText.replaceAll("\t", " ")); - // Wenn Fenster zu schmall, machen wir Dialog auch breiter + //If window too small, we make dialog box be wider if ( mpWindowImpl->mbFrame ) - nMaxWidth = 630; + { + nMaxWidth = 630 * GetDPIScaleFactor(); + } else if ( nMaxWidth < 120 ) nMaxWidth = 120; nMaxWidth -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder+4; // MessageBox sollte min. so breit sein, das auch Title sichtbar ist @@ -283,24 +285,27 @@ void MessBox::ImplPosControls() mpFixedImage->Show(); nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE; } else aTextPos.X() += IMPL_MSGBOX_OFFSET_EXTRA_X; - // Maximale Zeilenlaenge ohne Wordbreak ermitteln + // Determine maximum line length without wordbreak aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo ); nMaxLineWidth = aFormatRect.GetWidth(); nTextStyle |= TEXT_DRAW_WORDBREAK; - // Breite fuer Textformatierung ermitteln + // Determine the width for text formatting if ( nMaxLineWidth > 450 ) nWidth = 450; else if ( nMaxLineWidth > 300 ) nWidth = nMaxLineWidth+5; else nWidth = 300; + + nWidth *= GetDPIScaleFactor(); + if ( nButtonSize > nWidth ) nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET); if ( nWidth > nMaxWidth ) nWidth = nMaxWidth; aRect.Right() = nWidth; diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index bcde38e4eec0..e78b6c181ba9 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -2757,13 +2757,12 @@ IMPL_LINK_NOARG(ToolBox, ImplUpdateHdl) ImplFormat(); return 0; } // ----------------------------------------------------------------------- - static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, sal_Bool bSetColor, sal_Bool bRotate ) { Color aOldFillColor = pBox->GetFillColor(); Color aOldLineColor = pBox->GetLineColor(); pBox->SetLineColor(); @@ -2772,44 +2771,61 @@ static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, sal_Bo if ( pBox->GetSettings().GetStyleSettings().GetFaceColor().IsDark() ) pBox->SetFillColor( Color( COL_WHITE ) ); else pBox->SetFillColor( Color( COL_BLACK ) ); } + int linewidth = 1 * pBox->GetDPIScaleFactor(); + int space = 4 * pBox->GetDPIScaleFactor(); + if( !bRotate ) { - long width = 8; - long height = 5; + long width = 8 * pBox->GetDPIScaleFactor(); + long height = 5 * pBox->GetDPIScaleFactor(); + + //Keep odd b/c drawing code works better + if ( height % 2 == 0 ) + height--; + + long heightOrig = height; + long x = rRect.Left() + (rRect.getWidth() - width)/2 + 1; long y = rRect.Top() + (rRect.getHeight() - height)/2 + 1; while( height >= 1) { - pBox->DrawRect( Rectangle( x, y, x+1, y ) ); - x+=4; - pBox->DrawRect( Rectangle( x, y, x+1, y ) ); - x-=4; + pBox->DrawRect( Rectangle( x, y, x + linewidth, y ) ); + x += space; + pBox->DrawRect( Rectangle( x, y, x + linewidth, y ) ); + x -= space; y++; - if( height <= 3) x--; + if( height <= heightOrig / 2 + 1) x--; else x++; height--; } } else { - long width = 5; - long height = 8; + long width = 5 * pBox->GetDPIScaleFactor(); + long height = 8 * pBox->GetDPIScaleFactor(); + + //Keep odd b/c drawing code works better + if (width % 2 == 0) + width--; + + long widthOrig = width; + long x = rRect.Left() + (rRect.getWidth() - width)/2 + 1; long y = rRect.Top() + (rRect.getHeight() - height)/2 + 1; while( width >= 1) { - pBox->DrawRect( Rectangle( x, y, x, y+1 ) ); - y+=4; - pBox->DrawRect( Rectangle( x, y, x, y+1 ) ); - y-=4; + pBox->DrawRect( Rectangle( x, y, x, y + linewidth ) ); + y += space; + pBox->DrawRect( Rectangle( x, y, x, y + linewidth ) ); + y -= space; x++; - if( width <= 3) y--; + if( width <= widthOrig / 2 + 1) y--; else y++; width--; } } pBox->SetFillColor( aOldFillColor ); @@ -2831,27 +2847,29 @@ static void ImplDrawDropdownArrow( ToolBox *pBox, const Rectangle& rDropDownRect else pBox->SetFillColor( Color( COL_BLACK ) ); } if( !bRotate ) { - long width = 5; - long height = 3; + long width = 5 * pBox->GetDPIScaleFactor(); + long height = 3 * pBox->GetDPIScaleFactor(); + long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2; long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2; while( width >= 1) { pBox->DrawRect( Rectangle( x, y, x+width-1, y ) ); y++; x++; width -= 2; } } else { - long width = 3; - long height = 5; + long width = 3 * pBox->GetDPIScaleFactor(); + long height = 5 * pBox->GetDPIScaleFactor(); + long x = rDropDownRect.Left() + (rDropDownRect.getWidth() - width)/2; long y = rDropDownRect.Top() + (rDropDownRect.getHeight() - height)/2; while( height >= 1) { pBox->DrawRect( Rectangle( x, y, x, y+height-1 ) ); y++; x++; diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 7a3a89b6bfb5..af9f5f908cf9 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1017,12 +1017,13 @@ const Size& ToolBox::GetDefaultImageSize(bool bLarge) case STYLE_SYMBOLS_DEFAULT: // galaxy case STYLE_SYMBOLS_HICONTRAST: default: aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); } } + return bLarge ? aLargeButtonSize : aSmallButtonSize; } const Size& ToolBox::GetDefaultImageSize() const { return GetDefaultImageSize( GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE ); @@ -1339,31 +1340,47 @@ void* ToolBox::GetItemData( sal_uInt16 nItemId ) const else return NULL; } // ----------------------------------------------------------------------- -void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage ) +void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rInputImage ) { sal_uInt16 nPos = GetItemPos( nItemId ); if ( nPos != TOOLBOX_ITEM_NOTFOUND ) { + const Image* pImage = &rInputImage; // Use the pointer to avoid unnecessary copying + Image aImage; // But we still need to keep the modified image alive if created. + + if ( GetDPIScaleFactor() > 1) + { + BitmapEx aBitmap = rInputImage.GetBitmapEx(); + + //Some code calls this twice, so add a sanity check + if (aBitmap.GetSizePixel().Width() < 32) + { + aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST); + aImage = Image(aBitmap); + pImage = &aImage; + } + } + ImplToolItem* pItem = &mpData->m_aItems[nPos]; // Nur wenn alles berechnet ist, mehr Aufwand treiben if ( !mbCalc ) { Size aOldSize = pItem->maImage.GetSizePixel(); - pItem->maImage = rImage; + pItem->maImage = *pImage; if ( aOldSize != pItem->maImage.GetSizePixel() ) ImplInvalidate( sal_True ); else ImplUpdateItem( nPos ); } else - pItem->maImage = rImage; + pItem->maImage = *pImage; } } // ----------------------------------------------------------------------- void ToolBox::SetImageList( const ImageList& rImageList ) |