diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2011-10-04 17:16:34 +0400 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-10-04 14:57:08 +0100 |
commit | e758f6fa4bfc28fed1751b27ab0915ae875657f7 (patch) | |
tree | 9db5657aef78dbd16815d30d5e6cdfdd55cd2cf9 /sd | |
parent | 6cb6080869c7b527c7325694f8e29c8fa0834358 (diff) |
fix doubling of one page when range is empty and incorrect selection page
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/ui/view/DocumentRenderer.cxx | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx index 1439b659bdc4..9966f6c7b993 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) - .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); - - return sValue; + OUString sFullRange = ::rtl::OUStringBuffer() + .append(static_cast<sal_Int32>(1)) + .append(static_cast<sal_Unicode>('-')) + .append(nPageCount).makeStringAndClear(); + + 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 OUString(); } private: |