summaryrefslogtreecommitdiff
path: root/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/slidesorter/controller/SlsSlotManager.cxx')
-rw-r--r--[-rwxr-xr-x]sd/source/ui/slidesorter/controller/SlsSlotManager.cxx486
1 files changed, 337 insertions, 149 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index e571a765bdad..ded7c2ebfdde 100755..100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -33,20 +33,20 @@
#include "SlideSorter.hxx"
#include "SlideSorterViewShell.hxx"
#include "controller/SlideSorterController.hxx"
-#include "controller/SlsPageSelector.hxx"
#include "controller/SlsClipboard.hxx"
-#include "controller/SlsSelectionFunction.hxx"
-#include "controller/SlsFocusManager.hxx"
#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "controller/SlsSelectionFunction.hxx"
#include "controller/SlsSelectionManager.hxx"
-#include "SlsHideSlideFunction.hxx"
+#include "controller/SlsSelectionObserver.hxx"
#include "SlsCommand.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "model/SlsPageDescriptor.hxx"
#include "view/SlideSorterView.hxx"
#include "view/SlsLayouter.hxx"
-#include "view/SlsViewOverlay.hxx"
#include "framework/FrameworkHelper.hxx"
#include "Window.hxx"
#include "fupoor.hxx"
@@ -92,12 +92,30 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <vcl/svapp.hxx>
+#include <boost/bind.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::presentation;
namespace sd { namespace slidesorter { namespace controller {
+namespace {
+
+/** The state of a set of slides with respect to being excluded from the
+ slide show.
+*/
+enum SlideExclusionState {UNDEFINED, EXCLUDED, INCLUDED, MIXED};
+
+/** Return for the given set of slides whether they included are
+ excluded from the slide show.
+*/
+SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet);
+
+} // end of anonymous namespace
+
+
+
SlotManager::SlotManager (SlideSorter& rSlideSorter)
: mrSlideSorter(rSlideSorter),
maCommandQueue()
@@ -133,8 +151,11 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
break;
case SID_HIDE_SLIDE:
+ ChangeSlideExclusionState(model::SharedPageDescriptor(), true);
+ break;
+
case SID_SHOW_SLIDE:
- HideSlideFunction::Create(mrSlideSorter, rRequest);
+ ChangeSlideExclusionState(model::SharedPageDescriptor(), false);
break;
case SID_PAGES_PER_ROW:
@@ -145,15 +166,16 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
if (pPagesPerRow != NULL)
{
sal_Int32 nColumnCount = pPagesPerRow->GetValue();
- // Force the given number of columns by setting the
- // minimal and maximal number of columns to the same
- // value.
+ // Force the given number of columns by setting
+ // the minimal and maximal number of columns to
+ // the same value.
mrSlideSorter.GetView().GetLayouter().SetColumnCount (
nColumnCount, nColumnCount);
// Force a repaint and re-layout.
pShell->ArrangeGUIElements ();
// Rearrange the UI-elements controlled by the
- // controller and force a rearrangement of the view.
+ // controller and force a rearrangement of the
+ // view.
mrSlideSorter.GetController().Rearrange(true);
}
}
@@ -167,11 +189,11 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SLIDE_TRANSITIONS_PANEL:
{
- // Make the slide transition panel visible (expand it) in the
- // tool pane.
+ // Make the slide transition panel visible (expand it)
+ // in the tool pane.
if (mrSlideSorter.GetViewShellBase() != NULL)
- framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
- ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
+ framework::FrameworkHelper::Instance(*mrSlideSorter.GetViewShellBase())
+ ->RequestTaskPanel(sd::framework::FrameworkHelper::msSlideTransitionTaskPanelURL);
rRequest.Ignore ();
break;
}
@@ -179,7 +201,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_PRESENTATION_DLG:
FuSlideShowDlg::Create (
pShell,
- mrSlideSorter.GetView().GetWindow(),
+ mrSlideSorter.GetContentWindow().get(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -188,16 +210,16 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_CUSTOMSHOW_DLG:
FuCustomShowDlg::Create (
pShell,
- mrSlideSorter.GetView().GetWindow(),
+ mrSlideSorter.GetContentWindow().get(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
- break;
+ break;
case SID_EXPAND_PAGE:
FuExpandPage::Create (
pShell,
- mrSlideSorter.GetView().GetWindow(),
+ mrSlideSorter.GetContentWindow().get(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -206,7 +228,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SUMMARY_PAGE:
FuSummaryPage::Create (
pShell,
- mrSlideSorter.GetView().GetWindow(),
+ mrSlideSorter.GetContentWindow().get(),
&mrSlideSorter.GetView(),
pDocument,
rRequest);
@@ -218,17 +240,22 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
rRequest.Done();
break;
+ case SID_DUPLICATE_PAGE:
+ DuplicateSelectedSlides(rRequest);
+ rRequest.Done();
+ break;
+
case SID_DELETE_PAGE:
case SID_DELETE_MASTER_PAGE:
case SID_DELETE: // we need SID_CUT to handle the delete key
- // (DEL -> accelerator -> SID_CUT).
- if (mrSlideSorter.GetModel().GetPageCount() > 1)
- {
- mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages();
- }
+ // (DEL -> accelerator -> SID_CUT).
+ if (mrSlideSorter.GetModel().GetPageCount() > 1)
+ {
+ mrSlideSorter.GetController().GetSelectionManager()->DeleteSelectedPages();
+ }
- rRequest.Done();
- break;
+ rRequest.Done();
+ break;
case SID_RENAMEPAGE:
case SID_RENAME_MASTER_PAGE:
@@ -361,21 +388,33 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
break;
}
- case SID_UNDO :
+ case SID_UNDO:
{
SlideSorterViewShell* pViewShell
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != NULL)
+ {
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ SelectionObserver::Context aContext (mrSlideSorter);
pViewShell->ImpSidUndo (FALSE, rRequest);
+ }
break;
}
- case SID_REDO :
+ case SID_REDO:
{
SlideSorterViewShell* pViewShell
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != NULL)
+ {
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ SlideSorterController::ModelChangeLock aModelLock (mrSlideSorter.GetController());
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ SelectionObserver::Context aContext (mrSlideSorter);
pViewShell->ImpSidRedo (FALSE, rRequest);
+ }
break;
}
@@ -477,7 +516,7 @@ void SlotManager::GetAttrState (SfxItemSet& rSet)
}
}
-void SlotManager::GetMenuState ( SfxItemSet& rSet)
+void SlotManager::GetMenuState (SfxItemSet& rSet)
{
EditMode eEditMode = mrSlideSorter.GetModel().GetEditMode();
ViewShell* pShell = mrSlideSorter.GetViewShell();
@@ -592,39 +631,48 @@ void SlotManager::GetMenuState ( SfxItemSet& rSet)
model::PageEnumeration aSelectedPages (
model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
mrSlideSorter.GetModel()));
- HideSlideFunction::ExclusionState eState (
- HideSlideFunction::GetExclusionState(aSelectedPages));
+ const SlideExclusionState eState (GetSlideExclusionState(aSelectedPages));
switch (eState)
{
- case HideSlideFunction::MIXED:
+ case MIXED:
// Show both entries.
break;
- case HideSlideFunction::EXCLUDED:
+ case EXCLUDED:
rSet.DisableItem(SID_HIDE_SLIDE);
break;
- case HideSlideFunction::INCLUDED:
+ case INCLUDED:
rSet.DisableItem(SID_SHOW_SLIDE);
break;
- case HideSlideFunction::UNDEFINED:
+ case UNDEFINED:
rSet.DisableItem(SID_HIDE_SLIDE);
rSet.DisableItem(SID_SHOW_SLIDE);
break;
}
}
+
PageKind ePageKind = mrSlideSorter.GetModel().GetPageType();
- if( (eEditMode == EM_MASTERPAGE) && (ePageKind != PK_HANDOUT ) )
+ if ((eEditMode == EM_MASTERPAGE) && (ePageKind != PK_HANDOUT))
{
rSet.DisableItem(SID_ASSIGN_LAYOUT);
}
- if( (eEditMode == EM_MASTERPAGE) || (ePageKind==PK_NOTES) )
+ if ((eEditMode == EM_MASTERPAGE) || (ePageKind==PK_NOTES))
{
rSet.DisableItem(SID_INSERTPAGE);
}
+
+ // Disable some slots when in master page mode.
+ if (eEditMode == EM_MASTERPAGE)
+ {
+ if (rSet.GetItemState(SID_INSERTPAGE) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_INSERTPAGE);
+ if (rSet.GetItemState(SID_DUPLICATE_PAGE) == SFX_ITEM_AVAILABLE)
+ rSet.DisableItem(SID_DUPLICATE_PAGE);
+ }
}
@@ -774,18 +822,22 @@ void SlotManager::GetStatusBarState (SfxItemSet& rSet)
model::PageEnumeration aSelectedPages (
model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
mrSlideSorter.GetModel()));
- pPage = aSelectedPages.GetNextElement()->GetPage();
- nFirstPage = pPage->GetPageNum()/2;
- pFirstPage = pPage;
-
- aPageStr += sal_Unicode(' ');
- aPageStr += String::CreateFromInt32( nFirstPage + 1 );
- aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
- aPageStr += String::CreateFromInt32(
- mrSlideSorter.GetModel().GetPageCount());
-
- aLayoutStr = pFirstPage->GetLayoutName();
- aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if (pDescriptor)
+ {
+ pPage = pDescriptor->GetPage();
+ nFirstPage = pPage->GetPageNum()/2;
+ pFirstPage = pPage;
+
+ aPageStr += sal_Unicode(' ');
+ aPageStr += String::CreateFromInt32( nFirstPage + 1 );
+ aPageStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " / " ));
+ aPageStr += String::CreateFromInt32(
+ mrSlideSorter.GetModel().GetPageCount());
+
+ aLayoutStr = pFirstPage->GetLayoutName();
+ aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+ }
}
rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
@@ -836,7 +888,7 @@ void SlotManager::RenameSlide (void)
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
DBG_ASSERT(pFact, "Dialogdiet fail!");
AbstractSvxNameDialog* aNameDlg = pFact->CreateSvxNameDialog(
- mrSlideSorter.GetActiveWindow(),
+ mrSlideSorter.GetContentWindow().get(),
aPageName, aDescr);
DBG_ASSERT(aNameDlg, "Dialogdiet fail!");
aNameDlg->SetText( aTitle );
@@ -984,123 +1036,110 @@ bool SlotManager::RenameSlideFromDrawViewShell( USHORT nPageId, const String & r
*/
void SlotManager::InsertSlide (SfxRequest& rRequest)
{
- PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
- // The fallback insertion position is after the last slide.
- sal_Int32 nInsertionIndex (rSelector.GetPageCount() - 1);
- if (rSelector.GetSelectedPageCount() > 0)
+ const sal_Int32 nInsertionIndex (GetInsertionPosition());
+
+ PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter);
+
+ SdPage* pNewPage = NULL;
+ if (mrSlideSorter.GetModel().GetEditMode() == EM_PAGE)
{
- // Deselect all but the last selected slide.
- bool bLastSelectedSlideSeen (false);
- for (int nIndex=rSelector.GetPageCount()-1; nIndex>=0; --nIndex)
+ SlideSorterViewShell* pShell = dynamic_cast<SlideSorterViewShell*>(
+ mrSlideSorter.GetViewShell());
+ if (pShell != NULL)
{
- if (rSelector.IsPageSelected(nIndex))
- {
- if (bLastSelectedSlideSeen)
- rSelector.DeselectPage (nIndex);
- else
- {
- nInsertionIndex = nIndex;
- bLastSelectedSlideSeen = true;
- }
- }
+ pNewPage = pShell->CreateOrDuplicatePage (
+ rRequest,
+ mrSlideSorter.GetModel().GetPageType(),
+ nInsertionIndex>=0
+ ? mrSlideSorter.GetModel().GetPageDescriptor(nInsertionIndex)->GetPage()
+ : NULL);
}
}
-
- // No selection. Is there an insertion indicator?
- else if (mrSlideSorter.GetView().GetOverlay()
- .GetInsertionIndicatorOverlay().isVisible())
- {
- // Select the page before the insertion indicator.
- nInsertionIndex = mrSlideSorter.GetView().GetOverlay()
- .GetInsertionIndicatorOverlay().GetInsertionPageIndex();
- nInsertionIndex --;
- rSelector.SelectPage (nInsertionIndex);
- }
-
- // Is there a stored insertion position?
- else if (mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() >= 0)
+ else
{
- nInsertionIndex
- = mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() - 1;
- rSelector.SelectPage(nInsertionIndex);
- }
+ // Use the API to create a new page.
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
+ pDocument->getUnoModel(), UNO_QUERY);
+ if (xMasterPagesSupplier.is())
+ {
+ Reference<drawing::XDrawPages> xMasterPages (
+ xMasterPagesSupplier->getMasterPages());
+ if (xMasterPages.is())
+ {
+ xMasterPages->insertNewByIndex (nInsertionIndex+1);
- // Select the last page when there is at least one page.
- else if (rSelector.GetPageCount() > 0)
- {
- nInsertionIndex = rSelector.GetPageCount() - 1;
- rSelector.SelectPage (nInsertionIndex);
+ // Create shapes for the default layout.
+ pNewPage = pDocument->GetMasterSdPage(
+ (USHORT)(nInsertionIndex+1), PK_STANDARD);
+ pNewPage->CreateTitleAndLayout (TRUE,TRUE);
+ }
+ }
}
+ if (pNewPage == NULL)
+ return;
- // Hope for the best that CreateOrDuplicatePage() can cope with an empty
- // selection.
- else
- {
- nInsertionIndex = -1;
- }
+ // When a new page has been inserted then select it, make it the
+ // current page, and focus it.
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
+ PageSelector::UpdateLock aUpdateLock (mrSlideSorter);
+ mrSlideSorter.GetController().GetPageSelector().DeselectAllPages();
+ mrSlideSorter.GetController().GetPageSelector().SelectPage(pNewPage);
+}
- USHORT nPageCount ((USHORT)mrSlideSorter.GetModel().GetPageCount());
- rSelector.DisableBroadcasting();
- // In order for SlideSorterController::GetActualPage() to select the
- // selected page as current page we have to turn off the focus
- // temporarily.
- {
- FocusManager::FocusHider aTemporaryFocusHider (
- mrSlideSorter.GetController().GetFocusManager());
- SdPage* pPreviousPage = NULL;
- if (nInsertionIndex >= 0)
- pPreviousPage = mrSlideSorter.GetModel()
- .GetPageDescriptor(nInsertionIndex)->GetPage();
- if (mrSlideSorter.GetModel().GetEditMode() == EM_PAGE)
- {
- SlideSorterViewShell* pShell = dynamic_cast<SlideSorterViewShell*>(
- mrSlideSorter.GetViewShell());
- if (pShell != NULL)
- {
- pShell->CreateOrDuplicatePage (
- rRequest,
- mrSlideSorter.GetModel().GetPageType(),
- pPreviousPage);
- }
- }
- else
+void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
+{
+ // Create a list of the pages that are to be duplicated. The process of
+ // duplication alters the selection.
+ sal_Int32 nInsertPosition (0);
+ ::std::vector<SdPage*> aPagesToDuplicate;
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if (pDescriptor && pDescriptor->GetPage())
{
- // Use the API to create a new page.
- SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
- Reference<drawing::XMasterPagesSupplier> xMasterPagesSupplier (
- pDocument->getUnoModel(), UNO_QUERY);
- if (xMasterPagesSupplier.is())
- {
- Reference<drawing::XDrawPages> xMasterPages (
- xMasterPagesSupplier->getMasterPages());
- if (xMasterPages.is())
- {
- xMasterPages->insertNewByIndex (nInsertionIndex+1);
-
- // Create shapes for the default layout.
- SdPage* pMasterPage = pDocument->GetMasterSdPage(
- (USHORT)(nInsertionIndex+1), PK_STANDARD);
- pMasterPage->CreateTitleAndLayout (TRUE,TRUE);
- }
- }
+ aPagesToDuplicate.push_back(pDescriptor->GetPage());
+ nInsertPosition = pDescriptor->GetPage()->GetPageNum()+2;
}
}
- // When a new page has been inserted then select it and make it the
- // current page.
- mrSlideSorter.GetView().LockRedraw(TRUE);
- if (mrSlideSorter.GetModel().GetPageCount() > nPageCount)
+ // Duplicate the pages in aPagesToDuplicate and collect the newly
+ // created pages in aPagesToSelect.
+ const bool bUndo (aPagesToDuplicate.size()>1 && mrSlideSorter.GetView().IsUndoEnabled());
+ if (bUndo)
+ mrSlideSorter.GetView().BegUndo(String(SdResId(STR_INSERTPAGE)));
+
+ ::std::vector<SdPage*> aPagesToSelect;
+ for(::std::vector<SdPage*>::const_iterator
+ iPage(aPagesToDuplicate.begin()),
+ iEnd(aPagesToDuplicate.end());
+ iPage!=iEnd;
+ ++iPage, nInsertPosition+=2)
{
- nInsertionIndex++;
- model::SharedPageDescriptor pDescriptor = mrSlideSorter.GetModel().GetPageDescriptor(nInsertionIndex);
- if (pDescriptor.get() != NULL)
- mrSlideSorter.GetController().GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
+ aPagesToSelect.push_back(
+ mrSlideSorter.GetViewShell()->CreateOrDuplicatePage(
+ rRequest, PK_STANDARD, *iPage, nInsertPosition));
}
- rSelector.EnableBroadcasting();
- mrSlideSorter.GetView().LockRedraw(FALSE);
+ aPagesToDuplicate.clear();
+
+ if (bUndo)
+ mrSlideSorter.GetView().EndUndo();
+
+ // Set the selection to the pages in aPagesToSelect.
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+ rSelector.DeselectAllPages();
+ ::std::for_each (
+ aPagesToSelect.begin(),
+ aPagesToSelect.end(),
+ ::boost::bind(
+ static_cast<void (PageSelector::*)(const SdPage*)>(&PageSelector::SelectPage),
+ rSelector,
+ _1));
}
void SlotManager::ExecuteCommandAsynchronously (::std::auto_ptr<Command> pCommand)
@@ -1130,5 +1169,154 @@ IMPL_LINK(SlotManager, UserEventCallback, void*, EMPTYARG)
return 1;
}
+
+
+
+void SlotManager::ChangeSlideExclusionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bExcludeSlide)
+{
+ if (rpDescriptor)
+ {
+ mrSlideSorter.GetView().SetState(
+ rpDescriptor,
+ model::PageDescriptor::ST_Excluded,
+ bExcludeSlide);
+ }
+ else
+ {
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ mrSlideSorter.GetView().SetState(
+ pDescriptor,
+ model::PageDescriptor::ST_Excluded,
+ bExcludeSlide);
+ }
+ }
+
+ SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
+ rBindings.Invalidate(SID_PRESENTATION);
+ rBindings.Invalidate(SID_REHEARSE_TIMINGS);
+ rBindings.Invalidate(SID_HIDE_SLIDE);
+ rBindings.Invalidate(SID_SHOW_SLIDE);
+ mrSlideSorter.GetModel().GetDocument()->SetChanged();
+}
+
+
+
+
+sal_Int32 SlotManager::GetInsertionPosition (void)
+{
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+
+ // The insertion indicator is preferred. After all the user explicitly
+ // used it to define the insertion position.
+ if (mrSlideSorter.GetController().GetInsertionIndicatorHandler()->IsActive())
+ {
+ // Select the page before the insertion indicator.
+ return mrSlideSorter.GetController().GetInsertionIndicatorHandler()->GetInsertionPageIndex()
+ - 1;
+ }
+
+ // Is there a stored insertion position?
+ else if (mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() >= 0)
+ {
+ return mrSlideSorter.GetController().GetSelectionManager()->GetInsertionPosition() - 1;
+ }
+
+ // Use the index of the last selected slide.
+ else if (rSelector.GetSelectedPageCount() > 0)
+ {
+ for (int nIndex=rSelector.GetPageCount()-1; nIndex>=0; --nIndex)
+ if (rSelector.IsPageSelected(nIndex))
+ return nIndex;
+
+ // We should never get here.
+ OSL_ASSERT(false);
+ return rSelector.GetPageCount() - 1;
+ }
+
+ // Select the last page when there is at least one page.
+ else if (rSelector.GetPageCount() > 0)
+ {
+ return rSelector.GetPageCount() - 1;
+ }
+
+ // Hope for the best that CreateOrDuplicatePage() can cope with an empty
+ // selection.
+ else
+ {
+ // We should never get here because there has to be at least one page.
+ OSL_ASSERT(false);
+ return -1;
+ }
+}
+
+
+
+
+void SlotManager::NotifyEditModeChange (void)
+{
+ SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
+ rBindings.Invalidate(SID_PRESENTATION);
+ rBindings.Invalidate(SID_INSERTPAGE);
+ rBindings.Invalidate(SID_DUPLICATE_PAGE);
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+
+namespace {
+
+
+
+SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet)
+{
+ SlideExclusionState eState (UNDEFINED);
+ BOOL bState;
+
+ // Get toggle state of the selected pages.
+ while (rPageSet.HasMoreElements() && eState!=MIXED)
+ {
+ bState = rPageSet.GetNextElement()->GetPage()->IsExcluded();
+ switch (eState)
+ {
+ case UNDEFINED:
+ // Use the first selected page to set the inital value.
+ eState = bState ? EXCLUDED : INCLUDED;
+ break;
+
+ case EXCLUDED:
+ // The pages before where all not part of the show,
+ // this one is.
+ if ( ! bState)
+ eState = MIXED;
+ break;
+
+ case INCLUDED:
+ // The pages before where all part of the show,
+ // this one is not.
+ if (bState)
+ eState = MIXED;
+ break;
+
+ case MIXED:
+ default:
+ // No need to change anything.
+ break;
+ }
+ }
+
+ return eState;
+}
+
+} // end of anonymous namespace
+
} } } // end of namespace ::sd::slidesorter::controller