[Libreoffice-commits] .: 3 commits - sd/source

Caolán McNamara caolan at kemper.freedesktop.org
Mon Oct 3 02:40:52 PDT 2011


 sd/source/ui/view/DocumentRenderer.cxx |  291 +++++++++++++--------------------
 1 file changed, 116 insertions(+), 175 deletions(-)

New commits:
commit 3a924f260d498faa54d0c5bfb5b0047b287f8eb4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 3 10:40:17 2011 +0100

    drop voids and constify GetCurrentPageIndex

diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 6c7a234..1439b65 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -93,37 +93,37 @@ namespace {
         {
         }
 
-        bool IsWarningOrientation (void) const
+        bool IsWarningOrientation() const
         {
             return GetBoolValue(NULL, true);
         }
 
-        bool IsPrintPageName (void) const
+        bool IsPrintPageName() const
         {
             return GetBoolValue("IsPrintName");
         }
 
-        bool IsDate (void) const
+        bool IsDate() const
         {
             return GetBoolValue("IsPrintDateTime");
         }
 
-        bool IsTime (void) const
+        bool IsTime() const
         {
             return GetBoolValue("IsPrintDateTime");
         }
 
-        bool IsHiddenPages (void) const
+        bool IsHiddenPages() const
         {
             return GetBoolValue("IsPrintHidden");
         }
 
-        bool IsHandoutHorizontal (void) const
+        bool IsHandoutHorizontal() const
         {
             return GetBoolValue("SlidesPerPageOrder", sal_Int32(0), true);
         }
 
-        sal_Int32 GetHandoutPageCount (void) const
+        sal_Int32 GetHandoutPageCount() const
         {
             sal_uInt32 nIndex = static_cast<sal_Int32>(mrProperties.getIntValue("SlidesPerPage", sal_Int32(0)));
             if (nIndex<maSlidesPerPage.size())
@@ -134,75 +134,75 @@ namespace {
                 return 0;
         }
 
-        bool IsDraw (void) const
+        bool IsDraw() const
         {
             return GetBoolValue("PageContentType", sal_Int32(0));
         }
 
-        bool IsHandout (void) const
+        bool IsHandout() const
         {
             return GetBoolValue("PageContentType", sal_Int32(1));
         }
 
-        bool IsNotes (void) const
+        bool IsNotes() const
         {
             return GetBoolValue("PageContentType", sal_Int32(2));
         }
 
-        bool IsOutline (void) const
+        bool IsOutline() const
         {
             return GetBoolValue("PageContentType", sal_Int32(3));
         }
 
-        sal_uLong GetOutputQuality (void) const
+        sal_uLong GetOutputQuality() const
         {
             sal_Int32 nQuality = static_cast<sal_Int32>(mrProperties.getIntValue( "Quality", sal_Int32(0) ));
             return nQuality;
         }
 
-        bool IsPageSize (void) const
+        bool IsPageSize() const
         {
             return GetBoolValue("PageOptions", sal_Int32(1));
         }
 
-        bool IsTilePage (void) const
+        bool IsTilePage() const
         {
             return GetBoolValue("PageOptions", sal_Int32(2)) || GetBoolValue("PageOptions", sal_Int32(3));
         }
 
-        bool IsCutPage (void) const
+        bool IsCutPage() const
         {
             return GetBoolValue("PageOptions", sal_Int32(0));
         }
 
-        bool IsBooklet (void) const
+        bool IsBooklet() const
         {
             return GetBoolValue("PrintProspect", false);
         }
 
-        bool IsPrintExcluded (void) const
+        bool IsPrintExcluded() const
         {
             return (IsNotes() || IsDraw() || IsHandout()) &&  IsHiddenPages();
         }
 
-        bool IsPrintFrontPage (void) const
+        bool IsPrintFrontPage() const
         {
             sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 ));
             return nInclude == 0 || nInclude == 1;
         }
 
-        bool IsPrintBackPage (void) const
+        bool IsPrintBackPage() const
         {
             sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 ));
             return nInclude == 0 || nInclude == 2;
         }
 
-        bool IsPaperBin (void) const
+        bool IsPaperBin() const
         {
             return GetBoolValue("PrintPaperFromSetup", false);
         }
 
-        bool IsPrintMarkedOnly (void) const
+        bool IsPrintMarkedOnly() const
         {
             return GetBoolValue("PrintContent", sal_Int32(2));
         }
@@ -371,7 +371,7 @@ namespace {
             ProcessResource();
         }
 
