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

273 lines
7.8 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: conrect.cxx,v $
2000-09-18 16:15:01 +00:00
*
* $Revision: 1.13 $
2000-09-18 16:15:01 +00:00
*
* last change: $Author: obo $ $Date: 2006-09-16 23:10:57 $
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
2000-09-18 16:15:01 +00:00
#ifndef _SFX_BINDINGS_HXX //autogen
#include <sfx2/bindings.hxx>
#endif
#ifndef _SVX_HTMLMODE_HXX //autogen
#include <svx/htmlmode.hxx>
#endif
#ifndef sdtacitm_hxx //autogen
#include <svx/sdtacitm.hxx>
#endif
#ifndef _SVDOBJ_HXX //autogen
#include <svx/svdobj.hxx>
#endif
#ifndef _SDTAGITM_HXX //autogen
#include <svx/sdtagitm.hxx>
#endif
#ifndef SDTAKITM_HXX //autogen
#include <svx/sdtakitm.hxx>
#endif
#ifndef _SDTADITM_HXX //autogen
#include <svx/sdtaditm.hxx>
#endif
#ifndef _SDTAAITM_HXX //autogen
#include <svx/sdtaaitm.hxx>
#endif
#ifndef _SVDVIEW_HXX //autogen
#include <svx/svdview.hxx>
#endif
#ifndef _SVDCAPT_HXX
#include <svx/svdocapt.hxx>
#endif
#ifndef _OUTLOBJ_HXX
#include <svx/outlobj.hxx>
#endif
2001-03-16 13:47:06 +00:00
#ifndef _CMDID_H
#include <cmdid.h>
#endif
#ifndef _VIEW_HXX
#include <view.hxx>
#endif
#ifndef _EDTWIN_HXX
#include <edtwin.hxx>
#endif
#ifndef _WRTSH_HXX
#include <wrtsh.hxx>
#endif
#ifndef _VIEWOPT_HXX
#include <viewopt.hxx>
#endif
#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 ),
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
&& pWin->GetDrawMode() == OBJ_CAPTION)
{
pView->NoRotate();
if (pView->IsDrawSelMode())
{
pView->FlipDrawSelMode();
pSh->GetDrawView()->SetFrameDragSingles(pView->IsDrawSelMode());
}
}
return (bReturn);
}
/*************************************************************************
|*
|* MouseButtonUp-event
|*
\************************************************************************/
BOOL ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
{
Point aPnt(pWin->PixelToLogic(rMEvt.GetPosPixel()));
BOOL bRet = SwDrawBase::MouseButtonUp(rMEvt);
if( bRet )
2000-09-18 16:15:01 +00:00
{
SdrView *pSdrView = pSh->GetDrawView();
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
: 0;
switch( pWin->GetDrawMode() )
2000-09-18 16:15:01 +00:00
{
case OBJ_TEXT:
if( bMarquee )
2000-09-18 16:15:01 +00:00
{
BOOL bNewMode = 0 != (::GetHtmlMode(pView->GetDocShell())
& HTMLMODE_ON);
pSh->ChgAnchor(FLY_IN_CNTNT);
2000-09-18 16:15:01 +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);
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(
(INT16)pWin->PixelToLogic(Size(2,1)).Width()) );
pObj->SetMergedItemSetAndBroadcast(aItemSet);
}
2000-09-18 16:15:01 +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));
pText->SetMergedItemSet(aSet);
}
if( pObj )
{
SdrPageView* pPV = pSdrView->GetPageViewPvNum(0);
pView->BeginTextEdit( pObj, pPV, pWin, TRUE );
}
pView->LeaveDrawCreate(); // In Selektionsmode wechseln
pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
break;
2000-09-18 16:15:01 +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;
2000-09-18 16:15:01 +00:00
}
}
return bRet;
}
/*************************************************************************
|*
|* Function aktivieren
|*
\************************************************************************/
void ConstRectangle::Activate(const USHORT nSlotId)
{
bMarquee = bCapVertical = FALSE;
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:
pWin->SetDrawMode(OBJ_LINE);
break;
case SID_DRAW_RECT:
pWin->SetDrawMode(OBJ_RECT);
break;
case SID_DRAW_ELLIPSE:
pWin->SetDrawMode(OBJ_CIRC);
break;
case SID_DRAW_TEXT_MARQUEE:
bMarquee = TRUE;
pWin->SetDrawMode(OBJ_TEXT);
break;
2001-03-16 13:47:06 +00:00
case SID_DRAW_TEXT_VERTICAL:
// #93382#
mbVertical = sal_True;
pWin->SetDrawMode(OBJ_TEXT);
break;
case SID_DRAW_TEXT:
2001-03-16 13:47:06 +00:00
pWin->SetDrawMode(OBJ_TEXT);
break;
case SID_DRAW_CAPTION_VERTICAL:
bCapVertical = TRUE;
// no break
case SID_DRAW_CAPTION:
2001-03-16 13:47:06 +00:00
pWin->SetDrawMode(OBJ_CAPTION);
break;
default:
pWin->SetDrawMode(OBJ_NONE);
break;
2000-09-18 16:15:01 +00:00
}
SwDrawBase::Activate(nSlotId);
}