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

Chirag Manwani cmkmanwani at gmail.com
Mon Mar 28 01:55:08 UTC 2016


 cui/source/dialogs/cuihyperdlg.cxx |   25 ++++++++++++++++---------
 cui/source/dialogs/hldocntp.cxx    |    4 +++-
 cui/source/dialogs/hldoctp.cxx     |    8 ++++++--
 cui/source/dialogs/hlinettp.cxx    |    4 +++-
 cui/source/dialogs/hlmailtp.cxx    |    4 +++-
 cui/source/dialogs/hltpbase.cxx    |    4 +++-
 svtools/source/contnr/imivctl1.cxx |   14 +++++++++++---
 svtools/source/contnr/ivctrl.cxx   |    1 -
 8 files changed, 45 insertions(+), 19 deletions(-)

New commits:
commit d31a6e77478d36798a0b410f6977cda51ae45360
Author: Chirag Manwani <cmkmanwani at gmail.com>
Date:   Fri Mar 18 11:09:04 2016 +0530

    tdf#90795 Fix Hyperlink Dialog for HiDPI
    
    Change-Id: I30964d3bd3b5c4433e72be45bfa0202661248051
    Reviewed-on: https://gerrit.libreoffice.org/23347
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 1c872b1..02b29e7 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -25,6 +25,7 @@
 #include "hldoctp.hxx"
 #include "hldocntp.hxx"
 #include <svx/svxids.hrc>
+#include <vector>
 
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::frame::XFrame;
@@ -91,25 +92,31 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
     SetUniqueId( HID_HYPERLINK_DIALOG );
     mbGrabFocus = true;
     // insert pages
-    Image aImage;
+    std::vector<Image> imgVector;
     OUString aStrTitle;
     SvxIconChoiceCtrlEntry *pEntry;
+    imgVector.push_back( Image( CUI_RES ( RID_SVXBMP_HLINETTP ) ) );
+    imgVector.push_back( Image( CUI_RES ( RID_SVXBMP_HLMAILTP ) ) );
+    imgVector.push_back( Image( CUI_RES ( RID_SVXBMP_HLDOCTP  ) ) );
+    imgVector.push_back( Image( CUI_RES ( RID_SVXBMP_HLDOCNTP ) ) );
 
+    for(Image &aImage : imgVector )
+    {
+        BitmapEx aBitmap = aImage.GetBitmapEx();
+        aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality);
+        aImage = Image(aBitmap);
+    }
     aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP );
-    aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) );
-    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, aImage, SvxHyperlinkInternetTp::Create );
+    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, imgVector[0], SvxHyperlinkInternetTp::Create );
     pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
     aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP );
-    aImage = Image( CUI_RES ( RID_SVXBMP_HLMAILTP ) );
-    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, aImage, SvxHyperlinkMailTp::Create );
+    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, imgVector[1], SvxHyperlinkMailTp::Create );
     pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
     aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP );
-    aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCTP ) );
-    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, aImage, SvxHyperlinkDocTp::Create );
+    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, imgVector[2], SvxHyperlinkDocTp::Create );
     pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
     aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP );
