[PATCH] Display the number of active slides in the statusbar

Rob Snelders (via Code Review) gerrit at gerrit.libreoffice.org
Sat Mar 23 11:37:24 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2941

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/41/2941/1

Display the number of active slides in the statusbar

Change-Id: I788070fdf093ec8b9f875ea5e81999990cd04501
---
M sd/inc/drawdoc.hxx
M sd/source/core/PageListWatcher.cxx
M sd/source/core/PageListWatcher.hxx
M sd/source/core/drawdoc2.cxx
M sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
M sd/source/ui/view/drviews4.cxx
M sd/source/ui/view/drviewsa.cxx
7 files changed, 48 insertions(+), 3 deletions(-)



diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 3d89978..d9b9679 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -343,6 +343,8 @@
     SD_DLLPUBLIC SdPage*GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind);
     SD_DLLPUBLIC sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const;
 
+    SD_DLLPUBLIC sal_uInt16 GetActiveSdPageCount() const;
+
     sal_uInt16              GetMasterPageUserCount(SdrPage* pMaster) const;
 
     const sd::PresentationSettings& getPresentationSettings() const { return maPresentationSettings; }
diff --git a/sd/source/core/PageListWatcher.cxx b/sd/source/core/PageListWatcher.cxx
index 6efa75b..cd4f9ff 100644
--- a/sd/source/core/PageListWatcher.cxx
+++ b/sd/source/core/PageListWatcher.cxx
@@ -32,6 +32,7 @@
     maPageVectorStandard.clear();
     maPageVectorNotes.clear();
     mpHandoutPage = 0L;
+    mnVisiblePageCount = -1;
 
     // build up vectors again
     const sal_uInt32 nPageCount(ImpGetPageCount());
@@ -46,6 +47,7 @@
             case PK_STANDARD:
             {
                 maPageVectorStandard.push_back(pCandidate);
+                if (!pCandidate->IsExcluded()) mnVisiblePageCount++;
                 break;
             }
             case PK_NOTES:
@@ -167,6 +169,22 @@
     return nRetval;
 }
 
+
+sal_uInt32 ImpPageListWatcher::GetVisibleSdPageCount()
+{
+    sal_uInt32 nVisiblePageCount = 0;
+
+    // build up vectors again
+    const sal_uInt32 nPageCount(ImpGetPageCount());
+
+    for(sal_uInt32 a(0L); a < nPageCount; a++)
+    {
+        SdPage* pCandidate = ImpGetPage(a);
+        if ((pCandidate->GetPageKind() == PK_STANDARD)&&(!pCandidate->IsExcluded())) nVisiblePageCount++;
+    }
+    return nVisiblePageCount;
+}
+
 //////////////////////////////////////////////////////////////////////////////
 
 sal_uInt32 ImpDrawPageListWatcher::ImpGetPageCount() const
diff --git a/sd/source/core/PageListWatcher.hxx b/sd/source/core/PageListWatcher.hxx
index 177acd2..fd81645 100644
--- a/sd/source/core/PageListWatcher.hxx
+++ b/sd/source/core/PageListWatcher.hxx
@@ -43,6 +43,7 @@
     SdPage*                         mpHandoutPage;
 
     sal_Bool                        mbPageListValid;
+    sal_uInt32                      mnVisiblePageCount;
 
     void ImpRecreateSortedPageListOnDemand();
     virtual sal_uInt32 ImpGetPageCount() const = 0;
@@ -60,6 +61,7 @@
     void Invalidate() { mbPageListValid = sal_False; }
     SdPage* GetSdPage(PageKind ePgKind, sal_uInt32 nPgNum = 0L);
     sal_uInt32 GetSdPageCount(PageKind ePgKind);
+    sal_uInt32 GetVisibleSdPageCount();
 };
 
 //////////////////////////////////////////////////////////////////////////////
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index fd36dd4..0e8f5d6 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -66,6 +66,7 @@
 
 #include "PageListWatcher.hxx"
 #include <vcl/virdev.hxx>
+#include "customshowlist.hxx"
 
 using namespace ::sd;
 
@@ -202,6 +203,11 @@
     return (sal_uInt16)mpMasterPageListWatcher->GetSdPageCount(ePgKind);
 }
 
+sal_uInt16 SdDrawDocument::GetActiveSdPageCount() const
+{
+    return (sal_uInt16)mpDrawPageListWatcher->GetVisibleSdPageCount();
+}
+
 // Adapt the page numbers that are registered in the page objects of the notes
 // pages
 void SdDrawDocument::UpdatePageObjectsInNotes(sal_uInt16 nStartPos)
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 6db42a0..bdf802b 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -815,6 +815,8 @@
     SdPage* pPage      = NULL;
     SdPage* pFirstPage = NULL;
     sal_uInt16 nFirstPage;
+    sal_Int32 nPageCount;
+    sal_Int32 nActivePageCount;
     sal_uInt16 nSelectedPages = mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount();
     OUStringBuffer aPageStr;
     String aLayoutStr;
@@ -831,7 +833,14 @@
         {
             pPage = pDescriptor->GetPage();
             nFirstPage = (pPage->GetPageNum()/2) + 1;
-            aPageStr.append(" ").append(static_cast<sal_Int32>(nFirstPage), 10).append(" / ").append(mrSlideSorter.GetModel().GetPageCount(), 10);
+            nPageCount = mrSlideSorter.GetModel().GetPageCount();
+            nActivePageCount = static_cast<sal_Int32>(mrSlideSorter.GetModel().GetDocument()->GetActiveSdPageCount());
+
+            aPageStr.append(" ").append(static_cast<sal_Int32>(nFirstPage), 10).append(" / ").append(nPageCount, 10);
+            if (nPageCount != nActivePageCount)
+            {
+                aPageStr.append(" (").append(nActivePageCount, 10).append(")");
+            }
         }
       rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr.makeStringAndClear() ) );
     }
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index c3511c9..eedd6cc 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -866,7 +866,7 @@
                                    SID_ATTR_SIZE, SID_ATTR_SIZE,
                                    0L);
 
-//        GetStatusBarState(aSet);  nicht performant bei gedrueckter Modifiertaste!!
+        GetStatusBarState(aSet);
 
         aSet.Put( SfxStringItem( SID_CONTEXT, mpDrawView->GetStatusText() ) );
 
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 135b198..56a0f7f 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -735,12 +735,20 @@
     // Display of current page and layer.
     if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_STATUS_PAGE ) )
     {
+        sal_Int32 nPageCount = sal_Int32(GetDoc()->GetSdPageCount(mePageKind));
+        sal_Int32 nActivePageCount = sal_Int32(GetDoc()->GetActiveSdPageCount());
         // Always show the slide/page number.
         OUString aOUString = SD_RESSTR(STR_SD_PAGE);
         aOUString += " ";
         aOUString += OUString::valueOf( sal_Int32(maTabControl.GetCurPageId()) );
         aOUString += " / " ;
-        aOUString += OUString::valueOf( sal_Int32(GetDoc()->GetSdPageCount(mePageKind)) );
+        aOUString += OUString::valueOf( nPageCount );
+        if (nPageCount != nActivePageCount)
+        {
+            aOUString += " (";
+            aOUString += OUString::valueOf( nActivePageCount );
+            aOUString += ")";
+        }
 
         // If in layer mode additionally show the layer that contains all
         // selected shapes of the page.  If the shapes are distributed on

-- 
To view, visit https://gerrit.libreoffice.org/2941
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I788070fdf093ec8b9f875ea5e81999990cd04501
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Rob Snelders <libreoffice at ertai.nl>



More information about the LibreOffice mailing list