[Libreoffice-commits] core.git: 2 commits - sc/source sd/source sfx2/source svx/source sw/source vcl/source

Jan Holesovsky kendy at collabora.com
Sat Jan 4 04:04:06 PST 2014


 sc/source/ui/miscdlgs/autofmt.cxx                    |    2 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.src |    1 
 sd/source/ui/sidebar/MasterPagesSelector.cxx         |    4 +
 sfx2/source/dialog/dinfdlg.cxx                       |   11 +++
 sfx2/source/sidebar/DeckLayouter.cxx                 |    8 +-
 sfx2/source/sidebar/SidebarChildWindow.cxx           |    2 
 sfx2/source/sidebar/SidebarController.cxx            |   32 ++++++-----
 sfx2/source/sidebar/TabBar.cxx                       |   25 +++++++-
 svx/source/sidebar/tools/ValueSetWithTextControl.cxx |   29 ++++++++++
 svx/source/tbxctrls/fontworkgallery.cxx              |    4 +
 svx/source/tbxctrls/tbcontrl.cxx                     |   13 ++++
 sw/source/ui/table/tautofmt.cxx                      |    2 
 vcl/source/window/toolbox2.cxx                       |   53 +++++++++++++------
 13 files changed, 146 insertions(+), 40 deletions(-)

New commits:
commit 0459682b4186b7522783e33cca3791420559817a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Sat Jan 4 12:59:04 2014 +0100

    hidpi: Blind fix - avoid double scaling by updating GetItemImage().
    
    I guess some code uses GetItemImage(), and then SetItemImage() again.  To make
    it work, scale the image down in the hidpi mode.
    
    Change-Id: I1ce9fdb28564b829253d7a9c7eabb46019e68876

diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 1f90219..0294e3d 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -622,9 +622,17 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
     DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
                 "ToolBox::InsertItem(): ItemId already exists" );
 
-    // Item anlegen und in die Liste einfuegen
-    mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) );
-    SetItemImage(nItemId, rImage);
+    Image aImage(rImage);
+    if (GetDPIScaleFactor() > 1)
+    {
+        BitmapEx aBitmap(aImage.GetBitmapEx());
+        aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST);
+        aImage = Image(aBitmap);
+    }
+
+    mpData->m_aItems.insert((nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
+            ImplToolItem(nItemId, aImage, nBits));
+
     mpData->ImplClearLayoutData();
 
     ImplInvalidate( sal_True );
@@ -644,9 +652,17 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
     DBG_ASSERT( GetItemPos( nItemId ) == TOOLBOX_ITEM_NOTFOUND,
                 "ToolBox::InsertItem(): ItemId already exists" );
 
-    // Item anlegen und in die Liste einfuegen
-    mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) );
-    SetItemImage(nItemId, rImage);
+    Image aImage(rImage);
+    if (GetDPIScaleFactor() > 1)
+    {
+        BitmapEx aBitmap(aImage.GetBitmapEx());
+        aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST);
+        aImage = Image(aBitmap);
+    }
+
+    mpData->m_aItems.insert((nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(),
+            ImplToolItem(nItemId, aImage, ImplConvertMenuString(rText), nBits));
+
     mpData->ImplClearLayoutData();
 
     ImplInvalidate( sal_True );
@@ -1353,17 +1369,11 @@ void ToolBox::SetItemImage( sal_uInt16 nItemId, const Image& rImage )
     {
         Image aImage(rImage);
 
-        if ( GetDPIScaleFactor() > 1)
+        if (GetDPIScaleFactor() > 1)
         {
             BitmapEx aBitmap(aImage.GetBitmapEx());
-
-            // Some code calls this twice, so add a sanity check
-            // FIXME find out what that code is & fix accordingly
-            if (aBitmap.GetSizePixel().Width() < 32)
-            {
-                aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST);
-                aImage = Image(aBitmap);
-            }
+            aBitmap.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BMP_SCALE_FAST);
+            aImage = Image(aBitmap);
         }
 
         ImplToolItem* pItem = &mpData->m_aItems[nPos];
@@ -1487,7 +1497,20 @@ Image ToolBox::GetItemImage( sal_uInt16 nItemId ) const
     ImplToolItem* pItem = ImplGetItem( nItemId );
 
     if ( pItem )