-    aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCNTP ) );
-    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, aImage, SvxHyperlinkNewDocTp::Create );
+    pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, imgVector[3], SvxHyperlinkNewDocTp::Create );
     pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
 
     // set OK/Cancel - button
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index ec6026e..479d6a9 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -105,7 +105,9 @@ SvxHyperlinkNewDocTp::SvxHyperlinkNewDocTp ( vcl::Window *pParent, IconChoiceDia
     get(m_pCbbPath, "path");
     m_pCbbPath->SetSmartProtocol(INetProtocol::File);
     get(m_pBtCreate, "create");
-    m_pBtCreate->SetModeImage(Image(CUI_RES(RID_SVXBMP_NEWDOC)));
+    BitmapEx aBitmap = Image(CUI_RES(RID_SVXBMP_NEWDOC)).GetBitmapEx();
+    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
+    m_pBtCreate->SetModeImage(Image(aBitmap));
     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 5fc269e..4deb11d 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -41,11 +41,15 @@ SvxHyperlinkDocTp::SvxHyperlinkDocTp ( vcl::Window *pParent, IconChoiceDialog* p
     get(m_pCbbPath, "path");
     m_pCbbPath->SetSmartProtocol(INetProtocol::File);
     get(m_pBtFileopen, "fileopen");
-    m_pBtFileopen->SetModeImage(Image(CUI_RES(RID_SVXBMP_FILEOPEN)));
+    BitmapEx aBitmap = Image(CUI_RES(RID_SVXBMP_FILEOPEN)).GetBitmapEx();
+    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality);
+    m_pBtFileopen->SetModeImage(Image(aBitmap));
     get(m_pEdTarget, "target");
     get(m_pFtFullURL, "url");
     get(m_pBtBrowse, "browse");
-    m_pBtBrowse->SetModeImage(Image(CUI_RES(RID_SVXBMP_TARGET)));
+    aBitmap = Image(CUI_RES(RID_SVXBMP_TARGET)).GetBitmapEx();
+    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
+    m_pBtBrowse->SetModeImage(Image(aBitmap));
 
     // Disable display of bitmap names.
     m_pBtBrowse->EnableTextDisplay (false);
diff --git a/cui/source/dialogs/hlinettp.cxx b/cui/source/dialogs/hlinettp.cxx
index 8f24c21..700a58f 100644
--- a/cui/source/dialogs/hlinettp.cxx
+++ b/cui/source/dialogs/hlinettp.cxx
@@ -46,7 +46,9 @@ SvxHyperlinkInternetTp::SvxHyperlinkInternetTp ( vcl::Window *pParent,
     get(m_pCbbTarget, "target");
     m_pCbbTarget->SetSmartProtocol(INetProtocol::Http);
     get(m_pBtBrowse, "browse");
-    m_pBtBrowse->SetModeImage(Image(CUI_RES (RID_SVXBMP_BROWSE)));
+    BitmapEx aBitmap = Image(CUI_RES (RID_SVXBMP_BROWSE)).GetBitmapEx();
+    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
+    m_pBtBrowse->SetModeImage(Image(aBitmap));
     get(m_pFtLogin, "login_label");
     get(m_pEdLogin, "login");
     get(m_pFtPassword, "password_label");
diff --git a/cui/source/dialogs/hlmailtp.cxx b/cui/source/dialogs/hlmailtp.cxx
index d511cc5..cb40ed8 100644
--- a/cui/source/dialogs/hlmailtp.cxx
+++ b/cui/source/dialogs/hlmailtp.cxx
@@ -44,7 +44,9 @@ SvxHyperlinkMailTp::SvxHyperlinkMailTp ( vcl::Window *pParent, IconChoiceDialog*
     get(m_pCbbReceiver, "receiver");
     m_pCbbReceiver->SetSmartProtocol(INetProtocol::Mailto);
     get(m_pBtAdrBook, "adressbook");
-    m_pBtAdrBook->SetModeImage(Image(CUI_RES(RID_SVXBMP_ADRESSBOOK)));
+    BitmapEx aBitmap = Image(CUI_RES(RID_SVXBMP_ADRESSBOOK)).GetBitmapEx();
+    aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
+    m_pBtAdrBook->SetModeImage(Image(aBitmap));
     get(m_pFtSubject, "subject_label");
     get(m_pEdSubject, "subject");
 
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index c40509e..07cbd4c 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -199,7 +199,9 @@ void SvxHyperlinkTabPageBase::InitStdControls ()
         get(mpEdIndication, "indication");
         get(mpEdText, "name");
         get(mpBtScript, "script");
-        mpBtScript->SetModeImage(Image(CUI_RES (RID_SVXBMP_SCRIPT)));
+        BitmapEx aBitmap = Image(CUI_RES (RID_SVXBMP_SCRIPT)).GetBitmapEx();
+        aBitmap.Scale(GetDPIScaleFactor(),GetDPIScaleFactor(),BmpScaleFlag::BestQuality );
+        mpBtScript->SetModeImage(Image(aBitmap));
 
         mpBtScript->SetClickHdl ( LINK ( this, SvxHyperlinkTabPageBase, ClickScriptHdl_Impl ) );
         mpBtScript->EnableTextDisplay (false);
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index dbfb1d1..794fdfc 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -94,7 +94,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aVerSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_VSCROLL) ),
     aHorSBar( VclPtr<ScrollBar>::Create(pCurView, WB_DRAG | WB_HSCROLL) ),
     aScrBarBox( VclPtr<ScrollBarBox>::Create(pCurView) ),
-    aImageSize( 32, 32 ),
+    aImageSize( 32 * pCurView->GetDPIScaleFactor(), 32 * pCurView->GetDPIScaleFactor()),
     m_pColumns( nullptr )
 {
     bChooseWithCursor = false;
@@ -147,8 +147,12 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl(
     aVisRectChangedIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,VisRectChangedHdl));
 
     Clear( true );
-
-    SetGrid( Size(100, 70) );
+    Size gridSize(100,70);
+    if(pView->GetDPIScaleFactor() > 1)
+    {
+      gridSize.Height() *= pView->GetDPIScaleFactor();
+    }
+    SetGrid(gridSize);
 }
 
 SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl()
@@ -2420,6 +2424,10 @@ void SvxIconChoiceCtrl_Impl::SetDefaultTextSize()
     long nHeight = pView->GetTextHeight();
     if (nDY < nHeight)
         nDY = nHeight;
+    if(pView->GetDPIScaleFactor() > 1)
+    {
+      nDY*=2;
+    }
     aDefaultTextSize = Size(nDX, nDY);
 }
 
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index e248098..43041ec 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -80,7 +80,6 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle )
 
 {
     SetLineColor();
-    _pImp->SetGrid( Size( 100, 70 ) );
     _pImp->InitSettings();
     _pImp->SetPositionMode( IcnViewPositionModeAutoArrange );
 }


More information about the Libreoffice-commits mailing list