[Libreoffice-commits] core.git: cui/source sc/source sd/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 18 10:49:44 UTC 2019


 cui/source/dialogs/cuihyperdlg.cxx              |   19 ++++---------------
 cui/source/dialogs/hldocntp.cxx                 |    4 +---
 cui/source/dialogs/hldoctp.cxx                  |    8 ++------
 cui/source/dialogs/hlmailtp.cxx                 |    4 +---
 cui/source/dialogs/hltpbase.cxx                 |    4 +---
 cui/source/inc/border.hxx                       |    4 ++--
 cui/source/tabpages/align.cxx                   |   19 ++++++-------------
 cui/source/tabpages/border.cxx                  |   13 ++-----------
 sc/source/ui/cctrl/checklistmenu.cxx            |    7 ++-----
 sd/source/ui/animations/SlideTransitionPane.cxx |    4 ++--
 sd/source/ui/dlg/inspagob.cxx                   |    4 +---
 11 files changed, 24 insertions(+), 66 deletions(-)

New commits:
commit 41b8b8c5ede634774851b438a4c823962c14b611
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Jan 18 11:06:53 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 18 11:49:17 2019 +0100

    use Image(OUString) instead of Image(Bitmap(OUString))
    
    which benefits LOOL since we can delay creating the image until
    we know the dpi setting of the display we are going to write to.
    
    Change-Id: I4c16fd221f7ec3693e37bacf3fdf7026a8c2e8bc
    Reviewed-on: https://gerrit.libreoffice.org/66574
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 9612b8195bd6..26a6e4f027c4 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -89,33 +89,22 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
 {
     mbGrabFocus = true;
     // insert pages
-    std::vector<Image> imgVector;
     OUString aStrTitle;
     SvxIconChoiceCtrlEntry *pEntry;
-    imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLINETTP);
-    imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLMAILTP);
-    imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLDOCTP);
-    imgVector.emplace_back(StockImage::Yes, RID_SVXBMP_HLDOCNTP);
 
-    for(Image &aImage : imgVector )
-    {
-        BitmapEx aBitmap = aImage.GetBitmapEx();
-        aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality);
-        aImage = Image(aBitmap);
-    }
     aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP );
-    pEntry = AddTabPage ( HyperLinkPageType::Internet, aStrTitle, imgVector[0], SvxHyperlinkInternetTp::Create );
+    pEntry = AddTabPage ( HyperLinkPageType::Internet, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLINETTP), SvxHyperlinkInternetTp::Create );
     pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
     aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP );
-    pEntry = AddTabPage ( HyperLinkPageType::Mail, aStrTitle, imgVector[1], SvxHyperlinkMailTp::Create );
+    pEntry = AddTabPage ( HyperLinkPageType::Mail, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLMAILTP), SvxHyperlinkMailTp::Create );
     pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
     if (!comphelper::LibreOfficeKit::isActive())
     {
         aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP );
-        pEntry = AddTabPage ( HyperLinkPageType::Document, aStrTitle, imgVector[2], SvxHyperlinkDocTp::Create );
+        pEntry = AddTabPage ( HyperLinkPageType::Document, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLDOCTP), SvxHyperlinkDocTp::Create );
         pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
         aStrTitle = CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP );
-        pEntry = AddTabPage ( HyperLinkPageType::NewDocument, aStrTitle, imgVector[3], SvxHyperlinkNewDocTp::Create );
+        pEntry = AddTabPage ( HyperLinkPageType::NewDocument, aStrTitle, Image(StockImage::Yes, RID_SVXBMP_HLDOCNTP), SvxHyperlinkNewDocTp::Create );
         pEntry->SetQuickHelpText( CuiResId( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
     }
 
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index 96a2fcac3ed8..4246bfec636f 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -111,9 +111,7 @@ SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDia
     get(m_pCbbPath, "path");
     m_pCbbPath->SetSmartProtocol(INetProtocol::File);
     get(m_pBtCreate, "create");
-    BitmapEx aBitmap(RID_SVXBMP_NEWDOC);
-    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
-    m_pBtCreate->SetModeImage(Image(aBitmap));
+    m_pBtCreate->SetModeImage(Image(RID_SVXBMP_NEWDOC));
     get(m_pLbDocTypes, "types");
     m_pLbDocTypes->set_height_request(m_pLbDocTypes->GetTextHeight() * 5);
 
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 9c3033b693c7..968c420211c2 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -42,15 +42,11 @@ SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* p
     get(m_pCbbPath, "path");
     m_pCbbPath->SetSmartProtocol(INetProtocol::File);
     get(m_pBtFileopen, "fileopen");
-    BitmapEx aBitmap(RID_SVXBMP_FILEOPEN);
-    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality);
-    m_pBtFileopen->SetModeImage(Image(aBitmap));
+    m_pBtFileopen->SetModeImage(Image(RID_SVXBMP_FILEOPEN));
     get(m_pEdTarget, "target");
     get(m_pFtFullURL, "url");
     get(m_pBtBrowse, "browse");
