Files
libreoffice/sd/source/ui/func/fupoor.cxx

1068 lines
32 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* $RCSfile: fupoor.cxx,v $
*
* $Revision: 1.16 $
2000-09-18 16:07:07 +00:00
*
* last change: $Author: aw $ $Date: 2002-03-18 15:20:33 $
2000-09-18 16:07:07 +00:00
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#pragma hdrstop
#include <svx/svxids.hrc>
#ifndef _AEITEM_HXX //autogen
#include <svtools/aeitem.hxx>
#endif
#ifndef _SVDPAGV_HXX //autogen
#include <svx/svdpagv.hxx>
#endif
#ifndef _SV_SELENG_HXX //autogen
#include <vcl/seleng.hxx>
#endif
#ifndef _SFXAPP_HXX //autogen
#include <sfx2/app.hxx>
#endif
#ifndef _SFXDISPATCH_HXX //autogen
#include <sfx2/dispatch.hxx>
#endif
#ifndef _SFX_BINDINGS_HXX //autogen
#include <sfx2/bindings.hxx>
#endif
#ifndef _SFXREQUEST_HXX //autogen
#include <sfx2/request.hxx>
#endif
#ifndef _SV_DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
#endif
#ifndef _SFXSTBMGR_HXX //autogen
#include <sfx2/stbmgr.hxx>
#endif
#include "app.hrc"
#include "fupoor.hxx"
#include "fusel.hxx"
#include "sdpage.hxx"
#include "drawview.hxx"
#include "drviewsh.hxx"
#include "sdwindow.hxx"
#include "drawdoc.hxx"
#include "docshell.hxx"
#include "zoomlist.hxx"
#include "fuslshow.hxx"
// #97016# IV
#ifndef _SVDITER_HXX
#include <svx/svditer.hxx>
#endif
// #98198#
#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX
#include <svtools/syslocale.hxx>
#endif
2000-09-18 16:07:07 +00:00
TYPEINIT0( FuPoor );
/*************************************************************************
|*
|* Konstruktor
|*
\************************************************************************/
FuPoor::FuPoor(SdViewShell* pViewSh, SdWindow* pWin, SdView* pView,
SdDrawDocument* pDrDoc, SfxRequest& rReq) :
pViewShell(pViewSh),
pWindow(pWin),
pView(pView),
pDoc(pDrDoc),
pDocSh( pDrDoc->GetDocSh() ),
nSlotId( rReq.GetSlot() ),
pDialog(NULL),
bIsInDragMode(FALSE),
bScrollable (FALSE),
bDelayActive (FALSE),
bNoScrollUntilInside (TRUE),
nSlotValue(0),
// #95491# remember MouseButton state
mnCode(0)
2000-09-18 16:07:07 +00:00
{
ReceiveRequest(rReq);
aScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, ScrollHdl) );
aScrollTimer.SetTimeout(SELENG_AUTOREPEAT_INTERVAL);
aDragTimer.SetTimeoutHdl( LINK(this, FuPoor, DragHdl) );
aDragTimer.SetTimeout(SELENG_DRAGDROP_TIMEOUT);
aDelayToScrollTimer.SetTimeoutHdl( LINK(this, FuPoor, DelayHdl) );
aDelayToScrollTimer.SetTimeout(2000);
}
/*************************************************************************
|*
|* Destruktor
|*
\************************************************************************/
FuPoor::~FuPoor()
{
aDragTimer.Stop();
aScrollTimer.Stop();
aDelayToScrollTimer.Stop ();
if (pDialog)
delete pDialog;
}
/*************************************************************************
|*
|* Function aktivieren
|*
\************************************************************************/
void FuPoor::Activate()
{
if (pDialog)
{
pDialog->Show();
}
}
/*************************************************************************
|*
|* Function deaktivieren
|*
\************************************************************************/
void FuPoor::Deactivate()
{
aDragTimer.Stop();
aScrollTimer.Stop();
aDelayToScrollTimer.Stop ();
bScrollable =
bDelayActive = FALSE;
if (pDialog)
{
pDialog->Hide();
}
if (pWindow) pWindow->ReleaseMouse ();
}
/*************************************************************************
|*
|* Scrollen bei Erreichen des Fensterrandes; wird von
|* MouseMove aufgerufen
|*
\************************************************************************/
void FuPoor::ForceScroll(const Point& aPixPos)
{
aScrollTimer.Stop();
if ( !pView->IsDragHelpLine() && !pView->IsSetPageOrg() &&
!pViewShell->GetSlideShow() )
{
/* Size aSize = pWindow->GetSizePixel();
short dx = 0, dy = 0;
if ( aPixPos.X() <= 0 ) dx = -1;
if ( aPixPos.X() >= aSize.Width() ) dx = 1;
if ( aPixPos.Y() <= 0 ) dy = -1;
if ( aPixPos.Y() >= aSize.Height() ) dy = 1;
*/
Point aPos = pWindow->OutputToScreenPixel(aPixPos);
const Rectangle& rRect = pViewShell->GetAllWindowRect();
if ( bNoScrollUntilInside )
{
if ( rRect.IsInside(aPos) )
bNoScrollUntilInside = FALSE;
}
else
{
short dx = 0, dy = 0;
if ( aPos.X() <= rRect.Left() ) dx = -1;
if ( aPos.X() >= rRect.Right() ) dx = 1;
if ( aPos.Y() <= rRect.Top() ) dy = -1;
if ( aPos.Y() >= rRect.Bottom() ) dy = 1;
if ( dx != 0 || dy != 0 )
{
if (bScrollable)
{
// Scrollaktion in abgeleiteter Klasse
ScrollStart();
pViewShell->ScrollLines(dx, dy);
ScrollEnd();
aScrollTimer.Start();
}
else if (! bDelayActive) StartDelayToScrollTimer ();
}
}
}
}
/*************************************************************************
|*
|* Timer-Handler fuer Fensterscrolling
|*
\************************************************************************/
IMPL_LINK_INLINE_START( FuPoor, ScrollHdl, Timer *, pTimer )
{
Point aPnt(pWindow->GetPointerPosPixel());
// #95491# use remembered MouseButton state to create correct
// MouseEvents for this artifical MouseMove.
MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
2000-09-18 16:07:07 +00:00
return 0;
}
IMPL_LINK_INLINE_END( FuPoor, ScrollHdl, Timer *, pTimer )
/*************************************************************************
|*
|* String in Applikations-Statuszeile ausgeben
|*
\************************************************************************/
void FuPoor::WriteStatus(const String& aStr)
{
/*
// SFX_APP()->SetHelpText(aStr);
SfxStatusBarManager* pStatBarMan = SFX_APP()->GetStatusBarManager();
pStatBarMan->ShowHelpText(aStr);
*/
}
/*************************************************************************
|*
|* Tastaturereignisse bearbeiten
|*
|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
|* FALSE.
|*
\************************************************************************/
BOOL FuPoor::KeyInput(const KeyEvent& rKEvt)
{
BOOL bReturn = FALSE;
BOOL bSlideShow = FALSE;
USHORT nCode = rKEvt.GetKeyCode().GetCode();
2002-01-09 11:43:18 +00:00
FuSlideShow* pFuSlideShow = pViewShell->GetSlideShow();
2000-09-18 16:07:07 +00:00
if (pFuSlideShow)
{
bSlideShow = TRUE;
}
switch (nCode)
{
// #97016# IV
case KEY_RETURN:
{
if(rKEvt.GetKeyCode().IsMod1())
{
if(pViewShell && pViewShell->ISA(SdDrawViewShell))
{
SdDrawViewShell* pDrawViewShell = (SdDrawViewShell*)pViewShell;
SdPage* pActualPage = pDrawViewShell->GetActualPage();
SdrTextObj* pCandidate = 0L;
if(pActualPage)
{
SdrObjListIter aIter(*pActualPage, IM_DEEPNOGROUPS);
while(aIter.IsMore() && !pCandidate)
{
SdrObject* pObj = aIter.Next();
if(pObj && pObj->ISA(SdrTextObj))
{
sal_uInt32 nInv(pObj->GetObjInventor());
sal_uInt16 nKnd(pObj->GetObjIdentifier());
if(SdrInventor == nInv &&
(OBJ_TITLETEXT == nKnd || OBJ_OUTLINETEXT == nKnd || OBJ_TEXT == nKnd))
{
pCandidate = (SdrTextObj*)pObj;
}
}
}
}
if(pCandidate)
{
pView->UnMarkAll();
pView->MarkObj(pCandidate, pView->GetPageViewPvNum(0));
pViewShell->GetViewFrame()->GetDispatcher()->Execute(
SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
}
else
{
// insert a new page with the same page layout
pViewShell->GetViewFrame()->GetDispatcher()->Execute(
SID_INSERTPAGE_QUICK, SFX_CALLMODE_ASYNCHRON);
}
// consumed
bReturn = TRUE;
}
}
else
{
// #98198# activate text edit on RETURN for selected object
const SdrMarkList& rMarkList = pView->GetMarkList();
if(!pView->IsTextEdit() && 1 == rMarkList.GetMarkCount())
{
pViewShell->GetViewFrame()->GetDispatcher()->Execute(
SID_ATTR_CHAR, SFX_CALLMODE_ASYNCHRON);
// consumed
bReturn = TRUE;
}
}
}
break;
// #97016# II
case KEY_TAB:
{
if(rKEvt.GetKeyCode().IsMod1())
{
// #97016# II do something with a selected handle?
const SdrHdlList& rHdlList = pView->GetHdlList();
sal_Bool bForward(!rKEvt.GetKeyCode().IsShift());
((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
// guarantee visibility of focused handle
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(pHdl)
{
Point aHdlPosition(pHdl->GetPos());
Rectangle aVisRect(aHdlPosition - Point(100, 100), Size(200, 200));
pView->MakeVisible(aVisRect, *pWindow);
}
// consumed
bReturn = TRUE;
}
}
break;
2000-09-18 16:07:07 +00:00
case KEY_ESCAPE:
{
if ( !this->ISA(FuSelection) )
{
// In Selektion verzweigen
bReturn = TRUE;
pViewShell->GetViewFrame()->GetDispatcher()->Execute(SID_OBJECT_SELECT, SFX_CALLMODE_ASYNCHRON);
}
}
break;
case KEY_ADD:
{
if (!pView->IsTextEdit() && !bSlideShow)
{
// Zoom vergroessern
pViewShell->SetZoom(pWindow->GetZoom() * 3 / 2);
if (pViewShell->ISA(SdDrawViewShell))
((SdDrawViewShell*) pViewShell)->SetZoomOnPage(FALSE);
bReturn = TRUE;
}
}
break;
case KEY_SUBTRACT:
{
if (!pView->IsTextEdit() && !bSlideShow)
{
// Zoom verringern
pViewShell->SetZoom(pWindow->GetZoom() * 2 / 3);
if (pViewShell->ISA(SdDrawViewShell))
((SdDrawViewShell*) pViewShell)->SetZoomOnPage(FALSE);
bReturn = TRUE;
}
}
break;
case KEY_MULTIPLY:
{
if (!pView->IsTextEdit() && !bSlideShow)
{
// Zoom auf Seite
pViewShell->GetViewFrame()->GetDispatcher()->
Execute(SID_SIZE_PAGE, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
bReturn = TRUE;
}
}
break;
case KEY_DIVIDE:
{
if (!pView->IsTextEdit() && !bSlideShow)
{
// Zoom auf selektierte Objekte
pViewShell->GetViewFrame()->GetDispatcher()->
Execute(SID_SIZE_OPTIMAL, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
bReturn = TRUE;
}
}
break;
case KEY_POINT:
{
ZoomList* pZoomList = pViewShell->GetZoomList();
2002-01-09 11:43:18 +00:00
if (!pView->IsTextEdit() && pZoomList->IsNextPossible() && !bSlideShow)
2000-09-18 16:07:07 +00:00
{
// Naechstes ZoomRect einstellen
pViewShell->SetZoomRect(pZoomList->GetNextZoomRect());
bReturn = TRUE;
}
}
break;
case KEY_COMMA:
{
ZoomList* pZoomList = pViewShell->GetZoomList();
2002-01-09 11:43:18 +00:00
if (!pView->IsTextEdit() && pZoomList->IsPreviousPossible() && !bSlideShow)
2000-09-18 16:07:07 +00:00
{
// Vorheriges ZoomRect einstellen
pViewShell->SetZoomRect(pZoomList->GetPreviousZoomRect());
bReturn = TRUE;
}
}
break;
case KEY_HOME:
{
2002-01-09 11:43:18 +00:00
if (!pView->IsTextEdit() && pViewShell->ISA(SdDrawViewShell) && !bSlideShow)
2000-09-18 16:07:07 +00:00
{
// Sprung zu erster Seite
((SdDrawViewShell*) pViewShell)->SwitchPage(0);
bReturn = TRUE;
}
}
break;
case KEY_END:
{
2002-01-09 11:43:18 +00:00
if (!pView->IsTextEdit() && pViewShell->ISA(SdDrawViewShell) && !bSlideShow)
2000-09-18 16:07:07 +00:00
{
// Sprung zu letzter Seite
SdPage* pPage = ((SdDrawViewShell*) pViewShell)->GetActualPage();
((SdDrawViewShell*) pViewShell)->SwitchPage(pDoc->GetSdPageCount(
pPage->GetPageKind()) - 1);
bReturn = TRUE;
}
}
break;
case KEY_PAGEUP:
{
pView->EndTextEdit();
2002-01-09 11:43:18 +00:00
if (!rKEvt.GetKeyCode().IsMod1() && pViewShell->ISA(SdDrawViewShell) && !bSlideShow)
2000-09-18 16:07:07 +00:00
{
// Vorherige Seite
bReturn = TRUE;
SdPage* pPage = ((SdDrawViewShell*) pViewShell)->GetActualPage();
USHORT nSdPage = (pPage->GetPageNum() - 1) / 2;
if (nSdPage > 0)
((SdDrawViewShell*) pViewShell)->SwitchPage(nSdPage - 1);
}
else if (!bSlideShow)
{
// Scroll nach unten
ScrollStart();
pViewShell->ScrollLines(0, -1);
ScrollEnd();
}
}
break;
case KEY_PAGEDOWN:
{
pView->EndTextEdit();
2002-01-09 11:43:18 +00:00
if (!rKEvt.GetKeyCode().IsMod1() && pViewShell->ISA(SdDrawViewShell) && !bSlideShow)
2000-09-18 16:07:07 +00:00
{
// Naechste Seite
bReturn = TRUE;
SdPage* pPage = ((SdDrawViewShell*) pViewShell)->GetActualPage();
USHORT nSdPage = (pPage->GetPageNum() - 1) / 2;
if (nSdPage < pDoc->GetSdPageCount(pPage->GetPageKind()) - 1)
{
((SdDrawViewShell*) pViewShell)->SwitchPage(nSdPage + 1);
}
}
else if (!bSlideShow)
{
// Scroll nach oben
ScrollStart();
pViewShell->ScrollLines(0, 1);
ScrollEnd();
}
}
break;
// #97016# II change select state when focus is on poly point
case KEY_SPACE:
{
const SdrHdlList& rHdlList = pView->GetHdlList();
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(pHdl)
{
if(pHdl->GetKind() == HDL_POLY)
{
// rescue ID of point with focus
sal_uInt16 nPol(pHdl->GetPolyNum());
sal_uInt16 nPnt(pHdl->GetPointNum());
if(pView->IsPointMarked(*pHdl))
{
if(rKEvt.GetKeyCode().IsShift())
{
pView->UnmarkPoint(*pHdl);
}
}
else
{
if(!rKEvt.GetKeyCode().IsShift())
{
pView->UnmarkAllPoints();
}
pView->MarkPoint(*pHdl);
}
if(0L == rHdlList.GetFocusHdl())
{
// restore point with focus
SdrHdl* pNewOne = 0L;
for(sal_uInt32 a(0); !pNewOne && a < rHdlList.GetHdlCount(); a++)
{
SdrHdl* pAct = rHdlList.GetHdl(a);
if(pAct
&& pAct->GetKind() == HDL_POLY
&& pAct->GetPolyNum() == nPol
&& pAct->GetPointNum() == nPnt)
{
pNewOne = pAct;
}
}
if(pNewOne)
{
((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
}
}
bReturn = TRUE;
}
}
}
break;
2000-09-18 16:07:07 +00:00
case KEY_UP:
case KEY_DOWN:
case KEY_LEFT:
case KEY_RIGHT:
{
if (!pView->IsTextEdit() && !bSlideShow)
{
long nX = 0;
long nY = 0;
if (nCode == KEY_UP)
{
// Scroll nach oben
nX = 0;
nY =-1;
}
else if (nCode == KEY_DOWN)
{
// Scroll nach unten
nX = 0;
nY = 1;
}
else if (nCode == KEY_LEFT)
{
// Scroll nach links
nX =-1;
nY = 0;
}
else if (nCode == KEY_RIGHT)
{
// Scroll nach rechts
nX = 1;
nY = 0;
}
if (pView->HasMarkedObj() && !rKEvt.GetKeyCode().IsMod1() &&
!pDocSh->IsReadOnly())
{
if(rKEvt.GetKeyCode().IsMod2())
{
// #97016# move in 1 pixel distance
Size aLogicSizeOnePixel = (pWindow) ? pWindow->PixelToLogic(Size(1,1)) : Size(100, 100);
nX *= aLogicSizeOnePixel.Width();
nY *= aLogicSizeOnePixel.Height();
}
else
{
// old, fixed move distance
nX *= 100;
nY *= 100;
}
// #97016# II
const SdrHdlList& rHdlList = pView->GetHdlList();
SdrHdl* pHdl = rHdlList.GetFocusHdl();
if(0L == pHdl)
{
// #90129# restrict movement to WorkArea
const Rectangle& rWorkArea = pView->GetWorkArea();
if(!rWorkArea.IsEmpty())
{
Rectangle aMarkRect(pView->GetMarkedObjRect());
aMarkRect.Move(nX, nY);
if(!aMarkRect.IsInside(rWorkArea))
{
if(aMarkRect.Left() < rWorkArea.Left())
{
nX += rWorkArea.Left() - aMarkRect.Left();
}
if(aMarkRect.Right() > rWorkArea.Right())
{
nX -= aMarkRect.Right() - rWorkArea.Right();
}
if(aMarkRect.Top() < rWorkArea.Top())
{
nY += rWorkArea.Top() - aMarkRect.Top();
}
if(aMarkRect.Bottom() > rWorkArea.Bottom())
{
nY -= aMarkRect.Bottom() - rWorkArea.Bottom();
}
}
}
// no handle selected
if(0 != nX || 0 != nY)
{
pView->MoveAllMarked(Size(nX, nY));
// #97016# II
pView->MakeVisible(pView->GetAllMarkedRect(), *pWindow);
}
}
else
{
// move handle with index nHandleIndex
if(pHdl && (nX || nY))
{
// now move the Handle (nX, nY)
Point aStartPoint(pHdl->GetPos());
Point aEndPoint(pHdl->GetPos() + Point(nX, nY));
const SdrDragStat& rDragStat = pView->GetDragStat();
// start dragging
pView->BegDragObj(aStartPoint, 0, pHdl, 0);
if(pView->IsDragObj())
{
FASTBOOL bWasNoSnap = rDragStat.IsNoSnap();
BOOL bWasSnapEnabled = pView->IsSnapEnabled();
// switch snapping off
if(!bWasNoSnap)
((SdrDragStat&)rDragStat).SetNoSnap(TRUE);
if(bWasSnapEnabled)
pView->SetSnapEnabled(FALSE);
pView->MovAction(aEndPoint);
pView->EndDragObj();
// restore snap
if(!bWasNoSnap)
((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
if(bWasSnapEnabled)
pView->SetSnapEnabled(bWasSnapEnabled);
}
// make moved handle visible
Rectangle aVisRect(aEndPoint - Point(100, 100), Size(200, 200));
pView->MakeVisible(aVisRect, *pWindow);
}
}
2000-09-18 16:07:07 +00:00
}
else
{
// Seite scrollen
ScrollStart();
pViewShell->ScrollLines(nX, nY);
ScrollEnd();
}
bReturn = TRUE;
}
}
break;
}
if (bReturn)
{
pWindow->ReleaseMouse();
}
// #98198# when a text-editable object is selected and the
// input character is printable, activate text edit on that object
// and feed character to object
if(!bReturn)
{
const SdrMarkList& rMarkList = pView->GetMarkList();
if(!pView->IsTextEdit() && 1 == rMarkList.GetMarkCount())
{
SdrObject* pObj = rMarkList.GetMark(0)->GetObj();
if(pObj->ISA(SdrTextObj) && pObj->HasTextEdit())
{
// is the character a printable one?
SvtSysLocale aSysLocale;
const CharClass& rCharClass = aSysLocale.GetCharClass();
String aCharString(rKEvt.GetCharCode());
if(aCharString.Len())
{
sal_Int32 nCharType = rCharClass.getCharacterType(aCharString, 0);
sal_Bool bPrintable(0 != (nCharType & ::com::sun::star::i18n::KCharacterType::PRINTABLE));
if(bPrintable)
{
// try to activate textedit mode for the selected object
SfxStringItem aInputString(SID_ATTR_CHAR, aCharString);
pViewShell->GetViewFrame()->GetDispatcher()->Execute(
SID_ATTR_CHAR,
SFX_CALLMODE_ASYNCHRON,
&aInputString,
0L);
// consumed
bReturn = TRUE;
}
}
}
}
}
2000-09-18 16:07:07 +00:00
return(bReturn);
}
// #97016# II
void FuPoor::SelectionHasChanged()
{
const SdrHdlList& rHdlList = pView->GetHdlList();
((SdrHdlList&)rHdlList).ResetFocusHdl();
}
2000-09-18 16:07:07 +00:00
/*************************************************************************
|*
|* Cut object to clipboard
|*
\************************************************************************/
void FuPoor::DoCut()
{
if (pView)
{
pView->DoCut(pWindow);
}
}
/*************************************************************************
|*
|* Copy object to clipboard
|*
\************************************************************************/
void FuPoor::DoCopy()
{
if (pView)
{
pView->DoCopy(pWindow);
}
}
/*************************************************************************
|*
|* Paste object from clipboard
|*
\************************************************************************/
void FuPoor::DoPaste()
{
if (pView)
{
pView->DoPaste(pWindow);
}
}
/*************************************************************************
|*
|* Timer-Handler fuer Drag&Drop
|*
\************************************************************************/
IMPL_LINK( FuPoor, DragHdl, Timer *, pTimer )
{
USHORT nHitLog = USHORT ( pWindow->PixelToLogic(Size(HITPIX,0)).Width() );
SdrHdl* pHdl = pView->HitHandle(aMDPos, *pWindow);
if ( pHdl==NULL && pView->IsMarkedHit(aMDPos, nHitLog)
&& !pView->IsPresObjSelected(FALSE, TRUE) )
{
pWindow->ReleaseMouse();
bIsInDragMode = TRUE;
pView->StartDrag( aMDPos, pWindow );
2000-09-18 16:07:07 +00:00
}
return 0;
}
/*************************************************************************
|*
|* Command-event
|*
\************************************************************************/
BOOL FuPoor::Command(const CommandEvent& rCEvt)
{
return( pView->Command(rCEvt,pWindow) );
}
/*************************************************************************
|*
|* Timer-Handler fuer Fensterscrolling
|*
\************************************************************************/
IMPL_LINK_INLINE_START( FuPoor, DelayHdl, Timer *, pTimer )
{
aDelayToScrollTimer.Stop ();
bScrollable = TRUE;
Point aPnt(pWindow->GetPointerPosPixel());
// #95491# use remembered MouseButton state to create correct
// MouseEvents for this artifical MouseMove.
MouseMove(MouseEvent(aPnt, 1, 0, GetMouseButtonCode()));
2000-09-18 16:07:07 +00:00
return 0;
}
IMPL_LINK_INLINE_END( FuPoor, DelayHdl, Timer *, pTimer )
/*************************************************************************
|*
|* Handler fuer Maustaste
|*
\************************************************************************/
BOOL FuPoor::MouseButtonUp (const MouseEvent& rMEvt)
2000-09-18 16:07:07 +00:00
{
// #95491# remember button state for creation of own MouseEvents
SetMouseButtonCode(rMEvt.GetButtons());
2000-09-18 16:07:07 +00:00
aDelayToScrollTimer.Stop ();
bScrollable = bDelayActive = FALSE;
return FALSE;
}
BOOL FuPoor::MouseButtonDown(const MouseEvent& rMEvt)
{
// #95491# remember button state for creation of own MouseEvents
SetMouseButtonCode(rMEvt.GetButtons());
return FALSE;
2000-09-18 16:07:07 +00:00
}
/*************************************************************************
|*
|* Handler fuer Maustaste
|*
\************************************************************************/
void FuPoor::StartDelayToScrollTimer ()
2000-09-18 16:07:07 +00:00
{
bDelayActive = TRUE;
aDelayToScrollTimer.Start ();
}
/*************************************************************************
|*
|* Handler fuer Maustaste
|*
\************************************************************************/
long FuPoor::diffPoint (long pos1, long pos2)
{
return (pos1 > pos2) ? pos1 - pos2
: pos2 - pos1;
}
/*************************************************************************
|*
|* Help-event
|*
\************************************************************************/
BOOL FuPoor::RequestHelp(const HelpEvent& rHEvt)
{
BOOL bReturn = FALSE;
SdrPageView* pPV = pView->GetPageViewPvNum(0);
if (pPV)
{
SdPage* pPage = (SdPage*) pPV->GetPage();
if (pPage)
{
bReturn = pPage->RequestHelp(pWindow, pView, rHEvt);
}
}
return(bReturn);
}
/*************************************************************************
|*
|* Request verarbeiten
|*
\************************************************************************/
void FuPoor::ReceiveRequest(SfxRequest& rReq)
{
const SfxItemSet* pSet = rReq.GetArgs();
if (pSet)
{
if( pSet->GetItemState( nSlotId ) == SFX_ITEM_SET )
{
const SfxPoolItem& rItem = pSet->Get( nSlotId );
if( rItem.ISA( SfxAllEnumItem ) )
{
nSlotValue = ( ( const SfxAllEnumItem& ) rItem ).GetValue();
}
}
}
}
/*************************************************************************
|*
|* #97016#
|*
\************************************************************************/
SdrObject* FuPoor::CreateDefaultObject(const sal_uInt16 nID, const Rectangle& rRectangle)
{
// empty base implementation
return 0L;
}
2000-09-18 16:07:07 +00:00
void FuPoor::ImpForceQuadratic(Rectangle& rRect)
{
if(rRect.GetWidth() > rRect.GetHeight())
{
rRect = Rectangle(
Point(rRect.Left() + ((rRect.GetWidth() - rRect.GetHeight()) / 2), rRect.Top()),
Size(rRect.GetHeight(), rRect.GetHeight()));
}
else
{
rRect = Rectangle(
Point(rRect.Left(), rRect.Top() + ((rRect.GetHeight() - rRect.GetWidth()) / 2)),
Size(rRect.GetWidth(), rRect.GetWidth()));
}
}