-        Sequence< beans::PropertyValue > GetDialogControls(void) const
+        Sequence< beans::PropertyValue > GetDialogControls() const
         {
             if (maProperties.empty())
                 return Sequence< beans::PropertyValue >();
@@ -383,7 +383,7 @@ namespace {
             }
         }
 
-        ::std::vector<sal_Int32> GetSlidesPerPage (void) const
+        ::std::vector<sal_Int32> GetSlidesPerPage() const
         {
             return maSlidesPerPage;
         }
@@ -394,7 +394,7 @@ namespace {
         ::std::vector<sal_Int32> maSlidesPerPage;
         bool mbImpress;
 
-        void ProcessResource (void)
+        void ProcessResource()
         {
             SvtModuleOptions aOpt;
             String aAppGroupname( String( SdResId( _STR_IMPRESS_PRINT_UI_GROUP_NAME ) ) );
@@ -660,7 +660,7 @@ namespace {
             return aChoices;
         }
 
-        Sequence<rtl::OUString> GetSlidesPerPageSequence (void)
+        Sequence<rtl::OUString> GetSlidesPerPageSequence()
         {
             const Sequence<rtl::OUString> aChoice (
                 CreateChoice(_STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES));
@@ -709,7 +709,7 @@ namespace {
         {
         }
 
-        virtual ~PrinterPage (void) {}
+        virtual ~PrinterPage() {}
 
         virtual void Print (
             Printer& rPrinter,
@@ -720,9 +720,9 @@ namespace {
             const SetOfByte& rVisibleLayers,
             const SetOfByte& rPrintableLayers) const = 0;
 
-        sal_uLong GetDrawMode (void) const { return mnDrawMode; }
-        Orientation GetOrientation (void) const { return meOrientation; }
-        sal_uInt16 GetPaperTray (void) const { return mnPaperTray; }
+        sal_uLong GetDrawMode() const { return mnDrawMode; }
+        Orientation GetOrientation() const { return meOrientation; }
+        sal_uInt16 GetPaperTray() const { return mnPaperTray; }
 
     protected:
         const PageKind mePageKind;
@@ -760,7 +760,7 @@ namespace {
         {
         }
 
-        virtual ~RegularPrinterPage (void) {}
+        virtual ~RegularPrinterPage() {}
 
         virtual void Print (
             Printer& rPrinter,
@@ -818,7 +818,7 @@ namespace {
         {
         }
 
-        virtual ~TiledPrinterPage (void) {}
+        virtual ~TiledPrinterPage() {}
 
         virtual void Print (
             Printer& rPrinter,
@@ -904,7 +904,7 @@ namespace {
         {
         }
 
-        virtual ~BookletPrinterPage (void) {}
+        virtual ~BookletPrinterPage() {}
 
         virtual void Print (
             Printer& rPrinter,
@@ -1123,7 +1123,7 @@ namespace {
         {
         }
 
-        ~OutlinerPrinterPage (void)
+        ~OutlinerPrinterPage()
         {
             mpParaObject.reset();
         }
@@ -1205,7 +1205,7 @@ public:
 
 
 
-    virtual ~Implementation (void)
+    virtual ~Implementation()
     {
         EndListening(mrBase);
     }
@@ -1269,7 +1269,7 @@ public:
 
     /** Return the number of pages that are to be printed.
     */
-    sal_Int32 GetPrintPageCount (void)
+    sal_Int32 GetPrintPageCount()
     {
         OSL_ASSERT(!mbIsDisposed);
         if (mbIsDisposed)
@@ -1400,15 +1400,15 @@ private:
     ::std::vector<sal_Int32> maSlidesPerPage;
     awt::Size maPrintSize;
 
-    void Dispose (void)
+    void Dispose()
     {
         mbIsDisposed = true;
     }
 
-    sal_Int32 GetCurrentPageIndex()
+    sal_Int32 GetCurrentPageIndex() const
     {
-        ViewShell *pShell = mrBase.GetMainViewShell().get();
-        SdPage *pCurrentPage = pShell ? pShell->getCurrentPage() : NULL;
+        const ViewShell *pShell = mrBase.GetMainViewShell().get();
+        const SdPage *pCurrentPage = pShell ? pShell->getCurrentPage() : NULL;
         return pCurrentPage ? (pCurrentPage->GetPageNum()-1)/2 : -1;
     }
 
@@ -1455,7 +1455,7 @@ private:
         slides) one PrinterPage object is created and inserted into
         maPrinterPages.
     */
-    void PreparePages (void)
+    void PreparePages()
     {
         mpPrintView.reset();
         maPrinterPages.clear();
@@ -1539,7 +1539,7 @@ private:
         printing takes place then the page objects are assigned different
         sets of slides for each printed page (see HandoutPrinterPage::Print).
     */
-    void InitHandoutTemplate (void)
+    void InitHandoutTemplate()
     {
         const sal_Int32 nSlidesPerHandout (mpOptions->GetHandoutPageCount());
         const bool bHandoutHorizontal (mpOptions->IsHandoutHorizontal());
@@ -2299,7 +2299,7 @@ DocumentRenderer::DocumentRenderer (ViewShellBase& rBase)
 
 
 
-DocumentRenderer::~DocumentRenderer (void)
+DocumentRenderer::~DocumentRenderer()
 {
 }
 
commit 92ed1be5c9a881c2cdebbaa3f28eb7ef0045994d
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Sun Oct 2 23:04:55 2011 +0400

    remove unused and dead code in DocumentRenderer.cxx

diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index 94a9508..6c7a234 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -272,49 +272,6 @@ namespace {
 
 
 
-    /** This class is like MultiSelection but understands two special values.
-        "all" indicates that all pages are selected.  "selection" indicates that no
-        pages but a set of shapes is selected.
-    */
-    class Selection
-    {
-    public:
-        Selection (const OUString& rsSelection, const SdPage* pCurrentPage)
-            : mbAreAllPagesSelected(rsSelection.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("all"))),
-              mbIsShapeSelection(rsSelection.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("selection"))),
-              mnCurrentPageIndex(pCurrentPage!=NULL ? (pCurrentPage->GetPageNum()-1)/2 : -1),
-              mpSelectedPages()
-        {
-            if ( ! (mbAreAllPagesSelected || mbIsShapeSelection))
-                mpSelectedPages.reset(new MultiSelection(rsSelection));
-        }
-
-        bool IsMarkedOnly (void) const
-        {
-            return mbIsShapeSelection;
-        }
-
-        /** Call with a 0 based page index.
-        */
-        bool IsSelected (const sal_Int32 nIndex) const
-        {
-            if (mbAreAllPagesSelected)
-                return true;
-            else if (mpSelectedPages)
-                return mpSelectedPages->IsSelected(nIndex+1);
-            else if (mbIsShapeSelection && nIndex==mnCurrentPageIndex)
-                return true;
-            else
-                return false;
-        }
-
-    private:
-        const bool mbAreAllPagesSelected;
-        const bool mbIsShapeSelection;
-        const sal_Int32 mnCurrentPageIndex;
-        ::boost::scoped_ptr<MultiSelection> mpSelectedPages;
-    };
-
     /** A collection of values that helps to reduce the number of arguments
         given to some functions.  Note that not all values are set at the
         same time.
@@ -1480,7 +1437,6 @@ private:
           )
         {
             maPrintSize = awt::Size(aPaperSize.Height(), aPaperSize.Width());
-            //            rInfo.maPrintSize = Size(rInfo.maPrintSize.Height(), rInfo.maPrintSize.Width());
         }
         else
         {
@@ -1560,13 +1516,6 @@ private:
                     aInfo.mnDrawMode = DRAWMODE_DEFAULT;
             }
 
-            // check if selected range of pages contains transparent objects
-            /*
-            const bool bPrintPages (bPrintNotes || bPrintDraw || bPrintHandout);
-            const bool bContainsTransparency (bPrintPages && ContainsTransparency());
-            if (pPrinter->InitJob (mrBase.GetWindow(), !bIsAPI && bContainsTransparency))
-            */
-
             if (mpOptions->IsDraw())
                 PrepareStdOrNotes(PK_STANDARD, aInfo);
             if (mpOptions->IsNotes())
@@ -1667,35 +1616,6 @@ private:
 
 
 
-    /** Detect whether any of the slides that are to be printed contains
-        partially transparent or translucent shapes.
-    */
-    bool ContainsTransparency (const PrintInfo& rInfo) const
-    {
-        // const bool bPrintExcluded (mpOptions->IsPrintExcluded());
-        bool bContainsTransparency = false;
-
-        for (sal_uInt16
-                 nIndex=0,
-                 nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
-             nIndex < nCount && !bContainsTransparency;
-             ++nIndex)
-        {
-            SdPage* pPage = GetFilteredPage(nIndex, PK_STANDARD, rInfo);
-            if (pPage == NULL)
-                continue;
-
-            bContainsTransparency = pPage->HasTransparentObjects();
-            if ( ! bContainsTransparency && pPage->TRG_HasMasterPage())
-                bContainsTransparency = pPage->TRG_GetMasterPage().HasTransparentObjects();
-        }
-
-        return bContainsTransparency;
-    }
-
-
-
-
     /** Detect whether the specified slide is to be printed.
         @return
             When the slide is not to be printed then <NULL/> is returned.
@@ -1703,8 +1623,7 @@ private:
     */
     SdPage* GetFilteredPage (
         const sal_Int32 nPageIndex,
-        const PageKind ePageKind,
-        const PrintInfo& /*rInfo*/) const
+        const PageKind ePageKind) const
     {
         OSL_ASSERT(mrBase.GetDocument() != NULL);
         OSL_ASSERT(nPageIndex>=0);
@@ -1732,7 +1651,6 @@ private:
     {
         MapMode aMap (rInfo.maMap);
         Point aPageOfs (rInfo.mpPrinter->GetPageOffset() );
-        // aMap.SetOrigin(Point() - aPageOfs);
         aMap.SetScaleX(Fraction(1,2));
         aMap.SetScaleY(Fraction(1,2));
         mpPrinter->SetMapMode(aMap);
@@ -1774,7 +1692,7 @@ private:
             sal_Int32 nH (0);
             while (nH < nPageH && nIndex<nCount)
             {
-                SdPage* pPage = GetFilteredPage(aPages[nIndex], PK_STANDARD, rInfo);
+                SdPage* pPage = GetFilteredPage(aPages[nIndex], PK_STANDARD);
                 ++nIndex;
                 if (pPage == NULL)
                     continue;
@@ -1920,9 +1838,6 @@ private:
 
         MapMode aMap (rInfo.maMap);
         const Point aPageOfs (rInfo.mpPrinter->GetPageOffset());
-        //DrawView* pPrintView;
-
-        // aMap.SetOrigin(Point() - aPageOfs);
 
         if ( bScalePage )
         {
@@ -1975,7 +1890,7 @@ private:
             {
                 sal_Int32 nPageIndex = *it;
                 ++it;
-                if (GetFilteredPage(nPageIndex, PK_STANDARD, rInfo) == NULL)
+                if (GetFilteredPage(nPageIndex, PK_STANDARD) == NULL)
                     continue;
                 aPageIndices.push_back(nPageIndex);
             }
@@ -2027,7 +1942,6 @@ private:
             return;
 
         MapMode aMap (rInfo.maMap);
-        // aMap.SetOrigin(Point() - rInfo.mpPrinter->GetPageOffset());
         rInfo.maMap = aMap;
 
         if (mpOptions->IsBooklet())
@@ -2060,7 +1974,7 @@ private:
              it != itEnd;
              ++it)
         {
-            SdPage* pPage = GetFilteredPage(*it, ePageKind, rInfo);
+            SdPage* pPage = GetFilteredPage(*it, ePageKind);
             if (pPage == NULL)
                 continue;
 
@@ -2189,7 +2103,7 @@ private:
              it != itEnd;
              ++it)
         {
-            SdPage* pPage = GetFilteredPage(*it, ePageKind, rInfo);
+            SdPage* pPage = GetFilteredPage(*it, ePageKind);
             if (pPage != NULL)
                 aPageVector.push_back(*it);
         }
commit cb7c75302f29753189c78e988d78bcc1830cd515
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Sun Oct 2 22:18:51 2011 +0400

    migrate to StringRangeEnumerator in Draw

diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index efb1cbc..94a9508 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -202,14 +202,25 @@ namespace {
             return GetBoolValue("PrintPaperFromSetup", false);
         }
 
-        OUString GetPrinterSelection (void) const
+        bool IsPrintMarkedOnly (void) const
+        {
+            return GetBoolValue("PrintContent", sal_Int32(2));
+        }
+
+        OUString GetPrinterSelection (sal_Int32 nPageCount, sal_Int32 nCurrentPageIndex) const
         {
             sal_Int32 nContent = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 0 ));
-            OUString sValue( A2S("all") );
+            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", A2S( "all" ) );
-            else if( nContent == 2 )
-                sValue = A2S( "selection" );
+                sValue = mrProperties.getStringValue( "PageRange", sValue );
+            else if ( nContent == 2 )
+                sValue = nCurrentPageIndex < 0
+                    ? OUString() : OUString::valueOf(nCurrentPageIndex);
+
             return sValue;
         }
 
@@ -313,8 +324,7 @@ namespace {
     public:
         PrintInfo (
             const Printer* pPrinter,
-            const OUString& rsPrinterSelection,
-            const ::boost::shared_ptr<ViewShell> pView)
+            const bool bPrintMarkedOnly)
             : mpPrinter(pPrinter),
               mnDrawMode(DRAWMODE_DEFAULT),
               msTimeDate(),
@@ -323,8 +333,7 @@ namespace {
               maPageSize(0,0),
               meOrientation(ORIENTATION_PORTRAIT),
               maMap(),
-              maSelection(rsPrinterSelection, pView ? pView->getCurrentPage() : NULL),
-              mbPrintMarkedOnly(maSelection.IsMarkedOnly())
+              mbPrintMarkedOnly(bPrintMarkedOnly)
         {}
 
         const Printer* mpPrinter;
@@ -335,8 +344,7 @@ namespace {
         Size maPageSize;
         Orientation meOrientation;
         MapMode maMap;
-        const Selection maSelection;
-        bool mbPrintMarkedOnly;
+        const bool mbPrintMarkedOnly;
     };
 
 
@@ -1440,7 +1448,12 @@ private:
         mbIsDisposed = true;
     }
 
-
+    sal_Int32 GetCurrentPageIndex()
+    {
+        ViewShell *pShell = mrBase.GetMainViewShell().get();
+        SdPage *pCurrentPage = pShell ? pShell->getCurrentPage() : NULL;
+        return pCurrentPage ? (pCurrentPage->GetPageNum()-1)/2 : -1;
+    }
 
     /** Determine and set the paper orientation.
     */
@@ -1494,7 +1507,7 @@ private:
 
         ViewShell* pShell = mrBase.GetMainViewShell().get();
 
-        PrintInfo aInfo (mpPrinter, mpOptions->GetPrinterSelection(), mrBase.GetMainViewShell());
+        PrintInfo aInfo (mpPrinter, mpOptions->IsPrintMarkedOnly());
 
         if (aInfo.mpPrinter!=NULL && pShell!=NULL)
         {
@@ -1691,12 +1704,10 @@ private:
     SdPage* GetFilteredPage (
         const sal_Int32 nPageIndex,
         const PageKind ePageKind,
-        const PrintInfo& rInfo) const
+        const PrintInfo& /*rInfo*/) const
     {
         OSL_ASSERT(mrBase.GetDocument() != NULL);
         OSL_ASSERT(nPageIndex>=0);
-        if ( ! rInfo.maSelection.IsSelected(nPageIndex))
-            return NULL;
         SdPage* pPage = mrBase.GetDocument()->GetSdPage(
             sal::static_int_cast<sal_uInt16>(nPageIndex),
             ePageKind);
@@ -1748,20 +1759,22 @@ private:
 
         long nPageH = aOutRect.GetHeight();
 
-        for (sal_uInt16
-                 nIndex=0,
-                 nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
-             nIndex < nCount;
-             )
+        ::std::vector< sal_Int32 > aPages;
+        sal_Int32 nPageCount = mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+        StringRangeEnumerator::getRangesFromString(
+            mpOptions->GetPrinterSelection(nPageCount, GetCurrentPageIndex()),
+            aPages, 0, nPageCount-1);
+
+        for (size_t nIndex = 0, nCount = aPages.size(); nIndex < nCount;)
         {
             pOutliner->Clear();
-            pOutliner->SetFirstPageNumber(nIndex+1);
+            pOutliner->SetFirstPageNumber(aPages[nIndex]+1);
 
             Paragraph* pPara = NULL;
             sal_Int32 nH (0);
             while (nH < nPageH && nIndex<nCount)
             {
-                SdPage* pPage = GetFilteredPage(nIndex, PK_STANDARD, rInfo);
+                SdPage* pPage = GetFilteredPage(aPages[nIndex], PK_STANDARD, rInfo);
                 ++nIndex;
                 if (pPage == NULL)
                     continue;
@@ -1949,31 +1962,37 @@ private:
         mrBase.GetDocument()->setHandoutPageCount( nHandoutPageCount );
 
         // Distribute pages to handout pages.
+        StringRangeEnumerator aRangeEnum(
+            mpOptions->GetPrinterSelection(nPageCount, GetCurrentPageIndex()),
+            0, nPageCount-1);
         ::std::vector<sal_uInt16> aPageIndices;
-        std::vector<SdPage*> aPagesVector;
-        for (sal_uInt16
-                 nIndex=0,
-                 nCount= nPageCount,
-                 nHandoutPageIndex=0;
-             nIndex <= nCount;
-             ++nIndex)
+        sal_uInt16 nPrinterPageIndex = 0;
+        StringRangeEnumerator::Iterator it = aRangeEnum.begin(), itEnd = aRangeEnum.end();
+        bool bLastLoop = false;
+        while (!bLastLoop)
         {
-            if (nIndex < nCount)
+            if (it != itEnd)
             {
-                if (GetFilteredPage(nIndex, PK_STANDARD, rInfo) == NULL)
+                sal_Int32 nPageIndex = *it;
+                ++it;
+                if (GetFilteredPage(nPageIndex, PK_STANDARD, rInfo) == NULL)
                     continue;
-                aPageIndices.push_back(nIndex);
+                aPageIndices.push_back(nPageIndex);
+            }
+            else
+            {
+                bLastLoop = true;
             }
 
             // Create a printer page when we have found one page for each
             // placeholder or when this is the last (and special) loop.
             if (aPageIndices.size() == nShapeCount
-                || nIndex==nCount)
+                || bLastLoop)
             {
                 maPrinterPages.push_back(
                     ::boost::shared_ptr<PrinterPage>(
                         new HandoutPrinterPage(
-                            nHandoutPageIndex++,
+                            nPrinterPageIndex++,
                             aPageIndices,
                             aMap,
                             rInfo.msTimeDate,
@@ -2031,13 +2050,17 @@ private:
         pViewShell->WriteFrameViewData();
         Point aPtZero;
 
-        for (sal_uInt16
-                 nIndex=0,
-                 nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
-             nIndex < nCount;
-             ++nIndex)
-        {
-            SdPage* pPage = GetFilteredPage(nIndex, ePageKind, rInfo);
+        sal_Int32 nPageCount = mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+        StringRangeEnumerator aRangeEnum(
+            mpOptions->GetPrinterSelection(nPageCount, GetCurrentPageIndex()),
+            0, nPageCount-1);
+        for (StringRangeEnumerator::Iterator
+                 it = aRangeEnum.begin(),
+                 itEnd = aRangeEnum.end();
+             it != itEnd;
+             ++it)
+        {
+            SdPage* pPage = GetFilteredPage(*it, ePageKind, rInfo);
             if (pPage == NULL)
                 continue;
 
@@ -2090,12 +2113,12 @@ private:
                 && aPageHeight < rInfo.maPrintSize.Height())
             {
                 // Put multiple slides on one printer page.
-                PrepareTiledPage(nIndex, *pPage, ePageKind, rInfo);
+                PrepareTiledPage(*it, *pPage, ePageKind, rInfo);
             }
             else
             {
                 rInfo.maMap = aMap;
-                PrepareScaledPage(nIndex, *pPage, ePageKind, rInfo);
+                PrepareScaledPage(*it, *pPage, ePageKind, rInfo);
             }
         }
     }
@@ -2155,16 +2178,20 @@ private:
         }
 
         // create vector of pages to print
+        sal_Int32 nPageCount = mrBase.GetDocument()->GetSdPageCount(ePageKind);
+        StringRangeEnumerator aRangeEnum(
+            mpOptions->GetPrinterSelection(nPageCount, GetCurrentPageIndex()),
+            0, nPageCount-1);
         ::std::vector< sal_uInt16 > aPageVector;
-        for (sal_uInt16
-                 nIndex=0,
-                 nCount=mrBase.GetDocument()->GetSdPageCount(ePageKind);
-             nIndex < nCount;
-             ++nIndex)
+        for (StringRangeEnumerator::Iterator
+                 it = aRangeEnum.begin(),
+                 itEnd = aRangeEnum.end();
+             it != itEnd;
+             ++it)
         {
-            SdPage* pPage = GetFilteredPage(nIndex, ePageKind, rInfo);
+            SdPage* pPage = GetFilteredPage(*it, ePageKind, rInfo);
             if (pPage != NULL)
-                aPageVector.push_back(nIndex);
+                aPageVector.push_back(*it);
         }
 
         // create pairs of pages to print on each page


More information about the Libreoffice-commits mailing list