-    aBitmap = BitmapEx(RID_SVXBMP_TARGET);
-    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
-    m_pBtBrowse->SetModeImage(Image(aBitmap));
+    m_pBtBrowse->SetModeImage(Image(RID_SVXBMP_TARGET));
 
     // Disable display of bitmap names.
     m_pBtBrowse->EnableTextDisplay (false);
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index f3f9cbc9ed39..b56f34ff41c9 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -42,9 +42,7 @@ SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog*
     get(m_pCbbReceiver, "receiver");
     m_pCbbReceiver->SetSmartProtocol(INetProtocol::Mailto);
     get(m_pBtAdrBook, "adressbook");
-    BitmapEx aBitmap(RID_SVXBMP_ADRESSBOOK);
-    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
-    m_pBtAdrBook->SetModeImage(Image(aBitmap));
+    m_pBtAdrBook->SetModeImage(Image(RID_SVXBMP_ADRESSBOOK));
     get(m_pFtSubject, "subject_label");
     get(m_pEdSubject, "subject");
 
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 38402c8af924..0becb6f69590 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -176,9 +176,7 @@ void SvxHyperlinkTabPageBase::InitStdControls ()
         get(mpEdIndication, "indication");
         get(mpEdText, "name");
         get(mpBtScript, "script");
-        BitmapEx aBitmap(RID_SVXBMP_SCRIPT);
-        aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
-        mpBtScript->SetModeImage(Image(aBitmap));
+        mpBtScript->SetModeImage(Image(RID_SVXBMP_SCRIPT));
 
         mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) );
         mpBtScript->EnableTextDisplay (false);
diff --git a/cui/source/inc/border.hxx b/cui/source/inc/border.hxx
index 009048d738fb..a57db4dc58f0 100644
--- a/cui/source/inc/border.hxx
+++ b/cui/source/inc/border.hxx
@@ -102,8 +102,8 @@ protected:
 private:
     SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCoreAttrs);
 
-    std::vector<BitmapEx> m_aShadowImgVec;
-    std::vector<BitmapEx> m_aBorderImgVec;
+    std::vector<Image> m_aShadowImgVec;
+    std::vector<Image> m_aBorderImgVec;
 
     long                nMinValue;  ///< minimum distance
     SwBorderModes       nSWMode;    ///< table, textframe, paragraph
diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index 57e23b0bba46..0b230fc4cd05 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -596,24 +596,17 @@ void AlignmentTabPage::InitVsRefEgde()
     // remember selection - is deleted in call to ValueSet::Clear()
     sal_uInt16 nSel = m_aVsRefEdge.GetSelectedItemId();
 
-    BitmapEx aBottomLock(RID_SVXBMP_BOTTOMLOCK);
-    BitmapEx aTopLock(RID_SVXBMP_TOPLOCK);
-    BitmapEx aCellLock(RID_SVXBMP_CELLLOCK);
-
-    if( GetDPIScaleFactor() > 1 )
-    {
-        aBottomLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
-        aTopLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
-        aCellLock.Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
-    }
+    Image aBottomLock(RID_SVXBMP_BOTTOMLOCK);
+    Image aTopLock(RID_SVXBMP_TOPLOCK);
+    Image aCellLock(RID_SVXBMP_CELLLOCK);
 
     m_aVsRefEdge.Clear();
     m_aVsRefEdge.SetStyle(m_aVsRefEdge.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER);
 
     m_aVsRefEdge.SetColCount(3);
-    m_aVsRefEdge.InsertItem(IID_BOTTOMLOCK, Image(aBottomLock),  m_xFtBotLock->get_label());
-    m_aVsRefEdge.InsertItem(IID_TOPLOCK,    Image(aTopLock),     m_xFtTopLock->get_label());
-    m_aVsRefEdge.InsertItem(IID_CELLLOCK,   Image(aCellLock),    m_xFtCelLock->get_label());
+    m_aVsRefEdge.InsertItem(IID_BOTTOMLOCK, aBottomLock,  m_xFtBotLock->get_label());
+    m_aVsRefEdge.InsertItem(IID_TOPLOCK,    aTopLock,     m_xFtTopLock->get_label());
+    m_aVsRefEdge.InsertItem(IID_CELLLOCK,   aCellLock,    m_xFtCelLock->get_label());
     m_aVsRefEdge.SetOptimalSize();
 
     m_aVsRefEdge.SelectItem( nSel );
diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx
index 749505c1fd0f..aa48782017c9 100644
--- a/cui/source/tabpages/border.cxx
+++ b/cui/source/tabpages/border.cxx
@@ -309,15 +309,6 @@ SvxBorderTabPage::SvxBorderTabPage(TabPageParent pParent, const SfxItemSet& rCor
         m_aShadowImgVec.emplace_back(pnShadowImgIds[i]);
     assert(m_aShadowImgVec.size() == SVX_BORDER_SHADOW_COUNT);
 
-    if ( GetDPIScaleFactor() > 1 )
-    {
-        for (size_t i = 0; i < m_aBorderImgVec.size(); ++i)
-            m_aBorderImgVec[i].Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
-
-        for (size_t i = 0; i < m_aShadowImgVec.size(); ++i)
-            m_aShadowImgVec[i].Scale(GetDPIScaleFactor(), GetDPIScaleFactor(), BmpScaleFlag::Fast);
-    }
-
     // this page needs ExchangeSupport
     SetExchangeSupport();
 
@@ -1226,7 +1217,7 @@ void SvxBorderTabPage::FillPresetVS()
     for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_PRESET_COUNT; ++nVSIdx )
     {
         m_xWndPresets->InsertItem( nVSIdx );
-        m_xWndPresets->SetItemImage(nVSIdx, Image(m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]));
+        m_xWndPresets->SetItemImage(nVSIdx, m_aBorderImgVec[GetPresetImageId(nVSIdx) - 1]);
         m_xWndPresets->SetItemText( nVSIdx, CuiResId( GetPresetStringId( nVSIdx ) ) );
     }
 
@@ -1250,7 +1241,7 @@ void SvxBorderTabPage::FillShadowVS()
     for( sal_uInt16 nVSIdx = 1; nVSIdx <= SVX_BORDER_SHADOW_COUNT; ++nVSIdx )
     {
         m_xWndShadows->InsertItem( nVSIdx );
-        m_xWndShadows->SetItemImage(nVSIdx, Image(m_aShadowImgVec[nVSIdx-1]));
+        m_xWndShadows->SetItemImage(nVSIdx, m_aShadowImgVec[nVSIdx-1]);
         m_xWndShadows->SetItemText( nVSIdx, CuiResId( pnStrIds[ nVSIdx - 1 ] ) );
     }
 
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 72aa34c6bc91..337fad93bf62 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -1098,15 +1098,12 @@ void ScCheckListMenuWindow::packWindow()
 
     float fScaleFactor = GetDPIScaleFactor();
 
-    BitmapEx aSingleSelectBmp(RID_BMP_SELECT_CURRENT);
-    if (fScaleFactor > 1)
-        aSingleSelectBmp.Scale(fScaleFactor, fScaleFactor, BmpScaleFlag::Fast);
-    Image aSingleSelect(aSingleSelectBmp);
+    ;
 
     getSectionPosSize(aPos, aSize, BTN_SINGLE_SELECT);
     maBtnSelectSingle->SetPosSizePixel(aPos, aSize);
     maBtnSelectSingle->SetQuickHelpText(ScResId(STR_BTN_SELECT_CURRENT));
-    maBtnSelectSingle->SetModeImage(aSingleSelect);
+    maBtnSelectSingle->SetModeImage(Image(RID_BMP_SELECT_CURRENT));
     maBtnSelectSingle->SetClickHdl( LINK(this, ScCheckListMenuWindow, ButtonHdl) );
     maBtnSelectSingle->Show();
 
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index 311d5356f36d..d4f7a597277c 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -1159,10 +1159,10 @@ IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback, Timer *, void)
                 OUString sImageName("sd/cmd/transition-" + pPreset->getSetId() + ".png");
                 BitmapEx aIcon( sImageName );
                 if ( aIcon.IsEmpty() ) // need a fallback
-                    aIcon = BitmapEx( "sd/cmd/transition-none.png" );
+                    sImageName = "sd/cmd/transition-none.png";
 
                 mpVS_TRANSITION_ICONS->InsertItem(
-                    nPresetOffset + 1, Image( aIcon ), sLabel,
+                    nPresetOffset + 1, Image( sImageName ), sLabel,
                     VALUESET_APPEND, /* show legend */ true );
 
                 m_aNumVariants[ pPreset->getSetId() ] = 1;
diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx
index 9f2dcc7ca7d9..a70bdc81dc29 100644
--- a/sd/source/ui/dlg/inspagob.cxx
+++ b/sd/source/ui/dlg/inspagob.cxx
@@ -82,9 +82,7 @@ void SdInsertPagesObjsDlg::Reset()
     }
     else
     {
-        BitmapEx aBmpText(BMP_DOC_TEXT);
-        //to-do, check if this is already transparent and remove intermedia bitmapex if it is
-        Image aImgText(BitmapEx(aBmpText.GetBitmap(), COL_WHITE));
+        Image aImgText(BMP_DOC_TEXT);
         m_pLbTree->InsertEntry( rName, aImgText, aImgText );
     }
 


More information about the Libreoffice-commits mailing list