Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello,

my previous patch introduced some bugs. :-)
1. If doc contains the only one page and range is empty, this page
doubles. I think, this is due to errors in StringRangeEnumerator.
2. Current page index is zero-based in code and one-based in UI. So,
I've added "+1".
From d4ed0f5f1cc5e34fdad1cfdc1a6f4e46e1e49ccc Mon Sep 17 00:00:00 2001
From: Ivan Timofeev <timofeev.i.s@gmail.com>
Date: Tue, 4 Oct 2011 17:16:34 +0400
Subject: [PATCH] fix doubling of one page when range is empty and incorrect
 selection page

---
 sd/source/ui/view/DocumentRenderer.cxx |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 1439b659..459d793 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -210,18 +210,29 @@ namespace {
         OUString GetPrinterSelection (sal_Int32 nPageCount, sal_Int32 nCurrentPageIndex) const
         {
             sal_Int32 nContent = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 
0 ));
-            OUString sValue = ::rtl::OUStringBuffer(4)
+            OUString sFullRange = ::rtl::OUStringBuffer()
                 .append(static_cast<sal_Int32>(1))
                 .append(static_cast<sal_Unicode>('-'))
                 .append(nPageCount).makeStringAndClear();
 
-            if( nContent == 1 )
-                sValue = mrProperties.getStringValue( "PageRange", sValue );
-            else if ( nContent == 2 )
-                sValue = nCurrentPageIndex < 0
-                    ? OUString() : OUString::valueOf(nCurrentPageIndex);
+            if (nContent == 0) // all pages/slides
+            {
+                return sFullRange;
+            }
+
+            if (nContent == 1) // range
+            {
+                OUString sValue = mrProperties.getStringValue("PageRange");
+                return sValue.getLength() ? sValue : sFullRange;
+            }
+
+            if (nContent == 2 && // selection
+                nCurrentPageIndex >= 0)
+            {
+                return OUString::valueOf(nCurrentPageIndex - 1);
+            }
 
-            return sValue;
+            return OUString();
         }
 
     private:
-- 
1.7.7


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.