INTEGRATION: CWS impress111 (1.6.48); FILE MERGED
2006/12/01 13:21:46 af 1.6.48.1: #i43547# Added SID_SHOW_SLIDE and updated handling of SID_HIDE_SLIDE to reflect recent spec changes.
This commit is contained in:
parent
66045eb888
commit
1a94b2b244
1 changed files with 80 additions and 43 deletions
|
@ -4,9 +4,9 @@
|
|||
*
|
||||
* $RCSfile: SlsHideSlideFunction.cxx,v $
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
* last change: $Author: obo $ $Date: 2006-09-16 19:05:59 $
|
||||
* last change: $Author: kz $ $Date: 2006-12-12 16:07:27 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
|
@ -43,43 +43,106 @@
|
|||
#include "model/SlsPageDescriptor.hxx"
|
||||
#include "view/SlideSorterView.hxx"
|
||||
|
||||
#include "app.hrc"
|
||||
#include "drawdoc.hxx"
|
||||
#include "sdpage.hxx"
|
||||
|
||||
#include <sfx2/viewfrm.hxx>
|
||||
#include <sfx2/bindings.hxx>
|
||||
#include <sfx2/request.hxx>
|
||||
#include <svx/svxids.hrc>
|
||||
|
||||
namespace sd { namespace slidesorter { namespace controller {
|
||||
|
||||
TYPEINIT1(HideSlideFunction, SlideFunction);
|
||||
|
||||
HideSlideFunction::HideSlideFunction( SlideSorterController& rController, SfxRequest& rRequest)
|
||||
: SlideFunction( rController, rRequest)
|
||||
, mrController(rController)
|
||||
HideSlideFunction::HideSlideFunction (
|
||||
SlideSorterController& rController,
|
||||
SfxRequest& rRequest)
|
||||
: SlideFunction( rController, rRequest),
|
||||
mrController(rController)
|
||||
{
|
||||
}
|
||||
|
||||
FunctionReference HideSlideFunction::Create( SlideSorterController& rController, SfxRequest& rRequest )
|
||||
|
||||
|
||||
|
||||
HideSlideFunction::~HideSlideFunction (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
FunctionReference HideSlideFunction::Create (
|
||||
SlideSorterController& rController,
|
||||
SfxRequest& rRequest )
|
||||
{
|
||||
FunctionReference xFunc( new HideSlideFunction( rController, rRequest ) );
|
||||
xFunc->DoExecute(rRequest);
|
||||
return xFunc;
|
||||
}
|
||||
|
||||
void HideSlideFunction::DoExecute(SfxRequest& rRequest)
|
||||
|
||||
|
||||
|
||||
void HideSlideFunction::DoExecute (SfxRequest& rRequest)
|
||||
{
|
||||
SlideFunction::DoExecute(rRequest);
|
||||
|
||||
enum {UNDEFINED, EXCLUDED, INCLUDED, BOTH} eState (UNDEFINED);
|
||||
model::SlideSorterModel::Enumeration aSelectedPages (
|
||||
mrController.GetModel().GetSelectedPagesEnumeration());
|
||||
|
||||
ExclusionState eState (UNDEFINED);
|
||||
|
||||
switch (rRequest.GetSlot())
|
||||
{
|
||||
case SID_HIDE_SLIDE:
|
||||
eState = EXCLUDED;
|
||||
break;
|
||||
|
||||
case SID_SHOW_SLIDE:
|
||||
eState = INCLUDED;
|
||||
break;
|
||||
|
||||
default:
|
||||
eState = UNDEFINED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (eState != UNDEFINED)
|
||||
{
|
||||
// Set status at the selected pages.
|
||||
aSelectedPages.Rewind ();
|
||||
while (aSelectedPages.HasMoreElements())
|
||||
{
|
||||
model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
|
||||
pDescriptor->GetPage()->SetExcluded (eState==EXCLUDED);
|
||||
static_cast<view::SlideSorterView*>(pView)->RequestRepaint(pDescriptor);
|
||||
}
|
||||
}
|
||||
|
||||
SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
|
||||
rBindings.Invalidate (SID_PRESENTATION);
|
||||
rBindings.Invalidate (SID_REHEARSE_TIMINGS);
|
||||
rBindings.Invalidate (SID_HIDE_SLIDE);
|
||||
rBindings.Invalidate (SID_SHOW_SLIDE);
|
||||
pDoc->SetChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HideSlideFunction::ExclusionState HideSlideFunction::GetExclusionState (
|
||||
model::SlideSorterModel::Enumeration& rPageSet)
|
||||
{
|
||||
ExclusionState eState (UNDEFINED);
|
||||
BOOL bState;
|
||||
|
||||
// Get toggle state of the selected pages.
|
||||
model::SlideSorterModel::Enumeration aSelectedPages (
|
||||
mrController.GetModel().GetSelectedPagesEnumeration());
|
||||
while (aSelectedPages.HasMoreElements() && eState!=BOTH)
|
||||
while (rPageSet.HasMoreElements() && eState!=MIXED)
|
||||
{
|
||||
bState = aSelectedPages.GetNextElement()->GetPage()->IsExcluded();
|
||||
bState = rPageSet.GetNextElement()->GetPage()->IsExcluded();
|
||||
switch (eState)
|
||||
{
|
||||
case UNDEFINED:
|
||||
|
@ -91,51 +154,25 @@ void HideSlideFunction::DoExecute(SfxRequest& rRequest)
|
|||
// The pages before where all not part of the show,
|
||||
// this one is.
|
||||
if ( ! bState)
|
||||
eState = BOTH;
|
||||
eState = MIXED;
|
||||
break;
|
||||
|
||||
case INCLUDED:
|
||||
// The pages before where all part of the show,
|
||||
// this one is not.
|
||||
if (bState)
|
||||
eState = BOTH;
|
||||
eState = MIXED;
|
||||
break;
|
||||
|
||||
case BOTH:
|
||||
case MIXED:
|
||||
default:
|
||||
// No need to change anything.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle or set the state.
|
||||
switch (eState)
|
||||
{
|
||||
case BOTH:
|
||||
case UNDEFINED:
|
||||
eState = EXCLUDED;
|
||||
break;
|
||||
case EXCLUDED:
|
||||
eState = INCLUDED;
|
||||
break;
|
||||
case INCLUDED:
|
||||
eState = EXCLUDED;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set status at the selected pages.
|
||||
aSelectedPages.Rewind ();
|
||||
while (aSelectedPages.HasMoreElements())
|
||||
{
|
||||
model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
|
||||
pDescriptor->GetPage()->SetExcluded (eState==EXCLUDED);
|
||||
static_cast<view::SlideSorterView*>(pView)->RequestRepaint(pDescriptor);
|
||||
}
|
||||
|
||||
SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings();
|
||||
rBindings.Invalidate (SID_PRESENTATION);
|
||||
rBindings.Invalidate (SID_REHEARSE_TIMINGS);
|
||||
pDoc->SetChanged();
|
||||
return eState;
|
||||
}
|
||||
|
||||
|
||||
} } } // end of namespace ::sd::slidesorter::controller
|
||||
|
|
Loading…
Reference in a new issue