2004-07-13 13:28:36 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* $RCSfile: SlsViewOverlay.cxx,v $
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2006-04-06 15:28:14 +00:00
|
|
|
* $Revision: 1.9 $
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2006-04-06 15:28:14 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2006-04-06 16:28:14 $
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
2005-09-09 05:28:25 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2004-07-13 13:28:36 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#include "view/SlsViewOverlay.hxx"
|
|
|
|
|
|
|
|
#include "controller/SlideSorterController.hxx"
|
|
|
|
#include "model/SlideSorterModel.hxx"
|
|
|
|
#include "model/SlsPageDescriptor.hxx"
|
|
|
|
#include "model/SlsPageEnumeration.hxx"
|
|
|
|
#include "view/SlideSorterView.hxx"
|
|
|
|
#include "SlideSorterViewShell.hxx"
|
|
|
|
#include "view/SlsLayouter.hxx"
|
|
|
|
#include "view/SlsPageObject.hxx"
|
2004-09-20 12:35:48 +00:00
|
|
|
#include "view/SlsPageObjectViewObjectContact.hxx"
|
2005-03-30 08:26:35 +00:00
|
|
|
#include "ViewShellBase.hxx"
|
|
|
|
#include "UpdateLockManager.hxx"
|
2004-07-13 13:28:36 +00:00
|
|
|
|
|
|
|
#include "Window.hxx"
|
|
|
|
#include "sdpage.hxx"
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
class ShowingModeGuard
|
|
|
|
{
|
|
|
|
public:
|
2005-02-17 08:45:04 +00:00
|
|
|
explicit ShowingModeGuard (::sd::slidesorter::view::OverlayBase& rOverlay,
|
|
|
|
bool bHideAndSave = false)
|
2004-07-13 13:28:36 +00:00
|
|
|
: mrOverlay (rOverlay),
|
2005-02-17 08:45:04 +00:00
|
|
|
mbIsShowing (mrOverlay.IsShowing()),
|
|
|
|
mbRestorePending(false)
|
2004-07-13 13:28:36 +00:00
|
|
|
{
|
|
|
|
if (mbIsShowing)
|
2005-02-17 08:45:04 +00:00
|
|
|
if (bHideAndSave)
|
|
|
|
{
|
|
|
|
mrOverlay.GetViewOverlay().HideAndSave (
|
|
|
|
::sd::slidesorter::view::ViewOverlay::OPT_XOR);
|
|
|
|
mbRestorePending = true;
|
|
|
|
}
|
2004-07-13 13:28:36 +00:00
|
|
|
mrOverlay.Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
~ShowingModeGuard (void)
|
|
|
|
{
|
|
|
|
if (mbIsShowing)
|
2005-02-17 08:45:04 +00:00
|
|
|
{
|
2004-07-13 13:28:36 +00:00
|
|
|
mrOverlay.Show();
|
2005-02-17 08:45:04 +00:00
|
|
|
if (mbRestorePending)
|
|
|
|
mrOverlay.GetViewOverlay().Restore ();
|
|
|
|
}
|
2004-07-13 13:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
::sd::slidesorter::view::OverlayBase& mrOverlay;
|
|
|
|
bool mbIsShowing;
|
2005-02-17 08:45:04 +00:00
|
|
|
bool mbRestorePending;
|
2004-07-13 13:28:36 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace sd { namespace slidesorter { namespace view {
|
|
|
|
|
|
|
|
//===== ViewOverlay =========================================================
|
|
|
|
|
|
|
|
ViewOverlay::ViewOverlay (SlideSorterViewShell& rViewShell)
|
|
|
|
: mrViewShell (rViewShell),
|
|
|
|
maSelectionRectangleOverlay(*this),
|
2004-09-20 12:35:48 +00:00
|
|
|
maMouseOverIndicatorOverlay(*this),
|
2004-07-13 13:28:36 +00:00
|
|
|
maInsertionIndicatorOverlay(*this),
|
|
|
|
maSubstitutionOverlay(*this),
|
|
|
|
mbSelectionRectangleWasVisible(false),
|
2004-09-20 12:35:48 +00:00
|
|
|
mbMouseOverIndicatorWasVisible(false),
|
2004-07-13 13:28:36 +00:00
|
|
|
mbInsertionIndicatorWasVisible(false),
|
2004-11-26 14:13:08 +00:00
|
|
|
mbSubstitutionDisplayWasVisible(false),
|
|
|
|
mnHideAndSaveLevel(0)
|
2004-07-13 13:28:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ViewOverlay::~ViewOverlay (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SelectionRectangleOverlay& ViewOverlay::GetSelectionRectangleOverlay (void)
|
|
|
|
{
|
|
|
|
return maSelectionRectangleOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-09-20 12:35:48 +00:00
|
|
|
MouseOverIndicatorOverlay& ViewOverlay::GetMouseOverIndicatorOverlay (void)
|
|
|
|
{
|
|
|
|
return maMouseOverIndicatorOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-13 13:28:36 +00:00
|
|
|
InsertionIndicatorOverlay& ViewOverlay::GetInsertionIndicatorOverlay (void)
|
|
|
|
{
|
|
|
|
return maInsertionIndicatorOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SubstitutionOverlay& ViewOverlay::GetSubstitutionOverlay (void)
|
|
|
|
{
|
|
|
|
return maSubstitutionOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ViewOverlay::Paint (void)
|
|
|
|
{
|
|
|
|
maSelectionRectangleOverlay.Paint();
|
2004-09-20 12:35:48 +00:00
|
|
|
maMouseOverIndicatorOverlay.Paint();
|
2004-07-13 13:28:36 +00:00
|
|
|
maInsertionIndicatorOverlay.Paint();
|
|
|
|
maSubstitutionOverlay.Paint();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controller::SlideSorterController& ViewOverlay::GetController (void)
|
|
|
|
{
|
|
|
|
return mrViewShell.GetSlideSorterController();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SlideSorterViewShell& ViewOverlay::GetViewShell (void)
|
|
|
|
{
|
|
|
|
return mrViewShell;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ViewOverlay::HideAndSave (OverlayPaintType eType)
|
|
|
|
{
|
2004-11-26 14:13:08 +00:00
|
|
|
if (mnHideAndSaveLevel++ == 0)
|
|
|
|
{
|
|
|
|
// Remember the current state of the visiblities of the overlays.
|
|
|
|
mbSelectionRectangleWasVisible = maSelectionRectangleOverlay.IsShowing();
|
|
|
|
mbMouseOverIndicatorWasVisible = maMouseOverIndicatorOverlay.IsShowing();
|
|
|
|
mbInsertionIndicatorWasVisible = maInsertionIndicatorOverlay.IsShowing();
|
|
|
|
mbSubstitutionDisplayWasVisible = maSubstitutionOverlay.IsShowing();
|
2004-07-13 13:28:36 +00:00
|
|
|
|
2004-11-26 14:13:08 +00:00
|
|
|
// Remember that we have saved the current state.
|
|
|
|
meSavedStateType = eType;
|
2004-07-13 13:28:36 +00:00
|
|
|
|
2004-11-26 14:13:08 +00:00
|
|
|
// Hide the overlays.
|
|
|
|
if (eType==OPT_ALL || eType==OPT_XOR)
|
|
|
|
{
|
2005-02-17 08:45:04 +00:00
|
|
|
if (mbSelectionRectangleWasVisible)
|
|
|
|
maSelectionRectangleOverlay.Hide();
|
2004-11-26 14:13:08 +00:00
|
|
|
}
|
2005-02-17 08:45:04 +00:00
|
|
|
if (mbSubstitutionDisplayWasVisible)
|
|
|
|
maSubstitutionOverlay.Hide();
|
|
|
|
|
2004-11-26 14:13:08 +00:00
|
|
|
if (eType==OPT_ALL || eType==OPT_PAINT)
|
2005-02-17 08:45:04 +00:00
|
|
|
{
|
|
|
|
if (mbMouseOverIndicatorWasVisible)
|
|
|
|
maMouseOverIndicatorOverlay.Hide();
|
|
|
|
if (mbInsertionIndicatorWasVisible)
|
|
|
|
maInsertionIndicatorOverlay.Hide();
|
|
|
|
}
|
2004-07-13 13:28:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ViewOverlay::Restore (void)
|
|
|
|
{
|
2004-11-26 14:13:08 +00:00
|
|
|
if (--mnHideAndSaveLevel == 0)
|
2004-07-13 13:28:36 +00:00
|
|
|
{
|
|
|
|
if (meSavedStateType==OPT_ALL || meSavedStateType==OPT_PAINT)
|
2004-09-20 12:35:48 +00:00
|
|
|
{
|
2004-07-13 13:28:36 +00:00
|
|
|
if (mbInsertionIndicatorWasVisible)
|
|
|
|
maInsertionIndicatorOverlay.Show();
|
2004-09-20 12:35:48 +00:00
|
|
|
if (mbMouseOverIndicatorWasVisible)
|
|
|
|
maMouseOverIndicatorOverlay.Show();
|
|
|
|
}
|
2005-02-17 08:45:04 +00:00
|
|
|
if (mbSubstitutionDisplayWasVisible)
|
|
|
|
maSubstitutionOverlay.Show();
|
2004-07-13 13:28:36 +00:00
|
|
|
if (meSavedStateType==OPT_ALL || meSavedStateType==OPT_XOR)
|
|
|
|
{
|
|
|
|
if (mbSelectionRectangleWasVisible)
|
|
|
|
maSelectionRectangleOverlay.Show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== OverlayBase =========================================================
|
|
|
|
|
|
|
|
OverlayBase::OverlayBase (ViewOverlay& rViewOverlay)
|
|
|
|
: mrViewOverlay(rViewOverlay),
|
|
|
|
mbIsShowing (false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OverlayBase::~OverlayBase (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OverlayBase::Paint (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool OverlayBase::IsShowing (void)
|
|
|
|
{
|
|
|
|
return mbIsShowing;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OverlayBase::Toggle (void)
|
|
|
|
{
|
|
|
|
if (IsShowing())
|
|
|
|
Hide();
|
|
|
|
else
|
|
|
|
Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OverlayBase::Show (void)
|
|
|
|
{
|
|
|
|
if ( ! IsShowing())
|
|
|
|
{
|
|
|
|
mbIsShowing = true;
|
|
|
|
Paint ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OverlayBase::Hide (void)
|
|
|
|
{
|
|
|
|
if (IsShowing())
|
|
|
|
{
|
|
|
|
mbIsShowing = false;
|
|
|
|
Paint ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-02-17 08:45:04 +00:00
|
|
|
ViewOverlay& OverlayBase::GetViewOverlay (void)
|
|
|
|
{
|
|
|
|
return mrViewOverlay;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-13 13:28:36 +00:00
|
|
|
//===== SubstitutionOverlay =================================================
|
|
|
|
|
|
|
|
SubstitutionOverlay::SubstitutionOverlay (ViewOverlay& rViewOverlay)
|
|
|
|
: OverlayBase(rViewOverlay)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SubstitutionOverlay::~SubstitutionOverlay (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SubstitutionOverlay::Paint (void)
|
|
|
|
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard (maMutex);
|
|
|
|
|
|
|
|
SubstitutionShapeList::const_iterator aShape (maShapes.begin());
|
|
|
|
SubstitutionShapeList::const_iterator aShapeEnd (maShapes.end());
|
|
|
|
while (aShape!=aShapeEnd)
|
|
|
|
{
|
|
|
|
mrViewOverlay.GetViewShell().DrawMarkRect (*aShape);
|
|
|
|
aShape++;
|
|
|
|
}
|
|
|
|
|
|
|
|
OverlayBase::Paint();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SubstitutionOverlay::Create (
|
|
|
|
model::PageEnumeration& rSelection,
|
|
|
|
const Point& rPosition)
|
|
|
|
{
|
|
|
|
ShowingModeGuard aGuard (*this);
|
|
|
|
maPosition = rPosition;
|
|
|
|
|
|
|
|
maShapes.clear();
|
|
|
|
while (rSelection.HasMoreElements())
|
|
|
|
{
|
2006-04-06 15:28:14 +00:00
|
|
|
maShapes.push_back(
|
|
|
|
rSelection.GetNextElement()->GetPageObject()->GetCurrentBoundRect());
|
2004-07-13 13:28:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SubstitutionOverlay::Clear (void)
|
|
|
|
{
|
|
|
|
ShowingModeGuard aGuard (*this);
|
|
|
|
|
|
|
|
maShapes.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SubstitutionOverlay::Move (const Point& rOffset)
|
|
|
|
{
|
|
|
|
SetPosition (maPosition + rOffset);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SubstitutionOverlay::SetPosition (const Point& rPosition)
|
|
|
|
{
|
|
|
|
ShowingModeGuard aGuard (*this);
|
|
|
|
Point rOffset = rPosition - maPosition;
|
|
|
|
|
|
|
|
SubstitutionShapeList::iterator aShape (maShapes.begin());
|
|
|
|
SubstitutionShapeList::const_iterator aShapeEnd (maShapes.end());
|
|
|
|
for (;aShape!=aShapeEnd; aShape++)
|
|
|
|
aShape->SetPos (aShape->TopLeft() + rOffset);
|
|
|
|
|
|
|
|
maPosition = rPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Point& SubstitutionOverlay::GetPosition (void) const
|
|
|
|
{
|
|
|
|
return maPosition;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== SelectionRectangleOverlay ===========================================
|
|
|
|
|
|
|
|
SelectionRectangleOverlay::SelectionRectangleOverlay (
|
|
|
|
ViewOverlay& rViewOverlay)
|
2004-11-26 14:13:08 +00:00
|
|
|
: OverlayBase (rViewOverlay),
|
|
|
|
maAnchor(0,0),
|
|
|
|
maSecondCorner(0,0)
|
2004-07-13 13:28:36 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SelectionRectangleOverlay::Paint (void)
|
|
|
|
{
|
2004-11-26 14:13:08 +00:00
|
|
|
// mrViewOverlay.GetViewShell().DrawMarkRect (maSelectionRectangle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SelectionRectangleOverlay::Show (void)
|
|
|
|
{
|
2005-02-17 08:45:04 +00:00
|
|
|
if ( ! mbIsShowing)
|
|
|
|
{
|
2005-04-12 15:59:35 +00:00
|
|
|
SlideSorterView& rView (mrViewOverlay.GetViewShell().GetSlideSorterController().GetView());
|
|
|
|
rView.BegEncirclement(maAnchor);
|
|
|
|
rView.MovEncirclement(maSecondCorner);
|
2005-02-17 08:45:04 +00:00
|
|
|
OverlayBase::Show();
|
|
|
|
}
|
2004-07-13 13:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SelectionRectangleOverlay::Hide (void)
|
|
|
|
{
|
2005-02-17 08:45:04 +00:00
|
|
|
if (mbIsShowing)
|
|
|
|
{
|
|
|
|
mrViewOverlay.GetViewShell().GetSlideSorterController().GetView().EndEncirclement();
|
|
|
|
OverlayBase::Hide();
|
|
|
|
}
|
2004-11-26 14:13:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rectangle SelectionRectangleOverlay::GetSelectionRectangle (void)
|
|
|
|
{
|
|
|
|
return Rectangle(maAnchor, maSecondCorner);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SelectionRectangleOverlay::Start (const Point& rAnchor)
|
|
|
|
{
|
|
|
|
maAnchor = rAnchor;
|
|
|
|
maSecondCorner = rAnchor;
|
|
|
|
mrViewOverlay.GetViewShell().GetSlideSorterController().GetView().BegEncirclement(maAnchor);
|
|
|
|
OverlayBase::Show();
|
2004-07-13 13:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-11-26 14:13:08 +00:00
|
|
|
void SelectionRectangleOverlay::Update (const Point& rSecondCorner)
|
2004-07-13 13:28:36 +00:00
|
|
|
{
|
2004-11-26 14:13:08 +00:00
|
|
|
maSecondCorner = rSecondCorner;
|
|
|
|
mrViewOverlay.GetViewShell().GetSlideSorterController().GetView().MovEncirclement(maSecondCorner);
|
2004-07-13 13:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//===== InsertionIndicatorOverlay ===========================================
|
|
|
|
|
|
|
|
InsertionIndicatorOverlay::InsertionIndicatorOverlay (
|
|
|
|
ViewOverlay& rViewOverlay)
|
|
|
|
: OverlayBase (rViewOverlay)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsertionIndicatorOverlay::SetPositionAndSize (
|
|
|
|
const Rectangle& aNewBoundingBox)
|
|
|
|
{
|
|
|
|
if (maBoundingBox != aNewBoundingBox)
|
|
|
|
{
|
2005-02-17 08:45:04 +00:00
|
|
|
ShowingModeGuard aGuard (*this, true);
|
2004-07-13 13:28:36 +00:00
|
|
|
|
|
|
|
maBoundingBox = aNewBoundingBox;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsertionIndicatorOverlay::Paint (void)
|
|
|
|
{
|
|
|
|
Color aColor;
|
|
|
|
if (mbIsShowing)
|
2005-02-17 08:45:04 +00:00
|
|
|
aColor = Application::GetSettings().GetStyleSettings().GetFontColor();
|
2004-07-13 13:28:36 +00:00
|
|
|
else
|
2005-02-17 08:45:04 +00:00
|
|
|
aColor = Application::GetSettings().GetStyleSettings().GetWindowColor();
|
2004-07-13 13:28:36 +00:00
|
|
|
mrViewOverlay.GetViewShell().DrawFilledRect (
|
|
|
|
maBoundingBox,
|
|
|
|
aColor,
|
|
|
|
aColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InsertionIndicatorOverlay::SetPosition (const Point& rPoint)
|
|
|
|
{
|
|
|
|
static const bool bAllowHorizontalInsertMarker = true;
|
|
|
|
Layouter& rLayouter (
|
|
|
|
mrViewOverlay.GetController().GetView().GetLayouter());
|
|
|
|
USHORT nPageCount
|
|
|
|
= mrViewOverlay.GetController().GetModel().GetPageCount();
|
|
|
|
|
|
|
|
sal_Int32 nInsertionIndex = rLayouter.GetInsertionIndex (rPoint,
|
|
|
|
bAllowHorizontalInsertMarker);
|
|
|
|
if (nInsertionIndex >= nPageCount)
|
|
|
|
nInsertionIndex = nPageCount-1;
|
|
|
|
sal_Int32 nDrawIndex = nInsertionIndex;
|
|
|
|
|
|
|
|
bool bVertical = false;
|
|
|
|
bool bLeftOrTop = false;
|
|
|
|
if (nInsertionIndex >= 0)
|
|
|
|
{
|
|
|
|
// Now that we know where to insert, we still have to determine
|
|
|
|
// where to draw the marker. There are two decisions to make:
|
|
|
|
// 1. Draw a vertical or a horizontal insert marker.
|
|
|
|
// The horizontal one may only be chosen when there is only one
|
|
|
|
// column.
|
|
|
|
// 2. The vertical (standard) insert marker may be painted left to
|
|
|
|
// the insert page or right of the previous one. When both pages
|
|
|
|
// are in the same row this makes no difference. Otherwise the
|
|
|
|
// posiotions are at the left and right ends of two rows.
|
|
|
|
|
|
|
|
Point aPageCenter (rLayouter.GetPageObjectBox (
|
|
|
|
nInsertionIndex).Center());
|
|
|
|
|
|
|
|
if (bAllowHorizontalInsertMarker
|
|
|
|
&& rLayouter.GetColumnCount() == 1)
|
|
|
|
{
|
|
|
|
bVertical = false;
|
|
|
|
bLeftOrTop = (rPoint.Y() <= aPageCenter.Y());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bVertical = true;
|
|
|
|
bLeftOrTop = (rPoint.X() <= aPageCenter.X());
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add one when the mark was painted below or to the right of the
|
|
|
|
// page object.
|
|
|
|
if ( ! bLeftOrTop)
|
|
|
|
nInsertionIndex += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
mnInsertionIndex = nInsertionIndex;
|
|
|
|
|
|
|
|
Rectangle aBox;
|
|
|
|
if (mnInsertionIndex >= 0)
|
|
|
|
aBox = rLayouter.GetInsertionMarkerBox (
|
|
|
|
nDrawIndex,
|
|
|
|
bVertical,
|
|
|
|
bLeftOrTop);
|
|
|
|
SetPositionAndSize (aBox);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sal_Int32 InsertionIndicatorOverlay::GetInsertionPageIndex (void) const
|
|
|
|
{
|
|
|
|
return mnInsertionIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-20 12:35:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
//===== MouseOverIndicatorOverlay ===========================================
|
|
|
|
|
|
|
|
MouseOverIndicatorOverlay::MouseOverIndicatorOverlay (
|
|
|
|
ViewOverlay& rViewOverlay)
|
|
|
|
: OverlayBase (rViewOverlay),
|
2006-04-06 15:28:14 +00:00
|
|
|
mpPageUnderMouse()
|
2004-09-20 12:35:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MouseOverIndicatorOverlay::SetSlideUnderMouse (
|
2006-04-06 15:28:14 +00:00
|
|
|
const model::SharedPageDescriptor& rpDescriptor)
|
2004-09-20 12:35:48 +00:00
|
|
|
{
|
2005-03-30 08:26:35 +00:00
|
|
|
SlideSorterViewShell& rViewShell (mrViewOverlay.GetViewShell());
|
|
|
|
if ( ! rViewShell.GetViewShellBase().GetUpdateLockManager().IsLocked())
|
2006-04-06 15:28:14 +00:00
|
|
|
{
|
|
|
|
model::SharedPageDescriptor pDescriptor;
|
|
|
|
if ( ! mpPageUnderMouse.expired())
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
pDescriptor = model::SharedPageDescriptor(mpPageUnderMouse);
|
|
|
|
}
|
|
|
|
catch (::boost::bad_weak_ptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pDescriptor != rpDescriptor)
|
2005-03-30 08:26:35 +00:00
|
|
|
{
|
|
|
|
ShowingModeGuard aGuard (*this, true);
|
2004-09-20 12:35:48 +00:00
|
|
|
|
2006-04-06 15:28:14 +00:00
|
|
|
mpPageUnderMouse = rpDescriptor;
|
2005-03-30 08:26:35 +00:00
|
|
|
}
|
2006-04-06 15:28:14 +00:00
|
|
|
}
|
2004-09-20 12:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MouseOverIndicatorOverlay::Paint (void)
|
|
|
|
{
|
2006-04-06 15:28:14 +00:00
|
|
|
if ( ! mpPageUnderMouse.expired())
|
2004-09-20 12:35:48 +00:00
|
|
|
{
|
2006-04-06 15:28:14 +00:00
|
|
|
model::SharedPageDescriptor pDescriptor;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
pDescriptor = model::SharedPageDescriptor(mpPageUnderMouse);
|
|
|
|
}
|
|
|
|
catch (::boost::bad_weak_ptr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pDescriptor.get() != NULL)
|
2004-09-20 12:35:48 +00:00
|
|
|
{
|
2006-04-06 15:28:14 +00:00
|
|
|
SlideSorterViewShell& rViewShell (mrViewOverlay.GetViewShell());
|
|
|
|
if ( ! rViewShell.GetViewShellBase().GetUpdateLockManager().IsLocked())
|
2005-03-30 08:26:35 +00:00
|
|
|
{
|
2006-04-06 15:28:14 +00:00
|
|
|
SlideSorterView& rView (rViewShell.GetSlideSorterController().GetView());
|
|
|
|
OutputDevice* pDevice = rView.GetWindow();
|
|
|
|
PageObjectViewObjectContact* pContact = pDescriptor->GetViewObjectContact();
|
|
|
|
if (pDevice != NULL
|
|
|
|
&& pContact != NULL)
|
|
|
|
{
|
|
|
|
pContact->PaintFrame(*pDevice, mbIsShowing);
|
|
|
|
}
|
2005-03-30 08:26:35 +00:00
|
|
|
}
|
2004-09-20 12:35:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-07-13 13:28:36 +00:00
|
|
|
} } } // end of namespace ::sd::slidesorter::view
|