-        return pItem->maImage;
+    {
+        Image aImage(pItem->maImage);
+
+        if (GetDPIScaleFactor() > 1)
+        {
+            // we have scaled everything we have inserted, so scale it back to
+            // the original size
+            BitmapEx aBitmap(aImage.GetBitmapEx());
+            aBitmap.Scale(1.0/GetDPIScaleFactor(), 1.0/GetDPIScaleFactor(), BMP_SCALE_FAST);
+            aImage = Image(aBitmap);
+        }
+
+        return aImage;
+    }
     else
         return Image();
 }
commit ae37972cd25117d467d34ee8591c21dcbb5a0fec
Author: Keith Curtis <keithcu at gmail.com>
Date:   Thu Jan 2 16:01:07 2014 -0500

    hidpi: Sidebar, fontwork, autoformat and other improvements.
    
    This is a second batch of HiDPI changes. It fixes the following areas:
    
    Sidebar
    * Impress Master pages preview
    * deck title height
    * tab (icon) bar
    * valueset dropdown control
    * wider maximum width
    * Draw and other misc. buttons which didn't get fixed by earlier
       change to Toolbar.SetItemImage
    There are several more sidebar issues, but it is much improved.
    
    Other changes
    * Writer and Calc auto-format dialog text
    * file-properties document image
    * fontwork gallery preview size
    * Calc table border control
    
    Change-Id: I95a0169a3b011836b1c75b3dcacb2733c9567ef3

diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 425014f..a536b22 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -109,7 +109,7 @@ void ScAutoFmtPreview::MakeFonts( sal_uInt16 nIndex, Font& rFont, Font& rCJKFont
     if ( pCurData )
     {
         rFont = rCJKFont = rCTLFont = GetFont();
-        Size aFontSize( rFont.GetSize().Width(), 10 );
+        Size aFontSize( rFont.GetSize().Width(), 10 * GetDPIScaleFactor() );
 
         const SvxFontItem*        pFontItem       = (const SvxFontItem*)      pCurData->GetItem( nIndex, ATTR_FONT );
         const SvxWeightItem*      pWeightItem     = (const SvxWeightItem*)    pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT );
diff --git a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
index 0087628..4542e4c 100644
--- a/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
+++ b/sc/source/ui/sidebar/CellAppearancePropertyPanel.src
@@ -167,6 +167,7 @@ Control RID_POPUPPANEL_APPEARANCE_CELL_BORDERSTYLE
     DialogControl = TRUE;
     Border = FALSE;
 
+    //This is broken with the auto-doubled hidpi bitmaps
     Size = MAP_PIXEL(  POPUPPANEL_MARGIN_SMALL_PIXEL * 2 + 108,  POPUPPANEL_MARGIN_SMALL_PIXEL * 2  + 138);
 
     ToolBox TB_BORDER1
diff --git a/sd/source/ui/sidebar/MasterPagesSelector.cxx b/sd/source/ui/sidebar/MasterPagesSelector.cxx
index 783d4ed..9d1444a 100644
--- a/sd/source/ui/sidebar/MasterPagesSelector.cxx
+++ b/sd/source/ui/sidebar/MasterPagesSelector.cxx
@@ -87,6 +87,10 @@ MasterPagesSelector::MasterPagesSelector (
     PreviewValueSet::SetRightMouseClickHandler (
         LINK(this, MasterPagesSelector, RightClickHandler));
     PreviewValueSet::SetStyle(PreviewValueSet::GetStyle() | WB_NO_DIRECTSELECT);
+
+    if ( GetDPIScaleFactor() > 1 )
+        mpContainer->SetPreviewSize(MasterPageContainer::LARGE);
+
     PreviewValueSet::SetPreviewSize(mpContainer->GetPreviewSizePixel());
     PreviewValueSet::Show();
 
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 45030f3..6b58a51 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1055,7 +1055,16 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
     aURL.SetSmartProtocol( INET_PROT_FILE );
     aURL.SetSmartURL( aFactory);
     const OUString& rMainURL = aURL.GetMainURL( INetURLObject::NO_DECODE );
-    m_pBmp->SetImage( SvFileInformationManager::GetImage( aURL, sal_True ) );
+    Image aImage = SvFileInformationManager::GetImage( aURL, sal_True );
+
+    if ( GetDPIScaleFactor() > 1)
+    {
+        BitmapEx b = aImage.GetBitmapEx();
+        b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+        aImage = Image(b);
+    }
+
+    m_pBmp->SetImage( aImage );
 
     // determine size and type
     OUString aSizeText( m_aUnknownSize );
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index 9dcc358..c87625b 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -201,7 +201,6 @@ sal_Int32 DeckLayouter::PlacePanels (
 {
     ::std::vector<sal_Int32> aSeparators;
     const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
-    const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
     sal_Int32 nY (0);
 
     // Assign heights and places.
@@ -220,6 +219,8 @@ sal_Int32 DeckLayouter::PlacePanels (
         PanelTitleBar* pTitleBar = rPanel.GetTitleBar();
         if (pTitleBar != NULL)
         {
+            const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * rPanel.GetDPIScaleFactor());
+
             if (iItem->mbShowTitleBar)
             {
                 pTitleBar->setPosSizePixel(0, nY, nWidth, nPanelTitleBarHeight);
@@ -295,7 +296,6 @@ void DeckLayouter::GetRequestedSizes (
 {
     rAvailableHeight = rContentBox.GetHeight();
 
-    const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight));
     const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
 
     IterateLayoutItems(iItem,rLayoutItems)
@@ -315,6 +315,8 @@ void DeckLayouter::GetRequestedSizes (
             {
                 // Show the title bar and a separator above and below
                 // the title bar.
+                const sal_Int32 nPanelTitleBarHeight (Theme::GetInteger(Theme::Int_PanelTitleBarHeight) * iItem->mpPanel->GetDPIScaleFactor());
+
                 rAvailableHeight -= nPanelTitleBarHeight;
                 rAvailableHeight -= nDeckSeparatorHeight;
             }
@@ -438,7 +440,7 @@ Rectangle DeckLayouter::PlaceDeckTitle (
     }
     else
     {
-        const sal_Int32 nDeckTitleBarHeight (Theme::GetInteger(Theme::Int_DeckTitleBarHeight));
+        const sal_Int32 nDeckTitleBarHeight (Theme::GetInteger(Theme::Int_DeckTitleBarHeight) * rDeckTitleBar.GetDPIScaleFactor());
         rDeckTitleBar.setPosSizePixel(
             rAvailableSpace.Left(),
             rAvailableSpace.Top(),
diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx
index 8ef593a..f4347b1 100644
--- a/sfx2/source/sidebar/SidebarChildWindow.cxx
+++ b/sfx2/source/sidebar/SidebarChildWindow.cxx
@@ -68,7 +68,7 @@ sal_Int32 SidebarChildWindow::GetDefaultWidth (Window* pWindow)
         const static sal_Int32 nMaxPropertyPageWidth (115);
 
         return pWindow->LogicToPixel(Point(nMaxPropertyPageWidth,1), MAP_APPFONT).X()
-            + TabBar::GetDefaultWidth();
+            + TabBar::GetDefaultWidth() * pWindow->GetDPIScaleFactor();
     }
     else
         return 0;
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index d6fd4ba..357c545 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -338,11 +338,12 @@ void SidebarController::NotifyResize (void)
     }
 
     Window* pParentWindow = mpTabBar->GetParent();
+    sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
 
     const sal_Int32 nWidth (pParentWindow->GetSizePixel().Width());
     const sal_Int32 nHeight (pParentWindow->GetSizePixel().Height());
 
-    mbIsDeckOpen = (nWidth > TabBar::GetDefaultWidth());
+    mbIsDeckOpen = (nWidth > nTabBarDefaultWidth);
 
     if (mnSavedSidebarWidth <= 0)
         mnSavedSidebarWidth = nWidth;
@@ -352,9 +353,9 @@ void SidebarController::NotifyResize (void)
     {
         const bool bIsOpening (nWidth > mnWidthOnSplitterButtonDown);
         if (bIsOpening)
-            bIsDeckVisible = nWidth >= TabBar::GetDefaultWidth() + gnWidthOpenThreshold;
+            bIsDeckVisible = nWidth >= nTabBarDefaultWidth + gnWidthOpenThreshold;
         else
-            bIsDeckVisible = nWidth >= TabBar::GetDefaultWidth() + gnWidthCloseThreshold;
+            bIsDeckVisible = nWidth >= nTabBarDefaultWidth + gnWidthCloseThreshold;
         mbIsDeckRequestedOpen = bIsDeckVisible;
         UpdateCloseIndicator(!bIsDeckVisible);
     }
@@ -371,7 +372,7 @@ void SidebarController::NotifyResize (void)
             {
                 if (bIsDeckVisible)
                 {
-                    mpCurrentDeck->setPosSizePixel(0,0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+                    mpCurrentDeck->setPosSizePixel(0,0, nWidth-nTabBarDefaultWidth, nHeight);
                     mpCurrentDeck->Show();
                     mpCurrentDeck->RequestLayout();
                 }
@@ -380,19 +381,19 @@ void SidebarController::NotifyResize (void)
             }
 
             // Now place the tab bar.
-            mpTabBar->setPosSizePixel(nWidth-TabBar::GetDefaultWidth(),0,TabBar::GetDefaultWidth(),nHeight);
+            mpTabBar->setPosSizePixel(nWidth-nTabBarDefaultWidth,0,nTabBarDefaultWidth,nHeight);
             mpTabBar->Show();
         }
         else if ( pSplitWindow->GetAlign() == WINDOWALIGN_LEFT)     // attach the Sidebar towards the left-side of screen
         {
             // Place the tab bar first.
-            mpTabBar->setPosSizePixel(0,0,TabBar::GetDefaultWidth(),nHeight);
+            mpTabBar->setPosSizePixel(0,0,nTabBarDefaultWidth,nHeight);
             mpTabBar->Show();
 
             // Now place the deck.
             if (bIsDeckVisible)
             {
-                mpCurrentDeck->setPosSizePixel(TabBar::GetDefaultWidth(),0, nWidth-TabBar::GetDefaultWidth(), nHeight);
+                mpCurrentDeck->setPosSizePixel(nTabBarDefaultWidth,0, nWidth-nTabBarDefaultWidth, nHeight);
                 mpCurrentDeck->Show();
                 mpCurrentDeck->RequestLayout();
             }
@@ -436,7 +437,7 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth)
         mbIsDeckOpen = true;
         RequestCloseDeck();
 
-        if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth())
+        if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor())
             mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
     }
 }
@@ -688,7 +689,7 @@ void SidebarController::SwitchToDeck (
     mpCurrentDeck->setPosSizePixel(
         0,
         0,
-        mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth(),
+        mpParentWindow->GetSizePixel().Width()-TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor(),
         mpParentWindow->GetSizePixel().Height());
 
     mpCurrentDeck->SetPanels(aNewPanels);
@@ -1014,6 +1015,8 @@ void SidebarController::UpdateDeckOpenState (void)
         // No state requested.
         return;
 
+    sal_Int32 nTabBarDefaultWidth = TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor();
+
     // Update (change) the open state when it either has not yet been initialized
     // or when its value differs from the requested state.
     if ( ! mbIsDeckOpen
@@ -1021,7 +1024,7 @@ void SidebarController::UpdateDeckOpenState (void)
     {
         if (mbIsDeckRequestedOpen.get())
         {
-            if (mnSavedSidebarWidth <= TabBar::GetDefaultWidth())
+            if (mnSavedSidebarWidth <= nTabBarDefaultWidth)
                 SetChildWindowWidth(SidebarChildWindow::GetDefaultWidth(mpParentWindow));
             else
                 SetChildWindowWidth(mnSavedSidebarWidth);
@@ -1029,8 +1032,8 @@ void SidebarController::UpdateDeckOpenState (void)
         else
         {
             if ( ! mpParentWindow->IsFloatingMode())
-                mnSavedSidebarWidth = SetChildWindowWidth(TabBar::GetDefaultWidth());
-            if (mnWidthOnSplitterButtonDown > TabBar::GetDefaultWidth())
+                mnSavedSidebarWidth = SetChildWindowWidth(nTabBarDefaultWidth);
+            if (mnWidthOnSplitterButtonDown > nTabBarDefaultWidth)
                 mnSavedSidebarWidth = mnWidthOnSplitterButtonDown;
             mpParentWindow->SetStyle(mpParentWindow->GetStyle() & ~WB_SIZEABLE);
         }
@@ -1109,7 +1112,8 @@ void SidebarController::RestrictWidth (sal_Int32 nWidth)
         const sal_uInt16 nSetId (pSplitWindow->GetSet(nId));
         pSplitWindow->SetItemSizeRange(
             nSetId,
-            Range(TabBar::GetDefaultWidth() + nWidth, gnMaximumSidebarWidth));
+            Range(TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() + nWidth,
+                  gnMaximumSidebarWidth * mpTabBar->GetDPIScaleFactor()));
     }
 }
 
@@ -1163,7 +1167,7 @@ void SidebarController::UpdateCloseIndicator (const bool bCloseAfterDrag)
         const Size aImageSize (mpCloseIndicator->GetSizePixel());
         mpCloseIndicator->SetPosPixel(
             Point(
-                aWindowSize.Width() - TabBar::GetDefaultWidth() - aImageSize.Width(),
+                aWindowSize.Width() - TabBar::GetDefaultWidth() * mpTabBar->GetDPIScaleFactor() - aImageSize.Width(),
                 (aWindowSize.Height() - aImageSize.Height())/2));
         mpCloseIndicator->Show();
     }
diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index ba5974d..353a2bb 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -150,7 +150,14 @@ void TabBar::SetDecks (
 
 void TabBar::UpdateButtonIcons (void)
 {
-    mpMenuButton->SetModeImage(Theme::GetImage(Theme::Image_TabBarMenu));
+    Image aImage = Theme::GetImage(Theme::Image_TabBarMenu);
+    if ( mpMenuButton->GetDPIScaleFactor() > 1 )
+    {
+        BitmapEx b = aImage.GetBitmapEx();
+        b.Scale(mpMenuButton->GetDPIScaleFactor(), mpMenuButton->GetDPIScaleFactor(), BMP_SCALE_FAST);
+        aImage = Image(b);
+    }
+    mpMenuButton->SetModeImage(aImage);
 
     for(ItemContainer::const_iterator
             iItem(maItems.begin()), iEnd(maItems.end());
@@ -159,7 +166,17 @@ void TabBar::UpdateButtonIcons (void)
     {
         const DeckDescriptor* pDeckDescriptor = ResourceManager::Instance().GetDeckDescriptor(iItem->msDeckId);
         if (pDeckDescriptor != NULL)
-            iItem->mpButton->SetModeImage(GetItemImage(*pDeckDescriptor));
+        {
+            aImage = GetItemImage(*pDeckDescriptor);
+            if ( mpMenuButton->GetDPIScaleFactor() > 1 )
+            {
+                BitmapEx b = aImage.GetBitmapEx();
+                b.Scale(mpMenuButton->GetDPIScaleFactor(), mpMenuButton->GetDPIScaleFactor(), BMP_SCALE_FAST);
+                aImage = Image(b);
+            }
+
+            iItem->mpButton->SetModeImage(aImage);
+        }
     }
 
     Invalidate();
@@ -178,8 +195,8 @@ void TabBar::Layout (void)
     sal_Int32 nX (aPadding.Top());
     sal_Int32 nY (aPadding.Left());
     const Size aTabItemSize (
-        Theme::GetInteger(Theme::Int_TabItemWidth),
-        Theme::GetInteger(Theme::Int_TabItemHeight));
+        Theme::GetInteger(Theme::Int_TabItemWidth) * GetDPIScaleFactor(),
+        Theme::GetInteger(Theme::Int_TabItemHeight) * GetDPIScaleFactor());
 
     // Place the menu button and the separator.
     if (mpMenuButton != 0)
diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
index 25d5798..b897fac 100644
--- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
+++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx
@@ -99,6 +99,21 @@ void ValueSetWithTextControl::AddItem(
     aItem.maSelectedItemImage = (pSelectedItemImage != 0)
                                 ? *pSelectedItemImage
                                 : rItemImage;
+
+    if ( GetDPIScaleFactor() > 1 )
+    {
+        BitmapEx b = aItem.maItemImage.GetBitmapEx();
+        b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+        aItem.maItemImage = Image(b);
+
+        if ( pSelectedItemImage != 0 )
+        {
+            b = aItem.maSelectedItemImage.GetBitmapEx();
+            b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+            aItem.maSelectedItemImage = Image(b);
+        }
+    }
+
     aItem.maItemText = rItemText;
 
     maItems.push_back( aItem );
@@ -151,6 +166,20 @@ void ValueSetWithTextControl::ReplaceItemImages(
     maItems[nItemId-1].maSelectedItemImage = (pSelectedItemImage != 0)
                                              ? *pSelectedItemImage
                                              : rItemImage;
+
+    if ( GetDPIScaleFactor() > 1 )
+    {
+        BitmapEx b = maItems[nItemId-1].maItemImage.GetBitmapEx();
+        b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+        maItems[nItemId-1].maItemImage = Image(b);
+
+        if ( pSelectedItemImage != 0 )
+        {
+            b = maItems[nItemId-1].maSelectedItemImage.GetBitmapEx();
+            b.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+            maItems[nItemId-1].maSelectedItemImage = Image(b);
+        }
+    }
 }
 
 
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index db81609..01b34f9 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -126,6 +126,10 @@ void FontWorkGalleryDialog::initFavorites(sal_uInt16 nThemeId)
         {
             VirtualDevice aVDev;
             const Point aNull(0, 0);
+
+            if (GetDPIScaleFactor() > 1)
+                aThumb.Scale(GetDPIScaleFactor(), GetDPIScaleFactor());
+
             const Size aSize(aThumb.GetSizePixel());
 
             aVDev.SetOutputSizePixel(aSize);
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index f7976e8..6d6befa 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -1265,6 +1265,17 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFram
     AddStatusListener(OUString(".uno:BorderReducedMode"));
     aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) );
 
+    if( pParentWindow->GetDPIScaleFactor() > 1 )
+    {
+        for (short i = 0; i < aImgList.GetImageCount(); i++)
+        {
+            OUString rImageName = aImgList.GetImageName(i);
+            BitmapEx b = aImgList.GetImage(rImageName).GetBitmapEx();
+            b.Scale(pParentWindow->GetDPIScaleFactor(), pParentWindow->GetDPIScaleFactor());
+            aImgList.ReplaceImage(rImageName, Image(b));
+        }
+    }
+
     /*
      *  1       2        3         4
      *  -------------------------------------
@@ -1287,7 +1298,7 @@ SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFram
     aFrameSet.SetColCount( 4 );
     aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) );
 
-    lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
+    lcl_CalcSizeValueSet( *this, aFrameSet, Size( 20 * pParentWindow->GetDPIScaleFactor(), 20 * pParentWindow->GetDPIScaleFactor() ));
 
     SetHelpId( HID_POPUP_FRAME );
     SetText( SVX_RESSTR(RID_SVXSTR_FRAME) );
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 5b68feb..0651d15 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -566,7 +566,7 @@ void AutoFmtPreview::MakeFonts( sal_uInt8 nIndex, Font& rFont, Font& rCJKFont, F
     const SwBoxAutoFmt& rBoxFmt = aCurData.GetBoxFmt( nIndex );
 
     rFont = rCJKFont = rCTLFont = GetFont();
-    Size aFontSize( rFont.GetSize().Width(), 10 );
+    Size aFontSize( rFont.GetSize().Width(), 10 * GetDPIScaleFactor() );
 
     lcl_SetFontProperties( rFont, rBoxFmt.GetFont(), rBoxFmt.GetWeight(), rBoxFmt.GetPosture() );
     lcl_SetFontProperties( rCJKFont, rBoxFmt.GetCJKFont(), rBoxFmt.GetCJKWeight(), rBoxFmt.GetCJKPosture() );
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index fca0ce8..1f90219 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -624,6 +624,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
 
     // Item anlegen und in die Liste einfuegen
     mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, nBits ) );
+    SetItemImage(nItemId, rImage);
     mpData->ImplClearLayoutData();
 
     ImplInvalidate( sal_True );
@@ -645,6 +646,7 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
 
     // Item anlegen und in die Liste einfuegen
     mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), ImplToolItem( nItemId, rImage, ImplConvertMenuString( rText ), nBits ) );
+    SetItemImage(nItemId, rImage);
     mpData->ImplClearLayoutData();
 
     ImplInvalidate( sal_True );


More information about the Libreoffice-commits mailing list