2000-09-18 16:15:01 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* $RCSfile: conrect.cxx,v $
|
|
|
|
* $Revision: 1.16 $
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
2008-04-10 20:16:57 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:15:01 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 22:10:57 +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 <sfx2/bindings.hxx>
|
|
|
|
#include <svx/htmlmode.hxx>
|
|
|
|
#include <svx/sdtacitm.hxx>
|
|
|
|
#include <svx/svdobj.hxx>
|
|
|
|
#include <svx/sdtagitm.hxx>
|
|
|
|
#include <svx/sdtakitm.hxx>
|
|
|
|
#include <svx/sdtaditm.hxx>
|
|
|
|
#include <svx/sdtaaitm.hxx>
|
|
|
|
#include <svx/svdview.hxx>
|
2001-09-28 11:02:08 +00:00
|
|
|
#include <svx/svdocapt.hxx>
|
|
|
|
#include <svx/outlobj.hxx>
|
2001-03-16 13:47:06 +00:00
|
|
|
#ifndef _CMDID_H
|
|
|
|
#include <cmdid.h>
|
|
|
|
#endif
|
|
|
|
#ifndef _VIEW_HXX
|
|
|
|
#include <view.hxx>
|
|
|
|
#endif
|
|
|
|
#include <edtwin.hxx>
|
|
|
|
#include <wrtsh.hxx>
|
|
|
|
#include <viewopt.hxx>
|
|
|
|
#ifndef _DRAWBASE_HXX
|
|
|
|
#include <drawbase.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _CONRECT_HXX
|
|
|
|
#include <conrect.hxx>
|
|
|
|
#endif
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Konstruktor
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
2001-03-16 13:47:06 +00:00
|
|
|
ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
|
|
|
|
SwView* pSwView )
|
|
|
|
: SwDrawBase( pWrtShell, pEditWin, pSwView ),
|
2001-10-22 16:04:43 +00:00
|
|
|
bMarquee(FALSE),
|
|
|
|
// #93382#
|
|
|
|
mbVertical(sal_False)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* MouseButtonDown-event
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
BOOL ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
|
|
|
|
{
|
|
|
|
BOOL bReturn;
|
|
|
|
|
|
|
|
if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == TRUE
|
2007-09-27 11:24:49 +00:00
|
|
|
&& m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pView->NoRotate();
|
|
|
|
if (m_pView->IsDrawSelMode())
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pView->FlipDrawSelMode();
|
|
|
|
m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return (bReturn);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* MouseButtonUp-event
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
BOOL ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
|
|
|
|
{
|
2007-09-27 11:24:49 +00:00
|
|
|
Point aPnt(m_pWin->PixelToLogic(rMEvt.GetPosPixel()));
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
BOOL bRet = SwDrawBase::MouseButtonUp(rMEvt);
|
2001-09-28 11:02:08 +00:00
|
|
|
if( bRet )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 11:24:49 +00:00
|
|
|
SdrView *pSdrView = m_pSh->GetDrawView();
|
2004-07-12 14:50:08 +00:00
|
|
|
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
|
2006-07-25 11:42:01 +00:00
|
|
|
SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
|
2001-09-28 11:02:08 +00:00
|
|
|
: 0;
|
2007-09-27 11:24:49 +00:00
|
|
|
switch( m_pWin->GetSdrDrawMode() )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2001-09-28 11:02:08 +00:00
|
|
|
case OBJ_TEXT:
|
|
|
|
if( bMarquee )
|
2000-09-18 16:15:01 +00:00
|
|
|
{
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pSh->ChgAnchor(FLY_IN_CNTNT);
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2001-09-28 11:02:08 +00:00
|
|
|
if( pObj )
|
|
|
|
{
|
|
|
|
// die fuer das Scrollen benoetigten Attribute setzen
|
|
|
|
SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
|
2000-09-18 16:15:01 +00:00
|
|
|
SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
|
|
|
|
|
2001-09-28 11:02:08 +00:00
|
|
|
aItemSet.Put( SdrTextAutoGrowWidthItem( FALSE ) );
|
|
|
|
aItemSet.Put( SdrTextAutoGrowHeightItem( FALSE ) );
|
|
|
|
aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
|
|
|
|
aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
|
|
|
|
aItemSet.Put( SdrTextAniCountItem( 0 ) );
|
|
|
|
aItemSet.Put( SdrTextAniAmountItem(
|
2007-09-27 11:24:49 +00:00
|
|
|
(INT16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
|
2000-10-30 11:08:27 +00:00
|
|
|
|
2003-11-24 15:13:00 +00:00
|
|
|
pObj->SetMergedItemSetAndBroadcast(aItemSet);
|
2001-09-28 11:02:08 +00:00
|
|
|
}
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
2001-10-22 16:04:43 +00:00
|
|
|
else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
|
|
|
|
{
|
|
|
|
// #93382#
|
|
|
|
SdrTextObj* pText = (SdrTextObj*)pObj;
|
|
|
|
SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
|
|
|
|
|
|
|
|
pText->SetVerticalWriting(TRUE);
|
|
|
|
|
|
|
|
aSet.Put(SdrTextAutoGrowWidthItem(TRUE));
|
|
|
|
aSet.Put(SdrTextAutoGrowHeightItem(FALSE));
|
|
|
|
aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
|
|
|
|
aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
|
|
|
|
|
2003-11-24 15:13:00 +00:00
|
|
|
pText->SetMergedItemSet(aSet);
|
2001-10-22 16:04:43 +00:00
|
|
|
}
|
2001-09-28 11:02:08 +00:00
|
|
|
if( pObj )
|
|
|
|
{
|
2006-11-14 14:18:31 +00:00
|
|
|
SdrPageView* pPV = pSdrView->GetSdrPageView();
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True );
|
2001-09-28 11:02:08 +00:00
|
|
|
}
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pView->LeaveDrawCreate(); // In Selektionsmode wechseln
|
|
|
|
m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
|
2001-09-28 11:02:08 +00:00
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
2001-09-28 11:02:08 +00:00
|
|
|
case OBJ_CAPTION:
|
|
|
|
if( bCapVertical && pObj )
|
|
|
|
{
|
|
|
|
SdrCaptionObj* pCaptObj = (SdrCaptionObj*)pObj;
|
|
|
|
pCaptObj->ForceOutlinerParaObject();
|
|
|
|
OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
|
|
|
|
if( pOPO && !pOPO->IsVertical() )
|
|
|
|
pOPO->SetVertical( TRUE );
|
|
|
|
}
|
|
|
|
break;
|
2007-09-27 11:24:49 +00:00
|
|
|
default:; //prevent warning
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* Function aktivieren
|
|
|
|
|*
|
|
|
|
\************************************************************************/
|
|
|
|
|
|
|
|
void ConstRectangle::Activate(const USHORT nSlotId)
|
|
|
|
{
|
2001-09-28 11:02:08 +00:00
|
|
|
bMarquee = bCapVertical = FALSE;
|
2001-10-22 16:04:43 +00:00
|
|
|
mbVertical = sal_False;
|
2000-09-18 16:15:01 +00:00
|
|
|
|
|
|
|
switch (nSlotId)
|
|
|
|
{
|
2001-03-16 13:47:06 +00:00
|
|
|
case SID_DRAW_LINE:
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_LINE);
|
2001-03-16 13:47:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_DRAW_RECT:
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_RECT);
|
2001-03-16 13:47:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_DRAW_ELLIPSE:
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_CIRC);
|
2001-03-16 13:47:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_DRAW_TEXT_MARQUEE:
|
|
|
|
bMarquee = TRUE;
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_TEXT);
|
2001-10-22 16:04:43 +00:00
|
|
|
break;
|
|
|
|
|
2001-03-16 13:47:06 +00:00
|
|
|
case SID_DRAW_TEXT_VERTICAL:
|
2001-10-22 16:04:43 +00:00
|
|
|
// #93382#
|
|
|
|
mbVertical = sal_True;
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_TEXT);
|
2001-10-22 16:04:43 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_DRAW_TEXT:
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_TEXT);
|
2001-03-16 13:47:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SID_DRAW_CAPTION_VERTICAL:
|
2001-09-28 11:02:08 +00:00
|
|
|
bCapVertical = TRUE;
|
|
|
|
// no break
|
|
|
|
case SID_DRAW_CAPTION:
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_CAPTION);
|
2001-03-16 13:47:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-09-27 11:24:49 +00:00
|
|
|
m_pWin->SetSdrDrawMode(OBJ_NONE);
|
2001-03-16 13:47:06 +00:00
|
|
|
break;
|
2000-09-18 16:15:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwDrawBase::Activate(nSlotId);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|