Files
libreoffice/sw/source/ui/ribbar/drawbase.cxx

764 lines
24 KiB
C++
Raw Normal View History

2000-09-18 16:15:01 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:15:01 +00:00
*
* $RCSfile: drawbase.cxx,v $
2000-09-18 16:15:01 +00:00
*
* $Revision: 1.19 $
2000-09-18 16:15:01 +00:00
*
* last change: $Author: hr $ $Date: 2007-09-27 12:25:02 $
2000-09-18 16:15:01 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-09-18 16:15:01 +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
2000-09-18 16:15:01 +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.
2000-09-18 16:15:01 +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.
2000-09-18 16:15:01 +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
2000-09-18 16:15:01 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
2000-09-18 16:15:01 +00:00
#include <hintids.hxx>
#ifndef _LIST_HXX //autogen
#include <tools/list.hxx>
#endif
#ifndef _SVDVIEW_HXX //autogen
#include <svx/svdview.hxx>
#endif
#ifndef _SVDOBJ_HXX //autogen
#include <svx/svdobj.hxx>
#endif
#ifndef _SFXPTITEM_HXX //autogen
#include <svtools/ptitem.hxx>
#endif
#ifndef _SVX_SIZEITEM_HXX //autogen
#include <svx/sizeitem.hxx>
#endif
#ifndef _SFXREQUEST_HXX //autogen
#include <sfx2/request.hxx>
#endif
#ifndef _SFX_BINDINGS_HXX //autogen
#include <sfx2/bindings.hxx>
#endif
#ifndef _FMTCLDS_HXX
#include <fmtclds.hxx>
#endif
#ifndef _FRMFMT_HXX //autogen
#include <frmfmt.hxx>
#endif
#include "cmdid.h"
#include "basesh.hxx"
#include "view.hxx"
#include "wrtsh.hxx"
#include "drawbase.hxx"
#include "edtwin.hxx"
#include "caption.hxx"
#include "swundo.hxx"
#include "undobj.hxx"
#include "comcore.hrc"
2000-09-18 16:15:01 +00:00
using namespace ::com::sun::star;
2000-09-18 16:15:01 +00:00
extern BOOL bNoInterrupt; // in mainwn.cxx
#define MINMOVE ((USHORT)m_pSh->GetOut()->PixelToLogic(Size(m_pSh->GetDrawView()->GetMarkHdlSizePixel()/2,0)).Width())
2000-09-18 16:15:01 +00:00
/*************************************************************************
|*
|* Konstruktor
|*
\************************************************************************/
SwDrawBase::SwDrawBase(SwWrtShell* pSwWrtShell, SwEditWin* pWindow, SwView* pSwView) :
m_pView(pSwView),
m_pSh(pSwWrtShell),
m_pWin(pWindow),
m_nSlotId(USHRT_MAX),
m_bCreateObj(TRUE),
m_bInsForm(FALSE)
2000-09-18 16:15:01 +00:00
{
if ( !m_pSh->HasDrawView() )
m_pSh->MakeDrawView();
2000-09-18 16:15:01 +00:00
}
/*************************************************************************
|*
|* Destruktor
|*
\************************************************************************/
__EXPORT SwDrawBase::~SwDrawBase()
{
if (m_pView->GetWrtShellPtr()) // Im view-Dtor koennte die wrtsh bereits geloescht worden sein...
m_pSh->GetDrawView()->SetEditMode(TRUE);
2000-09-18 16:15:01 +00:00
}
/*************************************************************************
|*
|* MouseButtonDown-event
|*
\************************************************************************/
BOOL SwDrawBase::MouseButtonDown(const MouseEvent& rMEvt)
{
BOOL bReturn = FALSE;
SdrView *pSdrView = m_pSh->GetDrawView();
2000-09-18 16:15:01 +00:00
// #i33136#
// pSdrView->SetOrtho(rMEvt.IsShift());
pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift());
2000-09-18 16:15:01 +00:00
pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
if (rMEvt.IsMod2())
{
pSdrView->SetCreate1stPointAsCenter(TRUE);
pSdrView->SetResizeAtCenter(TRUE);
}
else
{
pSdrView->SetCreate1stPointAsCenter(FALSE);
pSdrView->SetResizeAtCenter(FALSE);
}
SdrViewEvent aVEvt;
SdrHitKind eHit = pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt);
// Nur neues Objekt, wenn nicht im Basismode (bzw reinem Selektionsmode)
if (rMEvt.IsLeft() && !m_pWin->IsDrawAction())
2000-09-18 16:15:01 +00:00
{
if (IsCreateObj() && (eHit == SDRHIT_UNMARKEDOBJECT || eHit == SDRHIT_NONE || m_pSh->IsDrawCreate()))
2000-09-18 16:15:01 +00:00
{
bNoInterrupt = TRUE;
m_pWin->CaptureMouse();
2000-09-18 16:15:01 +00:00
m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
2000-09-18 16:15:01 +00:00
bReturn = m_pSh->BeginCreate( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), m_aStartPos);
2000-09-18 16:15:01 +00:00
SetDrawPointer();
if ( bReturn )
m_pWin->SetDrawAction(TRUE);
2000-09-18 16:15:01 +00:00
}
else if (!pSdrView->IsAction())
{
/**********************************************************************
* BEZIER-EDITOR
**********************************************************************/
m_pWin->CaptureMouse();
m_aStartPos = m_pWin->PixelToLogic(rMEvt.GetPosPixel());
UINT16 nEditMode = m_pWin->GetBezierMode();
2000-09-18 16:15:01 +00:00
if (eHit == SDRHIT_HANDLE && aVEvt.pHdl->GetKind() == HDL_BWGT)
{
/******************************************************************
* Handle draggen
******************************************************************/
bNoInterrupt = TRUE;
bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, aVEvt.pHdl);
m_pWin->SetDrawAction(TRUE);
2000-09-18 16:15:01 +00:00
}
else if (eHit == SDRHIT_MARKEDOBJECT && nEditMode == SID_BEZIER_INSERT)
{
/******************************************************************
* Klebepunkt einfuegen
******************************************************************/
bNoInterrupt = TRUE;
bReturn = pSdrView->BegInsObjPoint(m_aStartPos, rMEvt.IsMod1());
m_pWin->SetDrawAction(TRUE);
2000-09-18 16:15:01 +00:00
}
else if (eHit == SDRHIT_MARKEDOBJECT && rMEvt.IsMod1())
{
/******************************************************************
* Klebepunkt selektieren
******************************************************************/
if (!rMEvt.IsShift())
pSdrView->UnmarkAllPoints();
bReturn = pSdrView->BegMarkPoints(m_aStartPos);
m_pWin->SetDrawAction(TRUE);
2000-09-18 16:15:01 +00:00
}
else if (eHit == SDRHIT_MARKEDOBJECT && !rMEvt.IsShift() && !rMEvt.IsMod2())
{
/******************************************************************
* Objekt verschieben
******************************************************************/
return FALSE;
}
else if (eHit == SDRHIT_HANDLE)
{
/******************************************************************
* Klebepunkt selektieren
******************************************************************/
if (pSdrView->HasMarkablePoints() && (!pSdrView->IsPointMarked(*aVEvt.pHdl) || rMEvt.IsShift()))
{
SdrHdl* pHdl = NULL;
if (!rMEvt.IsShift())
{
pSdrView->UnmarkAllPoints();
pHdl = pSdrView->PickHandle(m_aStartPos);
2000-09-18 16:15:01 +00:00
}
else
{
if (pSdrView->IsPointMarked(*aVEvt.pHdl))
{
bReturn = pSdrView->UnmarkPoint(*aVEvt.pHdl);
pHdl = NULL;
}
else
{
pHdl = pSdrView->PickHandle(m_aStartPos);
2000-09-18 16:15:01 +00:00
}
}
if (pHdl)
{
bNoInterrupt = TRUE;
pSdrView->MarkPoint(*pHdl);
// bReturn = pSdrView->BegDragObj(m_aStartPos, (OutputDevice*) NULL, pHdl);
// m_pWin->SetDrawAction(TRUE);
2000-09-18 16:15:01 +00:00
}
}
}
else
{
/******************************************************************
* Objekt selektieren oder draggen
******************************************************************/
if (m_pSh->IsObjSelectable(m_aStartPos) && eHit == SDRHIT_UNMARKEDOBJECT)
2000-09-18 16:15:01 +00:00
{
if (pSdrView->HasMarkablePoints())
pSdrView->UnmarkAllPoints();
bNoInterrupt = FALSE;
// Drag im edtwin verwenden
return FALSE;
}
bNoInterrupt = TRUE;
if (m_pSh->IsObjSelected())
2000-09-18 16:15:01 +00:00
{
if (!rMEvt.IsShift())
{
if (!pSdrView->HasMarkablePoints())
{
//JP 10.10.2001: Bug 89619 - don't scroll the
// cursor into the visible area
BOOL bUnlockView = !m_pSh->IsViewLocked();
m_pSh->LockView( TRUE ); //lock visible section
m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX)); // Alles deselektieren
if( bUnlockView )
m_pSh->LockView( FALSE );
}
2000-09-18 16:15:01 +00:00
else
pSdrView->UnmarkAllPoints();
}
}
if (!m_pSh->IsSelFrmMode())
m_pSh->EnterSelFrmMode(NULL);
2000-09-18 16:15:01 +00:00
if( 0 != (bReturn = m_pSh->BeginMark(m_aStartPos)) )
m_pWin->SetDrawAction(TRUE);
2000-09-18 16:15:01 +00:00
SetDrawPointer();
}
}
}
return bReturn;
}
/*************************************************************************
|*
|* MouseMove-event
|*
\************************************************************************/
BOOL SwDrawBase::MouseMove(const MouseEvent& rMEvt)
{
SdrView *pSdrView = m_pSh->GetDrawView();
Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
2000-09-18 16:15:01 +00:00
BOOL bRet = FALSE;
if (IsCreateObj() && !m_pWin->IsDrawSelMode() && pSdrView->IsCreateObj())
2000-09-18 16:15:01 +00:00
{
// #i33136#
// pSdrView->SetOrtho(rMEvt.IsShift());
pSdrView->SetOrtho(doConstructOrthogonal() ? !rMEvt.IsShift() : rMEvt.IsShift());
2000-09-18 16:15:01 +00:00
pSdrView->SetAngleSnapEnabled(rMEvt.IsShift());
m_pSh->MoveCreate(aPnt);
2000-09-18 16:15:01 +00:00
bRet = TRUE;
}
else if (pSdrView->IsAction() || pSdrView->IsInsObjPoint() || pSdrView->IsMarkPoints())
{
m_pSh->MoveMark(aPnt);
2000-09-18 16:15:01 +00:00
bRet = TRUE;
}
return (bRet);
}
/*************************************************************************
|*
|* MouseButtonUp-event
|*
\************************************************************************/
BOOL SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt)
{
BOOL bReturn = FALSE;
BOOL bCheckShell = FALSE;
BOOL bAutoCap = FALSE;
Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
2000-09-18 16:15:01 +00:00
if (IsCreateObj() && m_pSh->IsDrawCreate() && !m_pWin->IsDrawSelMode())
2000-09-18 16:15:01 +00:00
{
const SdrObjKind nDrawMode = m_pWin->GetSdrDrawMode();
//objects with multiple point may end at the start position
BOOL bMultiPoint = OBJ_PLIN == nDrawMode ||
OBJ_PATHLINE == nDrawMode ||
OBJ_FREELINE == nDrawMode;
if(rMEvt.IsRight() || (aPnt == m_aStartPos && !bMultiPoint))
2000-09-18 16:15:01 +00:00
{
m_pSh->BreakCreate();
m_pView->LeaveDrawCreate();
2000-09-18 16:15:01 +00:00
}
else
{
if (OBJ_NONE == nDrawMode)
{
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME));
m_pSh->StartUndo(UNDO_INSERT, &aRewriter);
}
2000-09-18 16:15:01 +00:00
m_pSh->EndCreate(SDRCREATE_FORCEEND);
if (OBJ_NONE == nDrawMode) // Textrahmen eingefuegt
2000-09-18 16:15:01 +00:00
{
uno::Reference< frame::XDispatchRecorder > xRecorder =
m_pSh->GetView().GetViewFrame()->GetBindings().GetRecorder();
2002-08-07 10:39:35 +00:00
if ( xRecorder.is() )
{
SfxRequest aReq(m_pSh->GetView().GetViewFrame(),FN_INSERT_FRAME);
2002-08-07 10:39:35 +00:00
aReq.AppendItem(SfxUInt16Item( FN_INSERT_FRAME, (USHORT)FLY_AT_CNTNT ));
aReq.AppendItem(SfxPointItem( FN_PARAM_1, m_pSh->GetAnchorObjDiff()));
aReq.AppendItem(SvxSizeItem( FN_PARAM_2, m_pSh->GetObjSize()));
2002-08-07 10:39:35 +00:00
aReq.Done();
}
2000-09-18 16:15:01 +00:00
bAutoCap = TRUE;
if(m_pWin->GetFrmColCount() > 1)
2000-09-18 16:15:01 +00:00
{
SfxItemSet aSet(m_pView->GetPool(),RES_COL,RES_COL);
2000-09-18 16:15:01 +00:00
SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL));
aCol.Init(m_pWin->GetFrmColCount(), aCol.GetGutterWidth(), aCol.GetWishWidth());
2000-09-18 16:15:01 +00:00
aSet.Put(aCol);
// Vorlagen-AutoUpdate
SwFrmFmt* pFmt = m_pSh->GetCurFrmFmt();
2000-09-18 16:15:01 +00:00
if(pFmt && pFmt->IsAutoUpdateFmt())
m_pSh->AutoUpdateFrame(pFmt, aSet);
2000-09-18 16:15:01 +00:00
else
m_pSh->SetFlyFrmAttr( aSet );
2000-09-18 16:15:01 +00:00
}
}
if (m_pWin->GetSdrDrawMode() == OBJ_NONE)
m_pSh->EndUndo(UNDO_INSERT);
2000-09-18 16:15:01 +00:00
}
bReturn = TRUE;
EnterSelectMode(rMEvt);
}
else
{
SdrView *pSdrView = m_pSh->GetDrawView();
2000-09-18 16:15:01 +00:00
if (!pSdrView->HasMarkablePoints())
{
/**********************************************************************
* KEIN BEZIER_EDITOR
**********************************************************************/
if ((m_pSh->GetDrawView()->IsMarkObj() || m_pSh->GetDrawView()->IsMarkPoints())
2000-09-18 16:15:01 +00:00
&& rMEvt.IsLeft())
{
bReturn = m_pSh->EndMark();
2000-09-18 16:15:01 +00:00
m_pWin->SetDrawAction(FALSE);
2000-09-18 16:15:01 +00:00
if (aPnt == m_aStartPos && m_pSh->IsObjSelectable(aPnt))
2000-09-18 16:15:01 +00:00
{
m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() &&
m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT : 0);
2000-09-18 16:15:01 +00:00
if (!m_pSh->IsObjSelected())
2000-09-18 16:15:01 +00:00
{
m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
2000-09-18 16:15:01 +00:00
m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
2000-09-18 16:15:01 +00:00
if (m_pSh->IsSelFrmMode())
m_pSh->LeaveSelFrmMode();
2000-09-18 16:15:01 +00:00
}
m_pView->NoRotate();
2000-09-18 16:15:01 +00:00
bCheckShell = TRUE; // ggf BezierShell anwerfen
}
else if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
2000-09-18 16:15:01 +00:00
{
if (m_pSh->IsObjSelectable(aPnt))
m_pSh->SelectObj(aPnt, ( rMEvt.IsShift() &&
m_pSh->IsSelFrmMode() ) ? SW_ADD_SELECT : 0 );
2000-09-18 16:15:01 +00:00
else
{
m_pView->LeaveDrawCreate();
if (m_pSh->IsSelFrmMode())
m_pSh->LeaveSelFrmMode();
2000-09-18 16:15:01 +00:00
}
m_pView->NoRotate();
2000-09-18 16:15:01 +00:00
bReturn = TRUE;
}
}
}
else
{
/**********************************************************************
* BEZIER_EDITOR
**********************************************************************/
if ( pSdrView->IsAction() )
{
if ( pSdrView->IsInsObjPoint() )
bReturn = pSdrView->EndInsObjPoint(SDRCREATE_FORCEEND);
else if (pSdrView->IsMarkPoints() )
bReturn = pSdrView->EndMarkPoints();
else
{
pSdrView->EndAction();
bReturn = TRUE;
}
m_pWin->SetDrawAction(FALSE);
2000-09-18 16:15:01 +00:00
if (aPnt == m_aStartPos)
2000-09-18 16:15:01 +00:00
{
if (!m_pSh->IsObjSelectable(aPnt))
m_pSh->SelectObj(Point(LONG_MAX, LONG_MAX));
2000-09-18 16:15:01 +00:00
else if (!bReturn)
{
if (!rMEvt.IsShift())
pSdrView->UnmarkAllPoints();
m_pSh->SelectObj(aPnt, (rMEvt.IsShift() &&
m_pSh->IsSelFrmMode()) ? SW_ADD_SELECT :0);
2000-09-18 16:15:01 +00:00
}
if (!m_pSh->IsObjSelected())
2000-09-18 16:15:01 +00:00
{
m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
2000-09-18 16:15:01 +00:00
m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
2000-09-18 16:15:01 +00:00
if (m_pSh->IsSelFrmMode())
m_pSh->LeaveSelFrmMode();
2000-09-18 16:15:01 +00:00
}
m_pView->NoRotate();
2000-09-18 16:15:01 +00:00
bCheckShell = TRUE; // ggf BezierShell anwerfen
}
}
SetDrawPointer();
if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
2000-09-18 16:15:01 +00:00
{
m_pView->LeaveDrawCreate();
if (m_pSh->IsSelFrmMode())
m_pSh->LeaveSelFrmMode();
2000-09-18 16:15:01 +00:00
m_pView->NoRotate();
2000-09-18 16:15:01 +00:00
bReturn = TRUE;
}
}
}
if (bCheckShell)
m_pView->AttrChangedNotify( m_pSh ); // ggf BezierShell anwerfen
2000-09-18 16:15:01 +00:00
//!!!!!!!!!! Achtung Suizid !!!!!!!!!!! Sollte alles mal erneuert werden
if ( bAutoCap )
m_pView->AutoCaption(FRAME_CAP); //Kann derzeit nur FRAME sein, sonst auf
2000-09-18 16:15:01 +00:00
//enums umstellen
return (bReturn);
}
/*************************************************************************
|*
|* Function aktivieren
|*
\************************************************************************/
void SwDrawBase::Activate(const USHORT nSlot)
2000-09-18 16:15:01 +00:00
{
SetSlotId(nSlot);
SdrView *pSdrView = m_pSh->GetDrawView();
2000-09-18 16:15:01 +00:00
pSdrView->SetCurrentObj( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()) );
2000-09-18 16:15:01 +00:00
pSdrView->SetEditMode(FALSE);
SetDrawPointer();
m_pSh->NoEdit();
2000-09-18 16:15:01 +00:00
}
/*************************************************************************
|*
|* Function deaktivieren
|*
\************************************************************************/
void __EXPORT SwDrawBase::Deactivate()
{
SdrView *pSdrView = m_pSh->GetDrawView();
2000-09-18 16:15:01 +00:00
pSdrView->SetOrtho(FALSE);
pSdrView->SetAngleSnapEnabled(FALSE);
if (m_pWin->IsDrawAction() && m_pSh->IsDrawCreate())
m_pSh->BreakCreate();
2000-09-18 16:15:01 +00:00
m_pWin->SetDrawAction(FALSE);
2000-09-18 16:15:01 +00:00
m_pWin->ReleaseMouse();
2000-09-18 16:15:01 +00:00
bNoInterrupt = FALSE;
// if(!m_pSh->IsObjSelected())
// m_pSh->Edit();
2000-09-18 16:15:01 +00:00
if(m_pWin->GetApplyTemplate())
m_pWin->SetApplyTemplate(SwApplyTemplate());
m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
2000-09-18 16:15:01 +00:00
}
/*************************************************************************
|*
|* Tastaturereignisse bearbeiten
|*
|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
|* FALSE.
|*
\************************************************************************/
BOOL SwDrawBase::KeyInput(const KeyEvent& rKEvt)
{
BOOL bReturn = FALSE;
USHORT nCode = rKEvt.GetKeyCode().GetCode();
switch (nCode)
{
case KEY_ESCAPE:
{
if (m_pWin->IsDrawAction())
2000-09-18 16:15:01 +00:00
{
BreakCreate();
m_pView->LeaveDrawCreate();
2000-09-18 16:15:01 +00:00
}
bReturn = TRUE;
}
break;
case KEY_DELETE:
{
m_pSh->DelSelectedObj();
2000-09-18 16:15:01 +00:00
bReturn = TRUE;
}
break;
case KEY_UP:
case KEY_DOWN:
case KEY_LEFT:
case KEY_RIGHT:
{
SdrView *pSdrView = m_pSh->GetDrawView();
2000-09-18 16:15:01 +00:00
if (!pSdrView->IsTextEdit())
{
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 (pSdrView->AreObjectsMarked() && rKEvt.GetKeyCode().IsMod2())
2000-09-18 16:15:01 +00:00
{
// Objekte verschieben
nX *= 100;
nY *= 100;
pSdrView->MoveAllMarked(Size(nX, nY));
}
bReturn = TRUE;
}
}
break;
}
return (bReturn);
}
/*************************************************************************
|*
|* Tastaturereignisse bearbeiten
|*
|* Wird ein KeyEvent bearbeitet, so ist der Return-Wert TRUE, andernfalls
|* FALSE.
|*
\************************************************************************/
void SwDrawBase::BreakCreate()
{
m_pSh->BreakCreate();
m_pWin->SetDrawAction(FALSE);
m_pWin->ReleaseMouse();
2000-09-18 16:15:01 +00:00
Deactivate();
// m_pView->LeaveDrawCreate();
2000-09-18 16:15:01 +00:00
}
/*************************************************************************
|*
|* Mauspointer umschalten
|*
\************************************************************************/
void SwDrawBase::SetDrawPointer()
{
SdrView *pSdrView = m_pSh->GetDrawView();
Point aPnt(m_pWin->OutputToScreenPixel(m_pWin->GetPointerPosPixel()));
aPnt = m_pWin->PixelToLogic(m_pWin->ScreenToOutputPixel(aPnt));
const Pointer aPointTyp = pSdrView->GetPreferedPointer(aPnt, m_pSh->GetOut());
2000-09-18 16:15:01 +00:00
const Pointer aDrawPt(aPointTyp);
m_pWin->SetPointer(aDrawPt);
2000-09-18 16:15:01 +00:00
}
/*************************************************************************
|*
|* Ggf in Selektionsmode wechseln
|*
\************************************************************************/
void SwDrawBase::EnterSelectMode(const MouseEvent& rMEvt)
{
m_pWin->SetDrawAction(FALSE);
2000-09-18 16:15:01 +00:00
if (!m_pSh->IsObjSelected() && !m_pWin->IsDrawAction())
2000-09-18 16:15:01 +00:00
{
Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
2000-09-18 16:15:01 +00:00
if (m_pSh->IsObjSelectable(aPnt))
2000-09-18 16:15:01 +00:00
{
m_pSh->SelectObj(aPnt);
if (rMEvt.GetModifier() == KEY_SHIFT || !m_pSh->IsObjSelected())
2000-09-18 16:15:01 +00:00
{
m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
2000-09-18 16:15:01 +00:00
m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
2000-09-18 16:15:01 +00:00
}
}
else
{
m_pView->LeaveDrawCreate();
if (m_pSh->IsSelFrmMode())
m_pSh->LeaveSelFrmMode();
2000-09-18 16:15:01 +00:00
}
m_pView->NoRotate();
2000-09-18 16:15:01 +00:00
}
}
/* -----------------------------03.04.2002 10:52------------------------------
2000-09-18 16:15:01 +00:00
---------------------------------------------------------------------------*/
void SwDrawBase::CreateDefaultObject()
{
Point aStartPos = GetDefaultCenterPos();
Point aEndPos(aStartPos);
aStartPos.X() -= 8 * MM50;
aStartPos.Y() -= 4 * MM50;
aEndPos.X() += 8 * MM50;
aEndPos.Y() += 4 * MM50;
Rectangle aRect(aStartPos, aEndPos);
m_pSh->CreateDefaultShape( static_cast< UINT16 >(m_pWin->GetSdrDrawMode()), aRect, m_nSlotId);
}
/* -----------------25.10.2002 14:14-----------------
*
* --------------------------------------------------*/
Point SwDrawBase::GetDefaultCenterPos()
{
Size aDocSz(m_pSh->GetDocSize());
const SwRect& rVisArea = m_pSh->VisArea();
Point aStartPos = rVisArea.Center();
if(rVisArea.Width() > aDocSz.Width())
aStartPos.X() = aDocSz.Width() / 2 + rVisArea.Left();
if(rVisArea.Height() > aDocSz.Height())
aStartPos.Y() = aDocSz.Height() / 2 + rVisArea.Top();
return aStartPos;
}
2000-09-18 16:15:01 +00:00
// #i33136#
bool SwDrawBase::doConstructOrthogonal() const
{
return false;
}
// eof