[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - include/sfx2 sfx2/source

Akshay Deep akshaydeepiitr at gmail.com
Tue Apr 12 08:51:47 UTC 2016


 include/sfx2/templateabstractview.hxx        |    8 ++++++++
 sfx2/source/control/templateabstractview.cxx |    9 +++++++++
 sfx2/source/control/templatedefaultview.cxx  |    1 +
 sfx2/source/control/templatelocalview.cxx    |    4 ++--
 4 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 8e65e1f91f23ff8ea34617c7fdacd933de0fad18
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Tue Apr 5 00:36:09 2016 +0530

    tdf#89095 Start Center: bigger thumbnails for templates
    
    TemplateDefaultView is now able to dynamically update the size of the thumbnail in its item.
    Removed padding for thumbnails.
    
    Change-Id: Ibc267c848a844098a59525c76e234f4f9c4d0ed1
    Reviewed-on: https://gerrit.libreoffice.org/23816
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    (cherry picked from commit 2e6ed7e0a0f7395d548cbbff71cb72ba32d10309)
    Reviewed-on: https://gerrit.libreoffice.org/23997

diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx
index bd2b590..fe10066 100644
--- a/include/sfx2/templateabstractview.hxx
+++ b/include/sfx2/templateabstractview.hxx
@@ -119,6 +119,11 @@ public:
 
     void setOpenTemplateHdl(const Link<ThumbnailViewItem*,void> &rLink);
 
+    void updateThumbnailDimensions(long itemMaxSize);
+
+    long getThumbnailWidth() const  { return mnThumbnailWidth;}
+    long getThumbnailHeight() const {return mnThumbnailHeight;}
+
     static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
 
     static BitmapEx getDefaultThumbnail( const OUString& rPath );
@@ -138,6 +143,9 @@ protected:
     sal_uInt16 mnCurRegionId;
     OUString maCurRegionName;
 
+    long mnThumbnailWidth;
+    long mnThumbnailHeight;
+
     VclPtr<PushButton> maAllButton;
     VclPtr<FixedText>  maFTName;
 
diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx
index 38c0609..2cc3102 100644
--- a/sfx2/source/control/templateabstractview.cxx
+++ b/sfx2/source/control/templateabstractview.cxx
@@ -129,6 +129,8 @@ bool ViewFilter_Keyword::operator ()(const ThumbnailViewItem *pItem)
 TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren)
     : ThumbnailView(pParent,nWinStyle,bDisableTransientChildren),
       mnCurRegionId(0),
+      mnThumbnailWidth(TEMPLATE_THUMBNAIL_MAX_WIDTH),
+      mnThumbnailHeight(TEMPLATE_THUMBNAIL_MAX_HEIGHT),
       maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
       maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
 {
@@ -141,6 +143,8 @@ TemplateAbstractView::TemplateAbstractView (vcl::Window *pParent, WinBits nWinSt
 TemplateAbstractView::TemplateAbstractView(vcl::Window *pParent)
     : ThumbnailView(pParent),
       mnCurRegionId(0),
+      mnThumbnailWidth(TEMPLATE_THUMBNAIL_MAX_WIDTH),
+      mnThumbnailHeight(TEMPLATE_THUMBNAIL_MAX_HEIGHT),
       maAllButton(VclPtr<PushButton>::Create(this, SfxResId(BTN_ALL_TEMPLATES))),
       maFTName(VclPtr<FixedText>::Create(this, SfxResId(FT_NAME)))
 {
@@ -214,6 +218,11 @@ void TemplateAbstractView::insertItems(const std::vector<TemplateItemProperties>
 
 
 
+void TemplateAbstractView::updateThumbnailDimensions(long itemMaxSize)
+{
+    mnThumbnailWidth = itemMaxSize;
+    mnThumbnailHeight = itemMaxSize;
+}
 
 void TemplateAbstractView::setOpenRegionHdl(const Link<void*,void> &rLink)
 {
diff --git a/sfx2/source/control/templatedefaultview.cxx b/sfx2/source/control/templatedefaultview.cxx
index 5c17536..aad2187 100644
--- a/sfx2/source/control/templatedefaultview.cxx
+++ b/sfx2/source/control/templatedefaultview.cxx
@@ -24,6 +24,7 @@ TemplateDefaultView::TemplateDefaultView( Window* pParent)
     Rectangle aScreen = Application::GetScreenPosSizePixel(Application::GetDisplayBuiltInScreen());
     mnItemMaxSize = std::min(aScreen.GetWidth(),aScreen.GetHeight()) > 800 ? 256 : 192;
     ThumbnailView::setItemDimensions( mnItemMaxSize, mnItemMaxSize, mnTextHeight, mnItemPadding );
+    updateThumbnailDimensions(mnItemMaxSize);
 
     // startcenter specific settings
     maFillColor = Color(officecfg::Office::Common::Help::StartCenter::StartCenterThumbnailsBackgroundColor::get());
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 070bb0a..7c82737 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -87,8 +87,8 @@ void TemplateLocalView::Populate ()
             aProperties.aName = aName;
             aProperties.aPath = aURL;
             aProperties.aThumbnail = TemplateAbstractView::fetchThumbnail(aURL,
-                                                                          TEMPLATE_THUMBNAIL_MAX_WIDTH,
-                                                                          TEMPLATE_THUMBNAIL_MAX_HEIGHT);
+                                                                          getThumbnailWidth(),
+                                                                          getThumbnailHeight());
 
             pItem->maTemplates.push_back(aProperties);
         }


More information about the Libreoffice-commits mailing list