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

203 lines
6.0 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 sw34bf06: #o12311627# use <rtl_random> methods to create unique ids for list styles and list ids http://svn.apache.org/viewvc?view=revision&revision=1172112 sw34bf06 #i114725#,#i115828# - method <SwDoc::ClearDoc()> - clear list structures completely http://svn.apache.org/viewvc?view=revision&revision=1172122 i#118572 - remove ui string and help content regarding usage of Java Mail in Writer's Mail Merge as Java Mail is not used. http://svn.apache.org/viewvc?view=revision&revision=1197035 Patches contributed by Mathias Bauer cws mba34issues01: #i117718#: provide filter name in case storage of medium does not allow to detect one http://svn.apache.org/viewvc?view=revision&revision=1172350 cws mba34issues01: #i117721#: directly provide parameters retrieved from SfxMedium http://svn.apache.org/viewvc?view=revision&revision=1172353 gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 cws mba34issues01: #i117723#: convert assertion into trace http://svn.apache.org/viewvc?view=revision&revision=1172355 cws mba34issues01: #i117699#: keep layout alive until swdoc dies http://svn.apache.org/viewvc?view=revision&revision=1172362 cws mba34issues01: #i117943#: missing color attributes in RTF clipboard http://svn.apache.org/viewvc?view=revision&revision=1172363 Patch contributed by Henning Brinkmann imported patch i#103878 http://svn.apache.org/viewvc?view=revision&revision=1172109 Patches contributed by Michael Stahl sw34bf06: #i117955#: WW8 export: disable storing of section breaks in endnotes http://svn.apache.org/viewvc?view=revision&revision=1172119 Patch contributed by imacat Fixed the Asian language work count. http://svn.apache.org/viewvc?view=revision&revision=1241345 Patch contributed by Pedro Giffuni i#20878 - Add comment with BZ issue for reference. http://svn.apache.org/viewvc?view=revision&revision=1244517 Patch contributed by Andre Fischer Do not add targets for junit tests when junit is disabled. http://svn.apache.org/viewvc?view=revision&revision=1241508 add writerperfect dependency.
2011-03-31 10:05:04 +02:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 .
*/
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>
#include <svx/svdocapt.hxx>
#include <editeng/outlobj.hxx>
2001-03-16 13:47:06 +00:00
#include <cmdid.h>
#include <view.hxx>
#include <edtwin.hxx>
#include <wrtsh.hxx>
#include <viewopt.hxx>
#include <drawbase.hxx>
#include <conrect.hxx>
2000-09-18 16:15:01 +00:00
/**
* Ctor
*/
2001-03-16 13:47:06 +00:00
ConstRectangle::ConstRectangle( SwWrtShell* pWrtShell, SwEditWin* pEditWin,
SwView* pSwView )
: SwDrawBase( pWrtShell, pEditWin, pSwView ),
bMarquee(false),
// #93382#
mbVertical(false)
2000-09-18 16:15:01 +00:00
{
}
/**
* MouseButtonDown event
*/
sal_Bool ConstRectangle::MouseButtonDown(const MouseEvent& rMEvt)
2000-09-18 16:15:01 +00:00
{
sal_Bool bReturn;
2000-09-18 16:15:01 +00:00
if ((bReturn = SwDrawBase::MouseButtonDown(rMEvt)) == sal_True
&& m_pWin->GetSdrDrawMode() == OBJ_CAPTION)
2000-09-18 16:15:01 +00:00
{
m_pView->NoRotate();
if (m_pView->IsDrawSelMode())
2000-09-18 16:15:01 +00:00
{
m_pView->FlipDrawSelMode();
m_pSh->GetDrawView()->SetFrameDragSingles(m_pView->IsDrawSelMode());
2000-09-18 16:15:01 +00:00
}
}
return (bReturn);
}
/**
* MouseButtonUp event
*/
sal_Bool ConstRectangle::MouseButtonUp(const MouseEvent& rMEvt)
2000-09-18 16:15:01 +00:00
{
sal_Bool bRet = SwDrawBase::MouseButtonUp(rMEvt);
if( bRet )
2000-09-18 16:15:01 +00:00
{
SdrView *pSdrView = m_pSh->GetDrawView();
const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
SdrObject* pObj = rMarkList.GetMark(0) ? rMarkList.GetMark(0)->GetMarkedSdrObj()
: 0;
switch( m_pWin->GetSdrDrawMode() )
2000-09-18 16:15:01 +00:00
{
case OBJ_TEXT:
if( bMarquee )
2000-09-18 16:15:01 +00:00
{
m_pSh->ChgAnchor(FLY_AS_CHAR);
2000-09-18 16:15:01 +00:00
if( pObj )
{
// Set the attributes needed for scrolling
SfxItemSet aItemSet( pSdrView->GetModel()->GetItemPool(),
2000-09-18 16:15:01 +00:00
SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST);
aItemSet.Put( SdrTextAutoGrowWidthItem( sal_False ) );
aItemSet.Put( SdrTextAutoGrowHeightItem( sal_False ) );
aItemSet.Put( SdrTextAniKindItem( SDRTEXTANI_SCROLL ) );
aItemSet.Put( SdrTextAniDirectionItem( SDRTEXTANI_LEFT ) );
aItemSet.Put( SdrTextAniCountItem( 0 ) );
aItemSet.Put( SdrTextAniAmountItem(
(sal_Int16)m_pWin->PixelToLogic(Size(2,1)).Width()) );
pObj->SetMergedItemSetAndBroadcast(aItemSet);
}
2000-09-18 16:15:01 +00:00
}
else if(mbVertical && pObj && pObj->ISA(SdrTextObj))
{
SdrTextObj* pText = (SdrTextObj*)pObj;
SfxItemSet aSet(pSdrView->GetModel()->GetItemPool());
pText->SetVerticalWriting(sal_True);
aSet.Put(SdrTextAutoGrowWidthItem(sal_True));
aSet.Put(SdrTextAutoGrowHeightItem(sal_False));
aSet.Put(SdrTextVertAdjustItem(SDRTEXTVERTADJUST_TOP));
aSet.Put(SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT));
pText->SetMergedItemSet(aSet);
}
if( pObj )
{
SdrPageView* pPV = pSdrView->GetSdrPageView();
m_pView->BeginTextEdit( pObj, pPV, m_pWin, sal_True );
}
m_pView->LeaveDrawCreate(); // Switch to selection mode
m_pSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_INSERT_DRAW);
break;
2000-09-18 16:15:01 +00:00
case OBJ_CAPTION:
{
SdrCaptionObj* pCaptObj = dynamic_cast<SdrCaptionObj*>(pObj);
if( bCapVertical && pCaptObj )
{
pCaptObj->ForceOutlinerParaObject();
OutlinerParaObject* pOPO = pCaptObj->GetOutlinerParaObject();
if( pOPO && !pOPO->IsVertical() )
pOPO->SetVertical( sal_True );
}
}
break;
default:; //prevent warning
2000-09-18 16:15:01 +00:00
}
}
return bRet;
}
/**
* Activate
*/
void ConstRectangle::Activate(const sal_uInt16 nSlotId)
2000-09-18 16:15:01 +00:00
{
bMarquee = bCapVertical = false;
mbVertical = false;
2000-09-18 16:15:01 +00:00
switch (nSlotId)
{
2001-03-16 13:47:06 +00:00
case SID_DRAW_LINE:
m_pWin->SetSdrDrawMode(OBJ_LINE);
2001-03-16 13:47:06 +00:00
break;
case SID_DRAW_RECT:
m_pWin->SetSdrDrawMode(OBJ_RECT);
2001-03-16 13:47:06 +00:00
break;
case SID_DRAW_ELLIPSE:
m_pWin->SetSdrDrawMode(OBJ_CIRC);
2001-03-16 13:47:06 +00:00
break;
case SID_DRAW_TEXT_MARQUEE:
bMarquee = true;
m_pWin->SetSdrDrawMode(OBJ_TEXT);
break;
2001-03-16 13:47:06 +00:00
case SID_DRAW_TEXT_VERTICAL:
mbVertical = true;
m_pWin->SetSdrDrawMode(OBJ_TEXT);
break;
case SID_DRAW_TEXT:
m_pWin->SetSdrDrawMode(OBJ_TEXT);
2001-03-16 13:47:06 +00:00
break;
case SID_DRAW_CAPTION_VERTICAL:
bCapVertical = true;
// no break
case SID_DRAW_CAPTION:
m_pWin->SetSdrDrawMode(OBJ_CAPTION);
2001-03-16 13:47:06 +00:00
break;
default:
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);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */