[Libreoffice-commits] core.git: Branch 'libreoffice-4-2-0' - sfx2/source

Zolnai Tamás tamas.zolnai at collabora.com
Mon Jan 13 04:25:43 PST 2014


 sfx2/source/control/recentdocsviewitem.cxx |   21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 41189d834e5d2b7c22eb91f2641c8c716e75c101
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Jan 9 18:57:38 2014 +0100

    Startcenter: use PAPER_SCREEN_4_3 as default paper for presentations
    
    Remove static to able to construct items with different
    paper info.
    
    (cherry picked from commit 5ab1fb926e984780380665ae185646b603292a6e)
    
    Change-Id: Ifba44675f6126ebfccf26f53f226214bed92352c
    Reviewed-on: https://gerrit.libreoffice.org/7339
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 9a436cece5a74d052e6a17f62f070ad151c7629b)
    Reviewed-on: https://gerrit.libreoffice.org/7358
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Reviewed-by: Zolnai Tamás <zolnaitamas2000 at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index 883b1fa..6d6b385 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -44,9 +44,24 @@ RecentDocsViewItem::RecentDocsViewItem(ThumbnailView &rView, const OUString &rUR
         Size aExtSize(aExt.GetSizePixel());
 
         // attempt to make it appear as if it is on a piece of paper
-        static PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
-        double ratio = double(nThumbnailSize) / double(std::max(aInfo.getWidth(), aInfo.getHeight()));
-        Size aThumbnailSize(aInfo.getWidth() * ratio, aInfo.getHeight() * ratio);
+        INetURLObject aUrl(rURL);
+        long nPaperHeight;
+        long nPaperWidth;
+        if( RecentDocsView::typeMatchesExtension(TYPE_IMPRESS, aUrl.getExtension()) )
+        {
+            // Swap width and height (PAPER_SCREEN_4_3 definition make it needed)
+            PaperInfo aInfo(PAPER_SCREEN_4_3);
+            nPaperHeight = aInfo.getWidth();
+            nPaperWidth = aInfo.getHeight();
+        }
+        else
+        {
+            PaperInfo aInfo(PaperInfo::getSystemDefaultPaper());
+            nPaperHeight = aInfo.getHeight();
+            nPaperWidth = aInfo.getWidth();
+        }
+        double ratio = double(nThumbnailSize) / double(std::max(nPaperHeight, nPaperWidth));
+        Size aThumbnailSize(nPaperWidth * ratio, nPaperHeight * ratio);
 
         if (aExtSize.Width() > aThumbnailSize.Width() || aExtSize.Height() > aThumbnailSize.Height())
         {


More information about the Libreoffice-commits mailing list