From 99120b7ddc8ede9108d4a45a5605ac191fe22bc9 Mon Sep 17 00:00:00 2001 From: Rob Snelders Date: Sat, 23 Mar 2013 19:36:41 +0100 Subject: Display the number of active slides in the statusbar Conflicts: sd/source/ui/view/drviews4.cxx Change-Id: I788070fdf093ec8b9f875ea5e81999990cd04501 --- sd/inc/drawdoc.hxx | 2 ++ sd/source/core/PageListWatcher.cxx | 18 ++++++++++++++++++ sd/source/core/PageListWatcher.hxx | 2 ++ sd/source/core/drawdoc2.cxx | 6 ++++++ sd/source/ui/slidesorter/controller/SlsSlotManager.cxx | 11 ++++++++++- sd/source/ui/view/drviews4.cxx | 2 +- sd/source/ui/view/drviewsa.cxx | 10 +++++++++- 7 files changed, 48 insertions(+), 3 deletions(-) (limited to 'sd') diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 3d8997885403..d9b96793e28a 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -343,6 +343,8 @@ public: 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 6efa75be5576..cd4f9ffe62bb 100644 --- a/sd/source/core/PageListWatcher.cxx +++ b/sd/source/core/PageListWatcher.cxx @@ -32,6 +32,7 @@ void ImpPageListWatcher::ImpRecreateSortedPageListOnDemand() maPageVectorStandard.clear(); maPageVectorNotes.clear(); mpHandoutPage = 0L; + mnVisiblePageCount = -1; // build up vectors again const sal_uInt32 nPageCount(ImpGetPageCount()); @@ -46,6 +47,7 @@ void ImpPageListWatcher::ImpRecreateSortedPageListOnDemand() case PK_STANDARD: { maPageVectorStandard.push_back(pCandidate); + if (!pCandidate->IsExcluded()) mnVisiblePageCount++; break; } case PK_NOTES: @@ -167,6 +169,22 @@ sal_uInt32 ImpPageListWatcher::GetSdPageCount(PageKind ePgKind) 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 177acd28f828..fd8164531fbf 100644 --- a/sd/source/core/PageListWatcher.hxx +++ b/sd/source/core/PageListWatcher.hxx @@ -43,6 +43,7 @@ protected: SdPage* mpHandoutPage; sal_Bool mbPageListValid; + sal_uInt32 mnVisiblePageCount; void ImpRecreateSortedPageListOnDemand(); virtual sal_uInt32 ImpGetPageCount() const = 0; @@ -60,6 +61,7 @@ public: 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 fd36dd446385..0e8f5d67e229 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -66,6 +66,7 @@ #include "PageListWatcher.hxx" #include +#include "customshowlist.hxx" using namespace ::sd; @@ -202,6 +203,11 @@ sal_uInt16 SdDrawDocument::GetMasterSdPageCount(PageKind ePgKind) const 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 6db42a09c38f..bdf802bcacb6 100644 --- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx @@ -815,6 +815,8 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet) 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 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet) { pPage = pDescriptor->GetPage(); nFirstPage = (pPage->GetPageNum()/2) + 1; - aPageStr.append(" ").append(static_cast(nFirstPage), 10).append(" / ").append(mrSlideSorter.GetModel().GetPageCount(), 10); + nPageCount = mrSlideSorter.GetModel().GetPageCount(); + nActivePageCount = static_cast(mrSlideSorter.GetModel().GetDocument()->GetActiveSdPageCount()); + + aPageStr.append(" ").append(static_cast(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 e360345f9016..1a5dd612660f 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -822,7 +822,7 @@ void DrawViewShell::ShowMousePosInfo(const Rectangle& rRect, SID_ATTR_SIZE, SID_ATTR_SIZE, 0L); -// GetStatusBarState(aSet); not fast by pressed modify key!! + 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 1a0443e7e468..b75289e456d3 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -699,12 +699,20 @@ void DrawViewShell::GetStatusBarState(SfxItemSet& rSet) // 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 -- cgit