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 @@ -322,6 +322,18 @@ void AlignmentTabPage::InitVsRefEgde() 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(); 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 @@ -87,9 +87,6 @@ SvxBorderTabPage::SvxBorderTabPage(Window* pParent, const SfxItemSet& rCoreAttrs , - - - aShadowImgLst( CUI_RES(IL_SDW_BITMAPS)), aBorderImgLst( CUI_RES(IL_PRE_BITMAPS)), nMinValue(0), @@ -131,6 +128,25 @@ SvxBorderTabPage::SvxBorderTabPage(Window* pParent, const SfxItemSet& rCoreAttrs 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(); 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 @@ -559,6 +559,8 @@ public: */ bool supportsOperation( OutDevSupportType ) const; + sal_Int32 GetDPIScaleFactor() const { return mnDPIScaleFactor; } + vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; } void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; } 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 @@ -650,6 +650,9 @@ void LayoutMenu::Fill (void) { 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); 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 @@ -19,7 +19,7 @@ --> <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"/> 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 @@ -19,7 +19,7 @@ --> <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"/> 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 @@ -449,8 +449,13 @@ void DialControl::Init( const Size& rWinSize, const Font& rWinFont ) 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 ); } 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 @@ -64,6 +64,7 @@ struct SvxModifyControl::ImplData 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); } }; @@ -75,6 +76,19 @@ SvxModifyControl::SvxModifyControl( sal_uInt16 _nSlotId, 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) ); } 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 @@ -177,6 +177,17 @@ SvxPosSizeStatusBarControl::SvxPosSizeStatusBarControl( sal_uInt16 _nSlotId, 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 @@ -80,6 +80,13 @@ SvxSelectionModeControl::SvxSelectionModeControl( sal_uInt16 _nSlotId, 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(), "" ); } 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 @@ -60,6 +60,23 @@ XmlSecStatusBarControl::XmlSecStatusBarControl( sal_uInt16 _nSlotId, sal_uInt16 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() @@ -135,20 +152,22 @@ void XmlSecStatusBarControl::Paint( const UserDrawEvent& rUsrEvt ) 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 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 @@ -66,12 +66,6 @@ struct SvxZoomSliderControl::SvxZoomSliderControl_Impl // ----------------------------------------------------------------------- -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 @@ -175,6 +169,23 @@ SvxZoomSliderControl::SvxZoomSliderControl( sal_uInt16 _nSlotId, sal_uInt16 _nI 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]; + } } // ----------------------------------------------------------------------- @@ -258,6 +269,9 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) 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; @@ -270,6 +284,7 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) pDev->SetLineColor( rStyleSettings.GetShadowColor() ); pDev->SetFillColor( rStyleSettings.GetShadowColor() ); + // draw snapping points: std::vector< long >::iterator aSnappingPointIter; for ( aSnappingPointIter = mpImpl->maSnappingPointOffsets.begin(); @@ -288,18 +303,18 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt ) // 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 ); @@ -317,6 +332,8 @@ sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt ) 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; 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 @@ -43,18 +43,6 @@ 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: @@ -71,6 +59,18 @@ private: 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: @@ -113,6 +113,12 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, const OUString& rCmd, const OUStri 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; 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 @@ -74,7 +74,7 @@ String RID_SVXSTR_FRAME_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 ; 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 @@ -85,7 +85,7 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( 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 ) 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 @@ -1561,6 +1561,19 @@ 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 @@ -3478,8 +3491,9 @@ 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 ); 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 @@ -28,12 +28,6 @@ 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 @@ -57,6 +51,30 @@ SwViewLayoutControl::SwViewLayoutControl( sal_uInt16 _nSlotId, sal_uInt16 _nId, 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() @@ -102,8 +120,12 @@ void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt ) 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; @@ -112,11 +134,11 @@ void SwViewLayoutControl::Paint( const UserDrawEvent& rUsrEvt ) 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 ); } @@ -129,6 +151,11 @@ sal_Bool SwViewLayoutControl::MouseButtonDown( const MouseEvent & rEvt ) 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 ) 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 @@ -513,11 +513,10 @@ void ImageList::ReplaceImage( const OUString& rImageName, const Image& rImage ) 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(); } } 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 @@ -395,6 +395,7 @@ static void ImplFontSubstitute( OUString& rFontName ) } } +//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 ) { @@ -5299,6 +5300,7 @@ void OutputDevice::DrawWaveLine( const Point& rStartPos, const Point& rEndPos, } long nWaveHeight; + if ( nStyle == WAVE_NORMAL ) { nWaveHeight = 3; 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 @@ -249,12 +249,14 @@ void MessBox::ImplPosControls() 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; @@ -286,18 +288,21 @@ void MessBox::ImplPosControls() 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 ) 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 @@ -2760,7 +2760,6 @@ IMPL_LINK_NOARG(ToolBox, ImplUpdateHdl) } // ----------------------------------------------------------------------- - static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, sal_Bool bSetColor, sal_Bool bRotate ) { Color aOldFillColor = pBox->GetFillColor(); @@ -2775,38 +2774,55 @@ static void ImplDrawMoreIndicator( ToolBox *pBox, const Rectangle& rRect, sal_Bo 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--; } @@ -2834,8 +2850,9 @@ static void ImplDrawDropdownArrow( ToolBox *pBox, const Rectangle& rDropDownRect 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) @@ -2847,8 +2864,9 @@ static void ImplDrawDropdownArrow( ToolBox *pBox, const Rectangle& rDropDownRect } 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) 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 @@ -1020,6 +1020,7 @@ const Size& ToolBox::GetDefaultImageSize(bool bLarge) aLargeButtonSize = Size( TB_LARGEIMAGESIZE, TB_LARGEIMAGESIZE ); } } + return bLarge ? aLargeButtonSize : aSmallButtonSize; } @@ -1342,25 +1343,41 @@ void* ToolBox::GetItemData( sal_uInt16 nItemId ) const // ----------------------------------------------------------------------- -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; } } |