1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <tools/list.hxx> 33*cdf0e10cSrcweir #include <swtypes.hxx> 34*cdf0e10cSrcweir #include <hintids.hxx> 35*cdf0e10cSrcweir #include <com/sun/star/accessibility/XAccessible.hpp> 36*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 37*cdf0e10cSrcweir #include <com/sun/star/i18n/XBreakIterator.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/i18n/ScriptType.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/i18n/InputSequenceCheckMode.hpp> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <com/sun/star/i18n/UnicodeScript.hpp> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <vcl/help.hxx> 44*cdf0e10cSrcweir #include <vcl/graph.hxx> 45*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 46*cdf0e10cSrcweir #include <vcl/cmdevt.h> 47*cdf0e10cSrcweir #include <sot/storage.hxx> 48*cdf0e10cSrcweir #include <svl/macitem.hxx> 49*cdf0e10cSrcweir #include <unotools/securityoptions.hxx> 50*cdf0e10cSrcweir #include <basic/sbxvar.hxx> 51*cdf0e10cSrcweir #include <svl/ctloptions.hxx> 52*cdf0e10cSrcweir #include <basic/sbx.hxx> 53*cdf0e10cSrcweir #include <svl/eitem.hxx> 54*cdf0e10cSrcweir #include <svl/stritem.hxx> 55*cdf0e10cSrcweir #include <sfx2/ipclient.hxx> 56*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 57*cdf0e10cSrcweir #include <sfx2/request.hxx> 58*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 59*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 60*cdf0e10cSrcweir #include <svl/ptitem.hxx> 61*cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 62*cdf0e10cSrcweir #include <editeng/langitem.hxx> 63*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 64*cdf0e10cSrcweir #include <svx/svdview.hxx> 65*cdf0e10cSrcweir #include <svx/svdhdl.hxx> 66*cdf0e10cSrcweir #include <svx/svdoutl.hxx> 67*cdf0e10cSrcweir #include <editeng/editeng.hxx> 68*cdf0e10cSrcweir #include <editeng/svxacorr.hxx> 69*cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 70*cdf0e10cSrcweir #include <editeng/flditem.hxx> 71*cdf0e10cSrcweir #include <editeng/colritem.hxx> 72*cdf0e10cSrcweir #include <editeng/brshitem.hxx> 73*cdf0e10cSrcweir #include <editeng/wghtitem.hxx> 74*cdf0e10cSrcweir #include <editeng/udlnitem.hxx> 75*cdf0e10cSrcweir #include <editeng/postitem.hxx> 76*cdf0e10cSrcweir #include <editeng/protitem.hxx> 77*cdf0e10cSrcweir #include <unotools/charclass.hxx> 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir #include <editeng/acorrcfg.hxx> 80*cdf0e10cSrcweir #include <SwSmartTagMgr.hxx> 81*cdf0e10cSrcweir #include <edtwin.hxx> 82*cdf0e10cSrcweir #include <view.hxx> 83*cdf0e10cSrcweir #include <wrtsh.hxx> 84*cdf0e10cSrcweir #include <IDocumentSettingAccess.hxx> 85*cdf0e10cSrcweir #include <fldbas.hxx> 86*cdf0e10cSrcweir #include <swmodule.hxx> 87*cdf0e10cSrcweir #include <docsh.hxx> 88*cdf0e10cSrcweir #include <viewopt.hxx> 89*cdf0e10cSrcweir #include <drawbase.hxx> 90*cdf0e10cSrcweir #include <dselect.hxx> 91*cdf0e10cSrcweir #include <textsh.hxx> 92*cdf0e10cSrcweir #include <shdwcrsr.hxx> 93*cdf0e10cSrcweir #include <fmtanchr.hxx> 94*cdf0e10cSrcweir #include <fmtornt.hxx> 95*cdf0e10cSrcweir #include <fmtfsize.hxx> 96*cdf0e10cSrcweir #include <fmtclds.hxx> 97*cdf0e10cSrcweir #include <frmfmt.hxx> 98*cdf0e10cSrcweir #include <modcfg.hxx> 99*cdf0e10cSrcweir #include <fmtcol.hxx> 100*cdf0e10cSrcweir #include <wview.hxx> 101*cdf0e10cSrcweir #include <listsh.hxx> 102*cdf0e10cSrcweir #include <gloslst.hxx> 103*cdf0e10cSrcweir #include <inputwin.hxx> 104*cdf0e10cSrcweir #include <gloshdl.hxx> 105*cdf0e10cSrcweir #include <swundo.hxx> 106*cdf0e10cSrcweir #include <drwtxtsh.hxx> 107*cdf0e10cSrcweir #include <fchrfmt.hxx> 108*cdf0e10cSrcweir #include <fmturl.hxx> 109*cdf0e10cSrcweir #include <romenu.hxx> 110*cdf0e10cSrcweir #include <initui.hxx> 111*cdf0e10cSrcweir #include <frmatr.hxx> 112*cdf0e10cSrcweir #include <extinput.hxx> 113*cdf0e10cSrcweir #include <acmplwrd.hxx> 114*cdf0e10cSrcweir #include <swcalwrp.hxx> 115*cdf0e10cSrcweir #include <swdtflvr.hxx> 116*cdf0e10cSrcweir #include <wdocsh.hxx> 117*cdf0e10cSrcweir #include <crsskip.hxx> 118*cdf0e10cSrcweir #include <breakit.hxx> 119*cdf0e10cSrcweir #include <checkit.hxx> 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir #include <helpid.h> 122*cdf0e10cSrcweir #include <cmdid.h> 123*cdf0e10cSrcweir #ifndef _DOCVW_HRC 124*cdf0e10cSrcweir #include <docvw.hrc> 125*cdf0e10cSrcweir #endif 126*cdf0e10cSrcweir #include <uitool.hxx> 127*cdf0e10cSrcweir // OD 18.09.2003 #i18732# 128*cdf0e10cSrcweir #include <fmtfollowtextflow.hxx> 129*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 130*cdf0e10cSrcweir #include <charfmt.hxx> 131*cdf0e10cSrcweir #include <numrule.hxx> 132*cdf0e10cSrcweir #include <pagedesc.hxx> 133*cdf0e10cSrcweir #include <svtools/ruler.hxx> // #i23726# 134*cdf0e10cSrcweir #include "formatclipboard.hxx" 135*cdf0e10cSrcweir #include <vos/mutex.hxx> 136*cdf0e10cSrcweir #include <vcl/svapp.hxx> 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir #include <IMark.hxx> 139*cdf0e10cSrcweir #include <doc.hxx> 140*cdf0e10cSrcweir #include <xmloff/odffields.hxx> 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir #include <PostItMgr.hxx> 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir //JP 11.10.2001: enable test code for bug fix 91313 145*cdf0e10cSrcweir #if defined(DBG_UTIL) && (OSL_DEBUG_LEVEL > 1) 146*cdf0e10cSrcweir //#define TEST_FOR_BUG91313 147*cdf0e10cSrcweir #endif 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir using namespace sw::mark; 150*cdf0e10cSrcweir using namespace ::com::sun::star; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir /*-------------------------------------------------------------------- 153*cdf0e10cSrcweir Beschreibung: Globals 154*cdf0e10cSrcweir --------------------------------------------------------------------*/ 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir static bool bInputLanguageSwitched = false; 157*cdf0e10cSrcweir extern sal_Bool bNoInterrupt; // in mainwn.cxx 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir //Normalerweise wird im MouseButtonUp eine Selektion aufgehoben wenn die 160*cdf0e10cSrcweir //Selektion nicht gerade aufgezogen wird. Leider wird im MouseButtonDown 161*cdf0e10cSrcweir //bei doppel-/dreifach-Klick Selektiert, diese Selektion wird in dem Handler 162*cdf0e10cSrcweir //komplett abgeschlossen und kann deshalb im Up nicht mehr unterschieden 163*cdf0e10cSrcweir //werden. Um dies Aufzuloese wird bHoldSelection im Down gesetzt und im 164*cdf0e10cSrcweir //Up ausgewertet. 165*cdf0e10cSrcweir static sal_Bool bHoldSelection = sal_False; 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir sal_Bool bFrmDrag = sal_False; 168*cdf0e10cSrcweir sal_Bool bValidCrsrPos = sal_False; 169*cdf0e10cSrcweir sal_Bool bModePushed = sal_False; 170*cdf0e10cSrcweir sal_Bool bDDTimerStarted = sal_False; 171*cdf0e10cSrcweir sal_Bool bFlushCharBuffer = sal_False; 172*cdf0e10cSrcweir sal_Bool SwEditWin::bReplaceQuote = sal_False; 173*cdf0e10cSrcweir sal_Bool bDDINetAttr = sal_False; 174*cdf0e10cSrcweir SdrHdlKind eSdrMoveHdl = HDL_USER; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir QuickHelpData* SwEditWin::pQuickHlpData = 0; 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir long SwEditWin::nDDStartPosY = 0; 179*cdf0e10cSrcweir long SwEditWin::nDDStartPosX = 0; 180*cdf0e10cSrcweir Color SwEditWin::aTextBackColor(COL_YELLOW); 181*cdf0e10cSrcweir Color SwEditWin::aTextColor(COL_RED); 182*cdf0e10cSrcweir sal_Bool SwEditWin::bTransparentBackColor = sal_False; // Hintergrund nicht transparent 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir extern sal_Bool bExecuteDrag; 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir DBG_NAME(edithdl) 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir class SwAnchorMarker 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir SdrHdl* pHdl; 194*cdf0e10cSrcweir Point aHdlPos; 195*cdf0e10cSrcweir Point aLastPos; 196*cdf0e10cSrcweir // --> OD 2010-09-16 #i114522# 197*cdf0e10cSrcweir bool bTopRightHandle; 198*cdf0e10cSrcweir // <-- 199*cdf0e10cSrcweir public: 200*cdf0e10cSrcweir SwAnchorMarker( SdrHdl* pH ) 201*cdf0e10cSrcweir : pHdl( pH ) 202*cdf0e10cSrcweir , aHdlPos( pH->GetPos() ) 203*cdf0e10cSrcweir , aLastPos( pH->GetPos() ) 204*cdf0e10cSrcweir // --> OD 2010-09-16 #i114522# 205*cdf0e10cSrcweir , bTopRightHandle( pH->GetKind() == HDL_ANCHOR_TR ) 206*cdf0e10cSrcweir // <-- 207*cdf0e10cSrcweir {} 208*cdf0e10cSrcweir const Point& GetLastPos() const { return aLastPos; } 209*cdf0e10cSrcweir void SetLastPos( const Point& rNew ) { aLastPos = rNew; } 210*cdf0e10cSrcweir void SetPos( const Point& rNew ) { pHdl->SetPos( rNew ); } 211*cdf0e10cSrcweir const Point& GetPos() { return pHdl->GetPos(); } 212*cdf0e10cSrcweir const Point& GetHdlPos() { return aHdlPos; } 213*cdf0e10cSrcweir void ChgHdl( SdrHdl* pNew ) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir pHdl = pNew; 216*cdf0e10cSrcweir // --> OD 2010-09-16 #i114522# 217*cdf0e10cSrcweir if ( pHdl ) 218*cdf0e10cSrcweir { 219*cdf0e10cSrcweir bTopRightHandle = (pHdl->GetKind() == HDL_ANCHOR_TR); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir // <-- 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir // --> OD 2010-09-16 #i114522# 224*cdf0e10cSrcweir const Point GetPosForHitTest( const OutputDevice& rOut ) 225*cdf0e10cSrcweir { 226*cdf0e10cSrcweir Point aHitTestPos( GetPos() ); 227*cdf0e10cSrcweir aHitTestPos = rOut.LogicToPixel( aHitTestPos ); 228*cdf0e10cSrcweir if ( bTopRightHandle ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir aHitTestPos += Point( -1, 1 ); 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir else 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir aHitTestPos += Point( 1, 1 ); 235*cdf0e10cSrcweir } 236*cdf0e10cSrcweir aHitTestPos = rOut.PixelToLogic( aHitTestPos ); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir return aHitTestPos; 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir // <-- 241*cdf0e10cSrcweir }; 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir struct QuickHelpData 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir SvStringsISortDtor aArr; 246*cdf0e10cSrcweir sal_uInt16* pAttrs; 247*cdf0e10cSrcweir CommandExtTextInputData* pCETID; 248*cdf0e10cSrcweir sal_uLong nTipId; 249*cdf0e10cSrcweir sal_uInt16 nLen, nCurArrPos; 250*cdf0e10cSrcweir sal_Bool bClear : 1, bChkInsBlank : 1, bIsTip : 1, bIsAutoText : 1; 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir QuickHelpData() : pAttrs( 0 ), pCETID( 0 ) { ClearCntnt(); } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir void Move( QuickHelpData& rCpy ); 255*cdf0e10cSrcweir void ClearCntnt(); 256*cdf0e10cSrcweir void Start( SwWrtShell& rSh, sal_uInt16 nWrdLen ); 257*cdf0e10cSrcweir void Stop( SwWrtShell& rSh ); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir sal_Bool HasCntnt() const { return aArr.Count() && 0 != nLen; } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void Inc( sal_Bool bEndLess ) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir if( ++nCurArrPos >= aArr.Count() ) 264*cdf0e10cSrcweir nCurArrPos = (bEndLess && !bIsAutoText )? 0 : nCurArrPos-1; 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir void Dec( sal_Bool bEndLess ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir if( 0 == nCurArrPos-- ) 269*cdf0e10cSrcweir nCurArrPos = (bEndLess && !bIsAutoText ) ? aArr.Count()-1 : 0; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir void FillStrArr( SwWrtShell& rSh, const String& rWord ); 272*cdf0e10cSrcweir }; 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir /*-------------------------------------------------------------------- 276*cdf0e10cSrcweir Beschreibung: Minimale Bewegung Zittern vermeiden 277*cdf0e10cSrcweir --------------------------------------------------------------------*/ 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir #define HIT_PIX 2 /* Hit-Toleranz in Pixel */ 280*cdf0e10cSrcweir #define MIN_MOVE 4 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir inline sal_Bool IsMinMove(const Point &rStartPos, const Point &rLPt) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir return Abs(rStartPos.X() - rLPt.X()) > MIN_MOVE || 285*cdf0e10cSrcweir Abs(rStartPos.Y() - rLPt.Y()) > MIN_MOVE; 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir /*-------------------------------------------------------------------- 289*cdf0e10cSrcweir JP 30.07.98: fuer MouseButtonDown - feststellen, ob ein DrawObject 290*cdf0e10cSrcweir und KEIN SwgFrame getroffen wurde! Shift/Ctrl sollen 291*cdf0e10cSrcweir nur bei DrawObjecte zum Selektieren fuehren, bei SwgFlys 292*cdf0e10cSrcweir ggfs zum ausloesen von Hyperlinks (DownLoad/NewWindow!) 293*cdf0e10cSrcweir --------------------------------------------------------------------*/ 294*cdf0e10cSrcweir inline sal_Bool IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt ) 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir sal_Bool bRet = sal_True; 297*cdf0e10cSrcweir SdrObject* pObj; 298*cdf0e10cSrcweir switch( rSh.GetObjCntType( rPt, pObj )) 299*cdf0e10cSrcweir { 300*cdf0e10cSrcweir case OBJCNT_NONE: 301*cdf0e10cSrcweir case OBJCNT_FLY: 302*cdf0e10cSrcweir case OBJCNT_GRF: 303*cdf0e10cSrcweir case OBJCNT_OLE: 304*cdf0e10cSrcweir bRet = sal_False; 305*cdf0e10cSrcweir break; 306*cdf0e10cSrcweir default:; //prevent warning 307*cdf0e10cSrcweir } 308*cdf0e10cSrcweir return bRet; 309*cdf0e10cSrcweir } 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir /*-------------------------------------------------------------------- 312*cdf0e10cSrcweir Beschreibung: Pointer umschalten 313*cdf0e10cSrcweir --------------------------------------------------------------------*/ 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 319*cdf0e10cSrcweir if( pApplyTempl ) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir PointerStyle eStyle = POINTER_FILL; 322*cdf0e10cSrcweir if( rSh.IsOverReadOnlyPos( rLPt )) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir if( pUserMarker ) 325*cdf0e10cSrcweir { 326*cdf0e10cSrcweir delete pUserMarker; 327*cdf0e10cSrcweir pUserMarker = 0L; 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir // rSh.SwCrsrShell::UnSetVisCrsr( rLPt ); 330*cdf0e10cSrcweir eStyle = POINTER_NOTALLOWED; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir else 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir SwRect aRect; 335*cdf0e10cSrcweir SwRect* pRect = &aRect; 336*cdf0e10cSrcweir const SwFrmFmt* pFmt = 0; 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir bool bFrameIsValidTarget = false; 339*cdf0e10cSrcweir if( pApplyTempl->pFormatClipboard ) 340*cdf0e10cSrcweir bFrameIsValidTarget = pApplyTempl->pFormatClipboard->HasContentForThisType( nsSelectionType::SEL_FRM ); 341*cdf0e10cSrcweir else if( !pApplyTempl->nColor ) 342*cdf0e10cSrcweir bFrameIsValidTarget = ( pApplyTempl->eType == SFX_STYLE_FAMILY_FRAME ); 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir if( bFrameIsValidTarget && 345*cdf0e10cSrcweir 0 !=(pFmt = rSh.GetFmtFromObj( rLPt, &pRect )) && 346*cdf0e10cSrcweir PTR_CAST(SwFlyFrmFmt, pFmt)) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir //Highlight fuer Rahmen anwerfen 349*cdf0e10cSrcweir Rectangle aTmp( pRect->SVRect() ); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir if ( !pUserMarker ) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp ); 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir else if(pUserMarker) 357*cdf0e10cSrcweir { 358*cdf0e10cSrcweir delete pUserMarker; 359*cdf0e10cSrcweir pUserMarker = 0L; 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir rSh.SwCrsrShell::SetVisCrsr( rLPt ); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir SetPointer( eStyle ); 365*cdf0e10cSrcweir return; 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir if( !rSh.VisArea().Width() ) 369*cdf0e10cSrcweir return; 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir SET_CURR_SHELL(&rSh); 372*cdf0e10cSrcweir 373*cdf0e10cSrcweir if ( IsChainMode() ) 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir SwRect aRect; 376*cdf0e10cSrcweir int nChainable = rSh.Chainable( aRect, *rSh.GetFlyFrmFmt(), rLPt ); 377*cdf0e10cSrcweir PointerStyle eStyle = nChainable 378*cdf0e10cSrcweir ? POINTER_CHAIN_NOTALLOWED : POINTER_CHAIN; 379*cdf0e10cSrcweir if ( !nChainable ) 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir Rectangle aTmp( aRect.SVRect() ); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir if ( !pUserMarker ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), aTmp ); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir else 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir delete pUserMarker; 391*cdf0e10cSrcweir pUserMarker = 0L; 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir rView.GetViewFrame()->ShowStatusText( 395*cdf0e10cSrcweir SW_RESSTR(STR_CHAIN_OK+nChainable)); 396*cdf0e10cSrcweir SetPointer( eStyle ); 397*cdf0e10cSrcweir return; 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir // Removed ExecHyperlink option. 401*cdf0e10cSrcweir //sal_Bool bExecHyperlinks = rSh.GetViewOptions()->IsExecHyperlinks() ^ 402*cdf0e10cSrcweir // (nModifier == KEY_MOD2 ? sal_True : sal_False); 403*cdf0e10cSrcweir sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly(); 404*cdf0e10cSrcweir if ( !bExecHyperlinks ) 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir SvtSecurityOptions aSecOpts; 407*cdf0e10cSrcweir const sal_Bool bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ); 408*cdf0e10cSrcweir if ( ( bSecureOption && nModifier == KEY_MOD1 ) || 409*cdf0e10cSrcweir ( !bSecureOption && nModifier != KEY_MOD1 ) ) 410*cdf0e10cSrcweir bExecHyperlinks = sal_True; 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir const sal_Bool bExecSmarttags = nModifier == KEY_MOD1; 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 416*cdf0e10cSrcweir sal_Bool bPrefSdrPointer = sal_False; 417*cdf0e10cSrcweir sal_Bool bHitHandle = sal_False; 418*cdf0e10cSrcweir sal_Bool bCntAtPos = sal_False; 419*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() && 420*cdf0e10cSrcweir rSh.IsCrsrReadonly(); 421*cdf0e10cSrcweir aActHitType = SDRHIT_NONE; 422*cdf0e10cSrcweir PointerStyle eStyle = POINTER_TEXT; 423*cdf0e10cSrcweir if ( !pSdrView ) 424*cdf0e10cSrcweir bCntAtPos = sal_True; 425*cdf0e10cSrcweir else if ( sal_True == (bHitHandle = pSdrView->PickHandle( rLPt ) != 0) ) 426*cdf0e10cSrcweir { 427*cdf0e10cSrcweir aActHitType = SDRHIT_OBJECT; 428*cdf0e10cSrcweir bPrefSdrPointer = sal_True; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir else 431*cdf0e10cSrcweir { 432*cdf0e10cSrcweir const sal_Bool bNotInSelObj = !rSh.IsInsideSelectedObj( rLPt ); 433*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() && !bInsDraw && bNotInSelObj ) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir aActHitType = SDRHIT_OBJECT; 436*cdf0e10cSrcweir if (IsObjectSelect()) 437*cdf0e10cSrcweir eStyle = POINTER_ARROW; 438*cdf0e10cSrcweir else 439*cdf0e10cSrcweir bPrefSdrPointer = sal_True; 440*cdf0e10cSrcweir } 441*cdf0e10cSrcweir else 442*cdf0e10cSrcweir { 443*cdf0e10cSrcweir SdrObject* pObj; SdrPageView* pPV; 444*cdf0e10cSrcweir pSdrView->SetHitTolerancePixel( HIT_PIX ); 445*cdf0e10cSrcweir if ( bNotInSelObj && bExecHyperlinks && 446*cdf0e10cSrcweir pSdrView->PickObj( rLPt, pSdrView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO )) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir SdrObjMacroHitRec aTmp; 449*cdf0e10cSrcweir aTmp.aPos = rLPt; 450*cdf0e10cSrcweir aTmp.pPageView = pPV; 451*cdf0e10cSrcweir SetPointer( pObj->GetMacroPointer( aTmp ) ); 452*cdf0e10cSrcweir return; 453*cdf0e10cSrcweir } 454*cdf0e10cSrcweir else 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir // dvo: IsObjSelectable() eventually calls SdrView::PickObj, so 457*cdf0e10cSrcweir // apparently this is used to determine whether this is a 458*cdf0e10cSrcweir // drawling layer object or not. 459*cdf0e10cSrcweir if ( rSh.IsObjSelectable( rLPt ) ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir if (pSdrView->IsTextEdit()) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir aActHitType = SDRHIT_NONE; 464*cdf0e10cSrcweir bPrefSdrPointer = sal_True; 465*cdf0e10cSrcweir } 466*cdf0e10cSrcweir else 467*cdf0e10cSrcweir { 468*cdf0e10cSrcweir SdrViewEvent aVEvt; 469*cdf0e10cSrcweir SdrHitKind eHit = pSdrView->PickAnything(rLPt, aVEvt); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir if (eHit == SDRHIT_URLFIELD && bExecHyperlinks) 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir aActHitType = SDRHIT_OBJECT; 474*cdf0e10cSrcweir bPrefSdrPointer = sal_True; 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir else 477*cdf0e10cSrcweir { 478*cdf0e10cSrcweir // if we're over a selected object, we show an 479*cdf0e10cSrcweir // ARROW by default. We only show a MOVE if 1) the 480*cdf0e10cSrcweir // object is selected, and 2) it may be moved 481*cdf0e10cSrcweir // (i.e., position is not protected). 482*cdf0e10cSrcweir bool bMovable = 483*cdf0e10cSrcweir (!bNotInSelObj) && 484*cdf0e10cSrcweir (rSh.IsObjSelected() || rSh.IsFrmSelected()) && 485*cdf0e10cSrcweir (!rSh.IsSelObjProtected(FLYPROTECT_POS)); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir eStyle = bMovable ? POINTER_MOVE : POINTER_ARROW; 488*cdf0e10cSrcweir aActHitType = SDRHIT_OBJECT; 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir else 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir if ( rSh.IsFrmSelected() && !bNotInSelObj ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir // dvo: this branch appears to be dead and should be 497*cdf0e10cSrcweir // removed in a future version. Reason: The condition 498*cdf0e10cSrcweir // !bNotInSelObj means that this branch will only be 499*cdf0e10cSrcweir // executed in the cursor points inside a selected 500*cdf0e10cSrcweir // object. However, if this is the case, the previous 501*cdf0e10cSrcweir // if( rSh.IsObjSelectable(rLPt) ) must always be true: 502*cdf0e10cSrcweir // rLPt is inside a selected object, then obviously 503*cdf0e10cSrcweir // rLPt is over a selectable object. 504*cdf0e10cSrcweir if (rSh.IsSelObjProtected(FLYPROTECT_SIZE)) 505*cdf0e10cSrcweir eStyle = POINTER_NOTALLOWED; 506*cdf0e10cSrcweir else 507*cdf0e10cSrcweir eStyle = POINTER_MOVE; 508*cdf0e10cSrcweir aActHitType = SDRHIT_OBJECT; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir else 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() ) 513*cdf0e10cSrcweir bPrefSdrPointer = sal_True; 514*cdf0e10cSrcweir else 515*cdf0e10cSrcweir bCntAtPos = sal_True; 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir } 521*cdf0e10cSrcweir if ( bPrefSdrPointer ) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir if (bIsDocReadOnly || (rSh.IsObjSelected() && rSh.IsSelObjProtected(FLYPROTECT_CONTENT))) 524*cdf0e10cSrcweir SetPointer( POINTER_NOTALLOWED ); 525*cdf0e10cSrcweir else 526*cdf0e10cSrcweir { 527*cdf0e10cSrcweir if (rView.GetDrawFuncPtr() && rView.GetDrawFuncPtr()->IsInsertForm() && !bHitHandle) 528*cdf0e10cSrcweir SetPointer( POINTER_DRAW_RECT ); 529*cdf0e10cSrcweir else 530*cdf0e10cSrcweir SetPointer( pSdrView->GetPreferedPointer( rLPt, rSh.GetOut() ) ); 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir } 533*cdf0e10cSrcweir else 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir if( !rSh.IsPageAtPos( rLPt ) || pAnchorMarker ) 536*cdf0e10cSrcweir eStyle = POINTER_ARROW; 537*cdf0e10cSrcweir else 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir if( bCntAtPos ) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir SwContentAtPos aSwContentAtPos( 542*cdf0e10cSrcweir SwContentAtPos::SW_CLICKFIELD| 543*cdf0e10cSrcweir SwContentAtPos::SW_INETATTR| 544*cdf0e10cSrcweir SwContentAtPos::SW_FTN | 545*cdf0e10cSrcweir SwContentAtPos::SW_SMARTTAG ); 546*cdf0e10cSrcweir if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) ) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir const bool bClickToFollow = SwContentAtPos::SW_INETATTR == aSwContentAtPos.eCntntAtPos || 549*cdf0e10cSrcweir SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eCntntAtPos; 550*cdf0e10cSrcweir 551*cdf0e10cSrcweir if( !bClickToFollow || 552*cdf0e10cSrcweir (SwContentAtPos::SW_INETATTR == aSwContentAtPos.eCntntAtPos && bExecHyperlinks) || 553*cdf0e10cSrcweir (SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eCntntAtPos && bExecSmarttags) ) 554*cdf0e10cSrcweir eStyle = POINTER_REFHAND; 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir } 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir // which kind of text pointer have we to show - horz / vert - ? 560*cdf0e10cSrcweir if( POINTER_TEXT == eStyle && rSh.IsInVerticalText( &rLPt )) 561*cdf0e10cSrcweir eStyle = POINTER_TEXT_VERTICAL; 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir SetPointer( eStyle ); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir /*-------------------------------------------------------------------- 568*cdf0e10cSrcweir Beschreibung: Timer fuer Selektion vergroessern 569*cdf0e10cSrcweir --------------------------------------------------------------------*/ 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir IMPL_LINK( SwEditWin, TimerHandler, Timer *, EMPTYARG ) 573*cdf0e10cSrcweir { 574*cdf0e10cSrcweir DBG_PROFSTART(edithdl); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 577*cdf0e10cSrcweir Point aModPt( aMovePos ); 578*cdf0e10cSrcweir const SwRect aOldVis( rSh.VisArea() ); 579*cdf0e10cSrcweir sal_Bool bDone = sal_False; 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir if ( !rSh.VisArea().IsInside( aModPt ) ) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir if ( bInsDraw ) 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir const int nMaxScroll = 40; 586*cdf0e10cSrcweir rView.Scroll( Rectangle(aModPt,Size(1,1)), nMaxScroll, nMaxScroll); 587*cdf0e10cSrcweir bDone = sal_True; 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir else if ( bFrmDrag ) 590*cdf0e10cSrcweir { 591*cdf0e10cSrcweir (rSh.*rSh.fnDrag)(&aModPt,sal_False); 592*cdf0e10cSrcweir bDone = sal_True; 593*cdf0e10cSrcweir } 594*cdf0e10cSrcweir if ( !bDone ) 595*cdf0e10cSrcweir aModPt = rSh.GetCntntPos( aModPt,aModPt.Y() > rSh.VisArea().Bottom() ); 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir if ( !bDone && !(bFrmDrag || bInsDraw) ) 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir if ( pRowColumnSelectionStart ) 600*cdf0e10cSrcweir { 601*cdf0e10cSrcweir Point aPos( aModPt ); 602*cdf0e10cSrcweir rSh.SelectTableRowCol( *pRowColumnSelectionStart, &aPos, bIsRowDrag ); 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir else 605*cdf0e10cSrcweir (rSh.*rSh.fnSetCrsr)( &aModPt, sal_False ); 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir //fix(24138): Es kann sein, dass der "Sprung" ueber eine Tabelle so 608*cdf0e10cSrcweir //nicht geschafft wird. Deshalb wir hier eben per Up/Down ueber die 609*cdf0e10cSrcweir //Tabelle gesprungen. 610*cdf0e10cSrcweir const SwRect& rVisArea = rSh.VisArea(); 611*cdf0e10cSrcweir if( aOldVis == rVisArea && !rSh.IsStartOfDoc() && !rSh.IsEndOfDoc() ) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir //JP 11.10.2001 Bug 72294 - take the center point of VisArea to 614*cdf0e10cSrcweir // decide in which direction the user want. 615*cdf0e10cSrcweir if( aModPt.Y() < ( rVisArea.Top() + rVisArea.Height() / 2 ) ) 616*cdf0e10cSrcweir rSh.Up( sal_True, 1 ); 617*cdf0e10cSrcweir else 618*cdf0e10cSrcweir rSh.Down( sal_True, 1 ); 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir aMovePos += rSh.VisArea().Pos() - aOldVis.Pos(); 623*cdf0e10cSrcweir JustifyAreaTimer(); 624*cdf0e10cSrcweir DBG_PROFSTOP(edithdl); 625*cdf0e10cSrcweir return 0; 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir /*-------------------------------------------------------------------- 629*cdf0e10cSrcweir Beschreibung: 630*cdf0e10cSrcweir --------------------------------------------------------------------*/ 631*cdf0e10cSrcweir 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir void SwEditWin::JustifyAreaTimer() 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir const Rectangle &rVisArea = GetView().GetVisArea(); 636*cdf0e10cSrcweir #ifdef UNX 637*cdf0e10cSrcweir const long coMinLen = 100; 638*cdf0e10cSrcweir #else 639*cdf0e10cSrcweir const long coMinLen = 50; 640*cdf0e10cSrcweir #endif 641*cdf0e10cSrcweir long nTimeout = 800, 642*cdf0e10cSrcweir nDiff = Max( 643*cdf0e10cSrcweir Max( aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - aMovePos.Y() ), 644*cdf0e10cSrcweir Max( aMovePos.X() - rVisArea.Right(), rVisArea.Left() - aMovePos.X())); 645*cdf0e10cSrcweir #ifdef TEST_FOR_BUG91313 646*cdf0e10cSrcweir aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff) ); 647*cdf0e10cSrcweir #else 648*cdf0e10cSrcweir aTimer.SetTimeout( Max( coMinLen, nTimeout - nDiff*2L) ); 649*cdf0e10cSrcweir #endif 650*cdf0e10cSrcweir } 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir void SwEditWin::LeaveArea(const Point &rPos) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir aMovePos = rPos; 655*cdf0e10cSrcweir JustifyAreaTimer(); 656*cdf0e10cSrcweir if( !aTimer.IsActive() ) 657*cdf0e10cSrcweir aTimer.Start(); 658*cdf0e10cSrcweir if( pShadCrsr ) 659*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 660*cdf0e10cSrcweir } 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir inline void SwEditWin::EnterArea() 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir aTimer.Stop(); 665*cdf0e10cSrcweir } 666*cdf0e10cSrcweir 667*cdf0e10cSrcweir /*------------------------------------------------------------------------ 668*cdf0e10cSrcweir Beschreibung: Modus fuer Rahmen einfuegen 669*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir void SwEditWin::InsFrm(sal_uInt16 nCols) 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir StdDrawMode( OBJ_NONE, sal_False ); 675*cdf0e10cSrcweir bInsFrm = sal_True; 676*cdf0e10cSrcweir nInsFrmColCount = nCols; 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir void SwEditWin::StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect ) 682*cdf0e10cSrcweir { 683*cdf0e10cSrcweir SetSdrDrawMode( eSdrObjectKind ); 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir /* if (GetDrawFuncPtr()) 686*cdf0e10cSrcweir GetDrawFuncPtr()->Deactivate();*/ 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir if (bObjSelect) 689*cdf0e10cSrcweir rView.SetDrawFuncPtr(new DrawSelection( &rView.GetWrtShell(), this, &rView )); 690*cdf0e10cSrcweir else 691*cdf0e10cSrcweir rView.SetDrawFuncPtr(new SwDrawBase( &rView.GetWrtShell(), this, &rView )); 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir rView.SetSelDrawSlot(); 694*cdf0e10cSrcweir SetSdrDrawMode( eSdrObjectKind ); 695*cdf0e10cSrcweir if (bObjSelect) 696*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Activate( SID_OBJECT_SELECT ); 697*cdf0e10cSrcweir else 698*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Activate( sal::static_int_cast< sal_uInt16 >(eSdrObjectKind) ); // don't know if this is useful at all; but it keeps functionality as it was... 699*cdf0e10cSrcweir bInsFrm = sal_False; 700*cdf0e10cSrcweir nInsFrmColCount = 1; 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir void SwEditWin::StopInsFrm() 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir if (rView.GetDrawFuncPtr()) 708*cdf0e10cSrcweir { 709*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 710*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir rView.LeaveDrawCreate(); // Konstruktionsmode verlassen 713*cdf0e10cSrcweir bInsFrm = sal_False; 714*cdf0e10cSrcweir nInsFrmColCount = 1; 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir 717*cdf0e10cSrcweir /*-------------------------------------------------------------------- 718*cdf0e10cSrcweir --------------------------------------------------------------------*/ 719*cdf0e10cSrcweir 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir sal_Bool SwEditWin::IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const 722*cdf0e10cSrcweir { 723*cdf0e10cSrcweir const SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions(); 724*cdf0e10cSrcweir if ( !rCTLOptions.IsCTLFontEnabled() || 725*cdf0e10cSrcweir !rCTLOptions.IsCTLSequenceChecking() ) 726*cdf0e10cSrcweir return sal_False; 727*cdf0e10cSrcweir 728*cdf0e10cSrcweir const xub_StrLen nFirstPos = rCrsr.Start()->nContent.GetIndex(); 729*cdf0e10cSrcweir if ( 0 == nFirstPos ) /* first char needs not to be checked */ 730*cdf0e10cSrcweir return sal_False; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir SwBreakIt *pBreakIter = SwBreakIt::Get(); 733*cdf0e10cSrcweir uno::Reference < i18n::XBreakIterator > xBI = pBreakIter->GetBreakIter(); 734*cdf0e10cSrcweir long nCTLScriptPos = -1; 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir if (xBI.is()) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir if (xBI->getScriptType( rText, 0 ) == i18n::ScriptType::COMPLEX) 739*cdf0e10cSrcweir nCTLScriptPos = 0; 740*cdf0e10cSrcweir else 741*cdf0e10cSrcweir nCTLScriptPos = xBI->nextScript( rText, 0, i18n::ScriptType::COMPLEX ); 742*cdf0e10cSrcweir } 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir return (0 <= nCTLScriptPos && nCTLScriptPos <= rText.Len()); 745*cdf0e10cSrcweir } 746*cdf0e10cSrcweir 747*cdf0e10cSrcweir 748*cdf0e10cSrcweir /*-------------------------------------------------------------------- 749*cdf0e10cSrcweir Beschreibung: Der Character Buffer wird in das Dokument eingefuegt 750*cdf0e10cSrcweir --------------------------------------------------------------------*/ 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir 753*cdf0e10cSrcweir void SwEditWin::FlushInBuffer() 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir if ( aInBuffer.Len() ) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir SwWrtShell& rSh = rView.GetWrtShell(); 758*cdf0e10cSrcweir 759*cdf0e10cSrcweir // generate new sequence input checker if not already done 760*cdf0e10cSrcweir if ( !pCheckIt ) 761*cdf0e10cSrcweir pCheckIt = new SwCheckIt; 762*cdf0e10cSrcweir 763*cdf0e10cSrcweir uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = pCheckIt->xCheck; 764*cdf0e10cSrcweir if ( xISC.is() && IsInputSequenceCheckingRequired( aInBuffer, *rSh.GetCrsr() ) ) 765*cdf0e10cSrcweir { 766*cdf0e10cSrcweir // 767*cdf0e10cSrcweir // apply (Thai) input sequence checking/correction 768*cdf0e10cSrcweir // 769*cdf0e10cSrcweir 770*cdf0e10cSrcweir rSh.Push(); // push current cursor to stack 771*cdf0e10cSrcweir 772*cdf0e10cSrcweir // get text from the beginning (i.e left side) of current selection 773*cdf0e10cSrcweir // to the start of the paragraph 774*cdf0e10cSrcweir rSh.NormalizePam(); // make point be the first (left) one 775*cdf0e10cSrcweir if (!rSh.GetCrsr()->HasMark()) 776*cdf0e10cSrcweir rSh.GetCrsr()->SetMark(); 777*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nContent = 0; 778*cdf0e10cSrcweir String aLeftText( rSh.GetCrsr()->GetTxt() ); 779*cdf0e10cSrcweir 780*cdf0e10cSrcweir SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions(); 781*cdf0e10cSrcweir 782*cdf0e10cSrcweir xub_StrLen nExpandSelection = 0; 783*cdf0e10cSrcweir if (aLeftText.Len() > 0) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir sal_Unicode cChar = '\0'; 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir xub_StrLen nTmpPos = aLeftText.Len(); 788*cdf0e10cSrcweir sal_Int16 nCheckMode = rCTLOptions.IsCTLSequenceCheckingRestricted() ? 789*cdf0e10cSrcweir i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC; 790*cdf0e10cSrcweir 791*cdf0e10cSrcweir rtl::OUString aOldText( aLeftText ); 792*cdf0e10cSrcweir rtl::OUString aNewText( aOldText ); 793*cdf0e10cSrcweir if (rCTLOptions.IsCTLSequenceCheckingTypeAndReplace()) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir for (xub_StrLen k = 0; k < aInBuffer.Len(); ++k) 796*cdf0e10cSrcweir { 797*cdf0e10cSrcweir cChar = aInBuffer.GetChar(k); 798*cdf0e10cSrcweir const xub_StrLen nPrevPos = static_cast<xub_StrLen>(xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode )); 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir // valid sequence or sequence could be corrected: 801*cdf0e10cSrcweir if (nPrevPos != aNewText.getLength()) 802*cdf0e10cSrcweir nTmpPos = nPrevPos + 1; 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir 805*cdf0e10cSrcweir // find position of first character that has changed 806*cdf0e10cSrcweir sal_Int32 nOldLen = aOldText.getLength(); 807*cdf0e10cSrcweir sal_Int32 nNewLen = aNewText.getLength(); 808*cdf0e10cSrcweir const sal_Unicode *pOldTxt = aOldText.getStr(); 809*cdf0e10cSrcweir const sal_Unicode *pNewTxt = aNewText.getStr(); 810*cdf0e10cSrcweir sal_Int32 nChgPos = 0; 811*cdf0e10cSrcweir while ( nChgPos < nOldLen && nChgPos < nNewLen && 812*cdf0e10cSrcweir pOldTxt[nChgPos] == pNewTxt[nChgPos] ) 813*cdf0e10cSrcweir ++nChgPos; 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir xub_StrLen nChgLen = static_cast< xub_StrLen >(nNewLen - nChgPos); 816*cdf0e10cSrcweir String aChgText( aNewText.copy( static_cast< xub_StrLen >(nChgPos), nChgLen ) ); 817*cdf0e10cSrcweir 818*cdf0e10cSrcweir if (aChgText.Len()) 819*cdf0e10cSrcweir { 820*cdf0e10cSrcweir aInBuffer = aChgText; 821*cdf0e10cSrcweir nExpandSelection = aLeftText.Len() - static_cast< xub_StrLen >(nChgPos); 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir else 824*cdf0e10cSrcweir aInBuffer.Erase(); 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir else 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir for (xub_StrLen k = 0; k < aInBuffer.Len(); ++k) 829*cdf0e10cSrcweir { 830*cdf0e10cSrcweir cChar = aInBuffer.GetChar(k); 831*cdf0e10cSrcweir if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode )) 832*cdf0e10cSrcweir { 833*cdf0e10cSrcweir // character can be inserted: 834*cdf0e10cSrcweir aNewText += rtl::OUString( (sal_Unicode) cChar ); 835*cdf0e10cSrcweir ++nTmpPos; 836*cdf0e10cSrcweir } 837*cdf0e10cSrcweir } 838*cdf0e10cSrcweir aInBuffer = aNewText.copy( aOldText.getLength() ); // copy new text to be inserted to buffer 839*cdf0e10cSrcweir } 840*cdf0e10cSrcweir } 841*cdf0e10cSrcweir 842*cdf0e10cSrcweir // at this point now we will insert the buffer text 'normally' some lines below... 843*cdf0e10cSrcweir 844*cdf0e10cSrcweir rSh.Pop( sal_False ); // pop old cursor from stack 845*cdf0e10cSrcweir 846*cdf0e10cSrcweir if (!aInBuffer.Len()) 847*cdf0e10cSrcweir return; 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir // if text prior to the original selection needs to be changed 850*cdf0e10cSrcweir // as well, we now expand the selection accordingly. 851*cdf0e10cSrcweir SwPaM &rCrsr = *rSh.GetCrsr(); 852*cdf0e10cSrcweir xub_StrLen nCrsrStartPos = rCrsr.Start()->nContent.GetIndex(); 853*cdf0e10cSrcweir DBG_ASSERT( nCrsrStartPos >= nExpandSelection, "cannot expand selection as specified!!" ); 854*cdf0e10cSrcweir if (nExpandSelection && nCrsrStartPos >= nExpandSelection) 855*cdf0e10cSrcweir { 856*cdf0e10cSrcweir if (!rCrsr.HasMark()) 857*cdf0e10cSrcweir rCrsr.SetMark(); 858*cdf0e10cSrcweir rCrsr.Start()->nContent -= nExpandSelection; 859*cdf0e10cSrcweir } 860*cdf0e10cSrcweir } 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 863*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().GetRecorder(); 864*cdf0e10cSrcweir if ( xRecorder.is() ) 865*cdf0e10cSrcweir { 866*cdf0e10cSrcweir //Shell ermitteln 867*cdf0e10cSrcweir SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) ); 868*cdf0e10cSrcweir // Request generieren und recorden 869*cdf0e10cSrcweir if (pSfxShell) 870*cdf0e10cSrcweir { 871*cdf0e10cSrcweir SfxRequest aReq( rView.GetViewFrame(), FN_INSERT_STRING ); 872*cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, aInBuffer ) ); 873*cdf0e10cSrcweir aReq.Done(); 874*cdf0e10cSrcweir } 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir //#21019# apply CTL and CJK language to the text input 877*cdf0e10cSrcweir sal_Bool bLang = true; 878*cdf0e10cSrcweir if(eBufferLanguage != LANGUAGE_DONTKNOW) 879*cdf0e10cSrcweir { 880*cdf0e10cSrcweir sal_uInt16 nWhich = 0; 881*cdf0e10cSrcweir switch( GetI18NScriptTypeOfLanguage( eBufferLanguage )) 882*cdf0e10cSrcweir { 883*cdf0e10cSrcweir case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; 884*cdf0e10cSrcweir case i18n::ScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break; 885*cdf0e10cSrcweir case i18n::ScriptType::LATIN: nWhich = RES_CHRATR_LANGUAGE; break; 886*cdf0e10cSrcweir default: bLang = sal_False; 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir if(bLang) 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir SfxItemSet aLangSet(rView.GetPool(), nWhich, nWhich); 891*cdf0e10cSrcweir rSh.GetCurAttr(aLangSet); 892*cdf0e10cSrcweir if(SFX_ITEM_DEFAULT <= aLangSet.GetItemState(nWhich, sal_True)) 893*cdf0e10cSrcweir { 894*cdf0e10cSrcweir LanguageType eLang = static_cast<const SvxLanguageItem&>(aLangSet.Get(nWhich)).GetLanguage(); 895*cdf0e10cSrcweir if ( eLang == eBufferLanguage ) 896*cdf0e10cSrcweir // current language attribute equal to language reported from system 897*cdf0e10cSrcweir bLang = sal_False; 898*cdf0e10cSrcweir else if ( !bInputLanguageSwitched && RES_CHRATR_LANGUAGE == nWhich /* && (eLang&LANGUAGE_MASK_PRIMARY) == LANGUAGE_ENGLISH */ ) 899*cdf0e10cSrcweir { 900*cdf0e10cSrcweir // special case: switching between two "LATIN" languages 901*cdf0e10cSrcweir // In case the current keyboard setting might be suitable for both languages we can't safely assume that the user 902*cdf0e10cSrcweir // wants to use the language reported from the system, except if we knew that it was explicitly switched (thus the check for "bInputLangeSwitched"). 903*cdf0e10cSrcweir // The language reported by the system could be just the system default language that the user is not even aware of, 904*cdf0e10cSrcweir // because no language selection tool is installed at all. In this case the OOo language should get preference as 905*cdf0e10cSrcweir // it might have been selected by the user explicitly. 906*cdf0e10cSrcweir // Usually this case happens if the OOo language is different to the system language but the system keyboard is still suitable 907*cdf0e10cSrcweir // for the OOo language (e.g. writing English texts with a German keyboard). 908*cdf0e10cSrcweir // For non-latin keyboards overwriting the attribute is still valid. We do this for kyrillic and greek ATM. 909*cdf0e10cSrcweir // In future versions of OOo this should be replaced by a configuration switch that allows to give the preference to 910*cdf0e10cSrcweir // the OOo setting or the system setting explicitly and/or a better handling of the script type. 911*cdf0e10cSrcweir sal_Int16 nScript = GetAppCharClass().getScript( aInBuffer, 0 ); 912*cdf0e10cSrcweir i18n::UnicodeScript eType = (i18n::UnicodeScript) nScript; 913*cdf0e10cSrcweir 914*cdf0e10cSrcweir bool bSystemIsNonLatin = false, bOOoLangIsNonLatin = false; 915*cdf0e10cSrcweir switch ( eType ) 916*cdf0e10cSrcweir { 917*cdf0e10cSrcweir case i18n::UnicodeScript_kGreek: 918*cdf0e10cSrcweir case i18n::UnicodeScript_kCyrillic: 919*cdf0e10cSrcweir // in case other UnicodeScripts require special keyboards they can be added here 920*cdf0e10cSrcweir bSystemIsNonLatin = true; 921*cdf0e10cSrcweir break; 922*cdf0e10cSrcweir default: 923*cdf0e10cSrcweir break; 924*cdf0e10cSrcweir } 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir switch ( eLang ) 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir case LANGUAGE_AZERI_CYRILLIC: 929*cdf0e10cSrcweir case LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA: 930*cdf0e10cSrcweir case LANGUAGE_BULGARIAN: 931*cdf0e10cSrcweir case LANGUAGE_GREEK: 932*cdf0e10cSrcweir case LANGUAGE_RUSSIAN: 933*cdf0e10cSrcweir case LANGUAGE_RUSSIAN_MOLDOVA: 934*cdf0e10cSrcweir case LANGUAGE_SERBIAN_CYRILLIC: 935*cdf0e10cSrcweir case LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA: 936*cdf0e10cSrcweir case LANGUAGE_UZBEK_CYRILLIC: 937*cdf0e10cSrcweir case LANGUAGE_UKRAINIAN: 938*cdf0e10cSrcweir case LANGUAGE_BELARUSIAN: 939*cdf0e10cSrcweir bOOoLangIsNonLatin = true; 940*cdf0e10cSrcweir break; 941*cdf0e10cSrcweir default: 942*cdf0e10cSrcweir break; 943*cdf0e10cSrcweir } 944*cdf0e10cSrcweir 945*cdf0e10cSrcweir bLang = (bSystemIsNonLatin != bOOoLangIsNonLatin); 946*cdf0e10cSrcweir } 947*cdf0e10cSrcweir } 948*cdf0e10cSrcweir if(bLang) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir SvxLanguageItem aLangItem( eBufferLanguage, nWhich ); 951*cdf0e10cSrcweir rSh.SetAttr( aLangItem ); 952*cdf0e10cSrcweir } 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir rSh.Insert( aInBuffer ); 957*cdf0e10cSrcweir eBufferLanguage = LANGUAGE_DONTKNOW; 958*cdf0e10cSrcweir aInBuffer.Erase(); 959*cdf0e10cSrcweir bFlushCharBuffer = sal_False; 960*cdf0e10cSrcweir } 961*cdf0e10cSrcweir } 962*cdf0e10cSrcweir 963*cdf0e10cSrcweir #define MOVE_LEFT_SMALL 0 964*cdf0e10cSrcweir #define MOVE_UP_SMALL 1 965*cdf0e10cSrcweir #define MOVE_RIGHT_BIG 2 966*cdf0e10cSrcweir #define MOVE_DOWN_BIG 3 967*cdf0e10cSrcweir #define MOVE_LEFT_BIG 4 968*cdf0e10cSrcweir #define MOVE_UP_BIG 5 969*cdf0e10cSrcweir #define MOVE_RIGHT_SMALL 6 970*cdf0e10cSrcweir #define MOVE_DOWN_SMALL 7 971*cdf0e10cSrcweir 972*cdf0e10cSrcweir void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb ) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 975*cdf0e10cSrcweir SwRect aTmp = rSh.GetFlyRect(); 976*cdf0e10cSrcweir if( aTmp.HasArea() && 977*cdf0e10cSrcweir // --> FME 2005-01-13 #i40348# 978*cdf0e10cSrcweir // IsSelObjProtected() seems to be the correct condition, not 979*cdf0e10cSrcweir // !HasReadonlySel(), otherwise frame is not moveable if content is 980*cdf0e10cSrcweir // protected. 981*cdf0e10cSrcweir !rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE ) ) 982*cdf0e10cSrcweir // <-- 983*cdf0e10cSrcweir { 984*cdf0e10cSrcweir // OD 18.09.2003 #i18732# - add item <RES_FOLLOW_TEXT_FLOW> 985*cdf0e10cSrcweir SfxItemSet aSet(rSh.GetAttrPool(), 986*cdf0e10cSrcweir RES_FRM_SIZE, RES_FRM_SIZE, 987*cdf0e10cSrcweir RES_VERT_ORIENT, RES_ANCHOR, 988*cdf0e10cSrcweir RES_COL, RES_COL, 989*cdf0e10cSrcweir RES_PROTECT, RES_PROTECT, 990*cdf0e10cSrcweir RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW, 0); 991*cdf0e10cSrcweir rSh.GetFlyFrmAttr( aSet ); 992*cdf0e10cSrcweir RndStdIds eAnchorId = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId(); 993*cdf0e10cSrcweir Size aSnap; 994*cdf0e10cSrcweir if(MOVE_LEFT_SMALL == nDir || 995*cdf0e10cSrcweir MOVE_UP_SMALL == nDir || 996*cdf0e10cSrcweir MOVE_RIGHT_SMALL == nDir || 997*cdf0e10cSrcweir MOVE_DOWN_SMALL == nDir ) 998*cdf0e10cSrcweir aSnap = PixelToLogic(Size(1,1)); 999*cdf0e10cSrcweir else 1000*cdf0e10cSrcweir { 1001*cdf0e10cSrcweir aSnap = rSh.GetViewOptions()->GetSnapSize(); 1002*cdf0e10cSrcweir short nDiv = rSh.GetViewOptions()->GetDivisionX(); 1003*cdf0e10cSrcweir if ( nDiv > 0 ) 1004*cdf0e10cSrcweir aSnap.Width() = Max( (sal_uLong)1, (sal_uLong)aSnap.Width() / nDiv ); 1005*cdf0e10cSrcweir nDiv = rSh.GetViewOptions()->GetDivisionY(); 1006*cdf0e10cSrcweir if ( nDiv > 0 ) 1007*cdf0e10cSrcweir aSnap.Height() = Max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv ); 1008*cdf0e10cSrcweir } 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir SwRect aBoundRect; 1011*cdf0e10cSrcweir Point aRefPoint; 1012*cdf0e10cSrcweir // OD 18.09.2003 #i18732# - adjustment for allowing vertical position 1013*cdf0e10cSrcweir // aligned to page for fly frame anchored to paragraph or to character. 1014*cdf0e10cSrcweir { 1015*cdf0e10cSrcweir SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) ); 1016*cdf0e10cSrcweir const bool bFollowTextFlow = 1017*cdf0e10cSrcweir static_cast<const SwFmtFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue(); 1018*cdf0e10cSrcweir // OD 12.11.2003 #i22341# - additional provide content position 1019*cdf0e10cSrcweir const SwPosition* pToCharCntntPos = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetCntntAnchor(); 1020*cdf0e10cSrcweir rSh.CalcBoundRect( aBoundRect, eAnchorId, 1021*cdf0e10cSrcweir text::RelOrientation::FRAME, aVert.GetRelationOrient(), 1022*cdf0e10cSrcweir pToCharCntntPos, bFollowTextFlow, 1023*cdf0e10cSrcweir false, &aRefPoint ); 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir long nLeft = Min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() ); 1026*cdf0e10cSrcweir long nRight = Min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() ); 1027*cdf0e10cSrcweir long nUp = Min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() ); 1028*cdf0e10cSrcweir long nDown = Min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() ); 1029*cdf0e10cSrcweir 1030*cdf0e10cSrcweir switch ( nDir ) 1031*cdf0e10cSrcweir { 1032*cdf0e10cSrcweir case MOVE_LEFT_BIG: 1033*cdf0e10cSrcweir case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft ); break; 1034*cdf0e10cSrcweir case MOVE_UP_BIG: 1035*cdf0e10cSrcweir case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp ); break; 1036*cdf0e10cSrcweir case MOVE_RIGHT_SMALL: if( aTmp.Width() < aSnap.Width() + MINFLY ) break; 1037*cdf0e10cSrcweir nRight = aSnap.Width(); // kein break 1038*cdf0e10cSrcweir case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight ); break; 1039*cdf0e10cSrcweir case MOVE_DOWN_SMALL: if( aTmp.Height() < aSnap.Height() + MINFLY ) break; 1040*cdf0e10cSrcweir nDown = aSnap.Height(); // kein break 1041*cdf0e10cSrcweir case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown ); break; 1042*cdf0e10cSrcweir default: ASSERT( sal_True, "ChangeFly: Unknown direction." ); 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir sal_Bool bSet = sal_False; 1045*cdf0e10cSrcweir if ((FLY_AS_CHAR == eAnchorId) && ( nDir % 2 )) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir long aDiff = aTmp.Top() - aRefPoint.Y(); 1048*cdf0e10cSrcweir if( aDiff > 0 ) 1049*cdf0e10cSrcweir aDiff = 0; 1050*cdf0e10cSrcweir else if ( aDiff < -aTmp.Height() ) 1051*cdf0e10cSrcweir aDiff = -aTmp.Height(); 1052*cdf0e10cSrcweir SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) ); 1053*cdf0e10cSrcweir sal_Int16 eNew; 1054*cdf0e10cSrcweir if( bWeb ) 1055*cdf0e10cSrcweir { 1056*cdf0e10cSrcweir eNew = aVert.GetVertOrient(); 1057*cdf0e10cSrcweir sal_Bool bDown = 0 != ( nDir & 0x02 ); 1058*cdf0e10cSrcweir switch( eNew ) 1059*cdf0e10cSrcweir { 1060*cdf0e10cSrcweir case text::VertOrientation::CHAR_TOP: 1061*cdf0e10cSrcweir if( bDown ) eNew = text::VertOrientation::CENTER; 1062*cdf0e10cSrcweir break; 1063*cdf0e10cSrcweir case text::VertOrientation::CENTER: 1064*cdf0e10cSrcweir eNew = bDown ? text::VertOrientation::TOP : text::VertOrientation::CHAR_TOP; 1065*cdf0e10cSrcweir break; 1066*cdf0e10cSrcweir case text::VertOrientation::TOP: 1067*cdf0e10cSrcweir if( !bDown ) eNew = text::VertOrientation::CENTER; 1068*cdf0e10cSrcweir break; 1069*cdf0e10cSrcweir case text::VertOrientation::LINE_TOP: 1070*cdf0e10cSrcweir if( bDown ) eNew = text::VertOrientation::LINE_CENTER; 1071*cdf0e10cSrcweir break; 1072*cdf0e10cSrcweir case text::VertOrientation::LINE_CENTER: 1073*cdf0e10cSrcweir eNew = bDown ? text::VertOrientation::LINE_BOTTOM : text::VertOrientation::LINE_TOP; 1074*cdf0e10cSrcweir break; 1075*cdf0e10cSrcweir case text::VertOrientation::LINE_BOTTOM: 1076*cdf0e10cSrcweir if( !bDown ) eNew = text::VertOrientation::LINE_CENTER; 1077*cdf0e10cSrcweir break; 1078*cdf0e10cSrcweir default:; //prevent warning 1079*cdf0e10cSrcweir } 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir else 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir aVert.SetPos( aDiff ); 1084*cdf0e10cSrcweir eNew = text::VertOrientation::NONE; 1085*cdf0e10cSrcweir } 1086*cdf0e10cSrcweir aVert.SetVertOrient( eNew ); 1087*cdf0e10cSrcweir aSet.Put( aVert ); 1088*cdf0e10cSrcweir bSet = sal_True; 1089*cdf0e10cSrcweir } 1090*cdf0e10cSrcweir if (bWeb && (FLY_AT_PARA == eAnchorId) 1091*cdf0e10cSrcweir && ( nDir==MOVE_LEFT_SMALL || nDir==MOVE_RIGHT_BIG )) 1092*cdf0e10cSrcweir { 1093*cdf0e10cSrcweir SwFmtHoriOrient aHori( (SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT) ); 1094*cdf0e10cSrcweir sal_Int16 eNew; 1095*cdf0e10cSrcweir eNew = aHori.GetHoriOrient(); 1096*cdf0e10cSrcweir switch( eNew ) 1097*cdf0e10cSrcweir { 1098*cdf0e10cSrcweir case text::HoriOrientation::RIGHT: 1099*cdf0e10cSrcweir if( nDir==MOVE_LEFT_SMALL ) 1100*cdf0e10cSrcweir eNew = text::HoriOrientation::LEFT; 1101*cdf0e10cSrcweir break; 1102*cdf0e10cSrcweir case text::HoriOrientation::LEFT: 1103*cdf0e10cSrcweir if( nDir==MOVE_RIGHT_BIG ) 1104*cdf0e10cSrcweir eNew = text::HoriOrientation::RIGHT; 1105*cdf0e10cSrcweir break; 1106*cdf0e10cSrcweir default:; //prevent warning 1107*cdf0e10cSrcweir } 1108*cdf0e10cSrcweir if( eNew != aHori.GetHoriOrient() ) 1109*cdf0e10cSrcweir { 1110*cdf0e10cSrcweir aHori.SetHoriOrient( eNew ); 1111*cdf0e10cSrcweir aSet.Put( aHori ); 1112*cdf0e10cSrcweir bSet = sal_True; 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir rSh.StartAllAction(); 1116*cdf0e10cSrcweir if( bSet ) 1117*cdf0e10cSrcweir rSh.SetFlyFrmAttr( aSet ); 1118*cdf0e10cSrcweir sal_Bool bSetPos = (FLY_AS_CHAR != eAnchorId); 1119*cdf0e10cSrcweir if(bSetPos && bWeb) 1120*cdf0e10cSrcweir { 1121*cdf0e10cSrcweir if (FLY_AT_PAGE != eAnchorId) 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir bSetPos = sal_False; 1124*cdf0e10cSrcweir } 1125*cdf0e10cSrcweir else 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir bSetPos = (::GetHtmlMode(rView.GetDocShell()) & HTMLMODE_SOME_ABS_POS) ? 1128*cdf0e10cSrcweir sal_True : sal_False; 1129*cdf0e10cSrcweir } 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir if( bSetPos ) 1132*cdf0e10cSrcweir rSh.SetFlyPos( aTmp.Pos() ); 1133*cdf0e10cSrcweir rSh.EndAllAction(); 1134*cdf0e10cSrcweir } 1135*cdf0e10cSrcweir } 1136*cdf0e10cSrcweir /* -----------------------------23.05.2002 11:35------------------------------ 1137*cdf0e10cSrcweir 1138*cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1139*cdf0e10cSrcweir void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) 1140*cdf0e10cSrcweir { 1141*cdf0e10cSrcweir // --> OD 2005-01-31 #i40845# - start undo action in order to get only one 1142*cdf0e10cSrcweir // undo action for this change. 1143*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 1144*cdf0e10cSrcweir rSh.StartUndo(); 1145*cdf0e10cSrcweir // <-- 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir long nX = 0; 1148*cdf0e10cSrcweir long nY = 0; 1149*cdf0e10cSrcweir sal_Bool bOnePixel = sal_False; 1150*cdf0e10cSrcweir sal_uInt16 nAnchorDir = SW_MOVE_UP; 1151*cdf0e10cSrcweir switch(nDir) 1152*cdf0e10cSrcweir { 1153*cdf0e10cSrcweir case MOVE_LEFT_SMALL: 1154*cdf0e10cSrcweir bOnePixel = sal_True; 1155*cdf0e10cSrcweir //no break; 1156*cdf0e10cSrcweir case MOVE_LEFT_BIG: 1157*cdf0e10cSrcweir nX = -1; 1158*cdf0e10cSrcweir nAnchorDir = SW_MOVE_LEFT; 1159*cdf0e10cSrcweir break; 1160*cdf0e10cSrcweir case MOVE_UP_SMALL: 1161*cdf0e10cSrcweir bOnePixel = sal_True; 1162*cdf0e10cSrcweir //no break; 1163*cdf0e10cSrcweir case MOVE_UP_BIG: 1164*cdf0e10cSrcweir nY = -1; 1165*cdf0e10cSrcweir break; 1166*cdf0e10cSrcweir case MOVE_RIGHT_SMALL: 1167*cdf0e10cSrcweir bOnePixel = sal_True; 1168*cdf0e10cSrcweir //no break; 1169*cdf0e10cSrcweir case MOVE_RIGHT_BIG: 1170*cdf0e10cSrcweir nX = +1; 1171*cdf0e10cSrcweir nAnchorDir = SW_MOVE_RIGHT; 1172*cdf0e10cSrcweir break; 1173*cdf0e10cSrcweir case MOVE_DOWN_SMALL: 1174*cdf0e10cSrcweir bOnePixel = sal_True; 1175*cdf0e10cSrcweir //no break; 1176*cdf0e10cSrcweir case MOVE_DOWN_BIG: 1177*cdf0e10cSrcweir nY = +1; 1178*cdf0e10cSrcweir nAnchorDir = SW_MOVE_DOWN; 1179*cdf0e10cSrcweir break; 1180*cdf0e10cSrcweir } 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir if(0 != nX || 0 != nY) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir sal_uInt8 nProtect = rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE ); 1185*cdf0e10cSrcweir Size aSnap( rSh.GetViewOptions()->GetSnapSize() ); 1186*cdf0e10cSrcweir short nDiv = rSh.GetViewOptions()->GetDivisionX(); 1187*cdf0e10cSrcweir if ( nDiv > 0 ) 1188*cdf0e10cSrcweir aSnap.Width() = Max( (sal_uLong)1, (sal_uLong)aSnap.Width() / nDiv ); 1189*cdf0e10cSrcweir nDiv = rSh.GetViewOptions()->GetDivisionY(); 1190*cdf0e10cSrcweir if ( nDiv > 0 ) 1191*cdf0e10cSrcweir aSnap.Height() = Max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv ); 1192*cdf0e10cSrcweir 1193*cdf0e10cSrcweir if(bOnePixel) 1194*cdf0e10cSrcweir aSnap = PixelToLogic(Size(1,1)); 1195*cdf0e10cSrcweir 1196*cdf0e10cSrcweir nX *= aSnap.Width(); 1197*cdf0e10cSrcweir nY *= aSnap.Height(); 1198*cdf0e10cSrcweir 1199*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 1200*cdf0e10cSrcweir const SdrHdlList& rHdlList = pSdrView->GetHdlList(); 1201*cdf0e10cSrcweir SdrHdl* pHdl = rHdlList.GetFocusHdl(); 1202*cdf0e10cSrcweir rSh.StartAllAction(); 1203*cdf0e10cSrcweir if(0L == pHdl) 1204*cdf0e10cSrcweir { 1205*cdf0e10cSrcweir // now move the selected draw objects 1206*cdf0e10cSrcweir // if the object's position is not protected 1207*cdf0e10cSrcweir if(0 == (nProtect&FLYPROTECT_POS)) 1208*cdf0e10cSrcweir { 1209*cdf0e10cSrcweir // --> FME 2005-04-26 #i47138# 1210*cdf0e10cSrcweir // Check if object is anchored as character and move direction 1211*cdf0e10cSrcweir sal_Bool bDummy1, bDummy2; 1212*cdf0e10cSrcweir const bool bVertAnchor = rSh.IsFrmVertical( sal_True, bDummy1, bDummy2 ); 1213*cdf0e10cSrcweir const bool bHoriMove = !bVertAnchor == !( nDir % 2 ); 1214*cdf0e10cSrcweir const bool bMoveAllowed = 1215*cdf0e10cSrcweir !bHoriMove || (rSh.GetAnchorId() != FLY_AS_CHAR); 1216*cdf0e10cSrcweir if ( bMoveAllowed ) 1217*cdf0e10cSrcweir { 1218*cdf0e10cSrcweir // <-- 1219*cdf0e10cSrcweir pSdrView->MoveAllMarked(Size(nX, nY)); 1220*cdf0e10cSrcweir rSh.SetModified(); 1221*cdf0e10cSrcweir } 1222*cdf0e10cSrcweir } 1223*cdf0e10cSrcweir } 1224*cdf0e10cSrcweir else 1225*cdf0e10cSrcweir { 1226*cdf0e10cSrcweir // move handle with index nHandleIndex 1227*cdf0e10cSrcweir if(pHdl && (nX || nY)) 1228*cdf0e10cSrcweir { 1229*cdf0e10cSrcweir if( HDL_ANCHOR == pHdl->GetKind() || 1230*cdf0e10cSrcweir HDL_ANCHOR_TR == pHdl->GetKind() ) 1231*cdf0e10cSrcweir { 1232*cdf0e10cSrcweir // anchor move cannot be allowed when position is protected 1233*cdf0e10cSrcweir if(0 == (nProtect&FLYPROTECT_POS)) 1234*cdf0e10cSrcweir rSh.MoveAnchor( nAnchorDir ); 1235*cdf0e10cSrcweir } 1236*cdf0e10cSrcweir //now resize if size is protected 1237*cdf0e10cSrcweir else if(0 == (nProtect&FLYPROTECT_SIZE)) 1238*cdf0e10cSrcweir { 1239*cdf0e10cSrcweir // now move the Handle (nX, nY) 1240*cdf0e10cSrcweir Point aStartPoint(pHdl->GetPos()); 1241*cdf0e10cSrcweir Point aEndPoint(pHdl->GetPos() + Point(nX, nY)); 1242*cdf0e10cSrcweir const SdrDragStat& rDragStat = pSdrView->GetDragStat(); 1243*cdf0e10cSrcweir 1244*cdf0e10cSrcweir // start dragging 1245*cdf0e10cSrcweir pSdrView->BegDragObj(aStartPoint, 0, pHdl, 0); 1246*cdf0e10cSrcweir 1247*cdf0e10cSrcweir if(pSdrView->IsDragObj()) 1248*cdf0e10cSrcweir { 1249*cdf0e10cSrcweir sal_Bool bWasNoSnap = static_cast< sal_Bool >(rDragStat.IsNoSnap()); 1250*cdf0e10cSrcweir sal_Bool bWasSnapEnabled = pSdrView->IsSnapEnabled(); 1251*cdf0e10cSrcweir 1252*cdf0e10cSrcweir // switch snapping off 1253*cdf0e10cSrcweir if(!bWasNoSnap) 1254*cdf0e10cSrcweir ((SdrDragStat&)rDragStat).SetNoSnap(sal_True); 1255*cdf0e10cSrcweir if(bWasSnapEnabled) 1256*cdf0e10cSrcweir pSdrView->SetSnapEnabled(sal_False); 1257*cdf0e10cSrcweir 1258*cdf0e10cSrcweir pSdrView->MovAction(aEndPoint); 1259*cdf0e10cSrcweir pSdrView->EndDragObj(); 1260*cdf0e10cSrcweir rSh.SetModified(); 1261*cdf0e10cSrcweir 1262*cdf0e10cSrcweir // restore snap 1263*cdf0e10cSrcweir if(!bWasNoSnap) 1264*cdf0e10cSrcweir ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap); 1265*cdf0e10cSrcweir if(bWasSnapEnabled) 1266*cdf0e10cSrcweir pSdrView->SetSnapEnabled(bWasSnapEnabled); 1267*cdf0e10cSrcweir } 1268*cdf0e10cSrcweir } 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir } 1271*cdf0e10cSrcweir rSh.EndAllAction(); 1272*cdf0e10cSrcweir } 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir // --> OD 2005-01-31 #i40845# - end undo action 1275*cdf0e10cSrcweir rSh.EndUndo(); 1276*cdf0e10cSrcweir // <-- 1277*cdf0e10cSrcweir } 1278*cdf0e10cSrcweir 1279*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1280*cdf0e10cSrcweir Beschreibung: KeyEvents 1281*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1282*cdf0e10cSrcweir 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir 1285*cdf0e10cSrcweir void SwEditWin::KeyInput(const KeyEvent &rKEvt) 1286*cdf0e10cSrcweir { 1287*cdf0e10cSrcweir if( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE && 1288*cdf0e10cSrcweir pApplyTempl && pApplyTempl->pFormatClipboard ) 1289*cdf0e10cSrcweir { 1290*cdf0e10cSrcweir pApplyTempl->pFormatClipboard->Erase(); 1291*cdf0e10cSrcweir SetApplyTemplate(SwApplyTemplate()); 1292*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().Invalidate(SID_FORMATPAINTBRUSH); 1293*cdf0e10cSrcweir } 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir SfxObjectShell *pObjSh = (SfxObjectShell*)rView.GetViewFrame()->GetObjectShell(); 1296*cdf0e10cSrcweir if ( bLockInput || (pObjSh && pObjSh->GetProgress()) ) 1297*cdf0e10cSrcweir // Wenn die Rechenleiste aktiv ist oder 1298*cdf0e10cSrcweir // auf dem Document ein Progress laeuft wird keine 1299*cdf0e10cSrcweir // Bestellungen angenommen. 1300*cdf0e10cSrcweir return; 1301*cdf0e10cSrcweir 1302*cdf0e10cSrcweir if( pShadCrsr ) 1303*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 1304*cdf0e10cSrcweir aKeyInputFlushTimer.Stop(); 1305*cdf0e10cSrcweir 1306*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 1307*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() && 1308*cdf0e10cSrcweir rSh.IsCrsrReadonly(); 1309*cdf0e10cSrcweir 1310*cdf0e10cSrcweir //if the language changes the buffer must be flushed 1311*cdf0e10cSrcweir LanguageType eNewLanguage = GetInputLanguage(); 1312*cdf0e10cSrcweir if(!bIsDocReadOnly && eBufferLanguage != eNewLanguage && aInBuffer.Len()) 1313*cdf0e10cSrcweir { 1314*cdf0e10cSrcweir FlushInBuffer(); 1315*cdf0e10cSrcweir } 1316*cdf0e10cSrcweir eBufferLanguage = eNewLanguage; 1317*cdf0e10cSrcweir 1318*cdf0e10cSrcweir QuickHelpData aTmpQHD; 1319*cdf0e10cSrcweir if( pQuickHlpData->bClear ) 1320*cdf0e10cSrcweir { 1321*cdf0e10cSrcweir aTmpQHD.Move( *pQuickHlpData ); 1322*cdf0e10cSrcweir pQuickHlpData->Stop( rSh ); 1323*cdf0e10cSrcweir } 1324*cdf0e10cSrcweir 1325*cdf0e10cSrcweir // OS:auch die DrawView braucht noch ein readonly-Flag 1326*cdf0e10cSrcweir if ( !bIsDocReadOnly && rSh.GetDrawView() && rSh.GetDrawView()->KeyInput( rKEvt, this ) ) 1327*cdf0e10cSrcweir { 1328*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll( sal_False ); 1329*cdf0e10cSrcweir rSh.SetModified(); 1330*cdf0e10cSrcweir return; // Event von der SdrView ausgewertet 1331*cdf0e10cSrcweir } 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() && bInsFrm ) 1334*cdf0e10cSrcweir { 1335*cdf0e10cSrcweir StopInsFrm(); 1336*cdf0e10cSrcweir rSh.Edit(); 1337*cdf0e10cSrcweir } 1338*cdf0e10cSrcweir 1339*cdf0e10cSrcweir sal_Bool bFlushBuffer = sal_False; 1340*cdf0e10cSrcweir sal_Bool bNormalChar = sal_False; 1341*cdf0e10cSrcweir sal_Bool bChkInsBlank = pQuickHlpData->bChkInsBlank; 1342*cdf0e10cSrcweir pQuickHlpData->bChkInsBlank = sal_False; 1343*cdf0e10cSrcweir 1344*cdf0e10cSrcweir KeyEvent aKeyEvent( rKEvt ); 1345*cdf0e10cSrcweir // look for vertical mappings 1346*cdf0e10cSrcweir if( !bIsDocReadOnly && !rSh.IsSelFrmMode() && !rSh.IsObjSelected() ) 1347*cdf0e10cSrcweir { 1348*cdf0e10cSrcweir //JP 21.2.2002: must changed from switch to if, because the Linux 1349*cdf0e10cSrcweir // compiler has problem with the code. Has to remove if the new general 1350*cdf0e10cSrcweir // handler exist. 1351*cdf0e10cSrcweir sal_uInt16 nKey = rKEvt.GetKeyCode().GetCode(); 1352*cdf0e10cSrcweir 1353*cdf0e10cSrcweir if( KEY_UP == nKey || KEY_DOWN == nKey || 1354*cdf0e10cSrcweir KEY_LEFT == nKey || KEY_RIGHT == nKey ) 1355*cdf0e10cSrcweir { 1356*cdf0e10cSrcweir // In general, we want to map the direction keys if we are inside 1357*cdf0e10cSrcweir // some vertical formatted text. 1358*cdf0e10cSrcweir // 1. Exception: For a table cursor in a horizontal table, the 1359*cdf0e10cSrcweir // directions should never be mapped. 1360*cdf0e10cSrcweir // 2. Exception: For a table cursor in a vertical table, the 1361*cdf0e10cSrcweir // directions should always be mapped. 1362*cdf0e10cSrcweir const bool bVertText = rSh.IsInVerticalText(); 1363*cdf0e10cSrcweir const bool bTblCrsr = rSh.GetTableCrsr(); 1364*cdf0e10cSrcweir const bool bVertTable = rSh.IsTableVertical(); 1365*cdf0e10cSrcweir if( ( bVertText && ( !bTblCrsr || bVertTable ) ) || 1366*cdf0e10cSrcweir ( bTblCrsr && bVertTable ) ) 1367*cdf0e10cSrcweir { 1368*cdf0e10cSrcweir // Attempt to integrate cursor travelling for mongolian layout does not work. 1369*cdf0e10cSrcweir // Thus, back to previous mapping of cursor keys to direction keys. 1370*cdf0e10cSrcweir if( KEY_UP == nKey ) nKey = KEY_LEFT; 1371*cdf0e10cSrcweir else if( KEY_DOWN == nKey ) nKey = KEY_RIGHT; 1372*cdf0e10cSrcweir else if( KEY_LEFT == nKey ) nKey = KEY_DOWN; 1373*cdf0e10cSrcweir else if( KEY_RIGHT == nKey ) nKey = KEY_UP; 1374*cdf0e10cSrcweir } 1375*cdf0e10cSrcweir 1376*cdf0e10cSrcweir if ( rSh.IsInRightToLeftText() ) 1377*cdf0e10cSrcweir { 1378*cdf0e10cSrcweir if( KEY_LEFT == nKey ) nKey = KEY_RIGHT; 1379*cdf0e10cSrcweir else if( KEY_RIGHT == nKey ) nKey = KEY_LEFT; 1380*cdf0e10cSrcweir } 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir aKeyEvent = KeyEvent( rKEvt.GetCharCode(), 1383*cdf0e10cSrcweir KeyCode( nKey, rKEvt.GetKeyCode().GetModifier() ), 1384*cdf0e10cSrcweir rKEvt.GetRepeat() ); 1385*cdf0e10cSrcweir } 1386*cdf0e10cSrcweir } 1387*cdf0e10cSrcweir 1388*cdf0e10cSrcweir const KeyCode& rKeyCode = aKeyEvent.GetKeyCode(); 1389*cdf0e10cSrcweir sal_Unicode aCh = aKeyEvent.GetCharCode(); 1390*cdf0e10cSrcweir 1391*cdf0e10cSrcweir // enable switching to notes ankor with Ctrl - Alt - Page Up/Down 1392*cdf0e10cSrcweir // pressing this inside a note will switch to next/previous note 1393*cdf0e10cSrcweir if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((rKeyCode.GetCode() == KEY_PAGEUP) || (rKeyCode.GetCode() == KEY_PAGEDOWN))) 1394*cdf0e10cSrcweir { 1395*cdf0e10cSrcweir bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN ? true : false; 1396*cdf0e10cSrcweir SwFieldType* pFldType = rSh.GetFldType(0, RES_POSTITFLD); 1397*cdf0e10cSrcweir rSh.MoveFldType( pFldType, bNext ); 1398*cdf0e10cSrcweir return; 1399*cdf0e10cSrcweir } 1400*cdf0e10cSrcweir 1401*cdf0e10cSrcweir const SwFrmFmt* pFlyFmt = rSh.GetFlyFrmFmt(); 1402*cdf0e10cSrcweir if( pFlyFmt ) 1403*cdf0e10cSrcweir { 1404*cdf0e10cSrcweir sal_uInt16 nEvent; 1405*cdf0e10cSrcweir 1406*cdf0e10cSrcweir if( 32 <= aCh && 1407*cdf0e10cSrcweir 0 == (( KEY_MOD1 | KEY_MOD2 ) & rKeyCode.GetModifier() )) 1408*cdf0e10cSrcweir nEvent = SW_EVENT_FRM_KEYINPUT_ALPHA; 1409*cdf0e10cSrcweir else 1410*cdf0e10cSrcweir nEvent = SW_EVENT_FRM_KEYINPUT_NOALPHA; 1411*cdf0e10cSrcweir 1412*cdf0e10cSrcweir const SvxMacro* pMacro = pFlyFmt->GetMacro().GetMacroTable().Get( nEvent ); 1413*cdf0e10cSrcweir if( pMacro ) 1414*cdf0e10cSrcweir { 1415*cdf0e10cSrcweir String sRet; 1416*cdf0e10cSrcweir SbxArrayRef xArgs = new SbxArray; 1417*cdf0e10cSrcweir SbxVariableRef xVar = new SbxVariable; 1418*cdf0e10cSrcweir xVar->PutString( pFlyFmt->GetName() ); 1419*cdf0e10cSrcweir xArgs->Put( &xVar, 1 ); 1420*cdf0e10cSrcweir 1421*cdf0e10cSrcweir xVar = new SbxVariable; 1422*cdf0e10cSrcweir if( SW_EVENT_FRM_KEYINPUT_ALPHA == nEvent ) 1423*cdf0e10cSrcweir xVar->PutChar( aCh ); 1424*cdf0e10cSrcweir else 1425*cdf0e10cSrcweir xVar->PutUShort( rKeyCode.GetModifier() | rKeyCode.GetCode() ); 1426*cdf0e10cSrcweir xArgs->Put( &xVar, 2 ); 1427*cdf0e10cSrcweir 1428*cdf0e10cSrcweir rSh.ExecMacro( *pMacro, &sRet, &xArgs ); 1429*cdf0e10cSrcweir if( sRet.Len() && 0 != sRet.ToInt32() ) 1430*cdf0e10cSrcweir return ; 1431*cdf0e10cSrcweir } 1432*cdf0e10cSrcweir } 1433*cdf0e10cSrcweir int nLclSelectionType; 1434*cdf0e10cSrcweir //A is converted to 1 1435*cdf0e10cSrcweir if( rKeyCode.GetFullCode() == (KEY_A | KEY_MOD1 |KEY_SHIFT) 1436*cdf0e10cSrcweir && rSh.HasDrawView() && 1437*cdf0e10cSrcweir (0 != (nLclSelectionType = rSh.GetSelectionType()) && 1438*cdf0e10cSrcweir ((nLclSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_GRF)) || 1439*cdf0e10cSrcweir ((nLclSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) && 1440*cdf0e10cSrcweir rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1)))) 1441*cdf0e10cSrcweir { 1442*cdf0e10cSrcweir SdrHdlList& rHdlList = (SdrHdlList&)rSh.GetDrawView()->GetHdlList(); 1443*cdf0e10cSrcweir SdrHdl* pAnchor = rHdlList.GetHdl(HDL_ANCHOR); 1444*cdf0e10cSrcweir if ( ! pAnchor ) 1445*cdf0e10cSrcweir pAnchor = rHdlList.GetHdl(HDL_ANCHOR_TR); 1446*cdf0e10cSrcweir if(pAnchor) 1447*cdf0e10cSrcweir rHdlList.SetFocusHdl(pAnchor); 1448*cdf0e10cSrcweir return; 1449*cdf0e10cSrcweir } 1450*cdf0e10cSrcweir 1451*cdf0e10cSrcweir SvxAutoCorrCfg* pACfg = 0; 1452*cdf0e10cSrcweir SvxAutoCorrect* pACorr = 0; 1453*cdf0e10cSrcweir 1454*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 1455*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().GetRecorder(); 1456*cdf0e10cSrcweir if ( !xRecorder.is() ) 1457*cdf0e10cSrcweir { 1458*cdf0e10cSrcweir pACfg = SvxAutoCorrCfg::Get(); 1459*cdf0e10cSrcweir pACorr = pACfg->GetAutoCorrect(); 1460*cdf0e10cSrcweir } 1461*cdf0e10cSrcweir 1462*cdf0e10cSrcweir SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); 1463*cdf0e10cSrcweir 1464*cdf0e10cSrcweir TblChgWidthHeightType eTblChgMode = nsTblChgWidthHeightType::WH_COL_LEFT; // initialization just for warning-free code 1465*cdf0e10cSrcweir sal_uInt16 nTblChgSize = 0; 1466*cdf0e10cSrcweir sal_Bool bStopKeyInputTimer = sal_True; 1467*cdf0e10cSrcweir String sFmlEntry; 1468*cdf0e10cSrcweir 1469*cdf0e10cSrcweir enum SW_KeyState { KS_Start, 1470*cdf0e10cSrcweir KS_CheckKey, KS_InsChar, KS_InsTab, 1471*cdf0e10cSrcweir KS_NoNum, KS_NumOff, KS_NumOrNoNum, KS_NumDown, KS_NumUp, 1472*cdf0e10cSrcweir // -> #i23725# 1473*cdf0e10cSrcweir KS_NumIndentInc, KS_NumIndentDec, 1474*cdf0e10cSrcweir // <- #i23725# 1475*cdf0e10cSrcweir 1476*cdf0e10cSrcweir KS_OutlineLvOff, 1477*cdf0e10cSrcweir KS_NextCell, KS_PrevCell, KS_OutlineUp, KS_OutlineDown, 1478*cdf0e10cSrcweir KS_GlossaryExpand, KS_NextPrevGlossary, 1479*cdf0e10cSrcweir KS_AutoFmtByInput, 1480*cdf0e10cSrcweir KS_NextObject, KS_PrevObject, 1481*cdf0e10cSrcweir KS_KeyToView, 1482*cdf0e10cSrcweir KS_LaunchOLEObject, KS_GoIntoFly, KS_GoIntoDrawing, 1483*cdf0e10cSrcweir KS_EnterDrawHandleMode, 1484*cdf0e10cSrcweir KS_CheckDocReadOnlyKeys, 1485*cdf0e10cSrcweir KS_CheckAutoCorrect, KS_EditFormula, 1486*cdf0e10cSrcweir KS_ColLeftBig, KS_ColRightBig, 1487*cdf0e10cSrcweir KS_ColLeftSmall, KS_ColRightSmall, 1488*cdf0e10cSrcweir KS_ColTopBig, KS_ColBottomBig, 1489*cdf0e10cSrcweir KS_ColTopSmall, KS_ColBottomSmall, 1490*cdf0e10cSrcweir KS_CellLeftBig, KS_CellRightBig, 1491*cdf0e10cSrcweir KS_CellLeftSmall, KS_CellRightSmall, 1492*cdf0e10cSrcweir KS_CellTopBig, KS_CellBottomBig, 1493*cdf0e10cSrcweir KS_CellTopSmall, KS_CellBottomSmall, 1494*cdf0e10cSrcweir 1495*cdf0e10cSrcweir KS_InsDel_ColLeftBig, KS_InsDel_ColRightBig, 1496*cdf0e10cSrcweir KS_InsDel_ColLeftSmall, KS_InsDel_ColRightSmall, 1497*cdf0e10cSrcweir KS_InsDel_ColTopBig, KS_InsDel_ColBottomBig, 1498*cdf0e10cSrcweir KS_InsDel_ColTopSmall, KS_InsDel_ColBottomSmall, 1499*cdf0e10cSrcweir KS_InsDel_CellLeftBig, KS_InsDel_CellRightBig, 1500*cdf0e10cSrcweir KS_InsDel_CellLeftSmall, KS_InsDel_CellRightSmall, 1501*cdf0e10cSrcweir KS_InsDel_CellTopBig, KS_InsDel_CellBottomBig, 1502*cdf0e10cSrcweir KS_InsDel_CellTopSmall, KS_InsDel_CellBottomSmall, 1503*cdf0e10cSrcweir KS_TblColCellInsDel, 1504*cdf0e10cSrcweir 1505*cdf0e10cSrcweir KS_Fly_Change, KS_Draw_Change, 1506*cdf0e10cSrcweir KS_SpecialInsert, 1507*cdf0e10cSrcweir KS_EnterCharCell, 1508*cdf0e10cSrcweir KS_GotoNextFieldMark, 1509*cdf0e10cSrcweir KS_GotoPrevFieldMark, 1510*cdf0e10cSrcweir KS_Ende }; 1511*cdf0e10cSrcweir 1512*cdf0e10cSrcweir 1513*cdf0e10cSrcweir 1514*cdf0e10cSrcweir SW_KeyState eKeyState = bIsDocReadOnly ? KS_CheckDocReadOnlyKeys 1515*cdf0e10cSrcweir : KS_CheckKey, 1516*cdf0e10cSrcweir eNextKeyState = KS_Ende; 1517*cdf0e10cSrcweir sal_uInt8 nDir = 0; 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir // -> #i23725# 1520*cdf0e10cSrcweir if (nKS_NUMDOWN_Count > 0) 1521*cdf0e10cSrcweir nKS_NUMDOWN_Count--; 1522*cdf0e10cSrcweir 1523*cdf0e10cSrcweir if (nKS_NUMINDENTINC_Count > 0) 1524*cdf0e10cSrcweir nKS_NUMINDENTINC_Count--; 1525*cdf0e10cSrcweir // <- #i23725# 1526*cdf0e10cSrcweir 1527*cdf0e10cSrcweir while( KS_Ende != eKeyState ) 1528*cdf0e10cSrcweir { 1529*cdf0e10cSrcweir SW_KeyState eFlyState = KS_KeyToView; 1530*cdf0e10cSrcweir 1531*cdf0e10cSrcweir switch( eKeyState ) 1532*cdf0e10cSrcweir { 1533*cdf0e10cSrcweir case KS_CheckKey: 1534*cdf0e10cSrcweir eKeyState = KS_KeyToView; // default weiter zur View 1535*cdf0e10cSrcweir 1536*cdf0e10cSrcweir #ifdef DBG_UTIL 1537*cdf0e10cSrcweir //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1538*cdf0e10cSrcweir // JP 19.01.99: zum Umschalten des Cursor Verhaltens in ReadOnly 1539*cdf0e10cSrcweir // Bereichen 1540*cdf0e10cSrcweir if( 0x7210 == rKeyCode.GetFullCode() ) 1541*cdf0e10cSrcweir rSh.SetReadOnlyAvailable( !rSh.IsReadOnlyAvailable() ); 1542*cdf0e10cSrcweir else 1543*cdf0e10cSrcweir //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1544*cdf0e10cSrcweir #endif 1545*cdf0e10cSrcweir 1546*cdf0e10cSrcweir if( !rKeyCode.IsMod2() && '=' == aCh && 1547*cdf0e10cSrcweir !rSh.IsTableMode() && rSh.GetTableFmt() && 1548*cdf0e10cSrcweir rSh.IsSttPara() /*&& rSh.IsEndPara()*/ && 1549*cdf0e10cSrcweir !rSh.HasReadonlySel() ) 1550*cdf0e10cSrcweir { 1551*cdf0e10cSrcweir // in der Tabelle am Anfang der Zelle ein '=' -> 1552*cdf0e10cSrcweir // EditZeile aufrufen (F2-Funktionalitaet) 1553*cdf0e10cSrcweir rSh.Push(); 1554*cdf0e10cSrcweir if( !rSh.MoveSection( fnSectionCurr, fnSectionStart) && 1555*cdf0e10cSrcweir !rSh.IsTableBoxTextFormat() ) 1556*cdf0e10cSrcweir { 1557*cdf0e10cSrcweir // steht also am Anfang der Box 1558*cdf0e10cSrcweir eKeyState = KS_EditFormula; 1559*cdf0e10cSrcweir if( rSh.HasMark() ) 1560*cdf0e10cSrcweir rSh.SwapPam(); 1561*cdf0e10cSrcweir else 1562*cdf0e10cSrcweir rSh.SttSelect(); 1563*cdf0e10cSrcweir rSh.MoveSection( fnSectionCurr, fnSectionEnd ); 1564*cdf0e10cSrcweir rSh.Pop( sal_True ); 1565*cdf0e10cSrcweir rSh.EndSelect(); 1566*cdf0e10cSrcweir sFmlEntry = '='; 1567*cdf0e10cSrcweir } 1568*cdf0e10cSrcweir else 1569*cdf0e10cSrcweir rSh.Pop( sal_False ); 1570*cdf0e10cSrcweir } 1571*cdf0e10cSrcweir else 1572*cdf0e10cSrcweir { 1573*cdf0e10cSrcweir if( pACorr && aTmpQHD.HasCntnt() && !rSh.HasSelection() && 1574*cdf0e10cSrcweir !rSh.HasReadonlySel() && !aTmpQHD.bIsAutoText && 1575*cdf0e10cSrcweir pACorr->GetSwFlags().nAutoCmpltExpandKey == 1576*cdf0e10cSrcweir (rKeyCode.GetModifier() | rKeyCode.GetCode()) ) 1577*cdf0e10cSrcweir { 1578*cdf0e10cSrcweir eKeyState = KS_GlossaryExpand; 1579*cdf0e10cSrcweir break; 1580*cdf0e10cSrcweir } 1581*cdf0e10cSrcweir 1582*cdf0e10cSrcweir switch( rKeyCode.GetModifier() | rKeyCode.GetCode() ) 1583*cdf0e10cSrcweir { 1584*cdf0e10cSrcweir case KEY_RIGHT | KEY_MOD2: 1585*cdf0e10cSrcweir eKeyState = KS_ColRightBig; 1586*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1587*cdf0e10cSrcweir nDir = MOVE_RIGHT_SMALL; 1588*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1589*cdf0e10cSrcweir 1590*cdf0e10cSrcweir case KEY_LEFT | KEY_MOD2: 1591*cdf0e10cSrcweir eKeyState = KS_ColRightSmall; 1592*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1593*cdf0e10cSrcweir nDir = MOVE_LEFT_SMALL; 1594*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1595*cdf0e10cSrcweir case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT: 1596*cdf0e10cSrcweir eKeyState = KS_ColLeftSmall; 1597*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1598*cdf0e10cSrcweir case KEY_LEFT | KEY_MOD2 | KEY_SHIFT: 1599*cdf0e10cSrcweir eKeyState = KS_ColLeftBig; 1600*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1601*cdf0e10cSrcweir 1602*cdf0e10cSrcweir case KEY_RIGHT | KEY_MOD2 | KEY_MOD1: 1603*cdf0e10cSrcweir eKeyState = KS_CellRightBig; 1604*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1605*cdf0e10cSrcweir case KEY_LEFT | KEY_MOD2 | KEY_MOD1: 1606*cdf0e10cSrcweir eKeyState = KS_CellRightSmall; 1607*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1608*cdf0e10cSrcweir case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1: 1609*cdf0e10cSrcweir eKeyState = KS_CellLeftSmall; 1610*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1611*cdf0e10cSrcweir case KEY_LEFT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1: 1612*cdf0e10cSrcweir eKeyState = KS_CellLeftBig; 1613*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1614*cdf0e10cSrcweir 1615*cdf0e10cSrcweir case KEY_UP | KEY_MOD2: 1616*cdf0e10cSrcweir eKeyState = KS_ColBottomSmall; 1617*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1618*cdf0e10cSrcweir nDir = MOVE_UP_SMALL; 1619*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1620*cdf0e10cSrcweir case KEY_DOWN | KEY_MOD2: 1621*cdf0e10cSrcweir eKeyState = KS_ColBottomBig; 1622*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1623*cdf0e10cSrcweir nDir = MOVE_DOWN_SMALL; 1624*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1625*cdf0e10cSrcweir // case KEY_UP | KEY_MOD2 | KEY_SHIFT: 1626*cdf0e10cSrcweir // eKeyState = KS_ColTopBig; 1627*cdf0e10cSrcweir // goto KEYINPUT_CHECKTABLE; 1628*cdf0e10cSrcweir // case KEY_DOWN | KEY_MOD2 | KEY_SHIFT: 1629*cdf0e10cSrcweir // eKeyState = KS_ColTopSmall; 1630*cdf0e10cSrcweir // goto KEYINPUT_CHECKTABLE; 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir case KEY_UP | KEY_MOD2 | KEY_MOD1: 1633*cdf0e10cSrcweir eKeyState = KS_CellBottomSmall; 1634*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1635*cdf0e10cSrcweir case KEY_DOWN | KEY_MOD2 | KEY_MOD1: 1636*cdf0e10cSrcweir eKeyState = KS_CellBottomBig; 1637*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1638*cdf0e10cSrcweir case KEY_UP | KEY_MOD2 | KEY_SHIFT | KEY_MOD1: 1639*cdf0e10cSrcweir eKeyState = KS_CellTopBig; 1640*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1641*cdf0e10cSrcweir case KEY_DOWN | KEY_MOD2 | KEY_SHIFT | KEY_MOD1: 1642*cdf0e10cSrcweir eKeyState = KS_CellTopSmall; 1643*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE; 1644*cdf0e10cSrcweir 1645*cdf0e10cSrcweir KEYINPUT_CHECKTABLE: 1646*cdf0e10cSrcweir if( rSh.IsTableMode() || !rSh.GetTableFmt() ) 1647*cdf0e10cSrcweir { 1648*cdf0e10cSrcweir if(KS_KeyToView != eFlyState) 1649*cdf0e10cSrcweir { 1650*cdf0e10cSrcweir if(!pFlyFmt && KS_KeyToView != eFlyState && 1651*cdf0e10cSrcweir (rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) && 1652*cdf0e10cSrcweir rSh.GetDrawView()->AreObjectsMarked()) 1653*cdf0e10cSrcweir eKeyState = KS_Draw_Change; 1654*cdf0e10cSrcweir } 1655*cdf0e10cSrcweir 1656*cdf0e10cSrcweir if( pFlyFmt ) 1657*cdf0e10cSrcweir eKeyState = eFlyState; 1658*cdf0e10cSrcweir else if( KS_Draw_Change != eKeyState) 1659*cdf0e10cSrcweir eKeyState = KS_EnterCharCell; 1660*cdf0e10cSrcweir } 1661*cdf0e10cSrcweir break; 1662*cdf0e10cSrcweir 1663*cdf0e10cSrcweir //------- 1664*cdf0e10cSrcweir // Insert/Delete 1665*cdf0e10cSrcweir case KEY_LEFT: 1666*cdf0e10cSrcweir case KEY_LEFT | KEY_MOD1: 1667*cdf0e10cSrcweir { 1668*cdf0e10cSrcweir sal_Bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1); 1669*cdf0e10cSrcweir if(!bMod1) 1670*cdf0e10cSrcweir { 1671*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1672*cdf0e10cSrcweir nDir = MOVE_LEFT_BIG; 1673*cdf0e10cSrcweir } 1674*cdf0e10cSrcweir eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | 1675*cdf0e10cSrcweir ( bMod1 1676*cdf0e10cSrcweir ? nsTblChgWidthHeightType::WH_CELL_LEFT 1677*cdf0e10cSrcweir : nsTblChgWidthHeightType::WH_COL_LEFT ); 1678*cdf0e10cSrcweir nTblChgSize = pModOpt->GetTblVInsert(); 1679*cdf0e10cSrcweir } 1680*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE_INSDEL; 1681*cdf0e10cSrcweir // case KEY_RIGHT: 1682*cdf0e10cSrcweir case KEY_RIGHT | KEY_MOD1: 1683*cdf0e10cSrcweir { 1684*cdf0e10cSrcweir eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_CELL_RIGHT; 1685*cdf0e10cSrcweir nTblChgSize = pModOpt->GetTblVInsert(); 1686*cdf0e10cSrcweir } 1687*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE_INSDEL; 1688*cdf0e10cSrcweir case KEY_UP: 1689*cdf0e10cSrcweir case KEY_UP | KEY_MOD1: 1690*cdf0e10cSrcweir { 1691*cdf0e10cSrcweir sal_Bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1); 1692*cdf0e10cSrcweir if(!bMod1) 1693*cdf0e10cSrcweir { 1694*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1695*cdf0e10cSrcweir nDir = MOVE_UP_BIG; 1696*cdf0e10cSrcweir } 1697*cdf0e10cSrcweir eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | 1698*cdf0e10cSrcweir ( bMod1 1699*cdf0e10cSrcweir ? nsTblChgWidthHeightType::WH_CELL_TOP 1700*cdf0e10cSrcweir : nsTblChgWidthHeightType::WH_ROW_TOP ); 1701*cdf0e10cSrcweir nTblChgSize = pModOpt->GetTblHInsert(); 1702*cdf0e10cSrcweir } 1703*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE_INSDEL; 1704*cdf0e10cSrcweir case KEY_DOWN: 1705*cdf0e10cSrcweir case KEY_DOWN | KEY_MOD1: 1706*cdf0e10cSrcweir { 1707*cdf0e10cSrcweir sal_Bool bMod1 = 0 != (rKeyCode.GetModifier() & KEY_MOD1); 1708*cdf0e10cSrcweir if(!bMod1) 1709*cdf0e10cSrcweir { 1710*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1711*cdf0e10cSrcweir nDir = MOVE_DOWN_BIG; 1712*cdf0e10cSrcweir } 1713*cdf0e10cSrcweir eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | 1714*cdf0e10cSrcweir ( bMod1 1715*cdf0e10cSrcweir ? nsTblChgWidthHeightType::WH_CELL_BOTTOM 1716*cdf0e10cSrcweir : nsTblChgWidthHeightType::WH_ROW_BOTTOM ); 1717*cdf0e10cSrcweir nTblChgSize = pModOpt->GetTblHInsert(); 1718*cdf0e10cSrcweir } 1719*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE_INSDEL; 1720*cdf0e10cSrcweir 1721*cdf0e10cSrcweir KEYINPUT_CHECKTABLE_INSDEL: 1722*cdf0e10cSrcweir if( rSh.IsTableMode() || !rSh.GetTableFmt() || 1723*cdf0e10cSrcweir !bTblInsDelMode || 1724*cdf0e10cSrcweir sal_False /* Tabelle geschuetzt */ 1725*cdf0e10cSrcweir ) 1726*cdf0e10cSrcweir { 1727*cdf0e10cSrcweir const int nSelectionType = rSh.GetSelectionType(); 1728*cdf0e10cSrcweir 1729*cdf0e10cSrcweir eKeyState = KS_KeyToView; 1730*cdf0e10cSrcweir if(KS_KeyToView != eFlyState) 1731*cdf0e10cSrcweir { 1732*cdf0e10cSrcweir if((nSelectionType & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM)) && 1733*cdf0e10cSrcweir rSh.GetDrawView()->AreObjectsMarked()) 1734*cdf0e10cSrcweir eKeyState = KS_Draw_Change; 1735*cdf0e10cSrcweir else if(nSelectionType & (nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF)) 1736*cdf0e10cSrcweir eKeyState = KS_Fly_Change; 1737*cdf0e10cSrcweir } 1738*cdf0e10cSrcweir } 1739*cdf0e10cSrcweir else 1740*cdf0e10cSrcweir { 1741*cdf0e10cSrcweir if( !bTblIsInsMode ) 1742*cdf0e10cSrcweir eTblChgMode = eTblChgMode | nsTblChgWidthHeightType::WH_FLAG_BIGGER; 1743*cdf0e10cSrcweir eKeyState = KS_TblColCellInsDel; 1744*cdf0e10cSrcweir } 1745*cdf0e10cSrcweir break; 1746*cdf0e10cSrcweir 1747*cdf0e10cSrcweir case KEY_DELETE: 1748*cdf0e10cSrcweir if (rSh.IsInFrontOfLabel() && 1749*cdf0e10cSrcweir rSh.NumOrNoNum(sal_False)) 1750*cdf0e10cSrcweir eKeyState = KS_NumOrNoNum; 1751*cdf0e10cSrcweir break; 1752*cdf0e10cSrcweir 1753*cdf0e10cSrcweir case KEY_DELETE | KEY_MOD2: 1754*cdf0e10cSrcweir if( !rSh.IsTableMode() && rSh.GetTableFmt() ) 1755*cdf0e10cSrcweir { 1756*cdf0e10cSrcweir eKeyState = KS_Ende; 1757*cdf0e10cSrcweir bTblInsDelMode = sal_True; 1758*cdf0e10cSrcweir bTblIsInsMode = sal_False; 1759*cdf0e10cSrcweir bTblIsColMode = sal_True; 1760*cdf0e10cSrcweir aKeyInputTimer.Start(); 1761*cdf0e10cSrcweir bStopKeyInputTimer = sal_False; 1762*cdf0e10cSrcweir } 1763*cdf0e10cSrcweir break; 1764*cdf0e10cSrcweir case KEY_INSERT | KEY_MOD2: 1765*cdf0e10cSrcweir if( !rSh.IsTableMode() && rSh.GetTableFmt() ) 1766*cdf0e10cSrcweir { 1767*cdf0e10cSrcweir eKeyState = KS_Ende; 1768*cdf0e10cSrcweir bTblInsDelMode = sal_True; 1769*cdf0e10cSrcweir bTblIsInsMode = sal_True; 1770*cdf0e10cSrcweir bTblIsColMode = sal_True; 1771*cdf0e10cSrcweir aKeyInputTimer.Start(); 1772*cdf0e10cSrcweir bStopKeyInputTimer = sal_False; 1773*cdf0e10cSrcweir } 1774*cdf0e10cSrcweir break; 1775*cdf0e10cSrcweir 1776*cdf0e10cSrcweir case KEY_RETURN: // Return 1777*cdf0e10cSrcweir if( !rSh.HasReadonlySel() ) 1778*cdf0e10cSrcweir { 1779*cdf0e10cSrcweir const int nSelectionType = rSh.GetSelectionType(); 1780*cdf0e10cSrcweir if(nSelectionType & nsSelectionType::SEL_OLE) 1781*cdf0e10cSrcweir eKeyState = KS_LaunchOLEObject; 1782*cdf0e10cSrcweir else if(nSelectionType & nsSelectionType::SEL_FRM) 1783*cdf0e10cSrcweir eKeyState = KS_GoIntoFly; 1784*cdf0e10cSrcweir else if((nSelectionType & nsSelectionType::SEL_DRW) && 1785*cdf0e10cSrcweir 0 == (nSelectionType & nsSelectionType::SEL_DRW_TXT) && 1786*cdf0e10cSrcweir rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1) 1787*cdf0e10cSrcweir eKeyState = KS_GoIntoDrawing; 1788*cdf0e10cSrcweir else if( aTmpQHD.HasCntnt() && !rSh.HasSelection() && 1789*cdf0e10cSrcweir aTmpQHD.bIsAutoText ) 1790*cdf0e10cSrcweir eKeyState = KS_GlossaryExpand; 1791*cdf0e10cSrcweir 1792*cdf0e10cSrcweir //RETURN und leerer Absatz in Numerierung -> Num. beenden 1793*cdf0e10cSrcweir else if( !aInBuffer.Len() && 1794*cdf0e10cSrcweir rSh.GetCurNumRule() && 1795*cdf0e10cSrcweir !rSh.GetCurNumRule()->IsOutlineRule() && 1796*cdf0e10cSrcweir !rSh.HasSelection() && 1797*cdf0e10cSrcweir rSh.IsSttPara() && rSh.IsEndPara() ) 1798*cdf0e10cSrcweir eKeyState = KS_NumOff, eNextKeyState = KS_OutlineLvOff; 1799*cdf0e10cSrcweir 1800*cdf0e10cSrcweir //RETURN fuer neuen Absatz mit AutoFormatierung 1801*cdf0e10cSrcweir else if( pACfg && pACfg->IsAutoFmtByInput() && 1802*cdf0e10cSrcweir !(nSelectionType & (nsSelectionType::SEL_GRF | 1803*cdf0e10cSrcweir nsSelectionType::SEL_OLE | nsSelectionType::SEL_FRM | 1804*cdf0e10cSrcweir nsSelectionType::SEL_TBL_CELLS | nsSelectionType::SEL_DRW | 1805*cdf0e10cSrcweir nsSelectionType::SEL_DRW_TXT)) ) 1806*cdf0e10cSrcweir eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_AutoFmtByInput; 1807*cdf0e10cSrcweir else 1808*cdf0e10cSrcweir eNextKeyState = eKeyState, eKeyState = KS_CheckAutoCorrect; 1809*cdf0e10cSrcweir } 1810*cdf0e10cSrcweir break; 1811*cdf0e10cSrcweir 1812*cdf0e10cSrcweir case KEY_RETURN | KEY_MOD2: // ALT-Return 1813*cdf0e10cSrcweir if( !rSh.HasReadonlySel() && !rSh.IsSttPara() && rSh.GetCurNumRule() ) 1814*cdf0e10cSrcweir eKeyState = KS_NoNum; 1815*cdf0e10cSrcweir else if( rSh.CanSpecialInsert() ) 1816*cdf0e10cSrcweir eKeyState = KS_SpecialInsert; 1817*cdf0e10cSrcweir break; 1818*cdf0e10cSrcweir 1819*cdf0e10cSrcweir case KEY_BACKSPACE: 1820*cdf0e10cSrcweir case KEY_BACKSPACE | KEY_SHIFT: 1821*cdf0e10cSrcweir if( !rSh.HasReadonlySel() ) 1822*cdf0e10cSrcweir { 1823*cdf0e10cSrcweir // #i23725# 1824*cdf0e10cSrcweir sal_Bool bDone = sal_False; 1825*cdf0e10cSrcweir // --> OD 2006-01-31 - try to add comment for code snip: 1826*cdf0e10cSrcweir // Remove the paragraph indent, if the cursor is at the 1827*cdf0e10cSrcweir // beginning of a paragraph, there is no selection 1828*cdf0e10cSrcweir // and no numbering rule found at the current paragraph 1829*cdf0e10cSrcweir // --> OD 2006-01-31 #b6341339#, #i58776# 1830*cdf0e10cSrcweir // Also try to remove indent, if current paragraph 1831*cdf0e10cSrcweir // has numbering rule, but isn't counted and only 1832*cdf0e10cSrcweir // key <backspace> is hit. 1833*cdf0e10cSrcweir const bool bOnlyBackspaceKey( 1834*cdf0e10cSrcweir KEY_BACKSPACE == rKeyCode.GetFullCode() ); 1835*cdf0e10cSrcweir if ( rSh.IsSttPara() && 1836*cdf0e10cSrcweir !rSh.HasSelection() && // i40834 1837*cdf0e10cSrcweir ( NULL == rSh.GetCurNumRule() || 1838*cdf0e10cSrcweir ( rSh.IsNoNum() && bOnlyBackspaceKey ) ) ) 1839*cdf0e10cSrcweir { 1840*cdf0e10cSrcweir bDone = rSh.TryRemoveIndent(); 1841*cdf0e10cSrcweir } 1842*cdf0e10cSrcweir // <-- 1843*cdf0e10cSrcweir 1844*cdf0e10cSrcweir // -> #i23725# 1845*cdf0e10cSrcweir if (bDone) 1846*cdf0e10cSrcweir eKeyState = KS_Ende; 1847*cdf0e10cSrcweir else 1848*cdf0e10cSrcweir { 1849*cdf0e10cSrcweir if (rSh.IsSttPara() && 1850*cdf0e10cSrcweir ! rSh.IsNoNum()) 1851*cdf0e10cSrcweir { 1852*cdf0e10cSrcweir if (nKS_NUMDOWN_Count > 0 && 1853*cdf0e10cSrcweir 0 < rSh.GetNumLevel()) 1854*cdf0e10cSrcweir { 1855*cdf0e10cSrcweir eKeyState = KS_NumUp; 1856*cdf0e10cSrcweir nKS_NUMDOWN_Count = 2; 1857*cdf0e10cSrcweir bDone = sal_True; 1858*cdf0e10cSrcweir } 1859*cdf0e10cSrcweir else if (nKS_NUMINDENTINC_Count > 0) 1860*cdf0e10cSrcweir { 1861*cdf0e10cSrcweir eKeyState = KS_NumIndentDec; 1862*cdf0e10cSrcweir nKS_NUMINDENTINC_Count = 2; 1863*cdf0e10cSrcweir bDone = sal_True; 1864*cdf0e10cSrcweir } 1865*cdf0e10cSrcweir } 1866*cdf0e10cSrcweir // <- #i23725# 1867*cdf0e10cSrcweir // --> OD 2006-01-31 #b6341339#, #i58776# 1868*cdf0e10cSrcweir // --> OD 2006-04-21 #i63540# 1869*cdf0e10cSrcweir // revise fix for issues b6341339 and i58776: 1870*cdf0e10cSrcweir // If the cursor is in an empty paragraph, which has 1871*cdf0e10cSrcweir // a numbering, but not the oultine numbering, and 1872*cdf0e10cSrcweir // there is no selection, the numbering has to be 1873*cdf0e10cSrcweir // deleted on key <Backspace>. 1874*cdf0e10cSrcweir // Otherwise method <SwEditShell::NumOrNoNum(..)> 1875*cdf0e10cSrcweir // should only change the <IsCounted()> state of 1876*cdf0e10cSrcweir // the current paragraph depending of the key. 1877*cdf0e10cSrcweir // On <backspace> it is set to <false>, 1878*cdf0e10cSrcweir // on <shift-backspace> it is set to <true>. 1879*cdf0e10cSrcweir // Thus, assure that method <SwEditShell::NumOrNum(..)> 1880*cdf0e10cSrcweir // is only called for the intended purpose. 1881*cdf0e10cSrcweir bool bCallNumOrNoNum( false ); 1882*cdf0e10cSrcweir { 1883*cdf0e10cSrcweir if ( !bDone ) 1884*cdf0e10cSrcweir { 1885*cdf0e10cSrcweir if ( bOnlyBackspaceKey && !rSh.IsNoNum() ) 1886*cdf0e10cSrcweir { 1887*cdf0e10cSrcweir bCallNumOrNoNum = true; 1888*cdf0e10cSrcweir } 1889*cdf0e10cSrcweir else if ( !bOnlyBackspaceKey && rSh.IsNoNum() ) 1890*cdf0e10cSrcweir { 1891*cdf0e10cSrcweir bCallNumOrNoNum = true; 1892*cdf0e10cSrcweir } 1893*cdf0e10cSrcweir else if ( bOnlyBackspaceKey && 1894*cdf0e10cSrcweir rSh.IsSttPara() && rSh.IsEndPara() && 1895*cdf0e10cSrcweir !rSh.HasSelection() ) 1896*cdf0e10cSrcweir { 1897*cdf0e10cSrcweir const SwNumRule* pCurrNumRule( rSh.GetCurNumRule() ); 1898*cdf0e10cSrcweir if ( pCurrNumRule && 1899*cdf0e10cSrcweir pCurrNumRule != rSh.GetOutlineNumRule() ) 1900*cdf0e10cSrcweir { 1901*cdf0e10cSrcweir bCallNumOrNoNum = true; 1902*cdf0e10cSrcweir } 1903*cdf0e10cSrcweir } 1904*cdf0e10cSrcweir } 1905*cdf0e10cSrcweir } 1906*cdf0e10cSrcweir if ( bCallNumOrNoNum && 1907*cdf0e10cSrcweir rSh.NumOrNoNum( !bOnlyBackspaceKey, sal_True ) ) 1908*cdf0e10cSrcweir { 1909*cdf0e10cSrcweir eKeyState = KS_NumOrNoNum; 1910*cdf0e10cSrcweir } 1911*cdf0e10cSrcweir // <-- 1912*cdf0e10cSrcweir } 1913*cdf0e10cSrcweir } 1914*cdf0e10cSrcweir break; 1915*cdf0e10cSrcweir 1916*cdf0e10cSrcweir case KEY_RIGHT: 1917*cdf0e10cSrcweir { 1918*cdf0e10cSrcweir eFlyState = KS_Fly_Change; 1919*cdf0e10cSrcweir nDir = MOVE_RIGHT_BIG; 1920*cdf0e10cSrcweir eTblChgMode = nsTblChgWidthHeightType::WH_FLAG_INSDEL | nsTblChgWidthHeightType::WH_COL_RIGHT; 1921*cdf0e10cSrcweir nTblChgSize = pModOpt->GetTblVInsert(); 1922*cdf0e10cSrcweir goto KEYINPUT_CHECKTABLE_INSDEL; 1923*cdf0e10cSrcweir } 1924*cdf0e10cSrcweir case KEY_TAB: 1925*cdf0e10cSrcweir { 1926*cdf0e10cSrcweir 1927*cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 1928*cdf0e10cSrcweir sal_Bool bOld = rSh.ChgCrsrTimerFlag( sal_False ); 1929*cdf0e10cSrcweir #endif 1930*cdf0e10cSrcweir if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark() || rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT) 1931*cdf0e10cSrcweir { 1932*cdf0e10cSrcweir eKeyState=KS_GotoNextFieldMark; 1933*cdf0e10cSrcweir } 1934*cdf0e10cSrcweir else 1935*cdf0e10cSrcweir if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && 1936*cdf0e10cSrcweir !rSh.HasReadonlySel() ) 1937*cdf0e10cSrcweir { 1938*cdf0e10cSrcweir // --> OD 2007-10-02 #b660435# 1939*cdf0e10cSrcweir // if (rSh.IsFirstOfNumRule()) // #i23725# 1940*cdf0e10cSrcweir if ( rSh.IsFirstOfNumRule() && 1941*cdf0e10cSrcweir numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() ) 1942*cdf0e10cSrcweir // <-- 1943*cdf0e10cSrcweir eKeyState = KS_NumIndentInc; 1944*cdf0e10cSrcweir else 1945*cdf0e10cSrcweir eKeyState = KS_NumDown; 1946*cdf0e10cSrcweir } 1947*cdf0e10cSrcweir else if ( rSh.GetTableFmt() ) 1948*cdf0e10cSrcweir { 1949*cdf0e10cSrcweir if( rSh.HasSelection() || rSh.HasReadonlySel() ) 1950*cdf0e10cSrcweir eKeyState = KS_NextCell; 1951*cdf0e10cSrcweir else 1952*cdf0e10cSrcweir eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_NextCell; 1953*cdf0e10cSrcweir } 1954*cdf0e10cSrcweir else if ( rSh.GetSelectionType() & 1955*cdf0e10cSrcweir (nsSelectionType::SEL_GRF | 1956*cdf0e10cSrcweir nsSelectionType::SEL_FRM | 1957*cdf0e10cSrcweir nsSelectionType::SEL_OLE | 1958*cdf0e10cSrcweir nsSelectionType::SEL_DRW | 1959*cdf0e10cSrcweir nsSelectionType::SEL_DRW_FORM)) 1960*cdf0e10cSrcweir 1961*cdf0e10cSrcweir eKeyState = KS_NextObject; 1962*cdf0e10cSrcweir else 1963*cdf0e10cSrcweir { 1964*cdf0e10cSrcweir eKeyState = KS_InsTab; 1965*cdf0e10cSrcweir if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) 1966*cdf0e10cSrcweir { 1967*cdf0e10cSrcweir SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 1968*cdf0e10cSrcweir if( pColl && 1969*cdf0e10cSrcweir //0 <= pColl->GetOutlineLevel() && #i24560# 1970*cdf0e10cSrcweir //MAXLEVEL - 1 > pColl->GetOutlineLevel() )//#outline level,zhaojianwei 1971*cdf0e10cSrcweir pColl->IsAssignedToListLevelOfOutlineStyle() 1972*cdf0e10cSrcweir && MAXLEVEL-1 > pColl->GetAssignedOutlineStyleLevel() )//<-end,zhaojianwei 1973*cdf0e10cSrcweir eKeyState = KS_OutlineDown; 1974*cdf0e10cSrcweir } 1975*cdf0e10cSrcweir } 1976*cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 1977*cdf0e10cSrcweir rSh.ChgCrsrTimerFlag( bOld ); 1978*cdf0e10cSrcweir #endif 1979*cdf0e10cSrcweir } 1980*cdf0e10cSrcweir break; 1981*cdf0e10cSrcweir case KEY_TAB | KEY_SHIFT: 1982*cdf0e10cSrcweir { 1983*cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 1984*cdf0e10cSrcweir sal_Bool bOld = rSh.ChgCrsrTimerFlag( sal_False ); 1985*cdf0e10cSrcweir sal_Bool bOld = rSh.ChgCrsrTimerFlag( sal_False ); 1986*cdf0e10cSrcweir #endif 1987*cdf0e10cSrcweir if (rSh.IsFormProtected() || rSh.GetCurrentFieldmark()|| rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT) { 1988*cdf0e10cSrcweir eKeyState=KS_GotoPrevFieldMark; 1989*cdf0e10cSrcweir } 1990*cdf0e10cSrcweir else if( rSh.GetCurNumRule() && rSh.IsSttOfPara() && 1991*cdf0e10cSrcweir !rSh.HasReadonlySel() ) 1992*cdf0e10cSrcweir { 1993*cdf0e10cSrcweir // --> OD 2007-10-02 #b660435# 1994*cdf0e10cSrcweir // if (rSh.IsFirstOfNumRule()) // #i23725# 1995*cdf0e10cSrcweir if ( rSh.IsFirstOfNumRule() && 1996*cdf0e10cSrcweir numfunc::ChangeIndentOnTabAtFirstPosOfFirstListItem() ) 1997*cdf0e10cSrcweir // <-- 1998*cdf0e10cSrcweir eKeyState = KS_NumIndentDec; 1999*cdf0e10cSrcweir else 2000*cdf0e10cSrcweir eKeyState = KS_NumUp; 2001*cdf0e10cSrcweir } 2002*cdf0e10cSrcweir else if ( rSh.GetTableFmt() ) 2003*cdf0e10cSrcweir { 2004*cdf0e10cSrcweir if( rSh.HasSelection() || rSh.HasReadonlySel() ) 2005*cdf0e10cSrcweir eKeyState = KS_PrevCell; 2006*cdf0e10cSrcweir else 2007*cdf0e10cSrcweir eKeyState = KS_CheckAutoCorrect, eNextKeyState = KS_PrevCell; 2008*cdf0e10cSrcweir } 2009*cdf0e10cSrcweir else if ( rSh.GetSelectionType() & 2010*cdf0e10cSrcweir (nsSelectionType::SEL_GRF | 2011*cdf0e10cSrcweir nsSelectionType::SEL_FRM | 2012*cdf0e10cSrcweir nsSelectionType::SEL_OLE | 2013*cdf0e10cSrcweir nsSelectionType::SEL_DRW | 2014*cdf0e10cSrcweir nsSelectionType::SEL_DRW_FORM)) 2015*cdf0e10cSrcweir 2016*cdf0e10cSrcweir eKeyState = KS_PrevObject; 2017*cdf0e10cSrcweir else 2018*cdf0e10cSrcweir { 2019*cdf0e10cSrcweir eKeyState = KS_Ende; 2020*cdf0e10cSrcweir if( rSh.IsSttOfPara() && !rSh.HasReadonlySel() ) 2021*cdf0e10cSrcweir { 2022*cdf0e10cSrcweir SwTxtFmtColl* pColl = rSh.GetCurTxtFmtColl(); 2023*cdf0e10cSrcweir //if( pColl && 0 < pColl->GetOutlineLevel() && //#outline level,zhaojianwei 2024*cdf0e10cSrcweir // MAXLEVEL - 1 >= pColl->GetOutlineLevel() ) 2025*cdf0e10cSrcweir if( pColl && 2026*cdf0e10cSrcweir pColl->IsAssignedToListLevelOfOutlineStyle() && 2027*cdf0e10cSrcweir 0 < pColl->GetAssignedOutlineStyleLevel()) 2028*cdf0e10cSrcweir eKeyState = KS_OutlineUp; 2029*cdf0e10cSrcweir } 2030*cdf0e10cSrcweir } 2031*cdf0e10cSrcweir #ifdef SW_CRSR_TIMER 2032*cdf0e10cSrcweir rSh.ChgCrsrTimerFlag( bOld ); 2033*cdf0e10cSrcweir #endif 2034*cdf0e10cSrcweir } 2035*cdf0e10cSrcweir break; 2036*cdf0e10cSrcweir case KEY_TAB | KEY_MOD1: 2037*cdf0e10cSrcweir case KEY_TAB | KEY_MOD2: 2038*cdf0e10cSrcweir if( !rSh.HasReadonlySel() ) 2039*cdf0e10cSrcweir { 2040*cdf0e10cSrcweir if( aTmpQHD.HasCntnt() && !rSh.HasSelection() ) 2041*cdf0e10cSrcweir { 2042*cdf0e10cSrcweir // zum naechsten Tip 2043*cdf0e10cSrcweir aTmpQHD.Inc( pACorr && pACorr->GetSwFlags(). 2044*cdf0e10cSrcweir bAutoCmpltEndless ); 2045*cdf0e10cSrcweir eKeyState = KS_NextPrevGlossary; 2046*cdf0e10cSrcweir } 2047*cdf0e10cSrcweir else if( rSh.GetTableFmt() ) 2048*cdf0e10cSrcweir eKeyState = KS_InsTab; 2049*cdf0e10cSrcweir else if((rSh.GetSelectionType() & 2050*cdf0e10cSrcweir (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM| 2051*cdf0e10cSrcweir nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF)) && 2052*cdf0e10cSrcweir rSh.GetDrawView()->AreObjectsMarked()) 2053*cdf0e10cSrcweir eKeyState = KS_EnterDrawHandleMode; 2054*cdf0e10cSrcweir else 2055*cdf0e10cSrcweir { 2056*cdf0e10cSrcweir eKeyState = KS_InsTab; 2057*cdf0e10cSrcweir } 2058*cdf0e10cSrcweir } 2059*cdf0e10cSrcweir break; 2060*cdf0e10cSrcweir 2061*cdf0e10cSrcweir case KEY_TAB | KEY_MOD1 | KEY_SHIFT: 2062*cdf0e10cSrcweir if( aTmpQHD.HasCntnt() && !rSh.HasSelection() && 2063*cdf0e10cSrcweir !rSh.HasReadonlySel() ) 2064*cdf0e10cSrcweir { 2065*cdf0e10cSrcweir // zum vorherigen Tip 2066*cdf0e10cSrcweir aTmpQHD.Dec( pACorr && pACorr->GetSwFlags(). 2067*cdf0e10cSrcweir bAutoCmpltEndless ); 2068*cdf0e10cSrcweir eKeyState = KS_NextPrevGlossary; 2069*cdf0e10cSrcweir } 2070*cdf0e10cSrcweir else if((rSh.GetSelectionType() & (nsSelectionType::SEL_DRW|nsSelectionType::SEL_DRW_FORM| 2071*cdf0e10cSrcweir nsSelectionType::SEL_FRM|nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF)) && 2072*cdf0e10cSrcweir rSh.GetDrawView()->AreObjectsMarked()) 2073*cdf0e10cSrcweir eKeyState = KS_EnterDrawHandleMode; 2074*cdf0e10cSrcweir break; 2075*cdf0e10cSrcweir case KEY_F2 : 2076*cdf0e10cSrcweir if( !rSh.HasReadonlySel() ) 2077*cdf0e10cSrcweir { 2078*cdf0e10cSrcweir const int nSelectionType = rSh.GetSelectionType(); 2079*cdf0e10cSrcweir if(nSelectionType & nsSelectionType::SEL_FRM) 2080*cdf0e10cSrcweir eKeyState = KS_GoIntoFly; 2081*cdf0e10cSrcweir else if((nSelectionType & nsSelectionType::SEL_DRW)) 2082*cdf0e10cSrcweir eKeyState = KS_GoIntoDrawing; 2083*cdf0e10cSrcweir } 2084*cdf0e10cSrcweir break; 2085*cdf0e10cSrcweir } 2086*cdf0e10cSrcweir } 2087*cdf0e10cSrcweir break; 2088*cdf0e10cSrcweir case KS_CheckDocReadOnlyKeys: 2089*cdf0e10cSrcweir { 2090*cdf0e10cSrcweir eKeyState = KS_KeyToView; 2091*cdf0e10cSrcweir switch( rKeyCode.GetModifier() | rKeyCode.GetCode() ) 2092*cdf0e10cSrcweir { 2093*cdf0e10cSrcweir case KEY_TAB: 2094*cdf0e10cSrcweir case KEY_TAB | KEY_SHIFT: 2095*cdf0e10cSrcweir bNormalChar = sal_False; 2096*cdf0e10cSrcweir eKeyState = KS_Ende; 2097*cdf0e10cSrcweir if ( rSh.GetSelectionType() & 2098*cdf0e10cSrcweir (nsSelectionType::SEL_GRF | 2099*cdf0e10cSrcweir nsSelectionType::SEL_FRM | 2100*cdf0e10cSrcweir nsSelectionType::SEL_OLE | 2101*cdf0e10cSrcweir nsSelectionType::SEL_DRW | 2102*cdf0e10cSrcweir nsSelectionType::SEL_DRW_FORM)) 2103*cdf0e10cSrcweir 2104*cdf0e10cSrcweir { 2105*cdf0e10cSrcweir eKeyState = rKeyCode.GetModifier() & KEY_SHIFT ? 2106*cdf0e10cSrcweir KS_PrevObject : KS_NextObject; 2107*cdf0e10cSrcweir } 2108*cdf0e10cSrcweir else 2109*cdf0e10cSrcweir rSh.SelectNextPrevHyperlink( 2110*cdf0e10cSrcweir KEY_SHIFT != rKeyCode.GetModifier() ); 2111*cdf0e10cSrcweir break; 2112*cdf0e10cSrcweir case KEY_RETURN: 2113*cdf0e10cSrcweir { 2114*cdf0e10cSrcweir const int nSelectionType = rSh.GetSelectionType(); 2115*cdf0e10cSrcweir if(nSelectionType & nsSelectionType::SEL_FRM) 2116*cdf0e10cSrcweir eKeyState = KS_GoIntoFly; 2117*cdf0e10cSrcweir else 2118*cdf0e10cSrcweir { 2119*cdf0e10cSrcweir SfxItemSet aSet(rSh.GetAttrPool(), RES_TXTATR_INETFMT, RES_TXTATR_INETFMT); 2120*cdf0e10cSrcweir rSh.GetCurAttr(aSet); 2121*cdf0e10cSrcweir if(SFX_ITEM_SET == aSet.GetItemState(RES_TXTATR_INETFMT, sal_False)) 2122*cdf0e10cSrcweir { 2123*cdf0e10cSrcweir const SfxPoolItem& rItem = aSet.Get(RES_TXTATR_INETFMT, sal_True); 2124*cdf0e10cSrcweir bNormalChar = sal_False; 2125*cdf0e10cSrcweir eKeyState = KS_Ende; 2126*cdf0e10cSrcweir rSh.ClickToINetAttr((const SwFmtINetFmt&)rItem, URLLOAD_NOFILTER); 2127*cdf0e10cSrcweir } 2128*cdf0e10cSrcweir } 2129*cdf0e10cSrcweir } 2130*cdf0e10cSrcweir break; 2131*cdf0e10cSrcweir } 2132*cdf0e10cSrcweir } 2133*cdf0e10cSrcweir break; 2134*cdf0e10cSrcweir 2135*cdf0e10cSrcweir case KS_EnterCharCell: 2136*cdf0e10cSrcweir { 2137*cdf0e10cSrcweir eKeyState = KS_KeyToView; 2138*cdf0e10cSrcweir switch ( rKeyCode.GetModifier() | rKeyCode.GetCode() ) 2139*cdf0e10cSrcweir { 2140*cdf0e10cSrcweir case KEY_RIGHT | KEY_MOD2: 2141*cdf0e10cSrcweir rSh.Right( CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 2142*cdf0e10cSrcweir eKeyState = KS_Ende; 2143*cdf0e10cSrcweir FlushInBuffer(); 2144*cdf0e10cSrcweir break; 2145*cdf0e10cSrcweir case KEY_LEFT | KEY_MOD2: 2146*cdf0e10cSrcweir rSh.Left( CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 2147*cdf0e10cSrcweir eKeyState = KS_Ende; 2148*cdf0e10cSrcweir FlushInBuffer(); 2149*cdf0e10cSrcweir break; 2150*cdf0e10cSrcweir } 2151*cdf0e10cSrcweir } 2152*cdf0e10cSrcweir break; 2153*cdf0e10cSrcweir 2154*cdf0e10cSrcweir case KS_KeyToView: 2155*cdf0e10cSrcweir { 2156*cdf0e10cSrcweir eKeyState = KS_Ende; 2157*cdf0e10cSrcweir bNormalChar = 2158*cdf0e10cSrcweir !rKeyCode.IsMod2() && 2159*cdf0e10cSrcweir rKeyCode.GetModifier() != (KEY_MOD1) && 2160*cdf0e10cSrcweir rKeyCode.GetModifier() != (KEY_MOD1|KEY_SHIFT) && 2161*cdf0e10cSrcweir SW_ISPRINTABLE( aCh ); 2162*cdf0e10cSrcweir 2163*cdf0e10cSrcweir if (bNormalChar && rSh.IsInFrontOfLabel()) 2164*cdf0e10cSrcweir { 2165*cdf0e10cSrcweir rSh.NumOrNoNum(sal_False); 2166*cdf0e10cSrcweir } 2167*cdf0e10cSrcweir 2168*cdf0e10cSrcweir if( aInBuffer.Len() && ( !bNormalChar || bIsDocReadOnly )) 2169*cdf0e10cSrcweir FlushInBuffer(); 2170*cdf0e10cSrcweir 2171*cdf0e10cSrcweir if( rView.KeyInput( aKeyEvent ) ) 2172*cdf0e10cSrcweir bFlushBuffer = sal_True, bNormalChar = sal_False; 2173*cdf0e10cSrcweir else 2174*cdf0e10cSrcweir { 2175*cdf0e10cSrcweir // OS 22.09.95: Da der Sfx Acceleratoren nur aufruft, wenn sie beim letzten 2176*cdf0e10cSrcweir // Statusupdate enabled wurden, muss copy ggf. von uns 2177*cdf0e10cSrcweir // 'gewaltsam' gerufen werden. 2178*cdf0e10cSrcweir if( rKeyCode.GetFunction() == KEYFUNC_COPY ) 2179*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Execute(SID_COPY); 2180*cdf0e10cSrcweir 2181*cdf0e10cSrcweir 2182*cdf0e10cSrcweir if( !bIsDocReadOnly && bNormalChar ) 2183*cdf0e10cSrcweir { 2184*cdf0e10cSrcweir const int nSelectionType = rSh.GetSelectionType(); 2185*cdf0e10cSrcweir if((nSelectionType & nsSelectionType::SEL_DRW) && 2186*cdf0e10cSrcweir 0 == (nSelectionType & nsSelectionType::SEL_DRW_TXT) && 2187*cdf0e10cSrcweir rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1) 2188*cdf0e10cSrcweir { 2189*cdf0e10cSrcweir SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 2190*cdf0e10cSrcweir if(pObj) 2191*cdf0e10cSrcweir { 2192*cdf0e10cSrcweir EnterDrawTextMode(pObj->GetLogicRect().Center()); 2193*cdf0e10cSrcweir if ( rView.GetCurShell()->ISA(SwDrawTextShell) ) 2194*cdf0e10cSrcweir ((SwDrawTextShell*)rView.GetCurShell())->Init(); 2195*cdf0e10cSrcweir rSh.GetDrawView()->KeyInput( rKEvt, this ); 2196*cdf0e10cSrcweir } 2197*cdf0e10cSrcweir } 2198*cdf0e10cSrcweir else if(nSelectionType & nsSelectionType::SEL_FRM) 2199*cdf0e10cSrcweir { 2200*cdf0e10cSrcweir rSh.UnSelectFrm(); 2201*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 2202*cdf0e10cSrcweir rView.AttrChangedNotify(&rSh); 2203*cdf0e10cSrcweir rSh.MoveSection( fnSectionCurr, fnSectionEnd ); 2204*cdf0e10cSrcweir } 2205*cdf0e10cSrcweir eKeyState = KS_InsChar; 2206*cdf0e10cSrcweir } 2207*cdf0e10cSrcweir else 2208*cdf0e10cSrcweir { 2209*cdf0e10cSrcweir bNormalChar = sal_False; 2210*cdf0e10cSrcweir Window::KeyInput( aKeyEvent ); 2211*cdf0e10cSrcweir } 2212*cdf0e10cSrcweir } 2213*cdf0e10cSrcweir } 2214*cdf0e10cSrcweir break; 2215*cdf0e10cSrcweir case KS_LaunchOLEObject: 2216*cdf0e10cSrcweir rSh.LaunchOLEObj(); 2217*cdf0e10cSrcweir eKeyState = KS_Ende; 2218*cdf0e10cSrcweir break; 2219*cdf0e10cSrcweir case KS_GoIntoFly : 2220*cdf0e10cSrcweir rSh.UnSelectFrm(); 2221*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 2222*cdf0e10cSrcweir rView.AttrChangedNotify(&rSh); 2223*cdf0e10cSrcweir rSh.MoveSection( fnSectionCurr, fnSectionEnd ); 2224*cdf0e10cSrcweir eKeyState = KS_Ende; 2225*cdf0e10cSrcweir break; 2226*cdf0e10cSrcweir case KS_GoIntoDrawing : 2227*cdf0e10cSrcweir { 2228*cdf0e10cSrcweir SdrObject* pObj = rSh.GetDrawView()->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); 2229*cdf0e10cSrcweir if(pObj) 2230*cdf0e10cSrcweir { 2231*cdf0e10cSrcweir EnterDrawTextMode(pObj->GetLogicRect().Center()); 2232*cdf0e10cSrcweir if ( rView.GetCurShell()->ISA(SwDrawTextShell) ) 2233*cdf0e10cSrcweir ((SwDrawTextShell*)rView.GetCurShell())->Init(); 2234*cdf0e10cSrcweir } 2235*cdf0e10cSrcweir eKeyState = KS_Ende; 2236*cdf0e10cSrcweir } 2237*cdf0e10cSrcweir break; 2238*cdf0e10cSrcweir case KS_EnterDrawHandleMode: 2239*cdf0e10cSrcweir { 2240*cdf0e10cSrcweir const SdrHdlList& rHdlList = rSh.GetDrawView()->GetHdlList(); 2241*cdf0e10cSrcweir sal_Bool bForward(!aKeyEvent.GetKeyCode().IsShift()); 2242*cdf0e10cSrcweir 2243*cdf0e10cSrcweir ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward); 2244*cdf0e10cSrcweir eKeyState = KS_Ende; 2245*cdf0e10cSrcweir } 2246*cdf0e10cSrcweir break; 2247*cdf0e10cSrcweir case KS_InsTab: 2248*cdf0e10cSrcweir if( rView.ISA( SwWebView )) //Kein Tabulator fuer Web! 2249*cdf0e10cSrcweir { 2250*cdf0e10cSrcweir // Bug 56196 - dann sollte der weiter gereicht werden. 2251*cdf0e10cSrcweir Window::KeyInput( aKeyEvent ); 2252*cdf0e10cSrcweir eKeyState = KS_Ende; 2253*cdf0e10cSrcweir break; 2254*cdf0e10cSrcweir } 2255*cdf0e10cSrcweir aCh = '\t'; 2256*cdf0e10cSrcweir // kein break! 2257*cdf0e10cSrcweir case KS_InsChar: 2258*cdf0e10cSrcweir if (rSh.GetChar(sal_False)==CH_TXT_ATR_FORMELEMENT) 2259*cdf0e10cSrcweir { 2260*cdf0e10cSrcweir ::sw::mark::ICheckboxFieldmark* pFieldmark = 2261*cdf0e10cSrcweir dynamic_cast< ::sw::mark::ICheckboxFieldmark* > 2262*cdf0e10cSrcweir (rSh.GetCurrentFieldmark()); 2263*cdf0e10cSrcweir OSL_ENSURE(pFieldmark, 2264*cdf0e10cSrcweir "Where is my FieldMark??"); 2265*cdf0e10cSrcweir if(pFieldmark) 2266*cdf0e10cSrcweir { 2267*cdf0e10cSrcweir pFieldmark->SetChecked(!pFieldmark->IsChecked()); 2268*cdf0e10cSrcweir SwDocShell* pDocSh = rView.GetDocShell(); 2269*cdf0e10cSrcweir SwDoc *pDoc=pDocSh->GetDoc(); 2270*cdf0e10cSrcweir OSL_ENSURE(pFieldmark->IsExpanded(), 2271*cdf0e10cSrcweir "where is the otherpos?"); 2272*cdf0e10cSrcweir if (pFieldmark->IsExpanded()) 2273*cdf0e10cSrcweir { 2274*cdf0e10cSrcweir SwPaM aPaM(pFieldmark->GetMarkPos(), pFieldmark->GetOtherMarkPos()); 2275*cdf0e10cSrcweir if(0) 2276*cdf0e10cSrcweir { 2277*cdf0e10cSrcweir rSh.StartAllAction(); //$flr TODO: understand why this not works 2278*cdf0e10cSrcweir pDoc->SetModified(aPaM); 2279*cdf0e10cSrcweir rSh.EndAllAction(); 2280*cdf0e10cSrcweir } 2281*cdf0e10cSrcweir else 2282*cdf0e10cSrcweir { 2283*cdf0e10cSrcweir rSh.CalcLayout(); // workaround 2284*cdf0e10cSrcweir } 2285*cdf0e10cSrcweir } 2286*cdf0e10cSrcweir } 2287*cdf0e10cSrcweir eKeyState = KS_Ende; 2288*cdf0e10cSrcweir } 2289*cdf0e10cSrcweir else if(!rSh.HasReadonlySel()) 2290*cdf0e10cSrcweir { 2291*cdf0e10cSrcweir sal_Bool bIsNormalChar = GetAppCharClass().isLetterNumeric( 2292*cdf0e10cSrcweir String( aCh ), 0 ); 2293*cdf0e10cSrcweir if( bChkInsBlank && bIsNormalChar && 2294*cdf0e10cSrcweir (aInBuffer.Len() || !rSh.IsSttPara() || !rSh.IsEndPara() )) 2295*cdf0e10cSrcweir { 2296*cdf0e10cSrcweir // vor dem Zeichen noch ein Blank einfuegen. Dieses 2297*cdf0e10cSrcweir // kommt zwischen den Expandierten Text und dem neuen 2298*cdf0e10cSrcweir // "nicht Worttrenner". 2299*cdf0e10cSrcweir aInBuffer.Expand( aInBuffer.Len() + 1, ' ' ); 2300*cdf0e10cSrcweir } 2301*cdf0e10cSrcweir 2302*cdf0e10cSrcweir 2303*cdf0e10cSrcweir sal_Bool bIsAutoCorrectChar = SvxAutoCorrect::IsAutoCorrectChar( aCh ); 2304*cdf0e10cSrcweir sal_Bool bRunNext = pACorr && pACorr->HasRunNext(); 2305*cdf0e10cSrcweir if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) && 2306*cdf0e10cSrcweir pACfg->IsAutoFmtByInput() && 2307*cdf0e10cSrcweir (( pACorr->IsAutoCorrFlag( ChgWeightUnderl ) && 2308*cdf0e10cSrcweir ( '*' == aCh || '_' == aCh ) ) || 2309*cdf0e10cSrcweir ( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))|| 2310*cdf0e10cSrcweir ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh)))) 2311*cdf0e10cSrcweir { 2312*cdf0e10cSrcweir FlushInBuffer(); 2313*cdf0e10cSrcweir rSh.AutoCorrect( *pACorr, aCh ); 2314*cdf0e10cSrcweir if( '\"' != aCh && '\'' != aCh ) // nur bei "*_" rufen! 2315*cdf0e10cSrcweir rSh.UpdateAttr(); 2316*cdf0e10cSrcweir } 2317*cdf0e10cSrcweir else if( !aKeyEvent.GetRepeat() && pACorr && ( bIsAutoCorrectChar || bRunNext ) && 2318*cdf0e10cSrcweir pACfg->IsAutoFmtByInput() && 2319*cdf0e10cSrcweir pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | 2320*cdf0e10cSrcweir ChgOrdinalNumber | AddNonBrkSpace | 2321*cdf0e10cSrcweir ChgToEnEmDash | SetINetAttr | 2322*cdf0e10cSrcweir Autocorrect ) && 2323*cdf0e10cSrcweir '\"' != aCh && '\'' != aCh && '*' != aCh && '_' != aCh 2324*cdf0e10cSrcweir ) 2325*cdf0e10cSrcweir { 2326*cdf0e10cSrcweir FlushInBuffer(); 2327*cdf0e10cSrcweir rSh.AutoCorrect( *pACorr, aCh ); 2328*cdf0e10cSrcweir } 2329*cdf0e10cSrcweir else 2330*cdf0e10cSrcweir { 2331*cdf0e10cSrcweir aInBuffer.Expand( aInBuffer.Len() + aKeyEvent.GetRepeat() + 1,aCh ); 2332*cdf0e10cSrcweir bFlushCharBuffer = Application::AnyInput( INPUT_KEYBOARD ); 2333*cdf0e10cSrcweir bFlushBuffer = !bFlushCharBuffer; 2334*cdf0e10cSrcweir if( bFlushCharBuffer ) 2335*cdf0e10cSrcweir aKeyInputFlushTimer.Start(); 2336*cdf0e10cSrcweir } 2337*cdf0e10cSrcweir eKeyState = KS_Ende; 2338*cdf0e10cSrcweir } 2339*cdf0e10cSrcweir else 2340*cdf0e10cSrcweir { 2341*cdf0e10cSrcweir InfoBox( this, SW_RES( MSG_READONLY_CONTENT )).Execute(); 2342*cdf0e10cSrcweir // ??? Window::KeyInput( aKeyEvent ); 2343*cdf0e10cSrcweir eKeyState = KS_Ende; 2344*cdf0e10cSrcweir } 2345*cdf0e10cSrcweir break; 2346*cdf0e10cSrcweir 2347*cdf0e10cSrcweir case KS_CheckAutoCorrect: 2348*cdf0e10cSrcweir { 2349*cdf0e10cSrcweir if( pACorr && pACfg->IsAutoFmtByInput() && 2350*cdf0e10cSrcweir pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | 2351*cdf0e10cSrcweir ChgOrdinalNumber | 2352*cdf0e10cSrcweir ChgToEnEmDash | SetINetAttr | 2353*cdf0e10cSrcweir Autocorrect ) && 2354*cdf0e10cSrcweir !rSh.HasReadonlySel() ) 2355*cdf0e10cSrcweir /* { 2356*cdf0e10cSrcweir pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | 2357*cdf0e10cSrcweir ChgFractionSymbol | ChgOrdinalNumber | 2358*cdf0e10cSrcweir ChgToEnEmDash | SetINetAttr | 2359*cdf0e10cSrcweir Autocorrect ) && 2360*cdf0e10cSrcweir !rSh.HasReadonlySel() ) */ 2361*cdf0e10cSrcweir { 2362*cdf0e10cSrcweir FlushInBuffer(); 2363*cdf0e10cSrcweir rSh.AutoCorrect( *pACorr, static_cast< sal_Unicode >('\0') ); 2364*cdf0e10cSrcweir } 2365*cdf0e10cSrcweir eKeyState = eNextKeyState; 2366*cdf0e10cSrcweir } 2367*cdf0e10cSrcweir break; 2368*cdf0e10cSrcweir 2369*cdf0e10cSrcweir default: 2370*cdf0e10cSrcweir { 2371*cdf0e10cSrcweir sal_uInt16 nSlotId = 0; 2372*cdf0e10cSrcweir FlushInBuffer(); 2373*cdf0e10cSrcweir //??? if( bFlushCharBuffer ) 2374*cdf0e10cSrcweir //??? FlushInBuffer( &rSh ); 2375*cdf0e10cSrcweir switch( eKeyState ) 2376*cdf0e10cSrcweir { 2377*cdf0e10cSrcweir case KS_SpecialInsert: 2378*cdf0e10cSrcweir rSh.DoSpecialInsert(); 2379*cdf0e10cSrcweir break; 2380*cdf0e10cSrcweir 2381*cdf0e10cSrcweir case KS_NoNum: 2382*cdf0e10cSrcweir rSh.NoNum(); 2383*cdf0e10cSrcweir break; 2384*cdf0e10cSrcweir 2385*cdf0e10cSrcweir case KS_NumOff: 2386*cdf0e10cSrcweir // Shellwechsel - also vorher aufzeichnen 2387*cdf0e10cSrcweir rSh.DelNumRules(); 2388*cdf0e10cSrcweir eKeyState = eNextKeyState; 2389*cdf0e10cSrcweir break; 2390*cdf0e10cSrcweir case KS_OutlineLvOff: // delete autofmt outlinelevel later 2391*cdf0e10cSrcweir break; 2392*cdf0e10cSrcweir 2393*cdf0e10cSrcweir case KS_NumDown: 2394*cdf0e10cSrcweir rSh.NumUpDown( sal_True ); 2395*cdf0e10cSrcweir nKS_NUMDOWN_Count = 2; // #i23725# 2396*cdf0e10cSrcweir break; 2397*cdf0e10cSrcweir case KS_NumUp: 2398*cdf0e10cSrcweir rSh.NumUpDown( sal_False ); 2399*cdf0e10cSrcweir break; 2400*cdf0e10cSrcweir 2401*cdf0e10cSrcweir // -> #i23726# 2402*cdf0e10cSrcweir case KS_NumIndentInc: 2403*cdf0e10cSrcweir // --> OD 2008-06-16 #i90078# 2404*cdf0e10cSrcweir rSh.ChangeIndentOfAllListLevels(360); 2405*cdf0e10cSrcweir // <-- 2406*cdf0e10cSrcweir nKS_NUMINDENTINC_Count = 2; 2407*cdf0e10cSrcweir break; 2408*cdf0e10cSrcweir 2409*cdf0e10cSrcweir case KS_GotoNextFieldMark: 2410*cdf0e10cSrcweir { 2411*cdf0e10cSrcweir ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkAfter(); 2412*cdf0e10cSrcweir if(pFieldmark) rSh.GotoFieldmark(pFieldmark); 2413*cdf0e10cSrcweir } 2414*cdf0e10cSrcweir break; 2415*cdf0e10cSrcweir 2416*cdf0e10cSrcweir case KS_GotoPrevFieldMark: 2417*cdf0e10cSrcweir { 2418*cdf0e10cSrcweir ::sw::mark::IFieldmark const * const pFieldmark = rSh.GetFieldmarkBefore(); 2419*cdf0e10cSrcweir if(pFieldmark) rSh.GotoFieldmark(pFieldmark); 2420*cdf0e10cSrcweir } 2421*cdf0e10cSrcweir break; 2422*cdf0e10cSrcweir 2423*cdf0e10cSrcweir case KS_NumIndentDec: 2424*cdf0e10cSrcweir // --> OD 2008-06-16 #i90078# 2425*cdf0e10cSrcweir rSh.ChangeIndentOfAllListLevels(-360); 2426*cdf0e10cSrcweir // <-- 2427*cdf0e10cSrcweir break; 2428*cdf0e10cSrcweir // <- #i23726# 2429*cdf0e10cSrcweir 2430*cdf0e10cSrcweir case KS_OutlineDown: 2431*cdf0e10cSrcweir rSh.OutlineUpDown( 1 ); 2432*cdf0e10cSrcweir break; 2433*cdf0e10cSrcweir case KS_OutlineUp: 2434*cdf0e10cSrcweir rSh.OutlineUpDown( -1 ); 2435*cdf0e10cSrcweir break; 2436*cdf0e10cSrcweir 2437*cdf0e10cSrcweir case KS_NextCell: 2438*cdf0e10cSrcweir //In Tabelle immer 'flushen' 2439*cdf0e10cSrcweir rSh.GoNextCell(); 2440*cdf0e10cSrcweir nSlotId = FN_GOTO_NEXT_CELL; 2441*cdf0e10cSrcweir break; 2442*cdf0e10cSrcweir case KS_PrevCell: 2443*cdf0e10cSrcweir rSh.GoPrevCell(); 2444*cdf0e10cSrcweir nSlotId = FN_GOTO_PREV_CELL; 2445*cdf0e10cSrcweir break; 2446*cdf0e10cSrcweir case KS_AutoFmtByInput: 2447*cdf0e10cSrcweir rSh.SplitNode( sal_True ); 2448*cdf0e10cSrcweir break; 2449*cdf0e10cSrcweir 2450*cdf0e10cSrcweir // case KS_NumOrNoNum: 2451*cdf0e10cSrcweir // break; 2452*cdf0e10cSrcweir case KS_NextObject: 2453*cdf0e10cSrcweir case KS_PrevObject: 2454*cdf0e10cSrcweir if(rSh.GotoObj( KS_NextObject == eKeyState, GOTOOBJ_GOTO_ANY)) 2455*cdf0e10cSrcweir { 2456*cdf0e10cSrcweir if( rSh.IsFrmSelected() && 2457*cdf0e10cSrcweir rView.GetDrawFuncPtr() ) 2458*cdf0e10cSrcweir { 2459*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 2460*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 2461*cdf0e10cSrcweir rView.LeaveDrawCreate(); 2462*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 2463*cdf0e10cSrcweir } 2464*cdf0e10cSrcweir rSh.HideCrsr(); 2465*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 2466*cdf0e10cSrcweir } 2467*cdf0e10cSrcweir break; 2468*cdf0e10cSrcweir case KS_GlossaryExpand: 2469*cdf0e10cSrcweir { 2470*cdf0e10cSrcweir // ersetze das Wort oder Kuerzel durch den den Textbaustein 2471*cdf0e10cSrcweir rSh.StartUndo( UNDO_START ); 2472*cdf0e10cSrcweir 2473*cdf0e10cSrcweir String sFnd( *aTmpQHD.aArr[ aTmpQHD.nCurArrPos ] ); 2474*cdf0e10cSrcweir if( aTmpQHD.bIsAutoText ) 2475*cdf0e10cSrcweir { 2476*cdf0e10cSrcweir SwGlossaryList* pList = ::GetGlossaryList(); 2477*cdf0e10cSrcweir String sShrtNm; 2478*cdf0e10cSrcweir String sGroup; 2479*cdf0e10cSrcweir if(pList->GetShortName( sFnd, sShrtNm, sGroup)) 2480*cdf0e10cSrcweir { 2481*cdf0e10cSrcweir rSh.SttSelect(); 2482*cdf0e10cSrcweir rSh.ExtendSelection( sal_False, aTmpQHD.nLen ); 2483*cdf0e10cSrcweir SwGlossaryHdl* pGlosHdl = GetView().GetGlosHdl(); 2484*cdf0e10cSrcweir pGlosHdl->SetCurGroup(sGroup, sal_True); 2485*cdf0e10cSrcweir pGlosHdl->InsertGlossary( sShrtNm); 2486*cdf0e10cSrcweir pQuickHlpData->bChkInsBlank = sal_True; 2487*cdf0e10cSrcweir } 2488*cdf0e10cSrcweir } 2489*cdf0e10cSrcweir else 2490*cdf0e10cSrcweir { 2491*cdf0e10cSrcweir rSh.Insert( sFnd.Erase( 0, aTmpQHD.nLen )); 2492*cdf0e10cSrcweir pQuickHlpData->bChkInsBlank = !pACorr || 2493*cdf0e10cSrcweir pACorr->GetSwFlags().bAutoCmpltAppendBlanc; 2494*cdf0e10cSrcweir } 2495*cdf0e10cSrcweir rSh.EndUndo( UNDO_END ); 2496*cdf0e10cSrcweir } 2497*cdf0e10cSrcweir break; 2498*cdf0e10cSrcweir 2499*cdf0e10cSrcweir case KS_NextPrevGlossary: 2500*cdf0e10cSrcweir pQuickHlpData->Move( aTmpQHD ); 2501*cdf0e10cSrcweir pQuickHlpData->Start( rSh, USHRT_MAX ); 2502*cdf0e10cSrcweir break; 2503*cdf0e10cSrcweir 2504*cdf0e10cSrcweir case KS_EditFormula: 2505*cdf0e10cSrcweir { 2506*cdf0e10cSrcweir const sal_uInt16 nId = SwInputChild::GetChildWindowId(); 2507*cdf0e10cSrcweir 2508*cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 2509*cdf0e10cSrcweir pVFrame->ToggleChildWindow( nId ); 2510*cdf0e10cSrcweir SwInputChild* pChildWin = (SwInputChild*)pVFrame-> 2511*cdf0e10cSrcweir GetChildWindow( nId ); 2512*cdf0e10cSrcweir if( pChildWin ) 2513*cdf0e10cSrcweir pChildWin->SetFormula( sFmlEntry ); 2514*cdf0e10cSrcweir } 2515*cdf0e10cSrcweir break; 2516*cdf0e10cSrcweir 2517*cdf0e10cSrcweir case KS_ColLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; 2518*cdf0e10cSrcweir case KS_ColRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; 2519*cdf0e10cSrcweir case KS_ColLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHMove() ); break; 2520*cdf0e10cSrcweir case KS_ColRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHMove() ); break; 2521*cdf0e10cSrcweir // case KS_ColTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break; 2522*cdf0e10cSrcweir case KS_ColBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break; 2523*cdf0e10cSrcweir // case KS_ColTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_TOP, pModOpt->GetTblVMove() ); break; 2524*cdf0e10cSrcweir case KS_ColBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVMove() ); break; 2525*cdf0e10cSrcweir case KS_CellLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; 2526*cdf0e10cSrcweir case KS_CellRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHMove() ); break; 2527*cdf0e10cSrcweir case KS_CellLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_LEFT, pModOpt->GetTblHMove() ); break; 2528*cdf0e10cSrcweir case KS_CellRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_RIGHT, pModOpt->GetTblHMove() ); break; 2529*cdf0e10cSrcweir case KS_CellTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break; 2530*cdf0e10cSrcweir case KS_CellBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVMove() ); break; 2531*cdf0e10cSrcweir case KS_CellTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_TOP, pModOpt->GetTblVMove() ); break; 2532*cdf0e10cSrcweir case KS_CellBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_CELL_BOTTOM, pModOpt->GetTblVMove() ); break; 2533*cdf0e10cSrcweir 2534*cdf0e10cSrcweir //--------------- 2535*cdf0e10cSrcweir case KS_InsDel_ColLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break; 2536*cdf0e10cSrcweir case KS_InsDel_ColRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break; 2537*cdf0e10cSrcweir case KS_InsDel_ColLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_LEFT, pModOpt->GetTblHInsert() ); break; 2538*cdf0e10cSrcweir case KS_InsDel_ColRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_COL_RIGHT, pModOpt->GetTblHInsert() ); break; 2539*cdf0e10cSrcweir case KS_InsDel_ColTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break; 2540*cdf0e10cSrcweir case KS_InsDel_ColBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break; 2541*cdf0e10cSrcweir case KS_InsDel_ColTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_TOP, pModOpt->GetTblVInsert() ); break; 2542*cdf0e10cSrcweir case KS_InsDel_ColBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_ROW_BOTTOM, pModOpt->GetTblVInsert() ); break; 2543*cdf0e10cSrcweir case KS_InsDel_CellLeftBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_LEFT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break; 2544*cdf0e10cSrcweir case KS_InsDel_CellRightBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_RIGHT|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblHInsert() ); break; 2545*cdf0e10cSrcweir case KS_InsDel_CellLeftSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_LEFT, pModOpt->GetTblHInsert() ); break; 2546*cdf0e10cSrcweir case KS_InsDel_CellRightSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_RIGHT, pModOpt->GetTblHInsert() ); break; 2547*cdf0e10cSrcweir case KS_InsDel_CellTopBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_TOP|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break; 2548*cdf0e10cSrcweir case KS_InsDel_CellBottomBig: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_BOTTOM|nsTblChgWidthHeightType::WH_FLAG_BIGGER, pModOpt->GetTblVInsert() ); break; 2549*cdf0e10cSrcweir case KS_InsDel_CellTopSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_TOP, pModOpt->GetTblVInsert() ); break; 2550*cdf0e10cSrcweir case KS_InsDel_CellBottomSmall: rSh.SetColRowWidthHeight( nsTblChgWidthHeightType::WH_FLAG_INSDEL|nsTblChgWidthHeightType::WH_CELL_BOTTOM, pModOpt->GetTblVInsert() ); break; 2551*cdf0e10cSrcweir //--------------- 2552*cdf0e10cSrcweir case KS_TblColCellInsDel: 2553*cdf0e10cSrcweir rSh.SetColRowWidthHeight( eTblChgMode, nTblChgSize ); 2554*cdf0e10cSrcweir break; 2555*cdf0e10cSrcweir case KS_Fly_Change: 2556*cdf0e10cSrcweir { 2557*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 2558*cdf0e10cSrcweir const SdrHdlList& rHdlList = pSdrView->GetHdlList(); 2559*cdf0e10cSrcweir if(rHdlList.GetFocusHdl()) 2560*cdf0e10cSrcweir ChangeDrawing( nDir ); 2561*cdf0e10cSrcweir else 2562*cdf0e10cSrcweir ChangeFly( nDir, rView.ISA( SwWebView ) ); 2563*cdf0e10cSrcweir } 2564*cdf0e10cSrcweir break; 2565*cdf0e10cSrcweir case KS_Draw_Change : 2566*cdf0e10cSrcweir ChangeDrawing( nDir ); 2567*cdf0e10cSrcweir break; 2568*cdf0e10cSrcweir default:; //prevent warning 2569*cdf0e10cSrcweir } 2570*cdf0e10cSrcweir if( nSlotId && rView.GetViewFrame()->GetBindings().GetRecorder().is() ) 2571*cdf0e10cSrcweir { 2572*cdf0e10cSrcweir SfxRequest aReq(rView.GetViewFrame(), nSlotId ); 2573*cdf0e10cSrcweir aReq.Done(); 2574*cdf0e10cSrcweir } 2575*cdf0e10cSrcweir eKeyState = KS_Ende; 2576*cdf0e10cSrcweir } 2577*cdf0e10cSrcweir } 2578*cdf0e10cSrcweir } 2579*cdf0e10cSrcweir 2580*cdf0e10cSrcweir if( bStopKeyInputTimer ) 2581*cdf0e10cSrcweir { 2582*cdf0e10cSrcweir aKeyInputTimer.Stop(); 2583*cdf0e10cSrcweir bTblInsDelMode = sal_False; 2584*cdf0e10cSrcweir } 2585*cdf0e10cSrcweir 2586*cdf0e10cSrcweir // falls die gepufferten Zeichen eingefuegt werden sollen 2587*cdf0e10cSrcweir if( bFlushBuffer && aInBuffer.Len() ) 2588*cdf0e10cSrcweir { 2589*cdf0e10cSrcweir //OS 16.02.96 11.04: bFlushCharBuffer wurde hier nicht zurueckgesetzt 2590*cdf0e10cSrcweir // warum nicht? 2591*cdf0e10cSrcweir sal_Bool bSave = bFlushCharBuffer; 2592*cdf0e10cSrcweir FlushInBuffer(); 2593*cdf0e10cSrcweir bFlushCharBuffer = bSave; 2594*cdf0e10cSrcweir 2595*cdf0e10cSrcweir // evt. Tip-Hilfe anzeigen 2596*cdf0e10cSrcweir String sWord; 2597*cdf0e10cSrcweir if( bNormalChar && pACfg && pACorr && 2598*cdf0e10cSrcweir ( pACfg->IsAutoTextTip() || 2599*cdf0e10cSrcweir pACorr->GetSwFlags().bAutoCompleteWords ) && 2600*cdf0e10cSrcweir rSh.GetPrevAutoCorrWord( *pACorr, sWord ) ) 2601*cdf0e10cSrcweir { 2602*cdf0e10cSrcweir ShowAutoTextCorrectQuickHelp(sWord, pACfg, pACorr); 2603*cdf0e10cSrcweir } 2604*cdf0e10cSrcweir } 2605*cdf0e10cSrcweir } 2606*cdf0e10cSrcweir 2607*cdf0e10cSrcweir /*-------------------------------------------------------------------- 2608*cdf0e10cSrcweir Beschreibung: MouseEvents 2609*cdf0e10cSrcweir --------------------------------------------------------------------*/ 2610*cdf0e10cSrcweir 2611*cdf0e10cSrcweir 2612*cdf0e10cSrcweir void SwEditWin::RstMBDownFlags() 2613*cdf0e10cSrcweir { 2614*cdf0e10cSrcweir //Nicht auf allen Systemen kommt vor dem modalen 2615*cdf0e10cSrcweir //Dialog noch ein MouseButton Up (wie unter WINDOWS). 2616*cdf0e10cSrcweir //Daher hier die Stati zuruecksetzen und die Maus 2617*cdf0e10cSrcweir //fuer den Dialog freigeben. 2618*cdf0e10cSrcweir bMBPressed = bNoInterrupt = sal_False; 2619*cdf0e10cSrcweir EnterArea(); 2620*cdf0e10cSrcweir ReleaseMouse(); 2621*cdf0e10cSrcweir } 2622*cdf0e10cSrcweir 2623*cdf0e10cSrcweir 2624*cdf0e10cSrcweir 2625*cdf0e10cSrcweir void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) 2626*cdf0e10cSrcweir { 2627*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 2628*cdf0e10cSrcweir 2629*cdf0e10cSrcweir // We have to check if a context menu is shown and we have an UI 2630*cdf0e10cSrcweir // active inplace client. In that case we have to ignore the mouse 2631*cdf0e10cSrcweir // button down event. Otherwise we would crash (context menu has been 2632*cdf0e10cSrcweir // opened by inplace client and we would deactivate the inplace client, 2633*cdf0e10cSrcweir // the contex menu is closed by VCL asynchronously which in the end 2634*cdf0e10cSrcweir // would work on deleted objects or the context menu has no parent anymore) 2635*cdf0e10cSrcweir // See #126086# and #128122# 2636*cdf0e10cSrcweir SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient(); 2637*cdf0e10cSrcweir sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); 2638*cdf0e10cSrcweir 2639*cdf0e10cSrcweir if ( bIsOleActive && PopupMenu::IsInExecute() ) 2640*cdf0e10cSrcweir return; 2641*cdf0e10cSrcweir 2642*cdf0e10cSrcweir MouseEvent rMEvt(_rMEvt); 2643*cdf0e10cSrcweir 2644*cdf0e10cSrcweir if (rView.GetPostItMgr()->IsHit(rMEvt.GetPosPixel())) 2645*cdf0e10cSrcweir return; 2646*cdf0e10cSrcweir 2647*cdf0e10cSrcweir rView.GetPostItMgr()->SetActiveSidebarWin(0); 2648*cdf0e10cSrcweir 2649*cdf0e10cSrcweir GrabFocus(); 2650*cdf0e10cSrcweir 2651*cdf0e10cSrcweir //ignore key modifiers for format paintbrush 2652*cdf0e10cSrcweir { 2653*cdf0e10cSrcweir sal_Bool bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard 2654*cdf0e10cSrcweir && pApplyTempl->pFormatClipboard->HasContent(); 2655*cdf0e10cSrcweir if( bExecFormatPaintbrush ) 2656*cdf0e10cSrcweir rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(), 2657*cdf0e10cSrcweir _rMEvt.GetMode(), _rMEvt.GetButtons() ); 2658*cdf0e10cSrcweir } 2659*cdf0e10cSrcweir 2660*cdf0e10cSrcweir bWasShdwCrsr = 0 != pShadCrsr; 2661*cdf0e10cSrcweir if( bWasShdwCrsr ) 2662*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 2663*cdf0e10cSrcweir 2664*cdf0e10cSrcweir const Point aDocPos( PixelToLogic( rMEvt.GetPosPixel() ) ); 2665*cdf0e10cSrcweir 2666*cdf0e10cSrcweir if ( IsChainMode() ) 2667*cdf0e10cSrcweir { 2668*cdf0e10cSrcweir SetChainMode( sal_False ); 2669*cdf0e10cSrcweir SwRect aDummy; 2670*cdf0e10cSrcweir SwFlyFrmFmt *pFmt = (SwFlyFrmFmt*)rSh.GetFlyFrmFmt(); 2671*cdf0e10cSrcweir if ( !rSh.Chainable( aDummy, *pFmt, aDocPos ) ) 2672*cdf0e10cSrcweir rSh.Chain( *pFmt, aDocPos ); 2673*cdf0e10cSrcweir UpdatePointer( aDocPos, rMEvt.GetModifier() ); 2674*cdf0e10cSrcweir return; 2675*cdf0e10cSrcweir } 2676*cdf0e10cSrcweir 2677*cdf0e10cSrcweir //Nach GrabFocus sollte eine Shell gepusht sein. Das muss eigentlich 2678*cdf0e10cSrcweir //klappen aber in der Praxis ... 2679*cdf0e10cSrcweir lcl_SelectShellForDrop( rView ); 2680*cdf0e10cSrcweir 2681*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly(); 2682*cdf0e10cSrcweir sal_Bool bCallBase = sal_True; 2683*cdf0e10cSrcweir 2684*cdf0e10cSrcweir if( pQuickHlpData->bClear ) 2685*cdf0e10cSrcweir pQuickHlpData->Stop( rSh ); 2686*cdf0e10cSrcweir pQuickHlpData->bChkInsBlank = sal_False; 2687*cdf0e10cSrcweir 2688*cdf0e10cSrcweir if( rSh.FinishOLEObj() ) 2689*cdf0e10cSrcweir return; //InPlace beenden und der Klick zaehlt nicht mehr 2690*cdf0e10cSrcweir 2691*cdf0e10cSrcweir SET_CURR_SHELL( &rSh ); 2692*cdf0e10cSrcweir 2693*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 2694*cdf0e10cSrcweir if ( pSdrView ) 2695*cdf0e10cSrcweir { 2696*cdf0e10cSrcweir if (pSdrView->MouseButtonDown( rMEvt, this ) ) 2697*cdf0e10cSrcweir { 2698*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); 2699*cdf0e10cSrcweir return; // Event von der SdrView ausgewertet 2700*cdf0e10cSrcweir } 2701*cdf0e10cSrcweir } 2702*cdf0e10cSrcweir 2703*cdf0e10cSrcweir 2704*cdf0e10cSrcweir bIsInMove = sal_False; 2705*cdf0e10cSrcweir aStartPos = rMEvt.GetPosPixel(); 2706*cdf0e10cSrcweir aRszMvHdlPt.X() = 0, aRszMvHdlPt.Y() = 0; 2707*cdf0e10cSrcweir 2708*cdf0e10cSrcweir sal_uInt8 nMouseTabCol = 0; 2709*cdf0e10cSrcweir const sal_Bool bTmp = !rSh.IsDrawCreate() && !pApplyTempl && !rSh.IsInSelect() && 2710*cdf0e10cSrcweir rMEvt.GetClicks() == 1 && MOUSE_LEFT == rMEvt.GetButtons(); 2711*cdf0e10cSrcweir if ( bTmp && 2712*cdf0e10cSrcweir 0 != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPos ) ) && 2713*cdf0e10cSrcweir !rSh.IsObjSelectable( aDocPos ) ) 2714*cdf0e10cSrcweir { 2715*cdf0e10cSrcweir // --> FME 2004-07-30 #i32329# Enhanced table selection 2716*cdf0e10cSrcweir if ( SW_TABSEL_HORI <= nMouseTabCol && SW_TABCOLSEL_VERT >= nMouseTabCol ) 2717*cdf0e10cSrcweir { 2718*cdf0e10cSrcweir rSh.EnterStdMode(); 2719*cdf0e10cSrcweir rSh.SelectTableRowCol( aDocPos ); 2720*cdf0e10cSrcweir if( SW_TABSEL_HORI != nMouseTabCol && SW_TABSEL_HORI_RTL != nMouseTabCol) 2721*cdf0e10cSrcweir { 2722*cdf0e10cSrcweir pRowColumnSelectionStart = new Point( aDocPos ); 2723*cdf0e10cSrcweir bIsRowDrag = SW_TABROWSEL_HORI == nMouseTabCol|| 2724*cdf0e10cSrcweir SW_TABROWSEL_HORI_RTL == nMouseTabCol || 2725*cdf0e10cSrcweir SW_TABCOLSEL_VERT == nMouseTabCol; 2726*cdf0e10cSrcweir bMBPressed = sal_True; 2727*cdf0e10cSrcweir CaptureMouse(); 2728*cdf0e10cSrcweir } 2729*cdf0e10cSrcweir return; 2730*cdf0e10cSrcweir } 2731*cdf0e10cSrcweir // <-- 2732*cdf0e10cSrcweir 2733*cdf0e10cSrcweir if ( !rSh.IsTableMode() ) 2734*cdf0e10cSrcweir { 2735*cdf0e10cSrcweir //Zuppeln von Tabellenspalten aus dem Dokument heraus. 2736*cdf0e10cSrcweir if(SW_TABCOL_VERT == nMouseTabCol || SW_TABCOL_HORI == nMouseTabCol) 2737*cdf0e10cSrcweir rView.SetTabColFromDoc( sal_True ); 2738*cdf0e10cSrcweir else 2739*cdf0e10cSrcweir rView.SetTabRowFromDoc( sal_True ); 2740*cdf0e10cSrcweir 2741*cdf0e10cSrcweir rView.SetTabColFromDocPos( aDocPos ); 2742*cdf0e10cSrcweir rView.InvalidateRulerPos(); 2743*cdf0e10cSrcweir SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); 2744*cdf0e10cSrcweir rBind.Update(); 2745*cdf0e10cSrcweir if ( RulerColumnDrag( rMEvt, 2746*cdf0e10cSrcweir (SW_TABCOL_VERT == nMouseTabCol || SW_TABROW_HORI == nMouseTabCol)) ) 2747*cdf0e10cSrcweir { 2748*cdf0e10cSrcweir rView.SetTabColFromDoc( sal_False ); 2749*cdf0e10cSrcweir rView.SetTabRowFromDoc( sal_False ); 2750*cdf0e10cSrcweir rView.InvalidateRulerPos(); 2751*cdf0e10cSrcweir rBind.Update(); 2752*cdf0e10cSrcweir bCallBase = sal_False; 2753*cdf0e10cSrcweir } 2754*cdf0e10cSrcweir else 2755*cdf0e10cSrcweir { 2756*cdf0e10cSrcweir return; 2757*cdf0e10cSrcweir } 2758*cdf0e10cSrcweir } 2759*cdf0e10cSrcweir } 2760*cdf0e10cSrcweir // #i23726# 2761*cdf0e10cSrcweir else if (bTmp && 2762*cdf0e10cSrcweir rSh.IsNumLabel(aDocPos)) 2763*cdf0e10cSrcweir { 2764*cdf0e10cSrcweir SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPos ); 2765*cdf0e10cSrcweir rView.SetNumRuleNodeFromDoc( pNodeAtPos ); 2766*cdf0e10cSrcweir rView.InvalidateRulerPos(); 2767*cdf0e10cSrcweir SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); 2768*cdf0e10cSrcweir rBind.Update(); 2769*cdf0e10cSrcweir 2770*cdf0e10cSrcweir // --> OD 2005-02-21 #i42921# 2771*cdf0e10cSrcweir if ( RulerMarginDrag( rMEvt, 2772*cdf0e10cSrcweir rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPos ) ) ) 2773*cdf0e10cSrcweir // <-- 2774*cdf0e10cSrcweir { 2775*cdf0e10cSrcweir rView.SetNumRuleNodeFromDoc( NULL ); 2776*cdf0e10cSrcweir rView.InvalidateRulerPos(); 2777*cdf0e10cSrcweir rBind.Update(); 2778*cdf0e10cSrcweir bCallBase = sal_False; 2779*cdf0e10cSrcweir } 2780*cdf0e10cSrcweir else 2781*cdf0e10cSrcweir { 2782*cdf0e10cSrcweir // --> FME 2005-11-03 #125036# Make sure the pointer is set to 0, 2783*cdf0e10cSrcweir // otherwise it may point to nowhere after deleting the corresponding 2784*cdf0e10cSrcweir // text node. 2785*cdf0e10cSrcweir rView.SetNumRuleNodeFromDoc( NULL ); 2786*cdf0e10cSrcweir // <-- 2787*cdf0e10cSrcweir return; 2788*cdf0e10cSrcweir } 2789*cdf0e10cSrcweir } 2790*cdf0e10cSrcweir 2791*cdf0e10cSrcweir //Man kann sich in einem Selektionszustand befinden, wenn zuletzt 2792*cdf0e10cSrcweir //mit dem Keyboard selektiert wurde, aber noch kein CURSOR_KEY 2793*cdf0e10cSrcweir //anschliessend bewegt worden ist. In diesem Fall muss die vorher- 2794*cdf0e10cSrcweir //gehende Selektion zuerst beendet werden. 2795*cdf0e10cSrcweir //MA 07. Oct. 95: Und zwar nicht nur bei Linker Maustaste sondern immer. 2796*cdf0e10cSrcweir //siehe auch Bug: 19263 2797*cdf0e10cSrcweir if ( rSh.IsInSelect() ) 2798*cdf0e10cSrcweir rSh.EndSelect(); 2799*cdf0e10cSrcweir 2800*cdf0e10cSrcweir //Abfrage auf LEFT, da sonst auch bei einem Click mit der rechten Taste 2801*cdf0e10cSrcweir //beispielsweise die Selektion aufgehoben wird. 2802*cdf0e10cSrcweir if ( MOUSE_LEFT == rMEvt.GetButtons() ) 2803*cdf0e10cSrcweir { 2804*cdf0e10cSrcweir sal_Bool bOnlyText = sal_False; 2805*cdf0e10cSrcweir bMBPressed = bNoInterrupt = sal_True; 2806*cdf0e10cSrcweir nKS_NUMDOWN_Count = 0; // #i23725# 2807*cdf0e10cSrcweir 2808*cdf0e10cSrcweir CaptureMouse(); 2809*cdf0e10cSrcweir 2810*cdf0e10cSrcweir //ggf. Cursorpositionen zuruecksetzen 2811*cdf0e10cSrcweir rSh.ResetCursorStack(); 2812*cdf0e10cSrcweir 2813*cdf0e10cSrcweir switch ( rMEvt.GetModifier() + rMEvt.GetButtons() ) 2814*cdf0e10cSrcweir { 2815*cdf0e10cSrcweir case MOUSE_LEFT: 2816*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT: 2817*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD2: 2818*cdf0e10cSrcweir if( rSh.IsObjSelected() ) 2819*cdf0e10cSrcweir { 2820*cdf0e10cSrcweir SdrHdl* pHdl; 2821*cdf0e10cSrcweir if( !bIsDocReadOnly && 2822*cdf0e10cSrcweir !pAnchorMarker && 2823*cdf0e10cSrcweir 0 != ( pHdl = pSdrView->PickHandle(aDocPos) ) && 2824*cdf0e10cSrcweir ( pHdl->GetKind() == HDL_ANCHOR || 2825*cdf0e10cSrcweir pHdl->GetKind() == HDL_ANCHOR_TR ) ) 2826*cdf0e10cSrcweir { 2827*cdf0e10cSrcweir pAnchorMarker = new SwAnchorMarker( pHdl ); 2828*cdf0e10cSrcweir UpdatePointer( aDocPos, rMEvt.GetModifier() ); 2829*cdf0e10cSrcweir return; 2830*cdf0e10cSrcweir } 2831*cdf0e10cSrcweir } 2832*cdf0e10cSrcweir if ( EnterDrawMode( rMEvt, aDocPos ) ) 2833*cdf0e10cSrcweir { 2834*cdf0e10cSrcweir bNoInterrupt = sal_False; 2835*cdf0e10cSrcweir return; 2836*cdf0e10cSrcweir } 2837*cdf0e10cSrcweir else if ( rView.GetDrawFuncPtr() && bInsFrm ) 2838*cdf0e10cSrcweir { 2839*cdf0e10cSrcweir StopInsFrm(); 2840*cdf0e10cSrcweir rSh.Edit(); 2841*cdf0e10cSrcweir } 2842*cdf0e10cSrcweir 2843*cdf0e10cSrcweir // Ohne SHIFT, da sonst Toggle bei Selektion nicht funktioniert 2844*cdf0e10cSrcweir if (rMEvt.GetClicks() == 1) 2845*cdf0e10cSrcweir { 2846*cdf0e10cSrcweir if ( rSh.IsSelFrmMode()) 2847*cdf0e10cSrcweir { 2848*cdf0e10cSrcweir SdrHdl* pHdl = rSh.GetDrawView()->PickHandle(aDocPos); 2849*cdf0e10cSrcweir sal_Bool bHitHandle = pHdl && pHdl->GetKind() != HDL_ANCHOR && 2850*cdf0e10cSrcweir pHdl->GetKind() != HDL_ANCHOR_TR; 2851*cdf0e10cSrcweir 2852*cdf0e10cSrcweir if ((rSh.IsInsideSelectedObj(aDocPos) || bHitHandle) && 2853*cdf0e10cSrcweir !(rMEvt.GetModifier() == KEY_SHIFT && !bHitHandle)) 2854*cdf0e10cSrcweir { 2855*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 2856*cdf0e10cSrcweir if ( !pApplyTempl ) 2857*cdf0e10cSrcweir { 2858*cdf0e10cSrcweir //nur, wenn keine Position zum Sizen getroffen ist. 2859*cdf0e10cSrcweir if (!bHitHandle) 2860*cdf0e10cSrcweir { 2861*cdf0e10cSrcweir StartDDTimer(); 2862*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 2863*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 2864*cdf0e10cSrcweir } 2865*cdf0e10cSrcweir bFrmDrag = sal_True; 2866*cdf0e10cSrcweir } 2867*cdf0e10cSrcweir bNoInterrupt = sal_False; 2868*cdf0e10cSrcweir return; 2869*cdf0e10cSrcweir } 2870*cdf0e10cSrcweir } 2871*cdf0e10cSrcweir } 2872*cdf0e10cSrcweir } 2873*cdf0e10cSrcweir 2874*cdf0e10cSrcweir sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly(); 2875*cdf0e10cSrcweir if ( !bExecHyperlinks ) 2876*cdf0e10cSrcweir { 2877*cdf0e10cSrcweir SvtSecurityOptions aSecOpts; 2878*cdf0e10cSrcweir const sal_Bool bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ); 2879*cdf0e10cSrcweir if ( ( bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) || 2880*cdf0e10cSrcweir ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) ) 2881*cdf0e10cSrcweir bExecHyperlinks = sal_True; 2882*cdf0e10cSrcweir } 2883*cdf0e10cSrcweir 2884*cdf0e10cSrcweir // --> FME 2004-07-30 #i32329# Enhanced selection 2885*cdf0e10cSrcweir sal_uInt8 nNumberOfClicks = static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4); 2886*cdf0e10cSrcweir if ( 0 == nNumberOfClicks && 0 < rMEvt.GetClicks() ) 2887*cdf0e10cSrcweir nNumberOfClicks = 4; 2888*cdf0e10cSrcweir // <-- 2889*cdf0e10cSrcweir 2890*cdf0e10cSrcweir sal_Bool bExecDrawTextLink = sal_False; 2891*cdf0e10cSrcweir 2892*cdf0e10cSrcweir switch ( rMEvt.GetModifier() + rMEvt.GetButtons() ) 2893*cdf0e10cSrcweir { 2894*cdf0e10cSrcweir case MOUSE_LEFT: 2895*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD1: 2896*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD2: 2897*cdf0e10cSrcweir switch ( nNumberOfClicks ) 2898*cdf0e10cSrcweir { 2899*cdf0e10cSrcweir case 1: 2900*cdf0e10cSrcweir { 2901*cdf0e10cSrcweir UpdatePointer( aDocPos, rMEvt.GetModifier() ); 2902*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 2903*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 2904*cdf0e10cSrcweir 2905*cdf0e10cSrcweir // URL in DrawText-Objekt getroffen? 2906*cdf0e10cSrcweir if (bExecHyperlinks && pSdrView) 2907*cdf0e10cSrcweir { 2908*cdf0e10cSrcweir SdrViewEvent aVEvt; 2909*cdf0e10cSrcweir pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 2910*cdf0e10cSrcweir 2911*cdf0e10cSrcweir if (aVEvt.eEvent == SDREVENT_EXECUTEURL) 2912*cdf0e10cSrcweir bExecDrawTextLink = sal_True; 2913*cdf0e10cSrcweir } 2914*cdf0e10cSrcweir 2915*cdf0e10cSrcweir //Rahmen nur zu selektieren versuchen, wenn 2916*cdf0e10cSrcweir //der Pointer bereits entsprechend geschaltet wurde 2917*cdf0e10cSrcweir if ( aActHitType != SDRHIT_NONE && !rSh.IsSelFrmMode() && 2918*cdf0e10cSrcweir !GetView().GetViewFrame()->GetDispatcher()->IsLocked() && 2919*cdf0e10cSrcweir !bExecDrawTextLink) 2920*cdf0e10cSrcweir { 2921*cdf0e10cSrcweir // #107513# 2922*cdf0e10cSrcweir // Test if there is a draw object at that position and if it should be selected. 2923*cdf0e10cSrcweir sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos); 2924*cdf0e10cSrcweir 2925*cdf0e10cSrcweir if(bShould) 2926*cdf0e10cSrcweir { 2927*cdf0e10cSrcweir rView.NoRotate(); 2928*cdf0e10cSrcweir rSh.HideCrsr(); 2929*cdf0e10cSrcweir 2930*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 2931*cdf0e10cSrcweir rSh.LockView( sal_True ); 2932*cdf0e10cSrcweir sal_Bool bSelObj = rSh.SelectObj( aDocPos, 2933*cdf0e10cSrcweir rMEvt.IsMod1() ? SW_ENTER_GROUP : 0); 2934*cdf0e10cSrcweir if( bUnLockView ) 2935*cdf0e10cSrcweir rSh.LockView( sal_False ); 2936*cdf0e10cSrcweir 2937*cdf0e10cSrcweir if( bSelObj ) 2938*cdf0e10cSrcweir { 2939*cdf0e10cSrcweir // falls im Macro der Rahmen deselektiert 2940*cdf0e10cSrcweir // wurde, muss nur noch der Cursor 2941*cdf0e10cSrcweir // wieder angezeigt werden. 2942*cdf0e10cSrcweir if( FRMTYPE_NONE == rSh.GetSelFrmType() ) 2943*cdf0e10cSrcweir rSh.ShowCrsr(); 2944*cdf0e10cSrcweir else 2945*cdf0e10cSrcweir { 2946*cdf0e10cSrcweir if (rSh.IsFrmSelected() && rView.GetDrawFuncPtr()) 2947*cdf0e10cSrcweir { 2948*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 2949*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 2950*cdf0e10cSrcweir rView.LeaveDrawCreate(); 2951*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 2952*cdf0e10cSrcweir } 2953*cdf0e10cSrcweir 2954*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 2955*cdf0e10cSrcweir bFrmDrag = sal_True; 2956*cdf0e10cSrcweir UpdatePointer( aDocPos, rMEvt.GetModifier() ); 2957*cdf0e10cSrcweir } 2958*cdf0e10cSrcweir return; 2959*cdf0e10cSrcweir } 2960*cdf0e10cSrcweir else 2961*cdf0e10cSrcweir bOnlyText = static_cast< sal_Bool >(rSh.IsObjSelectable( aDocPos )); 2962*cdf0e10cSrcweir 2963*cdf0e10cSrcweir if (!rView.GetDrawFuncPtr()) 2964*cdf0e10cSrcweir rSh.ShowCrsr(); 2965*cdf0e10cSrcweir } 2966*cdf0e10cSrcweir else 2967*cdf0e10cSrcweir bOnlyText = KEY_MOD1 != rMEvt.GetModifier(); 2968*cdf0e10cSrcweir } 2969*cdf0e10cSrcweir else if ( rSh.IsSelFrmMode() && 2970*cdf0e10cSrcweir (aActHitType == SDRHIT_NONE || 2971*cdf0e10cSrcweir !rSh.IsInsideSelectedObj( aDocPos ))) 2972*cdf0e10cSrcweir { 2973*cdf0e10cSrcweir rView.NoRotate(); 2974*cdf0e10cSrcweir SdrHdl *pHdl; 2975*cdf0e10cSrcweir if( !bIsDocReadOnly && !pAnchorMarker && 0 != 2976*cdf0e10cSrcweir ( pHdl = pSdrView->PickHandle(aDocPos) ) && 2977*cdf0e10cSrcweir ( pHdl->GetKind() == HDL_ANCHOR || 2978*cdf0e10cSrcweir pHdl->GetKind() == HDL_ANCHOR_TR ) ) 2979*cdf0e10cSrcweir { 2980*cdf0e10cSrcweir pAnchorMarker = new SwAnchorMarker( pHdl ); 2981*cdf0e10cSrcweir UpdatePointer( aDocPos, rMEvt.GetModifier() ); 2982*cdf0e10cSrcweir return; 2983*cdf0e10cSrcweir } 2984*cdf0e10cSrcweir else 2985*cdf0e10cSrcweir { 2986*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 2987*cdf0e10cSrcweir rSh.LockView( sal_True ); 2988*cdf0e10cSrcweir sal_uInt8 nFlag = rMEvt.IsShift() ? SW_ADD_SELECT :0; 2989*cdf0e10cSrcweir if( rMEvt.IsMod1() ) 2990*cdf0e10cSrcweir nFlag = nFlag | SW_ENTER_GROUP; 2991*cdf0e10cSrcweir 2992*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 2993*cdf0e10cSrcweir { 2994*cdf0e10cSrcweir rSh.UnSelectFrm(); 2995*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 2996*cdf0e10cSrcweir rView.AttrChangedNotify(&rSh); 2997*cdf0e10cSrcweir } 2998*cdf0e10cSrcweir 2999*cdf0e10cSrcweir sal_Bool bSelObj = rSh.SelectObj( aDocPos, nFlag ); 3000*cdf0e10cSrcweir if( bUnLockView ) 3001*cdf0e10cSrcweir rSh.LockView( sal_False ); 3002*cdf0e10cSrcweir 3003*cdf0e10cSrcweir if( !bSelObj ) 3004*cdf0e10cSrcweir { 3005*cdf0e10cSrcweir // Cursor hier umsetzen, damit er nicht zuerst 3006*cdf0e10cSrcweir // im Rahmen gezeichnet wird; ShowCrsr() geschieht 3007*cdf0e10cSrcweir // in LeaveSelFrmMode() 3008*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,sal_False)); 3009*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 3010*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 3011*cdf0e10cSrcweir bCallBase = sal_False; 3012*cdf0e10cSrcweir } 3013*cdf0e10cSrcweir else 3014*cdf0e10cSrcweir { 3015*cdf0e10cSrcweir rSh.HideCrsr(); 3016*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 3017*cdf0e10cSrcweir rSh.SelFlyGrabCrsr(); 3018*cdf0e10cSrcweir rSh.MakeSelVisible(); 3019*cdf0e10cSrcweir bFrmDrag = sal_True; 3020*cdf0e10cSrcweir if( rSh.IsFrmSelected() && 3021*cdf0e10cSrcweir rView.GetDrawFuncPtr() ) 3022*cdf0e10cSrcweir { 3023*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 3024*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 3025*cdf0e10cSrcweir rView.LeaveDrawCreate(); 3026*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 3027*cdf0e10cSrcweir } 3028*cdf0e10cSrcweir UpdatePointer( aDocPos, rMEvt.GetModifier() ); 3029*cdf0e10cSrcweir return; 3030*cdf0e10cSrcweir } 3031*cdf0e10cSrcweir } 3032*cdf0e10cSrcweir } 3033*cdf0e10cSrcweir 3034*cdf0e10cSrcweir break; 3035*cdf0e10cSrcweir } 3036*cdf0e10cSrcweir case 2: 3037*cdf0e10cSrcweir { 3038*cdf0e10cSrcweir bFrmDrag = sal_False; 3039*cdf0e10cSrcweir if ( !bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos) && 3040*cdf0e10cSrcweir 0 == rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) ) 3041*cdf0e10cSrcweir 3042*cdf0e10cSrcweir /* SJ: 01.03.2005: this is no good, on the one hand GetSelectionType is used as flag field (take a look into the GetSelectionType method) 3043*cdf0e10cSrcweir on the other hand the return value is used in a switch without proper masking (very nice), this must lead to trouble 3044*cdf0e10cSrcweir */ 3045*cdf0e10cSrcweir switch ( rSh.GetSelectionType() &~ ( nsSelectionType::SEL_FONTWORK | nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE ) ) 3046*cdf0e10cSrcweir { 3047*cdf0e10cSrcweir case nsSelectionType::SEL_GRF: 3048*cdf0e10cSrcweir RstMBDownFlags(); 3049*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Execute( 3050*cdf0e10cSrcweir FN_FORMAT_GRAFIC_DLG, 0, 0, 3051*cdf0e10cSrcweir SFX_CALLMODE_RECORD|SFX_CALLMODE_SLOT); 3052*cdf0e10cSrcweir return; 3053*cdf0e10cSrcweir 3054*cdf0e10cSrcweir // Doppelklick auf OLE-Objekt --> OLE-InPlace 3055*cdf0e10cSrcweir case nsSelectionType::SEL_OLE: 3056*cdf0e10cSrcweir if (!rSh.IsSelObjProtected(FLYPROTECT_CONTENT)) 3057*cdf0e10cSrcweir { 3058*cdf0e10cSrcweir RstMBDownFlags(); 3059*cdf0e10cSrcweir rSh.LaunchOLEObj(); 3060*cdf0e10cSrcweir } 3061*cdf0e10cSrcweir return; 3062*cdf0e10cSrcweir 3063*cdf0e10cSrcweir case nsSelectionType::SEL_FRM: 3064*cdf0e10cSrcweir RstMBDownFlags(); 3065*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Execute( 3066*cdf0e10cSrcweir FN_FORMAT_FRAME_DLG, 0, 0, SFX_CALLMODE_RECORD|SFX_CALLMODE_SLOT); 3067*cdf0e10cSrcweir return; 3068*cdf0e10cSrcweir 3069*cdf0e10cSrcweir case nsSelectionType::SEL_DRW: 3070*cdf0e10cSrcweir RstMBDownFlags(); 3071*cdf0e10cSrcweir EnterDrawTextMode(aDocPos); 3072*cdf0e10cSrcweir if ( rView.GetCurShell()->ISA(SwDrawTextShell) ) 3073*cdf0e10cSrcweir ((SwDrawTextShell*)rView.GetCurShell())->Init(); 3074*cdf0e10cSrcweir return; 3075*cdf0e10cSrcweir } 3076*cdf0e10cSrcweir 3077*cdf0e10cSrcweir //falls die Cursorposition korrigiert wurde oder 3078*cdf0e10cSrcweir // ein Fly im ReadOnlyModus selektiert ist, 3079*cdf0e10cSrcweir //keine Wortselektion. 3080*cdf0e10cSrcweir if ( !bValidCrsrPos || 3081*cdf0e10cSrcweir (rSh.IsFrmSelected() && rSh.IsFrmSelected() )) 3082*cdf0e10cSrcweir return; 3083*cdf0e10cSrcweir 3084*cdf0e10cSrcweir SwField *pFld; 3085*cdf0e10cSrcweir sal_Bool bFtn = sal_False; 3086*cdf0e10cSrcweir 3087*cdf0e10cSrcweir if( !bIsDocReadOnly && 3088*cdf0e10cSrcweir ( 0 != ( pFld = rSh.GetCurFld() ) || 3089*cdf0e10cSrcweir 0 != ( bFtn = rSh.GetCurFtn() )) ) 3090*cdf0e10cSrcweir { 3091*cdf0e10cSrcweir RstMBDownFlags(); 3092*cdf0e10cSrcweir if( bFtn ) 3093*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Execute( FN_EDIT_FOOTNOTE ); 3094*cdf0e10cSrcweir else 3095*cdf0e10cSrcweir { 3096*cdf0e10cSrcweir sal_uInt16 nTypeId = pFld->GetTypeId(); 3097*cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView().GetViewFrame(); 3098*cdf0e10cSrcweir switch( nTypeId ) 3099*cdf0e10cSrcweir { 3100*cdf0e10cSrcweir case TYP_POSTITFLD: 3101*cdf0e10cSrcweir case TYP_SCRIPTFLD: 3102*cdf0e10cSrcweir { 3103*cdf0e10cSrcweir //falls es ein Readonly-Bereich ist, dann muss der Status 3104*cdf0e10cSrcweir //enabled werden 3105*cdf0e10cSrcweir sal_uInt16 nSlot = TYP_POSTITFLD == nTypeId ? FN_POSTIT : FN_JAVAEDIT; 3106*cdf0e10cSrcweir SfxBoolItem aItem(nSlot, sal_True); 3107*cdf0e10cSrcweir pVFrame->GetBindings().SetState(aItem); 3108*cdf0e10cSrcweir pVFrame->GetBindings().Execute(nSlot); 3109*cdf0e10cSrcweir break; 3110*cdf0e10cSrcweir } 3111*cdf0e10cSrcweir case TYP_AUTHORITY : 3112*cdf0e10cSrcweir pVFrame->GetBindings().Execute(FN_EDIT_AUTH_ENTRY_DLG); 3113*cdf0e10cSrcweir break; 3114*cdf0e10cSrcweir default: 3115*cdf0e10cSrcweir pVFrame->GetBindings().Execute(FN_EDIT_FIELD); 3116*cdf0e10cSrcweir } 3117*cdf0e10cSrcweir } 3118*cdf0e10cSrcweir return; 3119*cdf0e10cSrcweir } 3120*cdf0e10cSrcweir //im Extended Mode hat Doppel- und 3121*cdf0e10cSrcweir //Dreifachklick keine Auswirkungen. 3122*cdf0e10cSrcweir if ( rSh.IsExtMode() || rSh.IsBlockMode() ) 3123*cdf0e10cSrcweir return; 3124*cdf0e10cSrcweir 3125*cdf0e10cSrcweir //Wort selektieren, gfs. Additional Mode 3126*cdf0e10cSrcweir if ( KEY_MOD1 == rMEvt.GetModifier() && !rSh.IsAddMode() ) 3127*cdf0e10cSrcweir { 3128*cdf0e10cSrcweir rSh.EnterAddMode(); 3129*cdf0e10cSrcweir rSh.SelWrd( &aDocPos ); 3130*cdf0e10cSrcweir rSh.LeaveAddMode(); 3131*cdf0e10cSrcweir } 3132*cdf0e10cSrcweir else 3133*cdf0e10cSrcweir rSh.SelWrd( &aDocPos ); 3134*cdf0e10cSrcweir bHoldSelection = sal_True; 3135*cdf0e10cSrcweir return; 3136*cdf0e10cSrcweir } 3137*cdf0e10cSrcweir case 3: 3138*cdf0e10cSrcweir case 4: 3139*cdf0e10cSrcweir { 3140*cdf0e10cSrcweir bFrmDrag = sal_False; 3141*cdf0e10cSrcweir //im Extended Mode hat Doppel- und 3142*cdf0e10cSrcweir //Dreifachklick keine Auswirkungen. 3143*cdf0e10cSrcweir if ( rSh.IsExtMode() ) 3144*cdf0e10cSrcweir return; 3145*cdf0e10cSrcweir 3146*cdf0e10cSrcweir //falls die Cursorposition korrigiert wurde oder 3147*cdf0e10cSrcweir // ein Fly im ReadOnlyModus selektiert ist, 3148*cdf0e10cSrcweir //keine Wortselektion. 3149*cdf0e10cSrcweir if ( !bValidCrsrPos || rSh.IsFrmSelected() ) 3150*cdf0e10cSrcweir return; 3151*cdf0e10cSrcweir 3152*cdf0e10cSrcweir //Zeile selektieren, gfs. Additional Mode 3153*cdf0e10cSrcweir const bool bMod = KEY_MOD1 == rMEvt.GetModifier() && 3154*cdf0e10cSrcweir !rSh.IsAddMode(); 3155*cdf0e10cSrcweir 3156*cdf0e10cSrcweir if ( bMod ) 3157*cdf0e10cSrcweir rSh.EnterAddMode(); 3158*cdf0e10cSrcweir 3159*cdf0e10cSrcweir // --> FME 2004-07-30 #i32329# Enhanced selection 3160*cdf0e10cSrcweir if ( 3 == nNumberOfClicks ) 3161*cdf0e10cSrcweir rSh.SelSentence( &aDocPos ); 3162*cdf0e10cSrcweir else 3163*cdf0e10cSrcweir rSh.SelPara( &aDocPos ); 3164*cdf0e10cSrcweir // <-- 3165*cdf0e10cSrcweir 3166*cdf0e10cSrcweir if ( bMod ) 3167*cdf0e10cSrcweir rSh.LeaveAddMode(); 3168*cdf0e10cSrcweir 3169*cdf0e10cSrcweir bHoldSelection = sal_True; 3170*cdf0e10cSrcweir return; 3171*cdf0e10cSrcweir } 3172*cdf0e10cSrcweir 3173*cdf0e10cSrcweir default: 3174*cdf0e10cSrcweir return; 3175*cdf0e10cSrcweir } 3176*cdf0e10cSrcweir /* no break */ 3177*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT: 3178*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1: 3179*cdf0e10cSrcweir { 3180*cdf0e10cSrcweir sal_Bool bLockView = bWasShdwCrsr; 3181*cdf0e10cSrcweir 3182*cdf0e10cSrcweir switch ( rMEvt.GetModifier() ) 3183*cdf0e10cSrcweir { 3184*cdf0e10cSrcweir case KEY_MOD1 + KEY_SHIFT: 3185*cdf0e10cSrcweir { 3186*cdf0e10cSrcweir if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) ) 3187*cdf0e10cSrcweir { 3188*cdf0e10cSrcweir rView.NoRotate(); 3189*cdf0e10cSrcweir rSh.HideCrsr(); 3190*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 3191*cdf0e10cSrcweir rSh.SelectObj(aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP); 3192*cdf0e10cSrcweir else 3193*cdf0e10cSrcweir { if ( rSh.SelectObj( aDocPos, SW_ADD_SELECT | SW_ENTER_GROUP ) ) 3194*cdf0e10cSrcweir { 3195*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 3196*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 3197*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 3198*cdf0e10cSrcweir bFrmDrag = sal_True; 3199*cdf0e10cSrcweir return; 3200*cdf0e10cSrcweir } 3201*cdf0e10cSrcweir } 3202*cdf0e10cSrcweir } 3203*cdf0e10cSrcweir else if( rSh.IsSelFrmMode() && 3204*cdf0e10cSrcweir rSh.GetDrawView()->PickHandle( aDocPos )) 3205*cdf0e10cSrcweir { 3206*cdf0e10cSrcweir bFrmDrag = sal_True; 3207*cdf0e10cSrcweir bNoInterrupt = sal_False; 3208*cdf0e10cSrcweir return; 3209*cdf0e10cSrcweir } 3210*cdf0e10cSrcweir } 3211*cdf0e10cSrcweir break; 3212*cdf0e10cSrcweir case KEY_MOD1: 3213*cdf0e10cSrcweir if ( !bExecDrawTextLink ) 3214*cdf0e10cSrcweir { 3215*cdf0e10cSrcweir if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) ) 3216*cdf0e10cSrcweir { 3217*cdf0e10cSrcweir rView.NoRotate(); 3218*cdf0e10cSrcweir rSh.HideCrsr(); 3219*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 3220*cdf0e10cSrcweir rSh.SelectObj(aDocPos, SW_ENTER_GROUP); 3221*cdf0e10cSrcweir else 3222*cdf0e10cSrcweir { if ( rSh.SelectObj( aDocPos, SW_ENTER_GROUP ) ) 3223*cdf0e10cSrcweir { 3224*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 3225*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 3226*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 3227*cdf0e10cSrcweir bFrmDrag = sal_True; 3228*cdf0e10cSrcweir return; 3229*cdf0e10cSrcweir } 3230*cdf0e10cSrcweir } 3231*cdf0e10cSrcweir } 3232*cdf0e10cSrcweir else if( rSh.IsSelFrmMode() && 3233*cdf0e10cSrcweir rSh.GetDrawView()->PickHandle( aDocPos )) 3234*cdf0e10cSrcweir { 3235*cdf0e10cSrcweir bFrmDrag = sal_True; 3236*cdf0e10cSrcweir bNoInterrupt = sal_False; 3237*cdf0e10cSrcweir return; 3238*cdf0e10cSrcweir } 3239*cdf0e10cSrcweir else 3240*cdf0e10cSrcweir { 3241*cdf0e10cSrcweir if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() ) 3242*cdf0e10cSrcweir { 3243*cdf0e10cSrcweir rSh.PushMode(); 3244*cdf0e10cSrcweir bModePushed = sal_True; 3245*cdf0e10cSrcweir 3246*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 3247*cdf0e10cSrcweir rSh.LockView( sal_True ); 3248*cdf0e10cSrcweir rSh.EnterAddMode(); 3249*cdf0e10cSrcweir if( bUnLockView ) 3250*cdf0e10cSrcweir rSh.LockView( sal_False ); 3251*cdf0e10cSrcweir } 3252*cdf0e10cSrcweir bCallBase = sal_False; 3253*cdf0e10cSrcweir } 3254*cdf0e10cSrcweir } 3255*cdf0e10cSrcweir break; 3256*cdf0e10cSrcweir case KEY_MOD2: 3257*cdf0e10cSrcweir { 3258*cdf0e10cSrcweir if ( !rSh.IsAddMode() && !rSh.IsExtMode() && !rSh.IsBlockMode() ) 3259*cdf0e10cSrcweir { 3260*cdf0e10cSrcweir rSh.PushMode(); 3261*cdf0e10cSrcweir bModePushed = sal_True; 3262*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 3263*cdf0e10cSrcweir rSh.LockView( sal_True ); 3264*cdf0e10cSrcweir rSh.EnterBlockMode(); 3265*cdf0e10cSrcweir if( bUnLockView ) 3266*cdf0e10cSrcweir rSh.LockView( sal_False ); 3267*cdf0e10cSrcweir } 3268*cdf0e10cSrcweir bCallBase = sal_False; 3269*cdf0e10cSrcweir } 3270*cdf0e10cSrcweir break; 3271*cdf0e10cSrcweir case KEY_SHIFT: 3272*cdf0e10cSrcweir { 3273*cdf0e10cSrcweir if ( !bInsDraw && IsDrawObjSelectable( rSh, aDocPos ) ) 3274*cdf0e10cSrcweir { 3275*cdf0e10cSrcweir rView.NoRotate(); 3276*cdf0e10cSrcweir rSh.HideCrsr(); 3277*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 3278*cdf0e10cSrcweir { 3279*cdf0e10cSrcweir rSh.SelectObj(aDocPos, SW_ADD_SELECT); 3280*cdf0e10cSrcweir 3281*cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); 3282*cdf0e10cSrcweir if (rMarkList.GetMark(0) == NULL) 3283*cdf0e10cSrcweir { 3284*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 3285*cdf0e10cSrcweir rView.AttrChangedNotify(&rSh); 3286*cdf0e10cSrcweir bFrmDrag = sal_False; 3287*cdf0e10cSrcweir } 3288*cdf0e10cSrcweir } 3289*cdf0e10cSrcweir else 3290*cdf0e10cSrcweir { if ( rSh.SelectObj( aDocPos ) ) 3291*cdf0e10cSrcweir { 3292*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 3293*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 3294*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 3295*cdf0e10cSrcweir bFrmDrag = sal_True; 3296*cdf0e10cSrcweir return; 3297*cdf0e10cSrcweir } 3298*cdf0e10cSrcweir } 3299*cdf0e10cSrcweir } 3300*cdf0e10cSrcweir else 3301*cdf0e10cSrcweir { 3302*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() && 3303*cdf0e10cSrcweir rSh.IsInsideSelectedObj( aDocPos ) ) 3304*cdf0e10cSrcweir { 3305*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 3306*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 3307*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 3308*cdf0e10cSrcweir bFrmDrag = sal_True; 3309*cdf0e10cSrcweir return; 3310*cdf0e10cSrcweir } 3311*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 3312*cdf0e10cSrcweir { 3313*cdf0e10cSrcweir rSh.UnSelectFrm(); 3314*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 3315*cdf0e10cSrcweir rView.AttrChangedNotify(&rSh); 3316*cdf0e10cSrcweir bFrmDrag = sal_False; 3317*cdf0e10cSrcweir } 3318*cdf0e10cSrcweir if ( !rSh.IsExtMode() ) 3319*cdf0e10cSrcweir { 3320*cdf0e10cSrcweir // keine Selection anfangen, wenn in ein URL- 3321*cdf0e10cSrcweir // Feld oder eine -Grafik geklickt wird 3322*cdf0e10cSrcweir sal_Bool bSttSelect = rSh.HasSelection() || 3323*cdf0e10cSrcweir Pointer(POINTER_REFHAND) != GetPointer(); 3324*cdf0e10cSrcweir 3325*cdf0e10cSrcweir if( !bSttSelect ) 3326*cdf0e10cSrcweir { 3327*cdf0e10cSrcweir bSttSelect = sal_True; 3328*cdf0e10cSrcweir if( bExecHyperlinks ) 3329*cdf0e10cSrcweir { 3330*cdf0e10cSrcweir SwContentAtPos aCntntAtPos( 3331*cdf0e10cSrcweir SwContentAtPos::SW_FTN | 3332*cdf0e10cSrcweir SwContentAtPos::SW_INETATTR ); 3333*cdf0e10cSrcweir 3334*cdf0e10cSrcweir if( rSh.GetContentAtPos( aDocPos, aCntntAtPos ) ) 3335*cdf0e10cSrcweir { 3336*cdf0e10cSrcweir if( !rSh.IsViewLocked() && 3337*cdf0e10cSrcweir !rSh.IsReadOnlyAvailable() && 3338*cdf0e10cSrcweir aCntntAtPos.IsInProtectSect() ) 3339*cdf0e10cSrcweir bLockView = sal_True; 3340*cdf0e10cSrcweir 3341*cdf0e10cSrcweir bSttSelect = sal_False; 3342*cdf0e10cSrcweir } 3343*cdf0e10cSrcweir else if( rSh.IsURLGrfAtPos( aDocPos )) 3344*cdf0e10cSrcweir bSttSelect = sal_False; 3345*cdf0e10cSrcweir } 3346*cdf0e10cSrcweir } 3347*cdf0e10cSrcweir 3348*cdf0e10cSrcweir if( bSttSelect ) 3349*cdf0e10cSrcweir rSh.SttSelect(); 3350*cdf0e10cSrcweir } 3351*cdf0e10cSrcweir } 3352*cdf0e10cSrcweir bCallBase = sal_False; 3353*cdf0e10cSrcweir break; 3354*cdf0e10cSrcweir } 3355*cdf0e10cSrcweir default: 3356*cdf0e10cSrcweir if( !rSh.IsViewLocked() ) 3357*cdf0e10cSrcweir { 3358*cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD | 3359*cdf0e10cSrcweir SwContentAtPos::SW_INETATTR ); 3360*cdf0e10cSrcweir if( rSh.GetContentAtPos( aDocPos, aCntntAtPos, sal_False ) && 3361*cdf0e10cSrcweir !rSh.IsReadOnlyAvailable() && 3362*cdf0e10cSrcweir aCntntAtPos.IsInProtectSect() ) 3363*cdf0e10cSrcweir bLockView = sal_True; 3364*cdf0e10cSrcweir } 3365*cdf0e10cSrcweir } 3366*cdf0e10cSrcweir 3367*cdf0e10cSrcweir if ( rSh.IsGCAttr() ) 3368*cdf0e10cSrcweir { 3369*cdf0e10cSrcweir rSh.GCAttr(); 3370*cdf0e10cSrcweir rSh.ClearGCAttr(); 3371*cdf0e10cSrcweir } 3372*cdf0e10cSrcweir 3373*cdf0e10cSrcweir sal_Bool bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = sal_False; 3374*cdf0e10cSrcweir if( !bOverSelect ) 3375*cdf0e10cSrcweir bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos ); 3376*cdf0e10cSrcweir 3377*cdf0e10cSrcweir if ( !bOverSelect ) 3378*cdf0e10cSrcweir { 3379*cdf0e10cSrcweir const sal_Bool bTmpNoInterrupt = bNoInterrupt; 3380*cdf0e10cSrcweir bNoInterrupt = sal_False; 3381*cdf0e10cSrcweir 3382*cdf0e10cSrcweir if( !rSh.IsViewLocked() && bLockView ) 3383*cdf0e10cSrcweir rSh.LockView( sal_True ); 3384*cdf0e10cSrcweir else 3385*cdf0e10cSrcweir bLockView = sal_False; 3386*cdf0e10cSrcweir 3387*cdf0e10cSrcweir int nTmpSetCrsr = 0; 3388*cdf0e10cSrcweir 3389*cdf0e10cSrcweir { // nur temp. Move-Kontext aufspannen, da sonst die 3390*cdf0e10cSrcweir // Abfrage auf die Inhaltsform nicht funktioniert!!! 3391*cdf0e10cSrcweir MV_KONTEXT( &rSh ); 3392*cdf0e10cSrcweir nTmpSetCrsr = (rSh.*rSh.fnSetCrsr)(&aDocPos,bOnlyText); 3393*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & nTmpSetCrsr); 3394*cdf0e10cSrcweir bCallBase = sal_False; 3395*cdf0e10cSrcweir } 3396*cdf0e10cSrcweir 3397*cdf0e10cSrcweir //#i42732# - notify the edit window that from now on we do not use the input language 3398*cdf0e10cSrcweir if ( !(CRSR_POSOLD & nTmpSetCrsr) ) 3399*cdf0e10cSrcweir SetUseInputLanguage( sal_False ); 3400*cdf0e10cSrcweir 3401*cdf0e10cSrcweir if( bLockView ) 3402*cdf0e10cSrcweir rSh.LockView( sal_False ); 3403*cdf0e10cSrcweir 3404*cdf0e10cSrcweir bNoInterrupt = bTmpNoInterrupt; 3405*cdf0e10cSrcweir } 3406*cdf0e10cSrcweir if ( !bOverURLGrf && !bOnlyText ) 3407*cdf0e10cSrcweir { 3408*cdf0e10cSrcweir const int nSelType = rSh.GetSelectionType(); 3409*cdf0e10cSrcweir // --> OD 2009-12-30 #i89920# 3410*cdf0e10cSrcweir // Check in general, if an object is selectable at given position. 3411*cdf0e10cSrcweir // Thus, also text fly frames in background become selectable via Ctrl-Click. 3412*cdf0e10cSrcweir if ( nSelType & nsSelectionType::SEL_OLE || 3413*cdf0e10cSrcweir nSelType & nsSelectionType::SEL_GRF || 3414*cdf0e10cSrcweir rSh.IsObjSelectable( aDocPos ) ) 3415*cdf0e10cSrcweir // <-- 3416*cdf0e10cSrcweir { 3417*cdf0e10cSrcweir MV_KONTEXT( &rSh ); 3418*cdf0e10cSrcweir if( !rSh.IsFrmSelected() ) 3419*cdf0e10cSrcweir rSh.GotoNextFly(); 3420*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 3421*cdf0e10cSrcweir bCallBase = sal_False; 3422*cdf0e10cSrcweir } 3423*cdf0e10cSrcweir } 3424*cdf0e10cSrcweir // nicht mehr hier zuruecksetzen, damit -- falls durch MouseMove 3425*cdf0e10cSrcweir // bei gedrueckter Ctrl-Taste eine Mehrfachselektion erfolgen soll, 3426*cdf0e10cSrcweir // im Drag nicht die vorherige Selektion aufgehoben wird. 3427*cdf0e10cSrcweir // if(bModePushed) 3428*cdf0e10cSrcweir // rSh.PopMode(sal_False); 3429*cdf0e10cSrcweir break; 3430*cdf0e10cSrcweir } 3431*cdf0e10cSrcweir } 3432*cdf0e10cSrcweir } 3433*cdf0e10cSrcweir if (bCallBase) 3434*cdf0e10cSrcweir Window::MouseButtonDown(rMEvt); 3435*cdf0e10cSrcweir } 3436*cdf0e10cSrcweir 3437*cdf0e10cSrcweir /*-------------------------------------------------------------------- 3438*cdf0e10cSrcweir Beschreibung: MouseMove 3439*cdf0e10cSrcweir --------------------------------------------------------------------*/ 3440*cdf0e10cSrcweir 3441*cdf0e10cSrcweir 3442*cdf0e10cSrcweir void SwEditWin::MouseMove(const MouseEvent& _rMEvt) 3443*cdf0e10cSrcweir { 3444*cdf0e10cSrcweir MouseEvent rMEvt(_rMEvt); 3445*cdf0e10cSrcweir 3446*cdf0e10cSrcweir //ignore key modifiers for format paintbrush 3447*cdf0e10cSrcweir { 3448*cdf0e10cSrcweir sal_Bool bExecFormatPaintbrush = pApplyTempl && pApplyTempl->pFormatClipboard 3449*cdf0e10cSrcweir && pApplyTempl->pFormatClipboard->HasContent(); 3450*cdf0e10cSrcweir if( bExecFormatPaintbrush ) 3451*cdf0e10cSrcweir rMEvt = MouseEvent( _rMEvt.GetPosPixel(), _rMEvt.GetClicks(), 3452*cdf0e10cSrcweir _rMEvt.GetMode(), _rMEvt.GetButtons() ); 3453*cdf0e10cSrcweir } 3454*cdf0e10cSrcweir 3455*cdf0e10cSrcweir // solange eine Action laeuft sollte das MouseMove abgeklemmt sein 3456*cdf0e10cSrcweir // Ansonsten gibt es den Bug 40102 3457*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 3458*cdf0e10cSrcweir if( rSh.ActionPend() ) 3459*cdf0e10cSrcweir return ; 3460*cdf0e10cSrcweir 3461*cdf0e10cSrcweir if( pShadCrsr && 0 != (rMEvt.GetModifier() + rMEvt.GetButtons() ) ) 3462*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 3463*cdf0e10cSrcweir 3464*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly(); 3465*cdf0e10cSrcweir 3466*cdf0e10cSrcweir SET_CURR_SHELL( &rSh ); 3467*cdf0e10cSrcweir 3468*cdf0e10cSrcweir //aPixPt == Point in Pixel, rel. zu ChildWin 3469*cdf0e10cSrcweir //aDocPt == Point in Twips, Dokumentkoordinaten 3470*cdf0e10cSrcweir const Point aPixPt( rMEvt.GetPosPixel() ); 3471*cdf0e10cSrcweir const Point aDocPt( PixelToLogic( aPixPt ) ); 3472*cdf0e10cSrcweir 3473*cdf0e10cSrcweir if ( IsChainMode() ) 3474*cdf0e10cSrcweir { 3475*cdf0e10cSrcweir UpdatePointer( aDocPt, rMEvt.GetModifier() ); 3476*cdf0e10cSrcweir if ( rMEvt.IsLeaveWindow() ) 3477*cdf0e10cSrcweir rView.GetViewFrame()->HideStatusText(); 3478*cdf0e10cSrcweir return; 3479*cdf0e10cSrcweir } 3480*cdf0e10cSrcweir 3481*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 3482*cdf0e10cSrcweir 3483*cdf0e10cSrcweir const SwCallMouseEvent aLastCallEvent( aSaveCallEvent ); 3484*cdf0e10cSrcweir aSaveCallEvent.Clear(); 3485*cdf0e10cSrcweir 3486*cdf0e10cSrcweir if ( !bIsDocReadOnly && pSdrView && pSdrView->MouseMove(rMEvt,this) ) 3487*cdf0e10cSrcweir { 3488*cdf0e10cSrcweir SetPointer( POINTER_TEXT ); 3489*cdf0e10cSrcweir return; // Event von der SdrView ausgewertet 3490*cdf0e10cSrcweir } 3491*cdf0e10cSrcweir 3492*cdf0e10cSrcweir const Point aOldPt( rSh.VisArea().Pos() ); 3493*cdf0e10cSrcweir #ifdef TEST_FOR_BUG91313 3494*cdf0e10cSrcweir // n Pixel as FUZZY border 3495*cdf0e10cSrcweir SwRect aVis( rSh.VisArea() ); 3496*cdf0e10cSrcweir Size aFuzzySz( 2, 2 ); 3497*cdf0e10cSrcweir aFuzzySz = PixelToLogic( aFuzzySz ); 3498*cdf0e10cSrcweir 3499*cdf0e10cSrcweir aVis.Top( aVis.Top() + aFuzzySz.Height() ); 3500*cdf0e10cSrcweir aVis.Bottom( aVis.Bottom() - aFuzzySz.Height() ); 3501*cdf0e10cSrcweir aVis.Left( aVis.Left() + aFuzzySz.Width() ); 3502*cdf0e10cSrcweir aVis.Right( aVis.Right() - aFuzzySz.Width() ); 3503*cdf0e10cSrcweir const sal_Bool bInsWin = aVis.IsInside( aDocPt ); 3504*cdf0e10cSrcweir #else 3505*cdf0e10cSrcweir const sal_Bool bInsWin = rSh.VisArea().IsInside( aDocPt ); 3506*cdf0e10cSrcweir #endif 3507*cdf0e10cSrcweir 3508*cdf0e10cSrcweir if( pShadCrsr && !bInsWin ) 3509*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 3510*cdf0e10cSrcweir 3511*cdf0e10cSrcweir if( bInsWin && pRowColumnSelectionStart ) 3512*cdf0e10cSrcweir { 3513*cdf0e10cSrcweir EnterArea(); 3514*cdf0e10cSrcweir Point aPos( aDocPt ); 3515*cdf0e10cSrcweir if( rSh.SelectTableRowCol( *pRowColumnSelectionStart, &aPos, bIsRowDrag )) 3516*cdf0e10cSrcweir return; 3517*cdf0e10cSrcweir } 3518*cdf0e10cSrcweir 3519*cdf0e10cSrcweir // Position ist noetig fuer OS/2, da dort nach einem MB-Down 3520*cdf0e10cSrcweir // offensichtlich sofort ein MB-Move gerufen wird. 3521*cdf0e10cSrcweir if( bDDTimerStarted ) 3522*cdf0e10cSrcweir { 3523*cdf0e10cSrcweir Point aDD( SwEditWin::nDDStartPosX, SwEditWin::nDDStartPosY ); 3524*cdf0e10cSrcweir aDD = LogicToPixel( aDD ); 3525*cdf0e10cSrcweir Rectangle aRect( aDD.X()-3, aDD.Y()-3, aDD.X()+3, aDD.Y()+3 ); 3526*cdf0e10cSrcweir if ( !aRect.IsInside( aPixPt ) ) // MA 23. May. 95: Tatterschutz. 3527*cdf0e10cSrcweir StopDDTimer( &rSh, aDocPt ); 3528*cdf0e10cSrcweir } 3529*cdf0e10cSrcweir 3530*cdf0e10cSrcweir if(rView.GetDrawFuncPtr()) 3531*cdf0e10cSrcweir { 3532*cdf0e10cSrcweir if( bInsDraw ) 3533*cdf0e10cSrcweir { 3534*cdf0e10cSrcweir rView.GetDrawFuncPtr()->MouseMove( rMEvt ); 3535*cdf0e10cSrcweir if ( !bInsWin ) 3536*cdf0e10cSrcweir { 3537*cdf0e10cSrcweir Point aTmp( aDocPt ); 3538*cdf0e10cSrcweir aTmp += rSh.VisArea().Pos() - aOldPt; 3539*cdf0e10cSrcweir LeaveArea( aTmp ); 3540*cdf0e10cSrcweir } 3541*cdf0e10cSrcweir else 3542*cdf0e10cSrcweir EnterArea(); 3543*cdf0e10cSrcweir return; 3544*cdf0e10cSrcweir } 3545*cdf0e10cSrcweir else if(!rSh.IsFrmSelected() && !rSh.IsObjSelected()) 3546*cdf0e10cSrcweir { 3547*cdf0e10cSrcweir SfxBindings &rBnd = rSh.GetView().GetViewFrame()->GetBindings(); 3548*cdf0e10cSrcweir Point aRelPos = rSh.GetRelativePagePosition(aDocPt); 3549*cdf0e10cSrcweir if(aRelPos.X() >= 0) 3550*cdf0e10cSrcweir { 3551*cdf0e10cSrcweir FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); 3552*cdf0e10cSrcweir SW_MOD()->PutItem(SfxUInt16Item(SID_ATTR_METRIC, static_cast< sal_uInt16 >(eMetric))); 3553*cdf0e10cSrcweir const SfxPointItem aTmp1( SID_ATTR_POSITION, aRelPos ); 3554*cdf0e10cSrcweir rBnd.SetState( aTmp1 ); 3555*cdf0e10cSrcweir } 3556*cdf0e10cSrcweir else 3557*cdf0e10cSrcweir { 3558*cdf0e10cSrcweir rBnd.Invalidate(SID_ATTR_POSITION); 3559*cdf0e10cSrcweir } 3560*cdf0e10cSrcweir rBnd.Invalidate(SID_ATTR_SIZE); 3561*cdf0e10cSrcweir const SfxStringItem aCell( SID_TABLE_CELL, aEmptyStr ); 3562*cdf0e10cSrcweir rBnd.SetState( aCell ); 3563*cdf0e10cSrcweir } 3564*cdf0e10cSrcweir } 3565*cdf0e10cSrcweir 3566*cdf0e10cSrcweir sal_uInt8 nMouseTabCol; 3567*cdf0e10cSrcweir if( !bIsDocReadOnly && bInsWin && !pApplyTempl && !rSh.IsInSelect() ) 3568*cdf0e10cSrcweir { 3569*cdf0e10cSrcweir if ( SW_TABCOL_NONE != (nMouseTabCol = rSh.WhichMouseTabCol( aDocPt ) ) && 3570*cdf0e10cSrcweir !rSh.IsObjSelectable( aDocPt ) ) 3571*cdf0e10cSrcweir { 3572*cdf0e10cSrcweir sal_uInt16 nPointer = USHRT_MAX; 3573*cdf0e10cSrcweir bool bChkTblSel = false; 3574*cdf0e10cSrcweir 3575*cdf0e10cSrcweir switch ( nMouseTabCol ) 3576*cdf0e10cSrcweir { 3577*cdf0e10cSrcweir case SW_TABCOL_VERT : 3578*cdf0e10cSrcweir case SW_TABROW_HORI : 3579*cdf0e10cSrcweir nPointer = POINTER_VSIZEBAR; 3580*cdf0e10cSrcweir bChkTblSel = true; 3581*cdf0e10cSrcweir break; 3582*cdf0e10cSrcweir case SW_TABROW_VERT : 3583*cdf0e10cSrcweir case SW_TABCOL_HORI : 3584*cdf0e10cSrcweir nPointer = POINTER_HSIZEBAR; 3585*cdf0e10cSrcweir bChkTblSel = true; 3586*cdf0e10cSrcweir break; 3587*cdf0e10cSrcweir // --> FME 2004-07-30 #i20126# Enhanced table selection 3588*cdf0e10cSrcweir case SW_TABSEL_HORI : 3589*cdf0e10cSrcweir nPointer = POINTER_TAB_SELECT_SE; 3590*cdf0e10cSrcweir break; 3591*cdf0e10cSrcweir case SW_TABSEL_HORI_RTL : 3592*cdf0e10cSrcweir case SW_TABSEL_VERT : 3593*cdf0e10cSrcweir nPointer = POINTER_TAB_SELECT_SW; 3594*cdf0e10cSrcweir break; 3595*cdf0e10cSrcweir case SW_TABCOLSEL_HORI : 3596*cdf0e10cSrcweir case SW_TABROWSEL_VERT : 3597*cdf0e10cSrcweir nPointer = POINTER_TAB_SELECT_S; 3598*cdf0e10cSrcweir break; 3599*cdf0e10cSrcweir case SW_TABROWSEL_HORI : 3600*cdf0e10cSrcweir nPointer = POINTER_TAB_SELECT_E; 3601*cdf0e10cSrcweir break; 3602*cdf0e10cSrcweir case SW_TABROWSEL_HORI_RTL : 3603*cdf0e10cSrcweir case SW_TABCOLSEL_VERT : 3604*cdf0e10cSrcweir nPointer = POINTER_TAB_SELECT_W; 3605*cdf0e10cSrcweir break; 3606*cdf0e10cSrcweir // <-- 3607*cdf0e10cSrcweir } 3608*cdf0e10cSrcweir 3609*cdf0e10cSrcweir if ( USHRT_MAX != nPointer && 3610*cdf0e10cSrcweir // --> FME 2004-10-20 #i35543# 3611*cdf0e10cSrcweir // Enhanced table selection is explicitely allowed in table mode 3612*cdf0e10cSrcweir ( !bChkTblSel || !rSh.IsTableMode() ) ) 3613*cdf0e10cSrcweir // <-- 3614*cdf0e10cSrcweir { 3615*cdf0e10cSrcweir SetPointer( nPointer ); 3616*cdf0e10cSrcweir } 3617*cdf0e10cSrcweir 3618*cdf0e10cSrcweir return; 3619*cdf0e10cSrcweir } 3620*cdf0e10cSrcweir // #i23726# 3621*cdf0e10cSrcweir else if (rSh.IsNumLabel(aDocPt, RULER_MOUSE_MARGINWIDTH)) 3622*cdf0e10cSrcweir { 3623*cdf0e10cSrcweir // --> OD 2005-02-21 #i42921# - consider vertical mode 3624*cdf0e10cSrcweir SwTxtNode* pNodeAtPos = rSh.GetNumRuleNodeAtPos( aDocPt ); 3625*cdf0e10cSrcweir const sal_uInt16 nPointer = 3626*cdf0e10cSrcweir rSh.IsVerticalModeAtNdAndPos( *pNodeAtPos, aDocPt ) 3627*cdf0e10cSrcweir ? POINTER_VSIZEBAR 3628*cdf0e10cSrcweir : POINTER_HSIZEBAR; 3629*cdf0e10cSrcweir SetPointer( nPointer ); 3630*cdf0e10cSrcweir // <-- 3631*cdf0e10cSrcweir 3632*cdf0e10cSrcweir return; 3633*cdf0e10cSrcweir } 3634*cdf0e10cSrcweir } 3635*cdf0e10cSrcweir 3636*cdf0e10cSrcweir sal_Bool bDelShadCrsr = sal_True; 3637*cdf0e10cSrcweir 3638*cdf0e10cSrcweir switch ( rMEvt.GetModifier() + rMEvt.GetButtons() ) 3639*cdf0e10cSrcweir { 3640*cdf0e10cSrcweir case MOUSE_LEFT: 3641*cdf0e10cSrcweir if( pAnchorMarker ) 3642*cdf0e10cSrcweir { 3643*cdf0e10cSrcweir // Now we need to refresh the SdrHdl pointer of pAnchorMarker. 3644*cdf0e10cSrcweir // This looks a little bit tricky, but it solves the following 3645*cdf0e10cSrcweir // problem: the pAnchorMarker contains a pointer to an SdrHdl, 3646*cdf0e10cSrcweir // if the FindAnchorPos-call cause a scrolling of the visible 3647*cdf0e10cSrcweir // area, it's possible that the SdrHdl will be destroyed and a 3648*cdf0e10cSrcweir // new one will initialized at the original position(GetHdlPos). 3649*cdf0e10cSrcweir // So the pAnchorMarker has to find the right SdrHdl, if it's 3650*cdf0e10cSrcweir // the old one, it will find it with position aOld, if this one 3651*cdf0e10cSrcweir // is destroyed, it will find a new one at position GetHdlPos(). 3652*cdf0e10cSrcweir // --> OD 2010-09-16 #i114522# 3653*cdf0e10cSrcweir // const Point aOld = pAnchorMarker->GetPos(); 3654*cdf0e10cSrcweir const Point aOld = pAnchorMarker->GetPosForHitTest( *(rSh.GetOut()) ); 3655*cdf0e10cSrcweir // <-- 3656*cdf0e10cSrcweir Point aNew = rSh.FindAnchorPos( aDocPt ); 3657*cdf0e10cSrcweir SdrHdl* pHdl; 3658*cdf0e10cSrcweir if( (0!=( pHdl = pSdrView->PickHandle( aOld ) )|| 3659*cdf0e10cSrcweir 0 !=(pHdl = pSdrView->PickHandle( pAnchorMarker->GetHdlPos()) ) ) && 3660*cdf0e10cSrcweir ( pHdl->GetKind() == HDL_ANCHOR || 3661*cdf0e10cSrcweir pHdl->GetKind() == HDL_ANCHOR_TR ) ) 3662*cdf0e10cSrcweir { 3663*cdf0e10cSrcweir pAnchorMarker->ChgHdl( pHdl ); 3664*cdf0e10cSrcweir if( aNew.X() || aNew.Y() ) 3665*cdf0e10cSrcweir { 3666*cdf0e10cSrcweir pAnchorMarker->SetPos( aNew ); 3667*cdf0e10cSrcweir pAnchorMarker->SetLastPos( aDocPt ); 3668*cdf0e10cSrcweir //OLMpSdrView->RefreshAllIAOManagers(); 3669*cdf0e10cSrcweir } 3670*cdf0e10cSrcweir } 3671*cdf0e10cSrcweir else 3672*cdf0e10cSrcweir { 3673*cdf0e10cSrcweir delete pAnchorMarker; 3674*cdf0e10cSrcweir pAnchorMarker = NULL; 3675*cdf0e10cSrcweir } 3676*cdf0e10cSrcweir } 3677*cdf0e10cSrcweir if ( bInsDraw ) 3678*cdf0e10cSrcweir { 3679*cdf0e10cSrcweir if ( !bMBPressed ) 3680*cdf0e10cSrcweir break; 3681*cdf0e10cSrcweir if ( bIsInMove || IsMinMove( aStartPos, aPixPt ) ) 3682*cdf0e10cSrcweir { 3683*cdf0e10cSrcweir if ( !bInsWin ) 3684*cdf0e10cSrcweir LeaveArea( aDocPt ); 3685*cdf0e10cSrcweir else 3686*cdf0e10cSrcweir EnterArea(); 3687*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() ) 3688*cdf0e10cSrcweir { 3689*cdf0e10cSrcweir pSdrView->SetOrtho(sal_False); 3690*cdf0e10cSrcweir rView.GetDrawFuncPtr()->MouseMove( rMEvt ); 3691*cdf0e10cSrcweir } 3692*cdf0e10cSrcweir bIsInMove = sal_True; 3693*cdf0e10cSrcweir } 3694*cdf0e10cSrcweir return; 3695*cdf0e10cSrcweir } 3696*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT: 3697*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1: 3698*cdf0e10cSrcweir if ( !bMBPressed ) 3699*cdf0e10cSrcweir break; 3700*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD1: 3701*cdf0e10cSrcweir if ( bFrmDrag && rSh.IsSelFrmMode() ) 3702*cdf0e10cSrcweir { 3703*cdf0e10cSrcweir if( !bMBPressed ) 3704*cdf0e10cSrcweir break; 3705*cdf0e10cSrcweir 3706*cdf0e10cSrcweir if ( bIsInMove || IsMinMove( aStartPos, aPixPt ) ) 3707*cdf0e10cSrcweir { 3708*cdf0e10cSrcweir // Event-Verarbeitung fuers Resizen 3709*cdf0e10cSrcweir if( pSdrView->AreObjectsMarked() ) 3710*cdf0e10cSrcweir { 3711*cdf0e10cSrcweir const SwFrmFmt* pFlyFmt; 3712*cdf0e10cSrcweir const SvxMacro* pMacro; 3713*cdf0e10cSrcweir 3714*cdf0e10cSrcweir const Point aSttPt( PixelToLogic( aStartPos ) ); 3715*cdf0e10cSrcweir 3716*cdf0e10cSrcweir // geht es los? 3717*cdf0e10cSrcweir if( HDL_USER == eSdrMoveHdl ) 3718*cdf0e10cSrcweir { 3719*cdf0e10cSrcweir SdrHdl* pHdl = pSdrView->PickHandle( aSttPt ); 3720*cdf0e10cSrcweir eSdrMoveHdl = pHdl ? pHdl->GetKind() : HDL_MOVE; 3721*cdf0e10cSrcweir } 3722*cdf0e10cSrcweir 3723*cdf0e10cSrcweir sal_uInt16 nEvent = HDL_MOVE == eSdrMoveHdl 3724*cdf0e10cSrcweir ? SW_EVENT_FRM_MOVE 3725*cdf0e10cSrcweir : SW_EVENT_FRM_RESIZE; 3726*cdf0e10cSrcweir 3727*cdf0e10cSrcweir if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) && 3728*cdf0e10cSrcweir 0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable(). 3729*cdf0e10cSrcweir Get( nEvent )) && 3730*cdf0e10cSrcweir // oder nur z.B. alle 20 Twip bescheid sagen? 3731*cdf0e10cSrcweir // ( 20 > Abs( aRszMvHdlPt.X() - aDocPt.X() ) || 3732*cdf0e10cSrcweir // 20 > Abs( aRszMvHdlPt.Y() - aDocPt.Y() ) ) 3733*cdf0e10cSrcweir aRszMvHdlPt != aDocPt ) 3734*cdf0e10cSrcweir { 3735*cdf0e10cSrcweir aRszMvHdlPt = aDocPt; 3736*cdf0e10cSrcweir sal_uInt16 nPos = 0; 3737*cdf0e10cSrcweir String sRet; 3738*cdf0e10cSrcweir SbxArrayRef xArgs = new SbxArray; 3739*cdf0e10cSrcweir SbxVariableRef xVar = new SbxVariable; 3740*cdf0e10cSrcweir xVar->PutString( pFlyFmt->GetName() ); 3741*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 3742*cdf0e10cSrcweir 3743*cdf0e10cSrcweir if( SW_EVENT_FRM_RESIZE == nEvent ) 3744*cdf0e10cSrcweir { 3745*cdf0e10cSrcweir xVar = new SbxVariable; 3746*cdf0e10cSrcweir xVar->PutUShort( static_cast< sal_uInt16 >(eSdrMoveHdl) ); 3747*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 3748*cdf0e10cSrcweir } 3749*cdf0e10cSrcweir 3750*cdf0e10cSrcweir xVar = new SbxVariable; 3751*cdf0e10cSrcweir xVar->PutLong( aDocPt.X() - aSttPt.X() ); 3752*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 3753*cdf0e10cSrcweir xVar = new SbxVariable; 3754*cdf0e10cSrcweir xVar->PutLong( aDocPt.Y() - aSttPt.Y() ); 3755*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 3756*cdf0e10cSrcweir 3757*cdf0e10cSrcweir ReleaseMouse(); 3758*cdf0e10cSrcweir 3759*cdf0e10cSrcweir rSh.ExecMacro( *pMacro, &sRet, &xArgs ); 3760*cdf0e10cSrcweir 3761*cdf0e10cSrcweir CaptureMouse(); 3762*cdf0e10cSrcweir 3763*cdf0e10cSrcweir if( sRet.Len() && 0 != sRet.ToInt32() ) 3764*cdf0e10cSrcweir return ; 3765*cdf0e10cSrcweir } 3766*cdf0e10cSrcweir } 3767*cdf0e10cSrcweir // Event-Verarbeitung fuers Resizen 3768*cdf0e10cSrcweir 3769*cdf0e10cSrcweir if( bIsDocReadOnly ) 3770*cdf0e10cSrcweir break; 3771*cdf0e10cSrcweir 3772*cdf0e10cSrcweir if ( rMEvt.IsShift() ) 3773*cdf0e10cSrcweir { 3774*cdf0e10cSrcweir pSdrView->SetOrtho(sal_True); 3775*cdf0e10cSrcweir pSdrView->SetAngleSnapEnabled(sal_True); 3776*cdf0e10cSrcweir } 3777*cdf0e10cSrcweir else 3778*cdf0e10cSrcweir { 3779*cdf0e10cSrcweir pSdrView->SetOrtho(sal_False); 3780*cdf0e10cSrcweir pSdrView->SetAngleSnapEnabled(sal_False); 3781*cdf0e10cSrcweir } 3782*cdf0e10cSrcweir 3783*cdf0e10cSrcweir (rSh.*rSh.fnDrag)( &aDocPt, rMEvt.IsShift() ); 3784*cdf0e10cSrcweir bIsInMove = sal_True; 3785*cdf0e10cSrcweir } 3786*cdf0e10cSrcweir else if( bIsDocReadOnly ) 3787*cdf0e10cSrcweir break; 3788*cdf0e10cSrcweir 3789*cdf0e10cSrcweir if ( !bInsWin ) 3790*cdf0e10cSrcweir { 3791*cdf0e10cSrcweir Point aTmp( aDocPt ); 3792*cdf0e10cSrcweir aTmp += rSh.VisArea().Pos() - aOldPt; 3793*cdf0e10cSrcweir LeaveArea( aTmp ); 3794*cdf0e10cSrcweir } 3795*cdf0e10cSrcweir else if(bIsInMove) 3796*cdf0e10cSrcweir EnterArea(); 3797*cdf0e10cSrcweir return; 3798*cdf0e10cSrcweir } 3799*cdf0e10cSrcweir if ( !rSh.IsSelFrmMode() && !bDDINetAttr && 3800*cdf0e10cSrcweir (IsMinMove( aStartPos,aPixPt ) || bIsInMove) && 3801*cdf0e10cSrcweir (rSh.IsInSelect() || !rSh.ChgCurrPam( aDocPt )) ) 3802*cdf0e10cSrcweir { 3803*cdf0e10cSrcweir if ( pSdrView ) 3804*cdf0e10cSrcweir { 3805*cdf0e10cSrcweir if ( rMEvt.IsShift() ) 3806*cdf0e10cSrcweir pSdrView->SetOrtho(sal_True); 3807*cdf0e10cSrcweir else 3808*cdf0e10cSrcweir pSdrView->SetOrtho(sal_False); 3809*cdf0e10cSrcweir } 3810*cdf0e10cSrcweir if ( !bInsWin ) 3811*cdf0e10cSrcweir { 3812*cdf0e10cSrcweir Point aTmp( aDocPt ); 3813*cdf0e10cSrcweir aTmp += rSh.VisArea().Pos() - aOldPt; 3814*cdf0e10cSrcweir LeaveArea( aTmp ); 3815*cdf0e10cSrcweir } 3816*cdf0e10cSrcweir else 3817*cdf0e10cSrcweir { 3818*cdf0e10cSrcweir //JP 24.09.98: Fix fuer die Bugs 55592 / 55931 3819*cdf0e10cSrcweir //JP 23.04.99: Fix fuer den Bugs 65289 3820*cdf0e10cSrcweir //JP 06.07.99: Fix fuer den Bugs 67360 3821*cdf0e10cSrcweir if( !rMEvt.IsSynthetic() && 3822*cdf0e10cSrcweir !(( MOUSE_LEFT + KEY_MOD1 == 3823*cdf0e10cSrcweir rMEvt.GetModifier() + rMEvt.GetButtons() ) && 3824*cdf0e10cSrcweir rSh.Is_FnDragEQBeginDrag() && !rSh.IsAddMode() )) 3825*cdf0e10cSrcweir { 3826*cdf0e10cSrcweir (rSh.*rSh.fnDrag)( &aDocPt,sal_False ); 3827*cdf0e10cSrcweir 3828*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPt,sal_False)); 3829*cdf0e10cSrcweir EnterArea(); 3830*cdf0e10cSrcweir } 3831*cdf0e10cSrcweir } 3832*cdf0e10cSrcweir } 3833*cdf0e10cSrcweir bDDINetAttr = sal_False; 3834*cdf0e10cSrcweir break; 3835*cdf0e10cSrcweir case 0: 3836*cdf0e10cSrcweir { 3837*cdf0e10cSrcweir if ( pApplyTempl ) 3838*cdf0e10cSrcweir { 3839*cdf0e10cSrcweir UpdatePointer(aDocPt, 0); // evtl. muss hier ein Rahmen markiert werden 3840*cdf0e10cSrcweir break; 3841*cdf0e10cSrcweir } 3842*cdf0e10cSrcweir //#i6193#, change ui if mouse is over SwPostItField 3843*cdf0e10cSrcweir // TODO: do the same thing for redlines SW_REDLINE 3844*cdf0e10cSrcweir SwRect aFldRect; 3845*cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD); 3846*cdf0e10cSrcweir if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_False, &aFldRect ) ) 3847*cdf0e10cSrcweir { 3848*cdf0e10cSrcweir const SwField* pFld = aCntntAtPos.aFnd.pFld; 3849*cdf0e10cSrcweir if (pFld->Which()== RES_POSTITFLD) 3850*cdf0e10cSrcweir { 3851*cdf0e10cSrcweir rView.GetPostItMgr()->SetShadowState(reinterpret_cast<const SwPostItField*>(pFld),false); 3852*cdf0e10cSrcweir } 3853*cdf0e10cSrcweir else 3854*cdf0e10cSrcweir rView.GetPostItMgr()->SetShadowState(0,false); 3855*cdf0e10cSrcweir } 3856*cdf0e10cSrcweir else 3857*cdf0e10cSrcweir rView.GetPostItMgr()->SetShadowState(0,false); 3858*cdf0e10cSrcweir // no break; 3859*cdf0e10cSrcweir } 3860*cdf0e10cSrcweir case KEY_SHIFT: 3861*cdf0e10cSrcweir case KEY_MOD2: 3862*cdf0e10cSrcweir case KEY_MOD1: 3863*cdf0e10cSrcweir if ( !bInsDraw ) 3864*cdf0e10cSrcweir { 3865*cdf0e10cSrcweir sal_Bool bTstShdwCrsr = sal_True; 3866*cdf0e10cSrcweir 3867*cdf0e10cSrcweir UpdatePointer( aDocPt, rMEvt.GetModifier() ); 3868*cdf0e10cSrcweir 3869*cdf0e10cSrcweir const SwFrmFmt* pFmt = 0; 3870*cdf0e10cSrcweir const SwFmtINetFmt* pINet = 0; 3871*cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_INETATTR ); 3872*cdf0e10cSrcweir if( rSh.GetContentAtPos( aDocPt, aCntntAtPos ) ) 3873*cdf0e10cSrcweir pINet = (SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr; 3874*cdf0e10cSrcweir 3875*cdf0e10cSrcweir const void* pTmp = pINet; 3876*cdf0e10cSrcweir 3877*cdf0e10cSrcweir if( pINet || 3878*cdf0e10cSrcweir 0 != ( pTmp = pFmt = rSh.GetFmtFromAnyObj( aDocPt ))) 3879*cdf0e10cSrcweir { 3880*cdf0e10cSrcweir bTstShdwCrsr = sal_False; 3881*cdf0e10cSrcweir if( pTmp == pINet ) 3882*cdf0e10cSrcweir aSaveCallEvent.Set( pINet ); 3883*cdf0e10cSrcweir else 3884*cdf0e10cSrcweir { 3885*cdf0e10cSrcweir IMapObject* pIMapObj = pFmt->GetIMapObject( aDocPt ); 3886*cdf0e10cSrcweir if( pIMapObj ) 3887*cdf0e10cSrcweir aSaveCallEvent.Set( pFmt, pIMapObj ); 3888*cdf0e10cSrcweir else 3889*cdf0e10cSrcweir aSaveCallEvent.Set( EVENT_OBJECT_URLITEM, pFmt ); 3890*cdf0e10cSrcweir } 3891*cdf0e10cSrcweir 3892*cdf0e10cSrcweir // sollte wir ueber einem InternetFeld mit einem 3893*cdf0e10cSrcweir // gebundenen Macro stehen? 3894*cdf0e10cSrcweir if( aSaveCallEvent != aLastCallEvent ) 3895*cdf0e10cSrcweir { 3896*cdf0e10cSrcweir if( aLastCallEvent.HasEvent() ) 3897*cdf0e10cSrcweir rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT, 3898*cdf0e10cSrcweir aLastCallEvent, sal_True ); 3899*cdf0e10cSrcweir // 0 besagt, das das Object gar keine Tabelle hat 3900*cdf0e10cSrcweir if( !rSh.CallEvent( SFX_EVENT_MOUSEOVER_OBJECT, 3901*cdf0e10cSrcweir aSaveCallEvent )) 3902*cdf0e10cSrcweir aSaveCallEvent.Clear(); 3903*cdf0e10cSrcweir } 3904*cdf0e10cSrcweir } 3905*cdf0e10cSrcweir else if( aLastCallEvent.HasEvent() ) 3906*cdf0e10cSrcweir { 3907*cdf0e10cSrcweir // Cursor stand auf einem Object 3908*cdf0e10cSrcweir rSh.CallEvent( SFX_EVENT_MOUSEOUT_OBJECT, 3909*cdf0e10cSrcweir aLastCallEvent, sal_True ); 3910*cdf0e10cSrcweir } 3911*cdf0e10cSrcweir 3912*cdf0e10cSrcweir if( bTstShdwCrsr && bInsWin && !bIsDocReadOnly && 3913*cdf0e10cSrcweir !bInsFrm && 3914*cdf0e10cSrcweir !rSh.GetViewOptions()->getBrowseMode() && 3915*cdf0e10cSrcweir rSh.GetViewOptions()->IsShadowCursor() && 3916*cdf0e10cSrcweir !(rMEvt.GetModifier() + rMEvt.GetButtons()) && 3917*cdf0e10cSrcweir !rSh.HasSelection() && !GetConnectMetaFile() ) 3918*cdf0e10cSrcweir { 3919*cdf0e10cSrcweir SwRect aRect; 3920*cdf0e10cSrcweir sal_Int16 eOrient; 3921*cdf0e10cSrcweir SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode(); 3922*cdf0e10cSrcweir if( rSh.GetShadowCrsrPos( aDocPt, eMode, aRect, eOrient )) 3923*cdf0e10cSrcweir { 3924*cdf0e10cSrcweir if( !pShadCrsr ) 3925*cdf0e10cSrcweir pShadCrsr = new SwShadowCursor( *this, 3926*cdf0e10cSrcweir SwViewOption::GetDirectCursorColor() ); 3927*cdf0e10cSrcweir if( text::HoriOrientation::RIGHT != eOrient && text::HoriOrientation::CENTER != eOrient ) 3928*cdf0e10cSrcweir eOrient = text::HoriOrientation::LEFT; 3929*cdf0e10cSrcweir pShadCrsr->SetPos( aRect.Pos(), aRect.Height(), static_cast< sal_uInt16 >(eOrient) ); 3930*cdf0e10cSrcweir bDelShadCrsr = sal_False; 3931*cdf0e10cSrcweir } 3932*cdf0e10cSrcweir } 3933*cdf0e10cSrcweir } 3934*cdf0e10cSrcweir break; 3935*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD2: 3936*cdf0e10cSrcweir if( rSh.IsBlockMode() && !rMEvt.IsSynthetic() ) 3937*cdf0e10cSrcweir { 3938*cdf0e10cSrcweir (rSh.*rSh.fnDrag)( &aDocPt,sal_False ); 3939*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPt,sal_False)); 3940*cdf0e10cSrcweir EnterArea(); 3941*cdf0e10cSrcweir } 3942*cdf0e10cSrcweir break; 3943*cdf0e10cSrcweir } 3944*cdf0e10cSrcweir 3945*cdf0e10cSrcweir if( bDelShadCrsr && pShadCrsr ) 3946*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 3947*cdf0e10cSrcweir bWasShdwCrsr = sal_False; 3948*cdf0e10cSrcweir } 3949*cdf0e10cSrcweir 3950*cdf0e10cSrcweir /*-------------------------------------------------------------------- 3951*cdf0e10cSrcweir Beschreibung: Button Up 3952*cdf0e10cSrcweir --------------------------------------------------------------------*/ 3953*cdf0e10cSrcweir 3954*cdf0e10cSrcweir 3955*cdf0e10cSrcweir void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) 3956*cdf0e10cSrcweir { 3957*cdf0e10cSrcweir sal_Bool bCallBase = sal_True; 3958*cdf0e10cSrcweir 3959*cdf0e10cSrcweir sal_Bool bCallShadowCrsr = bWasShdwCrsr; 3960*cdf0e10cSrcweir bWasShdwCrsr = sal_False; 3961*cdf0e10cSrcweir if( pShadCrsr ) 3962*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 3963*cdf0e10cSrcweir 3964*cdf0e10cSrcweir if( pRowColumnSelectionStart ) 3965*cdf0e10cSrcweir DELETEZ( pRowColumnSelectionStart ); 3966*cdf0e10cSrcweir 3967*cdf0e10cSrcweir SdrHdlKind eOldSdrMoveHdl = eSdrMoveHdl; 3968*cdf0e10cSrcweir eSdrMoveHdl = HDL_USER; // fuer die MoveEvents - wieder zuruecksetzen 3969*cdf0e10cSrcweir 3970*cdf0e10cSrcweir // sicherheitshalber zuruecksetzen Bug 27900 3971*cdf0e10cSrcweir rView.SetTabColFromDoc( sal_False ); 3972*cdf0e10cSrcweir rView.SetNumRuleNodeFromDoc(NULL); 3973*cdf0e10cSrcweir 3974*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 3975*cdf0e10cSrcweir SET_CURR_SHELL( &rSh ); 3976*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 3977*cdf0e10cSrcweir if ( pSdrView ) 3978*cdf0e10cSrcweir { 3979*cdf0e10cSrcweir pSdrView->SetOrtho(sal_False); 3980*cdf0e10cSrcweir 3981*cdf0e10cSrcweir if ( pSdrView->MouseButtonUp( rMEvt,this ) ) 3982*cdf0e10cSrcweir { 3983*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); 3984*cdf0e10cSrcweir return; // Event von der SdrView ausgewertet 3985*cdf0e10cSrcweir } 3986*cdf0e10cSrcweir } 3987*cdf0e10cSrcweir //MouseButtonUp nur bearbeiten, wenn auch das Down an dieses Fenster ging. 3988*cdf0e10cSrcweir if ( !bMBPressed ) 3989*cdf0e10cSrcweir { 3990*cdf0e10cSrcweir // OS 25.02.97 Undo fuer die Giesskann ist bereits im CommandHdl 3991*cdf0e10cSrcweir //JP 29.09.95: so sollte es sein!!! if(pApplyTempl->bUndo) 3992*cdf0e10cSrcweir // if( pApplyTempl && MOUSE_RIGHT == rMEvt.GetModifier() + rMEvt.GetButtons() ) 3993*cdf0e10cSrcweir // rSh.Do( SwWrtShell::UNDO ); 3994*cdf0e10cSrcweir return; 3995*cdf0e10cSrcweir } 3996*cdf0e10cSrcweir 3997*cdf0e10cSrcweir Point aDocPt( PixelToLogic( rMEvt.GetPosPixel() ) ); 3998*cdf0e10cSrcweir 3999*cdf0e10cSrcweir if ( bDDTimerStarted ) 4000*cdf0e10cSrcweir { 4001*cdf0e10cSrcweir StopDDTimer( &rSh, aDocPt ); 4002*cdf0e10cSrcweir bMBPressed = sal_False; 4003*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 4004*cdf0e10cSrcweir { 4005*cdf0e10cSrcweir (rSh.*rSh.fnEndDrag)( &aDocPt, sal_False ); 4006*cdf0e10cSrcweir bFrmDrag = sal_False; 4007*cdf0e10cSrcweir } 4008*cdf0e10cSrcweir bNoInterrupt = sal_False; 4009*cdf0e10cSrcweir ReleaseMouse(); 4010*cdf0e10cSrcweir return; 4011*cdf0e10cSrcweir } 4012*cdf0e10cSrcweir 4013*cdf0e10cSrcweir if( pAnchorMarker ) 4014*cdf0e10cSrcweir { 4015*cdf0e10cSrcweir Point aPnt( pAnchorMarker->GetLastPos() ); 4016*cdf0e10cSrcweir //OLMpSdrView->RefreshAllIAOManagers(); 4017*cdf0e10cSrcweir DELETEZ( pAnchorMarker ); 4018*cdf0e10cSrcweir if( aPnt.X() || aPnt.Y() ) 4019*cdf0e10cSrcweir rSh.FindAnchorPos( aPnt, sal_True ); 4020*cdf0e10cSrcweir } 4021*cdf0e10cSrcweir if ( bInsDraw && rView.GetDrawFuncPtr() ) 4022*cdf0e10cSrcweir { 4023*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr()->MouseButtonUp( rMEvt ) ) 4024*cdf0e10cSrcweir { 4025*cdf0e10cSrcweir if (rView.GetDrawFuncPtr()) // Koennte im MouseButtonUp zerstoert worden sein 4026*cdf0e10cSrcweir { 4027*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 4028*cdf0e10cSrcweir 4029*cdf0e10cSrcweir if (!rView.IsDrawMode()) 4030*cdf0e10cSrcweir { 4031*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 4032*cdf0e10cSrcweir SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); 4033*cdf0e10cSrcweir rBind.Invalidate( SID_ATTR_SIZE ); 4034*cdf0e10cSrcweir rBind.Invalidate( SID_TABLE_CELL ); 4035*cdf0e10cSrcweir } 4036*cdf0e10cSrcweir } 4037*cdf0e10cSrcweir 4038*cdf0e10cSrcweir if ( rSh.IsObjSelected() ) 4039*cdf0e10cSrcweir { 4040*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 4041*cdf0e10cSrcweir if (!rView.GetDrawFuncPtr()) 4042*cdf0e10cSrcweir StdDrawMode( OBJ_NONE, sal_True ); 4043*cdf0e10cSrcweir } 4044*cdf0e10cSrcweir else if ( rSh.IsFrmSelected() ) 4045*cdf0e10cSrcweir { 4046*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 4047*cdf0e10cSrcweir StopInsFrm(); 4048*cdf0e10cSrcweir } 4049*cdf0e10cSrcweir else 4050*cdf0e10cSrcweir { 4051*cdf0e10cSrcweir const Point aDocPos( PixelToLogic( aStartPos ) ); 4052*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,sal_False)); 4053*cdf0e10cSrcweir rSh.Edit(); 4054*cdf0e10cSrcweir } 4055*cdf0e10cSrcweir 4056*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 4057*cdf0e10cSrcweir } 4058*cdf0e10cSrcweir else if (rMEvt.GetButtons() == MOUSE_RIGHT && rSh.IsDrawCreate()) 4059*cdf0e10cSrcweir rView.GetDrawFuncPtr()->BreakCreate(); // Zeichnen abbrechen 4060*cdf0e10cSrcweir 4061*cdf0e10cSrcweir bNoInterrupt = sal_False; 4062*cdf0e10cSrcweir ReleaseMouse(); 4063*cdf0e10cSrcweir return; 4064*cdf0e10cSrcweir } 4065*cdf0e10cSrcweir sal_Bool bPopMode = sal_False; 4066*cdf0e10cSrcweir switch ( rMEvt.GetModifier() + rMEvt.GetButtons() ) 4067*cdf0e10cSrcweir { 4068*cdf0e10cSrcweir case MOUSE_LEFT: 4069*cdf0e10cSrcweir if ( bInsDraw && rSh.IsDrawCreate() ) 4070*cdf0e10cSrcweir { 4071*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() && rView.GetDrawFuncPtr()->MouseButtonUp(rMEvt) == sal_True ) 4072*cdf0e10cSrcweir { 4073*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 4074*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 4075*cdf0e10cSrcweir if ( rSh.IsObjSelected() ) 4076*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 4077*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() && bInsFrm ) 4078*cdf0e10cSrcweir StopInsFrm(); 4079*cdf0e10cSrcweir } 4080*cdf0e10cSrcweir bCallBase = sal_False; 4081*cdf0e10cSrcweir break; 4082*cdf0e10cSrcweir } 4083*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD1: 4084*cdf0e10cSrcweir case MOUSE_LEFT + KEY_MOD2: 4085*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT + KEY_MOD1: 4086*cdf0e10cSrcweir if ( bFrmDrag && rSh.IsSelFrmMode() ) 4087*cdf0e10cSrcweir { 4088*cdf0e10cSrcweir if ( rMEvt.IsMod1() ) //Kopieren und nicht moven. 4089*cdf0e10cSrcweir { 4090*cdf0e10cSrcweir //Drag abbrechen, statt dessen internes Copy verwenden 4091*cdf0e10cSrcweir Rectangle aRect; 4092*cdf0e10cSrcweir rSh.GetDrawView()->TakeActionRect( aRect ); 4093*cdf0e10cSrcweir if (!aRect.IsEmpty()) 4094*cdf0e10cSrcweir { 4095*cdf0e10cSrcweir rSh.BreakDrag(); 4096*cdf0e10cSrcweir Point aEndPt, aSttPt; 4097*cdf0e10cSrcweir if ( rSh.GetSelFrmType() & FRMTYPE_FLY_ATCNT ) 4098*cdf0e10cSrcweir { 4099*cdf0e10cSrcweir aEndPt = aRect.TopLeft(); 4100*cdf0e10cSrcweir aSttPt = rSh.GetDrawView()->GetAllMarkedRect().TopLeft(); 4101*cdf0e10cSrcweir } 4102*cdf0e10cSrcweir else 4103*cdf0e10cSrcweir { 4104*cdf0e10cSrcweir aEndPt = aRect.Center(); 4105*cdf0e10cSrcweir aSttPt = rSh.GetDrawView()->GetAllMarkedRect().Center(); 4106*cdf0e10cSrcweir } 4107*cdf0e10cSrcweir if ( aSttPt != aEndPt ) 4108*cdf0e10cSrcweir { 4109*cdf0e10cSrcweir rSh.StartUndo( UNDO_UI_DRAG_AND_COPY ); 4110*cdf0e10cSrcweir rSh.Copy(&rSh, aSttPt, aEndPt, sal_False); 4111*cdf0e10cSrcweir rSh.EndUndo( UNDO_UI_DRAG_AND_COPY ); 4112*cdf0e10cSrcweir } 4113*cdf0e10cSrcweir } 4114*cdf0e10cSrcweir else 4115*cdf0e10cSrcweir (rSh.*rSh.fnEndDrag)( &aDocPt,sal_False ); 4116*cdf0e10cSrcweir } 4117*cdf0e10cSrcweir else 4118*cdf0e10cSrcweir { 4119*cdf0e10cSrcweir { 4120*cdf0e10cSrcweir const SwFrmFmt* pFlyFmt; 4121*cdf0e10cSrcweir const SvxMacro* pMacro; 4122*cdf0e10cSrcweir 4123*cdf0e10cSrcweir sal_uInt16 nEvent = HDL_MOVE == eOldSdrMoveHdl 4124*cdf0e10cSrcweir ? SW_EVENT_FRM_MOVE 4125*cdf0e10cSrcweir : SW_EVENT_FRM_RESIZE; 4126*cdf0e10cSrcweir 4127*cdf0e10cSrcweir if( 0 != ( pFlyFmt = rSh.GetFlyFrmFmt() ) && 4128*cdf0e10cSrcweir 0 != ( pMacro = pFlyFmt->GetMacro().GetMacroTable(). 4129*cdf0e10cSrcweir Get( nEvent )) ) 4130*cdf0e10cSrcweir { 4131*cdf0e10cSrcweir const Point aSttPt( PixelToLogic( aStartPos ) ); 4132*cdf0e10cSrcweir aRszMvHdlPt = aDocPt; 4133*cdf0e10cSrcweir sal_uInt16 nPos = 0; 4134*cdf0e10cSrcweir SbxArrayRef xArgs = new SbxArray; 4135*cdf0e10cSrcweir SbxVariableRef xVar = new SbxVariable; 4136*cdf0e10cSrcweir xVar->PutString( pFlyFmt->GetName() ); 4137*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 4138*cdf0e10cSrcweir 4139*cdf0e10cSrcweir if( SW_EVENT_FRM_RESIZE == nEvent ) 4140*cdf0e10cSrcweir { 4141*cdf0e10cSrcweir xVar = new SbxVariable; 4142*cdf0e10cSrcweir xVar->PutUShort( static_cast< sal_uInt16 >(eOldSdrMoveHdl) ); 4143*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 4144*cdf0e10cSrcweir } 4145*cdf0e10cSrcweir 4146*cdf0e10cSrcweir xVar = new SbxVariable; 4147*cdf0e10cSrcweir xVar->PutLong( aDocPt.X() - aSttPt.X() ); 4148*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 4149*cdf0e10cSrcweir xVar = new SbxVariable; 4150*cdf0e10cSrcweir xVar->PutLong( aDocPt.Y() - aSttPt.Y() ); 4151*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 4152*cdf0e10cSrcweir 4153*cdf0e10cSrcweir xVar = new SbxVariable; 4154*cdf0e10cSrcweir xVar->PutUShort( 1 ); 4155*cdf0e10cSrcweir xArgs->Put( &xVar, ++nPos ); 4156*cdf0e10cSrcweir 4157*cdf0e10cSrcweir ReleaseMouse(); 4158*cdf0e10cSrcweir 4159*cdf0e10cSrcweir rSh.ExecMacro( *pMacro, 0, &xArgs ); 4160*cdf0e10cSrcweir 4161*cdf0e10cSrcweir CaptureMouse(); 4162*cdf0e10cSrcweir } 4163*cdf0e10cSrcweir } 4164*cdf0e10cSrcweir (rSh.*rSh.fnEndDrag)( &aDocPt,sal_False ); 4165*cdf0e10cSrcweir } 4166*cdf0e10cSrcweir bFrmDrag = sal_False; 4167*cdf0e10cSrcweir bCallBase = sal_False; 4168*cdf0e10cSrcweir break; 4169*cdf0e10cSrcweir } 4170*cdf0e10cSrcweir bPopMode = sal_True; 4171*cdf0e10cSrcweir // no break 4172*cdf0e10cSrcweir case MOUSE_LEFT + KEY_SHIFT: 4173*cdf0e10cSrcweir if (rSh.IsSelFrmMode()) 4174*cdf0e10cSrcweir { 4175*cdf0e10cSrcweir 4176*cdf0e10cSrcweir (rSh.*rSh.fnEndDrag)( &aDocPt, sal_False ); 4177*cdf0e10cSrcweir bFrmDrag = sal_False; 4178*cdf0e10cSrcweir bCallBase = sal_False; 4179*cdf0e10cSrcweir break; 4180*cdf0e10cSrcweir } 4181*cdf0e10cSrcweir 4182*cdf0e10cSrcweir if( bHoldSelection ) 4183*cdf0e10cSrcweir { 4184*cdf0e10cSrcweir //JP 27.04.99: Bug 65389 - das EndDrag sollte auf jedenfall 4185*cdf0e10cSrcweir // gerufen werden. 4186*cdf0e10cSrcweir bHoldSelection = sal_False; 4187*cdf0e10cSrcweir (rSh.*rSh.fnEndDrag)( &aDocPt, sal_False ); 4188*cdf0e10cSrcweir } 4189*cdf0e10cSrcweir else 4190*cdf0e10cSrcweir { 4191*cdf0e10cSrcweir if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPt ) ) 4192*cdf0e10cSrcweir { 4193*cdf0e10cSrcweir const sal_Bool bTmpNoInterrupt = bNoInterrupt; 4194*cdf0e10cSrcweir bNoInterrupt = sal_False; 4195*cdf0e10cSrcweir { // nur temp. Move-Kontext aufspannen, da sonst die 4196*cdf0e10cSrcweir // Abfrage auf die Inhaltsform nicht funktioniert!!! 4197*cdf0e10cSrcweir MV_KONTEXT( &rSh ); 4198*cdf0e10cSrcweir const Point aDocPos( PixelToLogic( aStartPos ) ); 4199*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,sal_False)); 4200*cdf0e10cSrcweir } 4201*cdf0e10cSrcweir bNoInterrupt = bTmpNoInterrupt; 4202*cdf0e10cSrcweir 4203*cdf0e10cSrcweir } 4204*cdf0e10cSrcweir else 4205*cdf0e10cSrcweir { 4206*cdf0e10cSrcweir sal_Bool bInSel = rSh.IsInSelect(); 4207*cdf0e10cSrcweir (rSh.*rSh.fnEndDrag)( &aDocPt, sal_False ); 4208*cdf0e10cSrcweir 4209*cdf0e10cSrcweir // Internetfield? --> Link-Callen (DocLaden!!) 4210*cdf0e10cSrcweir //JP 18.10.96: Bug 32437 - 4211*cdf0e10cSrcweir // if( !rSh.HasSelection() ) 4212*cdf0e10cSrcweir if( !bInSel ) 4213*cdf0e10cSrcweir { 4214*cdf0e10cSrcweir sal_uInt16 nFilter = URLLOAD_NOFILTER; 4215*cdf0e10cSrcweir if( KEY_MOD1 == rMEvt.GetModifier() ) 4216*cdf0e10cSrcweir nFilter |= URLLOAD_NEWVIEW; 4217*cdf0e10cSrcweir 4218*cdf0e10cSrcweir sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly(); 4219*cdf0e10cSrcweir if ( !bExecHyperlinks ) 4220*cdf0e10cSrcweir { 4221*cdf0e10cSrcweir SvtSecurityOptions aSecOpts; 4222*cdf0e10cSrcweir const sal_Bool bSecureOption = aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ); 4223*cdf0e10cSrcweir if ( ( bSecureOption && rMEvt.GetModifier() == KEY_MOD1 ) || 4224*cdf0e10cSrcweir ( !bSecureOption && rMEvt.GetModifier() != KEY_MOD1 ) ) 4225*cdf0e10cSrcweir bExecHyperlinks = sal_True; 4226*cdf0e10cSrcweir } 4227*cdf0e10cSrcweir 4228*cdf0e10cSrcweir const sal_Bool bExecSmarttags = rMEvt.GetModifier() == KEY_MOD1; 4229*cdf0e10cSrcweir 4230*cdf0e10cSrcweir if(pApplyTempl) 4231*cdf0e10cSrcweir bExecHyperlinks = sal_False; 4232*cdf0e10cSrcweir 4233*cdf0e10cSrcweir SwContentAtPos aCntntAtPos( SwContentAtPos::SW_CLICKFIELD | 4234*cdf0e10cSrcweir SwContentAtPos::SW_INETATTR | 4235*cdf0e10cSrcweir SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL); 4236*cdf0e10cSrcweir 4237*cdf0e10cSrcweir if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_True ) ) 4238*cdf0e10cSrcweir { 4239*cdf0e10cSrcweir sal_Bool bViewLocked = rSh.IsViewLocked(); 4240*cdf0e10cSrcweir if( !bViewLocked && !rSh.IsReadOnlyAvailable() && 4241*cdf0e10cSrcweir aCntntAtPos.IsInProtectSect() ) 4242*cdf0e10cSrcweir rSh.LockView( sal_True ); 4243*cdf0e10cSrcweir 4244*cdf0e10cSrcweir ReleaseMouse(); 4245*cdf0e10cSrcweir 4246*cdf0e10cSrcweir if( SwContentAtPos::SW_FIELD == aCntntAtPos.eCntntAtPos ) 4247*cdf0e10cSrcweir { 4248*cdf0e10cSrcweir rSh.ClickToField( *aCntntAtPos.aFnd.pFld ); 4249*cdf0e10cSrcweir } 4250*cdf0e10cSrcweir else if ( SwContentAtPos::SW_SMARTTAG == aCntntAtPos.eCntntAtPos ) 4251*cdf0e10cSrcweir { 4252*cdf0e10cSrcweir // execute smarttag menu 4253*cdf0e10cSrcweir if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() ) 4254*cdf0e10cSrcweir rView.ExecSmartTagPopup( aDocPt ); 4255*cdf0e10cSrcweir } 4256*cdf0e10cSrcweir else if ( SwContentAtPos::SW_FORMCTRL == aCntntAtPos.eCntntAtPos ) 4257*cdf0e10cSrcweir { 4258*cdf0e10cSrcweir ASSERT( aCntntAtPos.aFnd.pFldmark != NULL, "where is my field ptr???"); 4259*cdf0e10cSrcweir if ( aCntntAtPos.aFnd.pFldmark != NULL) 4260*cdf0e10cSrcweir { 4261*cdf0e10cSrcweir IFieldmark *fieldBM = const_cast< IFieldmark* > ( aCntntAtPos.aFnd.pFldmark ); 4262*cdf0e10cSrcweir //SwDocShell* pDocSh = rView.GetDocShell(); 4263*cdf0e10cSrcweir //SwDoc *pDoc=pDocSh->GetDoc(); 4264*cdf0e10cSrcweir if (fieldBM->GetFieldname( ).equalsAscii( ODF_FORMCHECKBOX ) ) 4265*cdf0e10cSrcweir { 4266*cdf0e10cSrcweir ICheckboxFieldmark* pCheckboxFm = dynamic_cast<ICheckboxFieldmark*>(fieldBM); 4267*cdf0e10cSrcweir pCheckboxFm->SetChecked(!pCheckboxFm->IsChecked()); 4268*cdf0e10cSrcweir pCheckboxFm->Invalidate(); 4269*cdf0e10cSrcweir rSh.InvalidateWindows( rView.GetVisArea() ); 4270*cdf0e10cSrcweir } else if (fieldBM->GetFieldname().equalsAscii( ODF_FORMDROPDOWN) ) { 4271*cdf0e10cSrcweir rView.ExecFieldPopup( aDocPt, fieldBM ); 4272*cdf0e10cSrcweir fieldBM->Invalidate(); 4273*cdf0e10cSrcweir rSh.InvalidateWindows( rView.GetVisArea() ); 4274*cdf0e10cSrcweir } else { 4275*cdf0e10cSrcweir // unknown type.. 4276*cdf0e10cSrcweir } 4277*cdf0e10cSrcweir } 4278*cdf0e10cSrcweir } 4279*cdf0e10cSrcweir else // if ( SwContentAtPos::SW_INETATTR == aCntntAtPos.eCntntAtPos ) 4280*cdf0e10cSrcweir { 4281*cdf0e10cSrcweir if ( bExecHyperlinks ) 4282*cdf0e10cSrcweir rSh.ClickToINetAttr( *(SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr, nFilter ); 4283*cdf0e10cSrcweir } 4284*cdf0e10cSrcweir 4285*cdf0e10cSrcweir rSh.LockView( bViewLocked ); 4286*cdf0e10cSrcweir bCallShadowCrsr = sal_False; 4287*cdf0e10cSrcweir } 4288*cdf0e10cSrcweir else 4289*cdf0e10cSrcweir { 4290*cdf0e10cSrcweir aCntntAtPos = SwContentAtPos( SwContentAtPos::SW_FTN ); 4291*cdf0e10cSrcweir if( !rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_True ) && bExecHyperlinks ) 4292*cdf0e10cSrcweir { 4293*cdf0e10cSrcweir SdrViewEvent aVEvt; 4294*cdf0e10cSrcweir 4295*cdf0e10cSrcweir if (pSdrView) 4296*cdf0e10cSrcweir pSdrView->PickAnything(rMEvt, SDRMOUSEBUTTONDOWN, aVEvt); 4297*cdf0e10cSrcweir 4298*cdf0e10cSrcweir if (pSdrView && aVEvt.eEvent == SDREVENT_EXECUTEURL) 4299*cdf0e10cSrcweir { 4300*cdf0e10cSrcweir // URL-Feld getroffen 4301*cdf0e10cSrcweir const SvxURLField *pField = aVEvt.pURLField; 4302*cdf0e10cSrcweir if (pField) 4303*cdf0e10cSrcweir { 4304*cdf0e10cSrcweir String sURL(pField->GetURL()); 4305*cdf0e10cSrcweir String sTarget(pField->GetTargetFrame()); 4306*cdf0e10cSrcweir ::LoadURL( sURL, &rSh, nFilter, &sTarget); 4307*cdf0e10cSrcweir } 4308*cdf0e10cSrcweir bCallShadowCrsr = sal_False; 4309*cdf0e10cSrcweir } 4310*cdf0e10cSrcweir else 4311*cdf0e10cSrcweir { 4312*cdf0e10cSrcweir // Grafik getroffen 4313*cdf0e10cSrcweir ReleaseMouse(); 4314*cdf0e10cSrcweir if( rSh.ClickToINetGrf( aDocPt, nFilter )) 4315*cdf0e10cSrcweir bCallShadowCrsr = sal_False; 4316*cdf0e10cSrcweir } 4317*cdf0e10cSrcweir } 4318*cdf0e10cSrcweir } 4319*cdf0e10cSrcweir 4320*cdf0e10cSrcweir if( bCallShadowCrsr && 4321*cdf0e10cSrcweir rSh.GetViewOptions()->IsShadowCursor() && 4322*cdf0e10cSrcweir MOUSE_LEFT == (rMEvt.GetModifier() + rMEvt.GetButtons()) && 4323*cdf0e10cSrcweir !rSh.HasSelection() && 4324*cdf0e10cSrcweir !GetConnectMetaFile() && 4325*cdf0e10cSrcweir rSh.VisArea().IsInside( aDocPt )) 4326*cdf0e10cSrcweir { 4327*cdf0e10cSrcweir SwUndoId nLastUndoId(UNDO_EMPTY); 4328*cdf0e10cSrcweir if (rSh.GetLastUndoInfo(0, & nLastUndoId)) 4329*cdf0e10cSrcweir { 4330*cdf0e10cSrcweir if (UNDO_INS_FROM_SHADOWCRSR == nLastUndoId) 4331*cdf0e10cSrcweir { 4332*cdf0e10cSrcweir rSh.Undo(); 4333*cdf0e10cSrcweir } 4334*cdf0e10cSrcweir } 4335*cdf0e10cSrcweir SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCrsrFillMode(); 4336*cdf0e10cSrcweir rSh.SetShadowCrsrPos( aDocPt, eMode ); 4337*cdf0e10cSrcweir } 4338*cdf0e10cSrcweir } 4339*cdf0e10cSrcweir } 4340*cdf0e10cSrcweir bCallBase = sal_False; 4341*cdf0e10cSrcweir 4342*cdf0e10cSrcweir } 4343*cdf0e10cSrcweir 4344*cdf0e10cSrcweir // gfs. im Down gepushten Mode wieder zuruecksetzen 4345*cdf0e10cSrcweir if ( bPopMode && bModePushed ) 4346*cdf0e10cSrcweir { 4347*cdf0e10cSrcweir rSh.PopMode(); 4348*cdf0e10cSrcweir bModePushed = sal_False; 4349*cdf0e10cSrcweir bCallBase = sal_False; 4350*cdf0e10cSrcweir } 4351*cdf0e10cSrcweir break; 4352*cdf0e10cSrcweir 4353*cdf0e10cSrcweir default: 4354*cdf0e10cSrcweir ReleaseMouse(); 4355*cdf0e10cSrcweir return; 4356*cdf0e10cSrcweir } 4357*cdf0e10cSrcweir 4358*cdf0e10cSrcweir if( pApplyTempl ) 4359*cdf0e10cSrcweir { 4360*cdf0e10cSrcweir int eSelection = rSh.GetSelectionType(); 4361*cdf0e10cSrcweir SwFormatClipboard* pFormatClipboard = pApplyTempl->pFormatClipboard; 4362*cdf0e10cSrcweir if( pFormatClipboard )//apply format paintbrush 4363*cdf0e10cSrcweir { 4364*cdf0e10cSrcweir //get some parameters 4365*cdf0e10cSrcweir SwWrtShell& rWrtShell = rView.GetWrtShell(); 4366*cdf0e10cSrcweir SfxStyleSheetBasePool* pPool=0; 4367*cdf0e10cSrcweir bool bNoCharacterFormats = false; 4368*cdf0e10cSrcweir bool bNoParagraphFormats = false; 4369*cdf0e10cSrcweir { 4370*cdf0e10cSrcweir SwDocShell* pDocSh = rView.GetDocShell(); 4371*cdf0e10cSrcweir if(pDocSh) 4372*cdf0e10cSrcweir pPool = pDocSh->GetStyleSheetPool(); 4373*cdf0e10cSrcweir if( (rMEvt.GetModifier()&KEY_MOD1) && (rMEvt.GetModifier()&KEY_SHIFT) ) 4374*cdf0e10cSrcweir bNoCharacterFormats = true; 4375*cdf0e10cSrcweir else if( rMEvt.GetModifier() & KEY_MOD1 ) 4376*cdf0e10cSrcweir bNoParagraphFormats = true; 4377*cdf0e10cSrcweir } 4378*cdf0e10cSrcweir //execute paste 4379*cdf0e10cSrcweir pFormatClipboard->Paste( rWrtShell, pPool, bNoCharacterFormats, bNoParagraphFormats ); 4380*cdf0e10cSrcweir 4381*cdf0e10cSrcweir //if the clipboard is empty after paste remove the ApplyTemplate 4382*cdf0e10cSrcweir if(!pFormatClipboard->HasContent()) 4383*cdf0e10cSrcweir SetApplyTemplate(SwApplyTemplate()); 4384*cdf0e10cSrcweir } 4385*cdf0e10cSrcweir else if( pApplyTempl->nColor ) 4386*cdf0e10cSrcweir { 4387*cdf0e10cSrcweir sal_uInt16 nId = 0; 4388*cdf0e10cSrcweir switch( pApplyTempl->nColor ) 4389*cdf0e10cSrcweir { 4390*cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_EXT: 4391*cdf0e10cSrcweir nId = RES_CHRATR_COLOR; 4392*cdf0e10cSrcweir break; 4393*cdf0e10cSrcweir case SID_ATTR_CHAR_COLOR_BACKGROUND_EXT: 4394*cdf0e10cSrcweir nId = RES_CHRATR_BACKGROUND; 4395*cdf0e10cSrcweir break; 4396*cdf0e10cSrcweir } 4397*cdf0e10cSrcweir if( nId && (nsSelectionType::SEL_TXT|nsSelectionType::SEL_TBL) & eSelection) 4398*cdf0e10cSrcweir { 4399*cdf0e10cSrcweir if( rSh.IsSelection() && !rSh.HasReadonlySel() ) 4400*cdf0e10cSrcweir { 4401*cdf0e10cSrcweir if(nId == RES_CHRATR_BACKGROUND) 4402*cdf0e10cSrcweir { 4403*cdf0e10cSrcweir Color aColor( COL_TRANSPARENT ); 4404*cdf0e10cSrcweir if( !SwEditWin::bTransparentBackColor ) 4405*cdf0e10cSrcweir aColor = SwEditWin::aTextBackColor; 4406*cdf0e10cSrcweir rSh.SetAttr( SvxBrushItem( aColor, nId ) ); 4407*cdf0e10cSrcweir } 4408*cdf0e10cSrcweir else 4409*cdf0e10cSrcweir rSh.SetAttr( SvxColorItem(SwEditWin::aTextColor, nId) ); 4410*cdf0e10cSrcweir rSh.UnSetVisCrsr(); 4411*cdf0e10cSrcweir rSh.EnterStdMode(); 4412*cdf0e10cSrcweir rSh.SetVisCrsr(aDocPt); 4413*cdf0e10cSrcweir 4414*cdf0e10cSrcweir pApplyTempl->bUndo = sal_True; 4415*cdf0e10cSrcweir bCallBase = sal_False; 4416*cdf0e10cSrcweir aTemplateTimer.Stop(); 4417*cdf0e10cSrcweir } 4418*cdf0e10cSrcweir else if(rMEvt.GetClicks() == 1) 4419*cdf0e10cSrcweir { 4420*cdf0e10cSrcweir // keine Selektion -> also Giesskanne abschalten 4421*cdf0e10cSrcweir aTemplateTimer.Start(); 4422*cdf0e10cSrcweir } 4423*cdf0e10cSrcweir } 4424*cdf0e10cSrcweir } 4425*cdf0e10cSrcweir else 4426*cdf0e10cSrcweir { 4427*cdf0e10cSrcweir String aStyleName; 4428*cdf0e10cSrcweir switch ( pApplyTempl->eType ) 4429*cdf0e10cSrcweir { 4430*cdf0e10cSrcweir case SFX_STYLE_FAMILY_PARA: 4431*cdf0e10cSrcweir if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL ) 4432*cdf0e10cSrcweir & eSelection ) && !rSh.HasReadonlySel() ) 4433*cdf0e10cSrcweir { 4434*cdf0e10cSrcweir rSh.SetTxtFmtColl( pApplyTempl->aColl.pTxtColl ); 4435*cdf0e10cSrcweir pApplyTempl->bUndo = sal_True; 4436*cdf0e10cSrcweir bCallBase = sal_False; 4437*cdf0e10cSrcweir if ( pApplyTempl->aColl.pTxtColl ) 4438*cdf0e10cSrcweir aStyleName = pApplyTempl->aColl.pTxtColl->GetName(); 4439*cdf0e10cSrcweir } 4440*cdf0e10cSrcweir break; 4441*cdf0e10cSrcweir case SFX_STYLE_FAMILY_CHAR: 4442*cdf0e10cSrcweir if( (( nsSelectionType::SEL_TXT | nsSelectionType::SEL_TBL ) 4443*cdf0e10cSrcweir & eSelection ) && !rSh.HasReadonlySel() ) 4444*cdf0e10cSrcweir { 4445*cdf0e10cSrcweir rSh.SetAttr( SwFmtCharFmt(pApplyTempl->aColl.pCharFmt) ); 4446*cdf0e10cSrcweir rSh.UnSetVisCrsr(); 4447*cdf0e10cSrcweir rSh.EnterStdMode(); 4448*cdf0e10cSrcweir rSh.SetVisCrsr(aDocPt); 4449*cdf0e10cSrcweir pApplyTempl->bUndo = sal_True; 4450*cdf0e10cSrcweir bCallBase = sal_False; 4451*cdf0e10cSrcweir if ( pApplyTempl->aColl.pCharFmt ) 4452*cdf0e10cSrcweir aStyleName = pApplyTempl->aColl.pCharFmt->GetName(); 4453*cdf0e10cSrcweir } 4454*cdf0e10cSrcweir break; 4455*cdf0e10cSrcweir case SFX_STYLE_FAMILY_FRAME : 4456*cdf0e10cSrcweir { 4457*cdf0e10cSrcweir const SwFrmFmt* pFmt = rSh.GetFmtFromObj( aDocPt ); 4458*cdf0e10cSrcweir if(PTR_CAST(SwFlyFrmFmt, pFmt)) 4459*cdf0e10cSrcweir { 4460*cdf0e10cSrcweir rSh.SetFrmFmt( pApplyTempl->aColl.pFrmFmt, sal_False, &aDocPt ); 4461*cdf0e10cSrcweir pApplyTempl->bUndo = sal_True; 4462*cdf0e10cSrcweir bCallBase = sal_False; 4463*cdf0e10cSrcweir if( pApplyTempl->aColl.pFrmFmt ) 4464*cdf0e10cSrcweir aStyleName = pApplyTempl->aColl.pFrmFmt->GetName(); 4465*cdf0e10cSrcweir } 4466*cdf0e10cSrcweir break; 4467*cdf0e10cSrcweir } 4468*cdf0e10cSrcweir case SFX_STYLE_FAMILY_PAGE: 4469*cdf0e10cSrcweir // Kein Undo bei Seitenvorlagen 4470*cdf0e10cSrcweir rSh.ChgCurPageDesc( *pApplyTempl->aColl.pPageDesc ); 4471*cdf0e10cSrcweir if ( pApplyTempl->aColl.pPageDesc ) 4472*cdf0e10cSrcweir aStyleName = pApplyTempl->aColl.pPageDesc->GetName(); 4473*cdf0e10cSrcweir bCallBase = sal_False; 4474*cdf0e10cSrcweir break; 4475*cdf0e10cSrcweir case SFX_STYLE_FAMILY_PSEUDO: 4476*cdf0e10cSrcweir if( !rSh.HasReadonlySel() ) 4477*cdf0e10cSrcweir { 4478*cdf0e10cSrcweir // --> OD 2008-03-17 #refactorlists# 4479*cdf0e10cSrcweir rSh.SetCurNumRule( *pApplyTempl->aColl.pNumRule, 4480*cdf0e10cSrcweir false, 4481*cdf0e10cSrcweir pApplyTempl->aColl.pNumRule->GetDefaultListId() ); 4482*cdf0e10cSrcweir // <-- 4483*cdf0e10cSrcweir bCallBase = sal_False; 4484*cdf0e10cSrcweir pApplyTempl->bUndo = sal_True; 4485*cdf0e10cSrcweir if( pApplyTempl->aColl.pNumRule ) 4486*cdf0e10cSrcweir aStyleName = pApplyTempl->aColl.pNumRule->GetName(); 4487*cdf0e10cSrcweir } 4488*cdf0e10cSrcweir break; 4489*cdf0e10cSrcweir } 4490*cdf0e10cSrcweir 4491*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 4492*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().GetRecorder(); 4493*cdf0e10cSrcweir if ( aStyleName.Len() && xRecorder.is() ) 4494*cdf0e10cSrcweir { 4495*cdf0e10cSrcweir SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) ); 4496*cdf0e10cSrcweir if ( pSfxShell ) 4497*cdf0e10cSrcweir { 4498*cdf0e10cSrcweir SfxRequest aReq( rView.GetViewFrame(), SID_STYLE_APPLY ); 4499*cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aStyleName ) ); 4500*cdf0e10cSrcweir aReq.AppendItem( SfxUInt16Item( SID_STYLE_FAMILY, (sal_uInt16) pApplyTempl->eType ) ); 4501*cdf0e10cSrcweir aReq.Done(); 4502*cdf0e10cSrcweir } 4503*cdf0e10cSrcweir } 4504*cdf0e10cSrcweir } 4505*cdf0e10cSrcweir 4506*cdf0e10cSrcweir } 4507*cdf0e10cSrcweir ReleaseMouse(); 4508*cdf0e10cSrcweir // Hier kommen nur verarbeitete MouseEvents an; nur bei diesen duerfen 4509*cdf0e10cSrcweir // die Modi zurueckgesetzt werden. 4510*cdf0e10cSrcweir bMBPressed = sal_False; 4511*cdf0e10cSrcweir 4512*cdf0e10cSrcweir //sicherheitshalber aufrufen, da jetzt das Selektieren bestimmt zu Ende ist. 4513*cdf0e10cSrcweir //Andernfalls koennte der Timeout des Timers Kummer machen. 4514*cdf0e10cSrcweir EnterArea(); 4515*cdf0e10cSrcweir bNoInterrupt = sal_False; 4516*cdf0e10cSrcweir 4517*cdf0e10cSrcweir if (bCallBase) 4518*cdf0e10cSrcweir Window::MouseButtonUp(rMEvt); 4519*cdf0e10cSrcweir } 4520*cdf0e10cSrcweir 4521*cdf0e10cSrcweir 4522*cdf0e10cSrcweir /*-------------------------------------------------------------------- 4523*cdf0e10cSrcweir Beschreibung: Vorlage anwenden 4524*cdf0e10cSrcweir --------------------------------------------------------------------*/ 4525*cdf0e10cSrcweir 4526*cdf0e10cSrcweir 4527*cdf0e10cSrcweir void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl) 4528*cdf0e10cSrcweir { 4529*cdf0e10cSrcweir static sal_Bool bIdle = sal_False; 4530*cdf0e10cSrcweir DELETEZ(pApplyTempl); 4531*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 4532*cdf0e10cSrcweir 4533*cdf0e10cSrcweir if(rTempl.pFormatClipboard) 4534*cdf0e10cSrcweir { 4535*cdf0e10cSrcweir pApplyTempl = new SwApplyTemplate( rTempl ); 4536*cdf0e10cSrcweir SetPointer( POINTER_FILL );//@todo #i20119# maybe better a new brush pointer here in future 4537*cdf0e10cSrcweir rSh.NoEdit( sal_False ); 4538*cdf0e10cSrcweir bIdle = rSh.GetViewOptions()->IsIdle(); 4539*cdf0e10cSrcweir ((SwViewOption *)rSh.GetViewOptions())->SetIdle( sal_False ); 4540*cdf0e10cSrcweir } 4541*cdf0e10cSrcweir else if(rTempl.nColor) 4542*cdf0e10cSrcweir { 4543*cdf0e10cSrcweir pApplyTempl = new SwApplyTemplate( rTempl ); 4544*cdf0e10cSrcweir SetPointer( POINTER_FILL ); 4545*cdf0e10cSrcweir rSh.NoEdit( sal_False ); 4546*cdf0e10cSrcweir bIdle = rSh.GetViewOptions()->IsIdle(); 4547*cdf0e10cSrcweir ((SwViewOption *)rSh.GetViewOptions())->SetIdle( sal_False ); 4548*cdf0e10cSrcweir } 4549*cdf0e10cSrcweir else if( rTempl.eType ) 4550*cdf0e10cSrcweir { 4551*cdf0e10cSrcweir pApplyTempl = new SwApplyTemplate( rTempl ); 4552*cdf0e10cSrcweir SetPointer( POINTER_FILL ); 4553*cdf0e10cSrcweir rSh.NoEdit( sal_False ); 4554*cdf0e10cSrcweir bIdle = rSh.GetViewOptions()->IsIdle(); 4555*cdf0e10cSrcweir ((SwViewOption *)rSh.GetViewOptions())->SetIdle( sal_False ); 4556*cdf0e10cSrcweir } 4557*cdf0e10cSrcweir else 4558*cdf0e10cSrcweir { 4559*cdf0e10cSrcweir SetPointer( POINTER_TEXT ); 4560*cdf0e10cSrcweir rSh.UnSetVisCrsr(); 4561*cdf0e10cSrcweir 4562*cdf0e10cSrcweir ((SwViewOption *)rSh.GetViewOptions())->SetIdle( bIdle ); 4563*cdf0e10cSrcweir if ( !rSh.IsSelFrmMode() ) 4564*cdf0e10cSrcweir rSh.Edit(); 4565*cdf0e10cSrcweir } 4566*cdf0e10cSrcweir 4567*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInva[] = 4568*cdf0e10cSrcweir { 4569*cdf0e10cSrcweir SID_STYLE_WATERCAN, 4570*cdf0e10cSrcweir SID_ATTR_CHAR_COLOR_EXT, 4571*cdf0e10cSrcweir SID_ATTR_CHAR_COLOR_BACKGROUND_EXT, 4572*cdf0e10cSrcweir 0 4573*cdf0e10cSrcweir }; 4574*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().Invalidate(aInva); 4575*cdf0e10cSrcweir } 4576*cdf0e10cSrcweir 4577*cdf0e10cSrcweir /*-------------------------------------------------------------------- 4578*cdf0e10cSrcweir Beschreibung: ctor 4579*cdf0e10cSrcweir --------------------------------------------------------------------*/ 4580*cdf0e10cSrcweir 4581*cdf0e10cSrcweir 4582*cdf0e10cSrcweir SwEditWin::SwEditWin(Window *pParent, SwView &rMyView): 4583*cdf0e10cSrcweir Window(pParent, WinBits(WB_CLIPCHILDREN | WB_DIALOGCONTROL)), 4584*cdf0e10cSrcweir DropTargetHelper( this ), 4585*cdf0e10cSrcweir DragSourceHelper( this ), 4586*cdf0e10cSrcweir 4587*cdf0e10cSrcweir eBufferLanguage(LANGUAGE_DONTKNOW), 4588*cdf0e10cSrcweir pApplyTempl(0), 4589*cdf0e10cSrcweir pAnchorMarker( 0 ), 4590*cdf0e10cSrcweir pUserMarker( 0 ), 4591*cdf0e10cSrcweir pUserMarkerObj( 0 ), 4592*cdf0e10cSrcweir pShadCrsr( 0 ), 4593*cdf0e10cSrcweir pRowColumnSelectionStart( 0 ), 4594*cdf0e10cSrcweir 4595*cdf0e10cSrcweir rView( rMyView ), 4596*cdf0e10cSrcweir 4597*cdf0e10cSrcweir aActHitType(SDRHIT_NONE), 4598*cdf0e10cSrcweir m_nDropFormat( 0 ), 4599*cdf0e10cSrcweir m_nDropAction( 0 ), 4600*cdf0e10cSrcweir m_nDropDestination( 0 ), 4601*cdf0e10cSrcweir 4602*cdf0e10cSrcweir nInsFrmColCount( 1 ), 4603*cdf0e10cSrcweir eDrawMode(OBJ_NONE), 4604*cdf0e10cSrcweir 4605*cdf0e10cSrcweir bLockInput(sal_False), 4606*cdf0e10cSrcweir bObjectSelect( sal_False ), 4607*cdf0e10cSrcweir nKS_NUMDOWN_Count(0), // #i23725# 4608*cdf0e10cSrcweir nKS_NUMINDENTINC_Count(0) // #i23725# 4609*cdf0e10cSrcweir { 4610*cdf0e10cSrcweir SetHelpId(HID_EDIT_WIN); 4611*cdf0e10cSrcweir EnableChildTransparentMode(); 4612*cdf0e10cSrcweir SetDialogControlFlags( WINDOW_DLGCTRL_RETURN | WINDOW_DLGCTRL_WANTFOCUS ); 4613*cdf0e10cSrcweir 4614*cdf0e10cSrcweir bLinkRemoved = bMBPressed = bInsDraw = bInsFrm = 4615*cdf0e10cSrcweir bIsInDrag = bOldIdle = bOldIdleSet = bChainMode = bWasShdwCrsr = sal_False; 4616*cdf0e10cSrcweir //#i42732# initially use the input language 4617*cdf0e10cSrcweir bUseInputLanguage = sal_True; 4618*cdf0e10cSrcweir 4619*cdf0e10cSrcweir SetMapMode(MapMode(MAP_TWIP)); 4620*cdf0e10cSrcweir 4621*cdf0e10cSrcweir SetPointer( POINTER_TEXT ); 4622*cdf0e10cSrcweir aTimer.SetTimeoutHdl(LINK(this, SwEditWin, TimerHandler)); 4623*cdf0e10cSrcweir 4624*cdf0e10cSrcweir bTblInsDelMode = sal_False; 4625*cdf0e10cSrcweir aKeyInputTimer.SetTimeout( 3000 ); 4626*cdf0e10cSrcweir aKeyInputTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputTimerHandler)); 4627*cdf0e10cSrcweir 4628*cdf0e10cSrcweir aKeyInputFlushTimer.SetTimeout( 200 ); 4629*cdf0e10cSrcweir aKeyInputFlushTimer.SetTimeoutHdl(LINK(this, SwEditWin, KeyInputFlushHandler)); 4630*cdf0e10cSrcweir 4631*cdf0e10cSrcweir // TemplatePointer fuer Farben soll nach Einfachclick 4632*cdf0e10cSrcweir // ohne Selektion zurueckgesetzt werden 4633*cdf0e10cSrcweir aTemplateTimer.SetTimeout(400); 4634*cdf0e10cSrcweir aTemplateTimer.SetTimeoutHdl(LINK(this, SwEditWin, TemplateTimerHdl)); 4635*cdf0e10cSrcweir 4636*cdf0e10cSrcweir //JP 16.12.98: temporaere Loesung!!! Sollte bei jeder Cursorbewegung 4637*cdf0e10cSrcweir // den Font von der akt. einfuege Position setzen! 4638*cdf0e10cSrcweir if( !rMyView.GetDocShell()->IsReadOnly() ) 4639*cdf0e10cSrcweir { 4640*cdf0e10cSrcweir Font aFont; 4641*cdf0e10cSrcweir SetInputContext( InputContext( aFont, INPUTCONTEXT_TEXT | 4642*cdf0e10cSrcweir INPUTCONTEXT_EXTTEXTINPUT ) ); 4643*cdf0e10cSrcweir } 4644*cdf0e10cSrcweir } 4645*cdf0e10cSrcweir 4646*cdf0e10cSrcweir 4647*cdf0e10cSrcweir 4648*cdf0e10cSrcweir SwEditWin::~SwEditWin() 4649*cdf0e10cSrcweir { 4650*cdf0e10cSrcweir aKeyInputTimer.Stop(); 4651*cdf0e10cSrcweir delete pShadCrsr; 4652*cdf0e10cSrcweir delete pRowColumnSelectionStart; 4653*cdf0e10cSrcweir if( pQuickHlpData->bClear && rView.GetWrtShellPtr() ) 4654*cdf0e10cSrcweir pQuickHlpData->Stop( rView.GetWrtShell() ); 4655*cdf0e10cSrcweir bExecuteDrag = sal_False; 4656*cdf0e10cSrcweir delete pApplyTempl; 4657*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 4658*cdf0e10cSrcweir 4659*cdf0e10cSrcweir if(pUserMarker) 4660*cdf0e10cSrcweir { 4661*cdf0e10cSrcweir delete pUserMarker; 4662*cdf0e10cSrcweir } 4663*cdf0e10cSrcweir 4664*cdf0e10cSrcweir delete pAnchorMarker; 4665*cdf0e10cSrcweir } 4666*cdf0e10cSrcweir 4667*cdf0e10cSrcweir 4668*cdf0e10cSrcweir /****************************************************************************** 4669*cdf0e10cSrcweir * Beschreibung: DrawTextEditMode einschalten 4670*cdf0e10cSrcweir ******************************************************************************/ 4671*cdf0e10cSrcweir 4672*cdf0e10cSrcweir 4673*cdf0e10cSrcweir void SwEditWin::EnterDrawTextMode( const Point& aDocPos ) 4674*cdf0e10cSrcweir { 4675*cdf0e10cSrcweir if ( rView.EnterDrawTextMode(aDocPos) == sal_True ) 4676*cdf0e10cSrcweir { 4677*cdf0e10cSrcweir if (rView.GetDrawFuncPtr()) 4678*cdf0e10cSrcweir { 4679*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 4680*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 4681*cdf0e10cSrcweir rView.LeaveDrawCreate(); 4682*cdf0e10cSrcweir } 4683*cdf0e10cSrcweir rView.NoRotate(); 4684*cdf0e10cSrcweir rView.AttrChangedNotify( &rView.GetWrtShell() ); 4685*cdf0e10cSrcweir } 4686*cdf0e10cSrcweir } 4687*cdf0e10cSrcweir 4688*cdf0e10cSrcweir /****************************************************************************** 4689*cdf0e10cSrcweir * Beschreibung: DrawMode einschalten 4690*cdf0e10cSrcweir ******************************************************************************/ 4691*cdf0e10cSrcweir 4692*cdf0e10cSrcweir 4693*cdf0e10cSrcweir 4694*cdf0e10cSrcweir sal_Bool SwEditWin::EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos) 4695*cdf0e10cSrcweir { 4696*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 4697*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 4698*cdf0e10cSrcweir 4699*cdf0e10cSrcweir // if ( GetDrawFuncPtr() && (aActHitType == SDRHIT_NONE || rSh.IsDrawCreate()) ) 4700*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() ) 4701*cdf0e10cSrcweir { 4702*cdf0e10cSrcweir if (rSh.IsDrawCreate()) 4703*cdf0e10cSrcweir return sal_True; 4704*cdf0e10cSrcweir 4705*cdf0e10cSrcweir sal_Bool bRet = rView.GetDrawFuncPtr()->MouseButtonDown( rMEvt ); 4706*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 4707*cdf0e10cSrcweir return bRet; 4708*cdf0e10cSrcweir } 4709*cdf0e10cSrcweir 4710*cdf0e10cSrcweir if ( pSdrView && pSdrView->IsTextEdit() ) 4711*cdf0e10cSrcweir { 4712*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 4713*cdf0e10cSrcweir rSh.LockView( sal_True ); 4714*cdf0e10cSrcweir 4715*cdf0e10cSrcweir rSh.EndTextEdit(); // Danebengeklickt, Ende mit Edit 4716*cdf0e10cSrcweir rSh.SelectObj( aDocPos ); 4717*cdf0e10cSrcweir if ( !rSh.IsObjSelected() && !rSh.IsFrmSelected() ) 4718*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 4719*cdf0e10cSrcweir else 4720*cdf0e10cSrcweir { 4721*cdf0e10cSrcweir SwEditWin::nDDStartPosY = aDocPos.Y(); 4722*cdf0e10cSrcweir SwEditWin::nDDStartPosX = aDocPos.X(); 4723*cdf0e10cSrcweir bFrmDrag = sal_True; 4724*cdf0e10cSrcweir } 4725*cdf0e10cSrcweir if( bUnLockView ) 4726*cdf0e10cSrcweir rSh.LockView( sal_False ); 4727*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 4728*cdf0e10cSrcweir return sal_True; 4729*cdf0e10cSrcweir } 4730*cdf0e10cSrcweir return sal_False; 4731*cdf0e10cSrcweir } 4732*cdf0e10cSrcweir 4733*cdf0e10cSrcweir /****************************************************************************** 4734*cdf0e10cSrcweir * Beschreibung: 4735*cdf0e10cSrcweir ******************************************************************************/ 4736*cdf0e10cSrcweir 4737*cdf0e10cSrcweir 4738*cdf0e10cSrcweir 4739*cdf0e10cSrcweir sal_Bool SwEditWin::IsDrawSelMode() 4740*cdf0e10cSrcweir { 4741*cdf0e10cSrcweir // return (IsFrmAction() == sal_False && GetSdrDrawMode() == OBJ_NONE); 4742*cdf0e10cSrcweir return IsObjectSelect(); 4743*cdf0e10cSrcweir } 4744*cdf0e10cSrcweir 4745*cdf0e10cSrcweir /****************************************************************************** 4746*cdf0e10cSrcweir * Beschreibung: 4747*cdf0e10cSrcweir ******************************************************************************/ 4748*cdf0e10cSrcweir 4749*cdf0e10cSrcweir 4750*cdf0e10cSrcweir void SwEditWin::GetFocus() 4751*cdf0e10cSrcweir { 4752*cdf0e10cSrcweir if ( rView.GetPostItMgr()->HasActiveSidebarWin() ) 4753*cdf0e10cSrcweir { 4754*cdf0e10cSrcweir rView.GetPostItMgr()->GrabFocusOnActiveSidebarWin(); 4755*cdf0e10cSrcweir } 4756*cdf0e10cSrcweir else 4757*cdf0e10cSrcweir { 4758*cdf0e10cSrcweir rView.GotFocus(); 4759*cdf0e10cSrcweir Window::GetFocus(); 4760*cdf0e10cSrcweir rView.GetWrtShell().InvalidateAccessibleFocus(); 4761*cdf0e10cSrcweir } 4762*cdf0e10cSrcweir } 4763*cdf0e10cSrcweir 4764*cdf0e10cSrcweir /****************************************************************************** 4765*cdf0e10cSrcweir * Beschreibung: 4766*cdf0e10cSrcweir ******************************************************************************/ 4767*cdf0e10cSrcweir 4768*cdf0e10cSrcweir 4769*cdf0e10cSrcweir 4770*cdf0e10cSrcweir void SwEditWin::LoseFocus() 4771*cdf0e10cSrcweir { 4772*cdf0e10cSrcweir rView.GetWrtShell().InvalidateAccessibleFocus(); 4773*cdf0e10cSrcweir Window::LoseFocus(); 4774*cdf0e10cSrcweir if( pQuickHlpData->bClear ) 4775*cdf0e10cSrcweir pQuickHlpData->Stop( rView.GetWrtShell() ); 4776*cdf0e10cSrcweir rView.LostFocus(); 4777*cdf0e10cSrcweir } 4778*cdf0e10cSrcweir 4779*cdf0e10cSrcweir /****************************************************************************** 4780*cdf0e10cSrcweir * Beschreibung: 4781*cdf0e10cSrcweir ******************************************************************************/ 4782*cdf0e10cSrcweir 4783*cdf0e10cSrcweir 4784*cdf0e10cSrcweir 4785*cdf0e10cSrcweir void SwEditWin::Command( const CommandEvent& rCEvt ) 4786*cdf0e10cSrcweir { 4787*cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell(); 4788*cdf0e10cSrcweir 4789*cdf0e10cSrcweir if ( !rView.GetViewFrame() ) 4790*cdf0e10cSrcweir { 4791*cdf0e10cSrcweir //Wenn der ViewFrame in Kuerze stirbt kein Popup mehr! 4792*cdf0e10cSrcweir Window::Command(rCEvt); 4793*cdf0e10cSrcweir return; 4794*cdf0e10cSrcweir } 4795*cdf0e10cSrcweir 4796*cdf0e10cSrcweir // The command event is send to the window after a possible context 4797*cdf0e10cSrcweir // menu from an inplace client has been closed. Now we have the chance 4798*cdf0e10cSrcweir // to deactivate the inplace client without any problem regarding parent 4799*cdf0e10cSrcweir // windows and code on the stack. 4800*cdf0e10cSrcweir // For more information, see #126086# and #128122# 4801*cdf0e10cSrcweir SfxInPlaceClient* pIPClient = rSh.GetSfxViewShell()->GetIPClient(); 4802*cdf0e10cSrcweir sal_Bool bIsOleActive = ( pIPClient && pIPClient->IsObjectInPlaceActive() ); 4803*cdf0e10cSrcweir if ( bIsOleActive && ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )) 4804*cdf0e10cSrcweir { 4805*cdf0e10cSrcweir rSh.FinishOLEObj(); 4806*cdf0e10cSrcweir return; 4807*cdf0e10cSrcweir } 4808*cdf0e10cSrcweir 4809*cdf0e10cSrcweir sal_Bool bCallBase = sal_True; 4810*cdf0e10cSrcweir 4811*cdf0e10cSrcweir switch ( rCEvt.GetCommand() ) 4812*cdf0e10cSrcweir { 4813*cdf0e10cSrcweir case COMMAND_CONTEXTMENU: 4814*cdf0e10cSrcweir { 4815*cdf0e10cSrcweir const sal_uInt16 nId = SwInputChild::GetChildWindowId(); 4816*cdf0e10cSrcweir SwInputChild* pChildWin = (SwInputChild*)GetView().GetViewFrame()-> 4817*cdf0e10cSrcweir GetChildWindow( nId ); 4818*cdf0e10cSrcweir 4819*cdf0e10cSrcweir if (rView.GetPostItMgr()->IsHit(rCEvt.GetMousePosPixel())) 4820*cdf0e10cSrcweir return; 4821*cdf0e10cSrcweir 4822*cdf0e10cSrcweir if((!pChildWin || pChildWin->GetView() != &rView) && 4823*cdf0e10cSrcweir !rSh.IsDrawCreate() && !IsDrawAction()) 4824*cdf0e10cSrcweir { 4825*cdf0e10cSrcweir SET_CURR_SHELL( &rSh ); 4826*cdf0e10cSrcweir if (!pApplyTempl) 4827*cdf0e10cSrcweir { 4828*cdf0e10cSrcweir if (bNoInterrupt == sal_True) 4829*cdf0e10cSrcweir { 4830*cdf0e10cSrcweir ReleaseMouse(); 4831*cdf0e10cSrcweir bNoInterrupt = sal_False; 4832*cdf0e10cSrcweir bMBPressed = sal_False; 4833*cdf0e10cSrcweir } 4834*cdf0e10cSrcweir Point aDocPos( PixelToLogic( rCEvt.GetMousePosPixel() ) ); 4835*cdf0e10cSrcweir if ( !rCEvt.IsMouseEvent() ) 4836*cdf0e10cSrcweir aDocPos = rSh.GetCharRect().Center(); 4837*cdf0e10cSrcweir else 4838*cdf0e10cSrcweir { 4839*cdf0e10cSrcweir SelectMenuPosition(rSh, rCEvt.GetMousePosPixel()); 4840*cdf0e10cSrcweir rView.StopShellTimer(); 4841*cdf0e10cSrcweir 4842*cdf0e10cSrcweir } 4843*cdf0e10cSrcweir const Point aPixPos = LogicToPixel( aDocPos ); 4844*cdf0e10cSrcweir 4845*cdf0e10cSrcweir if ( rView.GetDocShell()->IsReadOnly() ) 4846*cdf0e10cSrcweir { 4847*cdf0e10cSrcweir SwReadOnlyPopup* pROPopup = new SwReadOnlyPopup( aDocPos, rView ); 4848*cdf0e10cSrcweir 4849*cdf0e10cSrcweir ui::ContextMenuExecuteEvent aEvent; 4850*cdf0e10cSrcweir aEvent.SourceWindow = VCLUnoHelper::GetInterface( this ); 4851*cdf0e10cSrcweir aEvent.ExecutePosition.X = aPixPos.X(); 4852*cdf0e10cSrcweir aEvent.ExecutePosition.Y = aPixPos.Y(); 4853*cdf0e10cSrcweir Menu* pMenu = 0; 4854*cdf0e10cSrcweir ::rtl::OUString sMenuName = 4855*cdf0e10cSrcweir ::rtl::OUString::createFromAscii( "private:resource/ReadonlyContextMenu"); 4856*cdf0e10cSrcweir if( GetView().TryContextMenuInterception( *pROPopup, sMenuName, pMenu, aEvent ) ) 4857*cdf0e10cSrcweir { 4858*cdf0e10cSrcweir if ( pMenu ) 4859*cdf0e10cSrcweir { 4860*cdf0e10cSrcweir sal_uInt16 nExecId = ((PopupMenu*)pMenu)->Execute(this, aPixPos); 4861*cdf0e10cSrcweir if( !::ExecuteMenuCommand( *static_cast<PopupMenu*>(pMenu), *rView.GetViewFrame(), nExecId )) 4862*cdf0e10cSrcweir pROPopup->Execute(this, nExecId); 4863*cdf0e10cSrcweir } 4864*cdf0e10cSrcweir else 4865*cdf0e10cSrcweir pROPopup->Execute(this, aPixPos); 4866*cdf0e10cSrcweir } 4867*cdf0e10cSrcweir delete pROPopup; 4868*cdf0e10cSrcweir } 4869*cdf0e10cSrcweir else if ( !rView.ExecSpellPopup( aDocPos ) ) 4870*cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->ExecutePopup( 0, this, &aPixPos); 4871*cdf0e10cSrcweir } 4872*cdf0e10cSrcweir else if (pApplyTempl->bUndo) 4873*cdf0e10cSrcweir rSh.Do(SwWrtShell::UNDO); 4874*cdf0e10cSrcweir bCallBase = sal_False; 4875*cdf0e10cSrcweir } 4876*cdf0e10cSrcweir } 4877*cdf0e10cSrcweir break; 4878*cdf0e10cSrcweir 4879*cdf0e10cSrcweir case COMMAND_WHEEL: 4880*cdf0e10cSrcweir case COMMAND_STARTAUTOSCROLL: 4881*cdf0e10cSrcweir case COMMAND_AUTOSCROLL: 4882*cdf0e10cSrcweir if( pShadCrsr ) 4883*cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0; 4884*cdf0e10cSrcweir bCallBase = !rView.HandleWheelCommands( rCEvt ); 4885*cdf0e10cSrcweir break; 4886*cdf0e10cSrcweir 4887*cdf0e10cSrcweir case COMMAND_VOICE: 4888*cdf0e10cSrcweir { 4889*cdf0e10cSrcweir //ggf. an Outliner weiterleiten 4890*cdf0e10cSrcweir if ( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() ) 4891*cdf0e10cSrcweir { 4892*cdf0e10cSrcweir bCallBase = sal_False; 4893*cdf0e10cSrcweir rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt ); 4894*cdf0e10cSrcweir break; 4895*cdf0e10cSrcweir } 4896*cdf0e10cSrcweir 4897*cdf0e10cSrcweir const CommandVoiceData *pCData = rCEvt.GetVoiceData(); 4898*cdf0e10cSrcweir if ( VOICECOMMANDTYPE_CONTROL == pCData->GetType() ) 4899*cdf0e10cSrcweir break; 4900*cdf0e10cSrcweir 4901*cdf0e10cSrcweir 4902*cdf0e10cSrcweir sal_uInt16 nSlotId = 0; 4903*cdf0e10cSrcweir SfxPoolItem *pItem = 0; 4904*cdf0e10cSrcweir 4905*cdf0e10cSrcweir switch ( pCData->GetCommand() ) 4906*cdf0e10cSrcweir { 4907*cdf0e10cSrcweir case DICTATIONCOMMAND_NEWPARAGRAPH: nSlotId = FN_INSERT_BREAK; break; 4908*cdf0e10cSrcweir case DICTATIONCOMMAND_NEWLINE: nSlotId = FN_INSERT_LINEBREAK; break; 4909*cdf0e10cSrcweir case DICTATIONCOMMAND_LEFT: nSlotId = FN_PREV_WORD; break; 4910*cdf0e10cSrcweir case DICTATIONCOMMAND_RIGHT: nSlotId = FN_NEXT_WORD; break; 4911*cdf0e10cSrcweir case DICTATIONCOMMAND_UP: nSlotId = FN_LINE_UP; break; 4912*cdf0e10cSrcweir case DICTATIONCOMMAND_DOWN: nSlotId = FN_LINE_DOWN; break; 4913*cdf0e10cSrcweir case DICTATIONCOMMAND_UNDO: nSlotId = SID_UNDO; break; 4914*cdf0e10cSrcweir case DICTATIONCOMMAND_REPEAT: nSlotId = SID_REPEAT; break; 4915*cdf0e10cSrcweir case DICTATIONCOMMAND_DEL: nSlotId = FN_DELETE_BACK_WORD; break; 4916*cdf0e10cSrcweir 4917*cdf0e10cSrcweir case DICTATIONCOMMAND_BOLD_ON: nSlotId = SID_ATTR_CHAR_WEIGHT; 4918*cdf0e10cSrcweir pItem = new SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ); 4919*cdf0e10cSrcweir break; 4920*cdf0e10cSrcweir case DICTATIONCOMMAND_BOLD_OFF: nSlotId = SID_ATTR_CHAR_WEIGHT; 4921*cdf0e10cSrcweir pItem = new SvxWeightItem( WEIGHT_NORMAL, RES_CHRATR_WEIGHT ); 4922*cdf0e10cSrcweir break; 4923*cdf0e10cSrcweir case DICTATIONCOMMAND_UNDERLINE_ON: nSlotId = SID_ATTR_CHAR_UNDERLINE; 4924*cdf0e10cSrcweir pItem = new SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_WEIGHT ); 4925*cdf0e10cSrcweir break; 4926*cdf0e10cSrcweir case DICTATIONCOMMAND_UNDERLINE_OFF:nSlotId = SID_ATTR_CHAR_UNDERLINE; 4927*cdf0e10cSrcweir pItem = new SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE ); 4928*cdf0e10cSrcweir break; 4929*cdf0e10cSrcweir case DICTATIONCOMMAND_ITALIC_ON: nSlotId = SID_ATTR_CHAR_POSTURE; 4930*cdf0e10cSrcweir pItem = new SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ); 4931*cdf0e10cSrcweir break; 4932*cdf0e10cSrcweir case DICTATIONCOMMAND_ITALIC_OFF: nSlotId = SID_ATTR_CHAR_POSTURE; 4933*cdf0e10cSrcweir pItem = new SvxPostureItem( ITALIC_NONE, RES_CHRATR_POSTURE ); 4934*cdf0e10cSrcweir break; 4935*cdf0e10cSrcweir case DICTATIONCOMMAND_NUMBERING_ON: 4936*cdf0e10cSrcweir if ( !rSh.GetCurNumRule() ) 4937*cdf0e10cSrcweir nSlotId = FN_NUM_NUMBERING_ON; 4938*cdf0e10cSrcweir break; 4939*cdf0e10cSrcweir case DICTATIONCOMMAND_NUMBERING_OFF: 4940*cdf0e10cSrcweir if ( rSh.GetCurNumRule() ) 4941*cdf0e10cSrcweir nSlotId = FN_NUM_NUMBERING_ON; 4942*cdf0e10cSrcweir break; 4943*cdf0e10cSrcweir case DICTATIONCOMMAND_TAB: 4944*cdf0e10cSrcweir { 4945*cdf0e10cSrcweir rSh.Insert( '\t' ); 4946*cdf0e10cSrcweir } 4947*cdf0e10cSrcweir break; 4948*cdf0e10cSrcweir case DICTATIONCOMMAND_UNKNOWN: 4949*cdf0e10cSrcweir { 4950*cdf0e10cSrcweir rView.GetWrtShell().Insert( pCData->GetText() ); 4951*cdf0e10cSrcweir } 4952*cdf0e10cSrcweir break; 4953*cdf0e10cSrcweir 4954*cdf0e10cSrcweir #ifdef DBG_UTIL 4955*cdf0e10cSrcweir default: 4956*cdf0e10cSrcweir ASSERT( !this, "unknown speech command." ); 4957*cdf0e10cSrcweir #endif 4958*cdf0e10cSrcweir } 4959*cdf0e10cSrcweir if ( nSlotId ) 4960*cdf0e10cSrcweir { 4961*cdf0e10cSrcweir bCallBase = sal_False; 4962*cdf0e10cSrcweir if ( pItem ) 4963*cdf0e10cSrcweir { 4964*cdf0e10cSrcweir const SfxPoolItem* aArgs[2]; 4965*cdf0e10cSrcweir aArgs[0] = pItem; 4966*cdf0e10cSrcweir aArgs[1] = 0; 4967*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Execute( 4968*cdf0e10cSrcweir nSlotId, aArgs, 0, SFX_CALLMODE_STANDARD ); 4969*cdf0e10cSrcweir delete pItem; 4970*cdf0e10cSrcweir } 4971*cdf0e10cSrcweir else 4972*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Execute( nSlotId ); 4973*cdf0e10cSrcweir } 4974*cdf0e10cSrcweir } 4975*cdf0e10cSrcweir break; 4976*cdf0e10cSrcweir 4977*cdf0e10cSrcweir case COMMAND_STARTEXTTEXTINPUT: 4978*cdf0e10cSrcweir { 4979*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() && 4980*cdf0e10cSrcweir rSh.IsCrsrReadonly(); 4981*cdf0e10cSrcweir if(!bIsDocReadOnly) 4982*cdf0e10cSrcweir { 4983*cdf0e10cSrcweir if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() ) 4984*cdf0e10cSrcweir { 4985*cdf0e10cSrcweir bCallBase = sal_False; 4986*cdf0e10cSrcweir rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt ); 4987*cdf0e10cSrcweir } 4988*cdf0e10cSrcweir else 4989*cdf0e10cSrcweir { 4990*cdf0e10cSrcweir if( rSh.HasSelection() ) 4991*cdf0e10cSrcweir rSh.DelRight(); 4992*cdf0e10cSrcweir 4993*cdf0e10cSrcweir bCallBase = sal_False; 4994*cdf0e10cSrcweir LanguageType eInputLanguage = GetInputLanguage(); 4995*cdf0e10cSrcweir rSh.CreateExtTextInput(eInputLanguage); 4996*cdf0e10cSrcweir } 4997*cdf0e10cSrcweir } 4998*cdf0e10cSrcweir break; 4999*cdf0e10cSrcweir } 5000*cdf0e10cSrcweir case COMMAND_ENDEXTTEXTINPUT: 5001*cdf0e10cSrcweir { 5002*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() && 5003*cdf0e10cSrcweir rSh.IsCrsrReadonly(); 5004*cdf0e10cSrcweir if(!bIsDocReadOnly) 5005*cdf0e10cSrcweir { 5006*cdf0e10cSrcweir if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() ) 5007*cdf0e10cSrcweir { 5008*cdf0e10cSrcweir bCallBase = sal_False; 5009*cdf0e10cSrcweir rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt ); 5010*cdf0e10cSrcweir } 5011*cdf0e10cSrcweir else 5012*cdf0e10cSrcweir { 5013*cdf0e10cSrcweir bCallBase = sal_False; 5014*cdf0e10cSrcweir String sRecord = rSh.DeleteExtTextInput(); 5015*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 5016*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().GetRecorder(); 5017*cdf0e10cSrcweir 5018*cdf0e10cSrcweir if ( sRecord.Len() ) 5019*cdf0e10cSrcweir { 5020*cdf0e10cSrcweir // #102812# convert quotes in IME text 5021*cdf0e10cSrcweir // works on the last input character, this is escpecially in Korean text often done 5022*cdf0e10cSrcweir // quotes that are inside of the string are not replaced! 5023*cdf0e10cSrcweir const sal_Unicode aCh = sRecord.GetChar(sRecord.Len() - 1); 5024*cdf0e10cSrcweir SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get(); 5025*cdf0e10cSrcweir SvxAutoCorrect* pACorr = pACfg->GetAutoCorrect(); 5026*cdf0e10cSrcweir if(pACorr && 5027*cdf0e10cSrcweir (( pACorr->IsAutoCorrFlag( ChgQuotes ) && ('\"' == aCh ))|| 5028*cdf0e10cSrcweir ( pACorr->IsAutoCorrFlag( ChgSglQuotes ) && ( '\'' == aCh)))) 5029*cdf0e10cSrcweir { 5030*cdf0e10cSrcweir rSh.DelLeft(); 5031*cdf0e10cSrcweir rSh.AutoCorrect( *pACorr, aCh ); 5032*cdf0e10cSrcweir } 5033*cdf0e10cSrcweir 5034*cdf0e10cSrcweir if ( xRecorder.is() ) 5035*cdf0e10cSrcweir { 5036*cdf0e10cSrcweir //Shell ermitteln 5037*cdf0e10cSrcweir SfxShell *pSfxShell = lcl_GetShellFromDispatcher( rView, TYPE(SwTextShell) ); 5038*cdf0e10cSrcweir // Request generieren und recorden 5039*cdf0e10cSrcweir if (pSfxShell) 5040*cdf0e10cSrcweir { 5041*cdf0e10cSrcweir SfxRequest aReq( rView.GetViewFrame(), FN_INSERT_STRING ); 5042*cdf0e10cSrcweir aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sRecord ) ); 5043*cdf0e10cSrcweir aReq.Done(); 5044*cdf0e10cSrcweir } 5045*cdf0e10cSrcweir } 5046*cdf0e10cSrcweir } 5047*cdf0e10cSrcweir } 5048*cdf0e10cSrcweir } 5049*cdf0e10cSrcweir } 5050*cdf0e10cSrcweir break; 5051*cdf0e10cSrcweir case COMMAND_EXTTEXTINPUT: 5052*cdf0e10cSrcweir { 5053*cdf0e10cSrcweir sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly() && 5054*cdf0e10cSrcweir rSh.IsCrsrReadonly(); 5055*cdf0e10cSrcweir if(!bIsDocReadOnly) 5056*cdf0e10cSrcweir { 5057*cdf0e10cSrcweir QuickHelpData aTmpQHD; 5058*cdf0e10cSrcweir if( pQuickHlpData->bClear ) 5059*cdf0e10cSrcweir { 5060*cdf0e10cSrcweir aTmpQHD.Move( *pQuickHlpData ); 5061*cdf0e10cSrcweir pQuickHlpData->Stop( rSh ); 5062*cdf0e10cSrcweir } 5063*cdf0e10cSrcweir String sWord; 5064*cdf0e10cSrcweir if( rSh.HasDrawView() && rSh.GetDrawView()->IsTextEdit() ) 5065*cdf0e10cSrcweir { 5066*cdf0e10cSrcweir bCallBase = sal_False; 5067*cdf0e10cSrcweir rSh.GetDrawView()->GetTextEditOutlinerView()->Command( rCEvt ); 5068*cdf0e10cSrcweir } 5069*cdf0e10cSrcweir else 5070*cdf0e10cSrcweir { 5071*cdf0e10cSrcweir const CommandExtTextInputData* pData = rCEvt.GetExtTextInputData(); 5072*cdf0e10cSrcweir if( pData ) 5073*cdf0e10cSrcweir { 5074*cdf0e10cSrcweir sWord = pData->GetText(); 5075*cdf0e10cSrcweir bCallBase = sal_False; 5076*cdf0e10cSrcweir rSh.SetExtTextInputData( *pData ); 5077*cdf0e10cSrcweir } 5078*cdf0e10cSrcweir } 5079*cdf0e10cSrcweir uno::Reference< frame::XDispatchRecorder > xRecorder = 5080*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().GetRecorder(); 5081*cdf0e10cSrcweir if(!xRecorder.is()) 5082*cdf0e10cSrcweir { 5083*cdf0e10cSrcweir SvxAutoCorrCfg* pACfg = SvxAutoCorrCfg::Get(); 5084*cdf0e10cSrcweir SvxAutoCorrect* pACorr = pACfg->GetAutoCorrect(); 5085*cdf0e10cSrcweir if( pACfg && pACorr && 5086*cdf0e10cSrcweir ( pACfg->IsAutoTextTip() || 5087*cdf0e10cSrcweir pACorr->GetSwFlags().bAutoCompleteWords ) && 5088*cdf0e10cSrcweir rSh.GetPrevAutoCorrWord( *pACorr, sWord ) ) 5089*cdf0e10cSrcweir { 5090*cdf0e10cSrcweir ShowAutoTextCorrectQuickHelp(sWord, pACfg, pACorr, sal_True); 5091*cdf0e10cSrcweir } 5092*cdf0e10cSrcweir } 5093*cdf0e10cSrcweir } 5094*cdf0e10cSrcweir } 5095*cdf0e10cSrcweir break; 5096*cdf0e10cSrcweir case COMMAND_CURSORPOS: 5097*cdf0e10cSrcweir // will be handled by the base class 5098*cdf0e10cSrcweir break; 5099*cdf0e10cSrcweir 5100*cdf0e10cSrcweir case COMMAND_PASTESELECTION: 5101*cdf0e10cSrcweir if( !rView.GetDocShell()->IsReadOnly() ) 5102*cdf0e10cSrcweir { 5103*cdf0e10cSrcweir TransferableDataHelper aDataHelper( 5104*cdf0e10cSrcweir TransferableDataHelper::CreateFromSelection( this )); 5105*cdf0e10cSrcweir if( !aDataHelper.GetXTransferable().is() ) 5106*cdf0e10cSrcweir break; 5107*cdf0e10cSrcweir 5108*cdf0e10cSrcweir sal_uLong nDropFormat; 5109*cdf0e10cSrcweir sal_uInt16 nEventAction, nDropAction, nDropDestination; 5110*cdf0e10cSrcweir nDropDestination = GetDropDestination( rCEvt.GetMousePosPixel() ); 5111*cdf0e10cSrcweir if( !nDropDestination ) 5112*cdf0e10cSrcweir break; 5113*cdf0e10cSrcweir 5114*cdf0e10cSrcweir nDropAction = SotExchange::GetExchangeAction( 5115*cdf0e10cSrcweir aDataHelper.GetDataFlavorExVector(), 5116*cdf0e10cSrcweir nDropDestination, EXCHG_IN_ACTION_COPY, 5117*cdf0e10cSrcweir EXCHG_IN_ACTION_COPY, nDropFormat, 5118*cdf0e10cSrcweir nEventAction ); 5119*cdf0e10cSrcweir if( EXCHG_INOUT_ACTION_NONE != nDropAction ) 5120*cdf0e10cSrcweir { 5121*cdf0e10cSrcweir const Point aDocPt( PixelToLogic( rCEvt.GetMousePosPixel() ) ); 5122*cdf0e10cSrcweir SwTransferable::PasteData( aDataHelper, rSh, nDropAction, 5123*cdf0e10cSrcweir nDropFormat, nDropDestination, sal_False, 5124*cdf0e10cSrcweir sal_False, &aDocPt, EXCHG_IN_ACTION_COPY, 5125*cdf0e10cSrcweir sal_True ); 5126*cdf0e10cSrcweir } 5127*cdf0e10cSrcweir } 5128*cdf0e10cSrcweir break; 5129*cdf0e10cSrcweir case COMMAND_MODKEYCHANGE : 5130*cdf0e10cSrcweir { 5131*cdf0e10cSrcweir const CommandModKeyData* pCommandData = (const CommandModKeyData*)rCEvt.GetData(); 5132*cdf0e10cSrcweir if(pCommandData->IsMod1() && !pCommandData->IsMod2()) 5133*cdf0e10cSrcweir { 5134*cdf0e10cSrcweir sal_uInt16 nSlot = 0; 5135*cdf0e10cSrcweir if(pCommandData->IsLeftShift() && !pCommandData->IsRightShift()) 5136*cdf0e10cSrcweir nSlot = SID_ATTR_PARA_LEFT_TO_RIGHT; 5137*cdf0e10cSrcweir else if(!pCommandData->IsLeftShift() && pCommandData->IsRightShift()) 5138*cdf0e10cSrcweir nSlot = SID_ATTR_PARA_RIGHT_TO_LEFT; 5139*cdf0e10cSrcweir if(nSlot && SW_MOD()->GetCTLOptions().IsCTLFontEnabled()) 5140*cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(nSlot); 5141*cdf0e10cSrcweir } 5142*cdf0e10cSrcweir } 5143*cdf0e10cSrcweir break; 5144*cdf0e10cSrcweir case COMMAND_HANGUL_HANJA_CONVERSION : 5145*cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(SID_HANGUL_HANJA_CONVERSION); 5146*cdf0e10cSrcweir break; 5147*cdf0e10cSrcweir case COMMAND_INPUTLANGUAGECHANGE : 5148*cdf0e10cSrcweir //#i42732# update state of fontname if input language changes 5149*cdf0e10cSrcweir bInputLanguageSwitched = true; 5150*cdf0e10cSrcweir SetUseInputLanguage( sal_True ); 5151*cdf0e10cSrcweir break; 5152*cdf0e10cSrcweir case COMMAND_SELECTIONCHANGE: 5153*cdf0e10cSrcweir { 5154*cdf0e10cSrcweir const CommandSelectionChangeData *pData = rCEvt.GetSelectionChangeData(); 5155*cdf0e10cSrcweir rSh.SttCrsrMove(); 5156*cdf0e10cSrcweir rSh.GoStartSentence(); 5157*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nContent += sal::static_int_cast<sal_uInt16, sal_uLong>(pData->GetStart()); 5158*cdf0e10cSrcweir rSh.SetMark(); 5159*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nContent += sal::static_int_cast<sal_uInt16, sal_uLong>(pData->GetEnd() - pData->GetStart()); 5160*cdf0e10cSrcweir rSh.EndCrsrMove( sal_True ); 5161*cdf0e10cSrcweir } 5162*cdf0e10cSrcweir break; 5163*cdf0e10cSrcweir case COMMAND_PREPARERECONVERSION: 5164*cdf0e10cSrcweir if( rSh.HasSelection() ) 5165*cdf0e10cSrcweir { 5166*cdf0e10cSrcweir SwPaM *pCrsr = (SwPaM*)rSh.GetCrsr(); 5167*cdf0e10cSrcweir 5168*cdf0e10cSrcweir if( rSh.IsMultiSelection() ) 5169*cdf0e10cSrcweir { 5170*cdf0e10cSrcweir if( pCrsr && !pCrsr->HasMark() && 5171*cdf0e10cSrcweir pCrsr->GetPoint() == pCrsr->GetMark() ) 5172*cdf0e10cSrcweir { 5173*cdf0e10cSrcweir rSh.GoPrevCrsr(); 5174*cdf0e10cSrcweir pCrsr = (SwPaM*)rSh.GetCrsr(); 5175*cdf0e10cSrcweir } 5176*cdf0e10cSrcweir 5177*cdf0e10cSrcweir // Cancel all selections other than the last selected one. 5178*cdf0e10cSrcweir while( rSh.GetCrsr()->GetNext() != rSh.GetCrsr() ) 5179*cdf0e10cSrcweir delete rSh.GetCrsr()->GetNext(); 5180*cdf0e10cSrcweir } 5181*cdf0e10cSrcweir 5182*cdf0e10cSrcweir if( pCrsr ) 5183*cdf0e10cSrcweir { 5184*cdf0e10cSrcweir sal_uLong nPosNodeIdx = pCrsr->GetPoint()->nNode.GetIndex(); 5185*cdf0e10cSrcweir xub_StrLen nPosIdx = pCrsr->GetPoint()->nContent.GetIndex(); 5186*cdf0e10cSrcweir sal_uLong nMarkNodeIdx = pCrsr->GetMark()->nNode.GetIndex(); 5187*cdf0e10cSrcweir xub_StrLen nMarkIdx = pCrsr->GetMark()->nContent.GetIndex(); 5188*cdf0e10cSrcweir 5189*cdf0e10cSrcweir if( !rSh.GetCrsr()->HasMark() ) 5190*cdf0e10cSrcweir rSh.GetCrsr()->SetMark(); 5191*cdf0e10cSrcweir 5192*cdf0e10cSrcweir rSh.SttCrsrMove(); 5193*cdf0e10cSrcweir 5194*cdf0e10cSrcweir if( nPosNodeIdx < nMarkNodeIdx ) 5195*cdf0e10cSrcweir { 5196*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx; 5197*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nContent = nPosIdx; 5198*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nNode = nPosNodeIdx; 5199*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nContent = 5200*cdf0e10cSrcweir rSh.GetCrsr()->GetCntntNode( sal_True )->Len(); 5201*cdf0e10cSrcweir } 5202*cdf0e10cSrcweir else if( nPosNodeIdx == nMarkNodeIdx ) 5203*cdf0e10cSrcweir { 5204*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nNode = nPosNodeIdx; 5205*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nContent = nPosIdx; 5206*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx; 5207*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nContent = nMarkIdx; 5208*cdf0e10cSrcweir } 5209*cdf0e10cSrcweir else 5210*cdf0e10cSrcweir { 5211*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nNode = nMarkNodeIdx; 5212*cdf0e10cSrcweir rSh.GetCrsr()->GetMark()->nContent = nMarkIdx; 5213*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nNode = nMarkNodeIdx; 5214*cdf0e10cSrcweir rSh.GetCrsr()->GetPoint()->nContent = 5215*cdf0e10cSrcweir rSh.GetCrsr()->GetCntntNode( sal_False )->Len(); 5216*cdf0e10cSrcweir } 5217*cdf0e10cSrcweir 5218*cdf0e10cSrcweir rSh.EndCrsrMove( sal_True ); 5219*cdf0e10cSrcweir } 5220*cdf0e10cSrcweir } 5221*cdf0e10cSrcweir break; 5222*cdf0e10cSrcweir #ifdef DBG_UTIL 5223*cdf0e10cSrcweir default: 5224*cdf0e10cSrcweir ASSERT( !this, "unknown command." ); 5225*cdf0e10cSrcweir #endif 5226*cdf0e10cSrcweir } 5227*cdf0e10cSrcweir if (bCallBase) 5228*cdf0e10cSrcweir Window::Command(rCEvt); 5229*cdf0e10cSrcweir } 5230*cdf0e10cSrcweir 5231*cdf0e10cSrcweir /* -----------------25.08.2003 10:12----------------- 5232*cdf0e10cSrcweir #i18686#: select the object/cursor at the mouse 5233*cdf0e10cSrcweir position of the context menu request 5234*cdf0e10cSrcweir --------------------------------------------------*/ 5235*cdf0e10cSrcweir sal_Bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) 5236*cdf0e10cSrcweir { 5237*cdf0e10cSrcweir sal_Bool bRet = sal_False; 5238*cdf0e10cSrcweir const Point aDocPos( PixelToLogic( rMousePos ) ); 5239*cdf0e10cSrcweir // --> OD 2005-02-17 #i42258# 5240*cdf0e10cSrcweir const bool bIsInsideSelectedObj( rSh.IsInsideSelectedObj( aDocPos ) ); 5241*cdf0e10cSrcweir // <-- 5242*cdf0e10cSrcweir //create a synthetic mouse event out of the coordinates 5243*cdf0e10cSrcweir MouseEvent aMEvt(rMousePos); 5244*cdf0e10cSrcweir SdrView *pSdrView = rSh.GetDrawView(); 5245*cdf0e10cSrcweir if ( pSdrView ) 5246*cdf0e10cSrcweir { 5247*cdf0e10cSrcweir // --> OD 2005-02-17 #i42258# - no close of insert_draw and reset of 5248*cdf0e10cSrcweir // draw mode, if context menu position is inside a selected object. 5249*cdf0e10cSrcweir if ( !bIsInsideSelectedObj && rView.GetDrawFuncPtr() ) 5250*cdf0e10cSrcweir // <-- 5251*cdf0e10cSrcweir { 5252*cdf0e10cSrcweir 5253*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 5254*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 5255*cdf0e10cSrcweir rView.LeaveDrawCreate(); 5256*cdf0e10cSrcweir SfxBindings& rBind = rView.GetViewFrame()->GetBindings(); 5257*cdf0e10cSrcweir rBind.Invalidate( SID_ATTR_SIZE ); 5258*cdf0e10cSrcweir rBind.Invalidate( SID_TABLE_CELL ); 5259*cdf0e10cSrcweir } 5260*cdf0e10cSrcweir 5261*cdf0e10cSrcweir // if draw text is active and there's a text selection 5262*cdf0e10cSrcweir // at the mouse position then do nothing 5263*cdf0e10cSrcweir if(rSh.GetSelectionType() & nsSelectionType::SEL_DRW_TXT) 5264*cdf0e10cSrcweir { 5265*cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView(); 5266*cdf0e10cSrcweir ESelection aSelection = pOLV->GetSelection(); 5267*cdf0e10cSrcweir if(!aSelection.IsZero()) 5268*cdf0e10cSrcweir { 5269*cdf0e10cSrcweir SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); 5270*cdf0e10cSrcweir sal_Bool bVertical = pOutliner->IsVertical(); 5271*cdf0e10cSrcweir const EditEngine& rEditEng = pOutliner->GetEditEngine(); 5272*cdf0e10cSrcweir Point aEEPos(aDocPos); 5273*cdf0e10cSrcweir const Rectangle& rOutputArea = pOLV->GetOutputArea(); 5274*cdf0e10cSrcweir // regard vertical mode 5275*cdf0e10cSrcweir if(bVertical) 5276*cdf0e10cSrcweir { 5277*cdf0e10cSrcweir aEEPos -= rOutputArea.TopRight(); 5278*cdf0e10cSrcweir //invert the horizontal direction and exchange X and Y 5279*cdf0e10cSrcweir long nTemp = -aEEPos.X(); 5280*cdf0e10cSrcweir aEEPos.X() = aEEPos.Y(); 5281*cdf0e10cSrcweir aEEPos.Y() = nTemp; 5282*cdf0e10cSrcweir } 5283*cdf0e10cSrcweir else 5284*cdf0e10cSrcweir aEEPos -= rOutputArea.TopLeft(); 5285*cdf0e10cSrcweir 5286*cdf0e10cSrcweir EPosition aDocPosition = rEditEng.FindDocPosition(aEEPos); 5287*cdf0e10cSrcweir ESelection aCompare(aDocPosition.nPara, aDocPosition.nIndex); 5288*cdf0e10cSrcweir // make it a forward selection - otherwise the IsLess/IsGreater do not work :-( 5289*cdf0e10cSrcweir aSelection.Adjust(); 5290*cdf0e10cSrcweir if(!aCompare.IsLess(aSelection) && !aCompare.IsGreater(aSelection)) 5291*cdf0e10cSrcweir { 5292*cdf0e10cSrcweir return sal_False; 5293*cdf0e10cSrcweir } 5294*cdf0e10cSrcweir } 5295*cdf0e10cSrcweir 5296*cdf0e10cSrcweir } 5297*cdf0e10cSrcweir 5298*cdf0e10cSrcweir if (pSdrView->MouseButtonDown( aMEvt, this ) ) 5299*cdf0e10cSrcweir { 5300*cdf0e10cSrcweir pSdrView->MouseButtonUp( aMEvt, this ); 5301*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetBindings().InvalidateAll(sal_False); 5302*cdf0e10cSrcweir return sal_True; 5303*cdf0e10cSrcweir } 5304*cdf0e10cSrcweir } 5305*cdf0e10cSrcweir rSh.ResetCursorStack(); 5306*cdf0e10cSrcweir 5307*cdf0e10cSrcweir if ( EnterDrawMode( aMEvt, aDocPos ) ) 5308*cdf0e10cSrcweir { 5309*cdf0e10cSrcweir return sal_True; 5310*cdf0e10cSrcweir } 5311*cdf0e10cSrcweir if ( rView.GetDrawFuncPtr() && bInsFrm ) 5312*cdf0e10cSrcweir { 5313*cdf0e10cSrcweir StopInsFrm(); 5314*cdf0e10cSrcweir rSh.Edit(); 5315*cdf0e10cSrcweir } 5316*cdf0e10cSrcweir 5317*cdf0e10cSrcweir UpdatePointer( aDocPos, 0 ); 5318*cdf0e10cSrcweir 5319*cdf0e10cSrcweir if( !rSh.IsSelFrmMode() && 5320*cdf0e10cSrcweir !GetView().GetViewFrame()->GetDispatcher()->IsLocked() ) 5321*cdf0e10cSrcweir { 5322*cdf0e10cSrcweir // #107513# 5323*cdf0e10cSrcweir // Test if there is a draw object at that position and if it should be selected. 5324*cdf0e10cSrcweir sal_Bool bShould = rSh.ShouldObjectBeSelected(aDocPos); 5325*cdf0e10cSrcweir 5326*cdf0e10cSrcweir if(bShould) 5327*cdf0e10cSrcweir { 5328*cdf0e10cSrcweir rView.NoRotate(); 5329*cdf0e10cSrcweir rSh.HideCrsr(); 5330*cdf0e10cSrcweir 5331*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 5332*cdf0e10cSrcweir rSh.LockView( sal_True ); 5333*cdf0e10cSrcweir sal_Bool bSelObj = rSh.SelectObj( aDocPos, 0); 5334*cdf0e10cSrcweir if( bUnLockView ) 5335*cdf0e10cSrcweir rSh.LockView( sal_False ); 5336*cdf0e10cSrcweir 5337*cdf0e10cSrcweir if( bSelObj ) 5338*cdf0e10cSrcweir { 5339*cdf0e10cSrcweir bRet = sal_True; 5340*cdf0e10cSrcweir // falls im Macro der Rahmen deselektiert 5341*cdf0e10cSrcweir // wurde, muss nur noch der Cursor 5342*cdf0e10cSrcweir // wieder angezeigt werden. 5343*cdf0e10cSrcweir if( FRMTYPE_NONE == rSh.GetSelFrmType() ) 5344*cdf0e10cSrcweir rSh.ShowCrsr(); 5345*cdf0e10cSrcweir else 5346*cdf0e10cSrcweir { 5347*cdf0e10cSrcweir if (rSh.IsFrmSelected() && rView.GetDrawFuncPtr()) 5348*cdf0e10cSrcweir { 5349*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 5350*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 5351*cdf0e10cSrcweir rView.LeaveDrawCreate(); 5352*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 5353*cdf0e10cSrcweir } 5354*cdf0e10cSrcweir 5355*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 5356*cdf0e10cSrcweir bFrmDrag = sal_True; 5357*cdf0e10cSrcweir UpdatePointer( aDocPos, 0 ); 5358*cdf0e10cSrcweir return bRet; 5359*cdf0e10cSrcweir } 5360*cdf0e10cSrcweir } 5361*cdf0e10cSrcweir 5362*cdf0e10cSrcweir if (!rView.GetDrawFuncPtr()) 5363*cdf0e10cSrcweir rSh.ShowCrsr(); 5364*cdf0e10cSrcweir } 5365*cdf0e10cSrcweir } 5366*cdf0e10cSrcweir else if ( rSh.IsSelFrmMode() && 5367*cdf0e10cSrcweir (aActHitType == SDRHIT_NONE || 5368*cdf0e10cSrcweir !bIsInsideSelectedObj)) 5369*cdf0e10cSrcweir { 5370*cdf0e10cSrcweir rView.NoRotate(); 5371*cdf0e10cSrcweir sal_Bool bUnLockView = !rSh.IsViewLocked(); 5372*cdf0e10cSrcweir rSh.LockView( sal_True ); 5373*cdf0e10cSrcweir sal_uInt8 nFlag = 0; 5374*cdf0e10cSrcweir 5375*cdf0e10cSrcweir if ( rSh.IsSelFrmMode() ) 5376*cdf0e10cSrcweir { 5377*cdf0e10cSrcweir rSh.UnSelectFrm(); 5378*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 5379*cdf0e10cSrcweir rView.AttrChangedNotify(&rSh); 5380*cdf0e10cSrcweir bRet = sal_True; 5381*cdf0e10cSrcweir } 5382*cdf0e10cSrcweir 5383*cdf0e10cSrcweir sal_Bool bSelObj = rSh.SelectObj( aDocPos, nFlag ); 5384*cdf0e10cSrcweir if( bUnLockView ) 5385*cdf0e10cSrcweir rSh.LockView( sal_False ); 5386*cdf0e10cSrcweir 5387*cdf0e10cSrcweir if( !bSelObj ) 5388*cdf0e10cSrcweir { 5389*cdf0e10cSrcweir // Cursor hier umsetzen, damit er nicht zuerst 5390*cdf0e10cSrcweir // im Rahmen gezeichnet wird; ShowCrsr() geschieht 5391*cdf0e10cSrcweir // in LeaveSelFrmMode() 5392*cdf0e10cSrcweir bValidCrsrPos = !(CRSR_POSCHG & (rSh.*rSh.fnSetCrsr)(&aDocPos,sal_False)); 5393*cdf0e10cSrcweir rSh.LeaveSelFrmMode(); 5394*cdf0e10cSrcweir rView.LeaveDrawCreate(); 5395*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 5396*cdf0e10cSrcweir bRet = sal_True; 5397*cdf0e10cSrcweir } 5398*cdf0e10cSrcweir else 5399*cdf0e10cSrcweir { 5400*cdf0e10cSrcweir rSh.HideCrsr(); 5401*cdf0e10cSrcweir rSh.EnterSelFrmMode( &aDocPos ); 5402*cdf0e10cSrcweir rSh.SelFlyGrabCrsr(); 5403*cdf0e10cSrcweir rSh.MakeSelVisible(); 5404*cdf0e10cSrcweir bFrmDrag = sal_True; 5405*cdf0e10cSrcweir if( rSh.IsFrmSelected() && 5406*cdf0e10cSrcweir rView.GetDrawFuncPtr() ) 5407*cdf0e10cSrcweir { 5408*cdf0e10cSrcweir rView.GetDrawFuncPtr()->Deactivate(); 5409*cdf0e10cSrcweir rView.SetDrawFuncPtr(NULL); 5410*cdf0e10cSrcweir rView.LeaveDrawCreate(); 5411*cdf0e10cSrcweir rView.AttrChangedNotify( &rSh ); 5412*cdf0e10cSrcweir } 5413*cdf0e10cSrcweir UpdatePointer( aDocPos, 0 ); 5414*cdf0e10cSrcweir bRet = sal_True; 5415*cdf0e10cSrcweir } 5416*cdf0e10cSrcweir } 5417*cdf0e10cSrcweir else if ( rSh.IsSelFrmMode() && bIsInsideSelectedObj ) 5418*cdf0e10cSrcweir { 5419*cdf0e10cSrcweir // ## object at the mouse cursor is already selected - do nothing 5420*cdf0e10cSrcweir return sal_False; 5421*cdf0e10cSrcweir } 5422*cdf0e10cSrcweir 5423*cdf0e10cSrcweir if ( rSh.IsGCAttr() ) 5424*cdf0e10cSrcweir { 5425*cdf0e10cSrcweir rSh.GCAttr(); 5426*cdf0e10cSrcweir rSh.ClearGCAttr(); 5427*cdf0e10cSrcweir } 5428*cdf0e10cSrcweir 5429*cdf0e10cSrcweir sal_Bool bOverSelect = rSh.ChgCurrPam( aDocPos ), bOverURLGrf = sal_False; 5430*cdf0e10cSrcweir if( !bOverSelect ) 5431*cdf0e10cSrcweir bOverURLGrf = bOverSelect = 0 != rSh.IsURLGrfAtPos( aDocPos ); 5432*cdf0e10cSrcweir 5433*cdf0e10cSrcweir if ( !bOverSelect ) 5434*cdf0e10cSrcweir { 5435*cdf0e10cSrcweir { // nur temp. Move-Kontext aufspannen, da sonst die 5436*cdf0e10cSrcweir // Abfrage auf die Inhaltsform nicht funktioniert!!! 5437*cdf0e10cSrcweir MV_KONTEXT( &rSh ); 5438*cdf0e10cSrcweir (rSh.*rSh.fnSetCrsr)(&aDocPos, sal_False); 5439*cdf0e10cSrcweir bRet = sal_True; 5440*cdf0e10cSrcweir } 5441*cdf0e10cSrcweir } 5442*cdf0e10cSrcweir if( !bOverURLGrf ) 5443*cdf0e10cSrcweir { 5444*cdf0e10cSrcweir const int nSelType = rSh.GetSelectionType(); 5445*cdf0e10cSrcweir if( nSelType == nsSelectionType::SEL_OLE || 5446*cdf0e10cSrcweir nSelType == nsSelectionType::SEL_GRF ) 5447*cdf0e10cSrcweir { 5448*cdf0e10cSrcweir MV_KONTEXT( &rSh ); 5449*cdf0e10cSrcweir if( !rSh.IsFrmSelected() ) 5450*cdf0e10cSrcweir rSh.GotoNextFly(); 5451*cdf0e10cSrcweir rSh.EnterSelFrmMode(); 5452*cdf0e10cSrcweir bRet = sal_True; 5453*cdf0e10cSrcweir } 5454*cdf0e10cSrcweir } 5455*cdf0e10cSrcweir return bRet; 5456*cdf0e10cSrcweir } 5457*cdf0e10cSrcweir 5458*cdf0e10cSrcweir SfxShell* lcl_GetShellFromDispatcher( SwView& rView, TypeId nType ) 5459*cdf0e10cSrcweir { 5460*cdf0e10cSrcweir //Shell ermitteln 5461*cdf0e10cSrcweir SfxShell* pShell; 5462*cdf0e10cSrcweir SfxDispatcher* pDispatcher = rView.GetViewFrame()->GetDispatcher(); 5463*cdf0e10cSrcweir for(sal_uInt16 i = 0; sal_True; ++i ) 5464*cdf0e10cSrcweir { 5465*cdf0e10cSrcweir pShell = pDispatcher->GetShell( i ); 5466*cdf0e10cSrcweir if( !pShell || pShell->IsA( nType ) ) 5467*cdf0e10cSrcweir break; 5468*cdf0e10cSrcweir } 5469*cdf0e10cSrcweir return pShell; 5470*cdf0e10cSrcweir } 5471*cdf0e10cSrcweir 5472*cdf0e10cSrcweir 5473*cdf0e10cSrcweir 5474*cdf0e10cSrcweir void SwEditWin::ClearTip() 5475*cdf0e10cSrcweir { 5476*cdf0e10cSrcweir } 5477*cdf0e10cSrcweir 5478*cdf0e10cSrcweir IMPL_LINK( SwEditWin, KeyInputFlushHandler, Timer *, EMPTYARG ) 5479*cdf0e10cSrcweir { 5480*cdf0e10cSrcweir FlushInBuffer(); 5481*cdf0e10cSrcweir return 0; 5482*cdf0e10cSrcweir } 5483*cdf0e10cSrcweir 5484*cdf0e10cSrcweir 5485*cdf0e10cSrcweir IMPL_LINK( SwEditWin, KeyInputTimerHandler, Timer *, EMPTYARG ) 5486*cdf0e10cSrcweir { 5487*cdf0e10cSrcweir bTblInsDelMode = sal_False; 5488*cdf0e10cSrcweir return 0; 5489*cdf0e10cSrcweir } 5490*cdf0e10cSrcweir 5491*cdf0e10cSrcweir void SwEditWin::_InitStaticData() 5492*cdf0e10cSrcweir { 5493*cdf0e10cSrcweir pQuickHlpData = new QuickHelpData(); 5494*cdf0e10cSrcweir } 5495*cdf0e10cSrcweir 5496*cdf0e10cSrcweir void SwEditWin::_FinitStaticData() 5497*cdf0e10cSrcweir { 5498*cdf0e10cSrcweir delete pQuickHlpData; 5499*cdf0e10cSrcweir } 5500*cdf0e10cSrcweir /* -----------------23.01.2003 12:15----------------- 5501*cdf0e10cSrcweir * #i3370# remove quick help to prevent saving 5502*cdf0e10cSrcweir * of autocorrection suggestions 5503*cdf0e10cSrcweir * --------------------------------------------------*/ 5504*cdf0e10cSrcweir void SwEditWin::StopQuickHelp() 5505*cdf0e10cSrcweir { 5506*cdf0e10cSrcweir if( HasFocus() && pQuickHlpData && pQuickHlpData->bClear ) 5507*cdf0e10cSrcweir pQuickHlpData->Stop( rView.GetWrtShell() ); 5508*cdf0e10cSrcweir } 5509*cdf0e10cSrcweir 5510*cdf0e10cSrcweir /*-----------------23.02.97 18:39------------------- 5511*cdf0e10cSrcweir 5512*cdf0e10cSrcweir --------------------------------------------------*/ 5513*cdf0e10cSrcweir 5514*cdf0e10cSrcweir 5515*cdf0e10cSrcweir IMPL_LINK(SwEditWin, TemplateTimerHdl, Timer*, EMPTYARG) 5516*cdf0e10cSrcweir { 5517*cdf0e10cSrcweir SetApplyTemplate(SwApplyTemplate()); 5518*cdf0e10cSrcweir return 0; 5519*cdf0e10cSrcweir } 5520*cdf0e10cSrcweir 5521*cdf0e10cSrcweir 5522*cdf0e10cSrcweir void SwEditWin::SetChainMode( sal_Bool bOn ) 5523*cdf0e10cSrcweir { 5524*cdf0e10cSrcweir if ( !bChainMode ) 5525*cdf0e10cSrcweir StopInsFrm(); 5526*cdf0e10cSrcweir 5527*cdf0e10cSrcweir if ( pUserMarker ) 5528*cdf0e10cSrcweir { 5529*cdf0e10cSrcweir delete pUserMarker; 5530*cdf0e10cSrcweir pUserMarker = 0L; 5531*cdf0e10cSrcweir } 5532*cdf0e10cSrcweir 5533*cdf0e10cSrcweir bChainMode = bOn; 5534*cdf0e10cSrcweir if ( !bChainMode ) 5535*cdf0e10cSrcweir rView.GetViewFrame()->HideStatusText(); 5536*cdf0e10cSrcweir 5537*cdf0e10cSrcweir static sal_uInt16 __READONLY_DATA aInva[] = 5538*cdf0e10cSrcweir { 5539*cdf0e10cSrcweir FN_FRAME_CHAIN, FN_FRAME_UNCHAIN, 0 5540*cdf0e10cSrcweir }; 5541*cdf0e10cSrcweir rView.GetViewFrame()->GetBindings().Invalidate(aInva); 5542*cdf0e10cSrcweir } 5543*cdf0e10cSrcweir 5544*cdf0e10cSrcweir uno::Reference< ::com::sun::star::accessibility::XAccessible > SwEditWin::CreateAccessible() 5545*cdf0e10cSrcweir { 5546*cdf0e10cSrcweir vos::OGuard aGuard(Application::GetSolarMutex()); // this should have 5547*cdf0e10cSrcweir // happend already!!! 5548*cdf0e10cSrcweir SwWrtShell *pSh = rView.GetWrtShellPtr(); 5549*cdf0e10cSrcweir ASSERT( pSh, "no writer shell, no accessible object" ); 5550*cdf0e10cSrcweir uno::Reference< 5551*cdf0e10cSrcweir ::com::sun::star::accessibility::XAccessible > xAcc; 5552*cdf0e10cSrcweir if( pSh ) 5553*cdf0e10cSrcweir xAcc = pSh->CreateAccessible(); 5554*cdf0e10cSrcweir 5555*cdf0e10cSrcweir return xAcc; 5556*cdf0e10cSrcweir } 5557*cdf0e10cSrcweir 5558*cdf0e10cSrcweir //------------------------------------------------------------- 5559*cdf0e10cSrcweir 5560*cdf0e10cSrcweir void QuickHelpData::Move( QuickHelpData& rCpy ) 5561*cdf0e10cSrcweir { 5562*cdf0e10cSrcweir // Pointer verschieben 5563*cdf0e10cSrcweir aArr.Insert( &rCpy.aArr ); 5564*cdf0e10cSrcweir rCpy.aArr.Remove( (sal_uInt16)0, rCpy.aArr.Count() ); 5565*cdf0e10cSrcweir // nTipId = rCpy.nTipId; 5566*cdf0e10cSrcweir bClear = rCpy.bClear; 5567*cdf0e10cSrcweir nLen = rCpy.nLen; 5568*cdf0e10cSrcweir nCurArrPos = rCpy.nCurArrPos; 5569*cdf0e10cSrcweir bChkInsBlank = rCpy.bChkInsBlank; 5570*cdf0e10cSrcweir bIsTip = rCpy.bIsTip; 5571*cdf0e10cSrcweir bIsAutoText = rCpy.bIsAutoText; 5572*cdf0e10cSrcweir 5573*cdf0e10cSrcweir if( pCETID ) delete pCETID; 5574*cdf0e10cSrcweir pCETID = rCpy.pCETID; 5575*cdf0e10cSrcweir rCpy.pCETID = 0; 5576*cdf0e10cSrcweir 5577*cdf0e10cSrcweir if( pAttrs ) 5578*cdf0e10cSrcweir delete[] pAttrs; 5579*cdf0e10cSrcweir pAttrs = rCpy.pAttrs; 5580*cdf0e10cSrcweir rCpy.pAttrs = 0; 5581*cdf0e10cSrcweir } 5582*cdf0e10cSrcweir 5583*cdf0e10cSrcweir void QuickHelpData::ClearCntnt() 5584*cdf0e10cSrcweir { 5585*cdf0e10cSrcweir nLen = nCurArrPos = 0; 5586*cdf0e10cSrcweir bClear = bChkInsBlank = sal_False; 5587*cdf0e10cSrcweir nTipId = 0; 5588*cdf0e10cSrcweir aArr.DeleteAndDestroy( 0 , aArr.Count() ); 5589*cdf0e10cSrcweir bIsTip = sal_True; 5590*cdf0e10cSrcweir bIsAutoText = sal_True; 5591*cdf0e10cSrcweir delete pCETID, pCETID = 0; 5592*cdf0e10cSrcweir delete[] pAttrs, pAttrs = 0; 5593*cdf0e10cSrcweir } 5594*cdf0e10cSrcweir 5595*cdf0e10cSrcweir 5596*cdf0e10cSrcweir void QuickHelpData::Start( SwWrtShell& rSh, sal_uInt16 nWrdLen ) 5597*cdf0e10cSrcweir { 5598*cdf0e10cSrcweir if( pCETID ) delete pCETID, pCETID = 0; 5599*cdf0e10cSrcweir if( pAttrs ) delete[] pAttrs, pAttrs = 0; 5600*cdf0e10cSrcweir 5601*cdf0e10cSrcweir if( USHRT_MAX != nWrdLen ) 5602*cdf0e10cSrcweir { 5603*cdf0e10cSrcweir nLen = nWrdLen; 5604*cdf0e10cSrcweir nCurArrPos = 0; 5605*cdf0e10cSrcweir } 5606*cdf0e10cSrcweir bClear = sal_True; 5607*cdf0e10cSrcweir 5608*cdf0e10cSrcweir Window& rWin = rSh.GetView().GetEditWin(); 5609*cdf0e10cSrcweir if( bIsTip ) 5610*cdf0e10cSrcweir { 5611*cdf0e10cSrcweir Point aPt( rWin.OutputToScreenPixel( rWin.LogicToPixel( 5612*cdf0e10cSrcweir rSh.GetCharRect().Pos() ))); 5613*cdf0e10cSrcweir aPt.Y() -= 3; 5614*cdf0e10cSrcweir nTipId = Help::ShowTip( &rWin, Rectangle( aPt, Size( 1, 1 )), 5615*cdf0e10cSrcweir *aArr[ nCurArrPos ], 5616*cdf0e10cSrcweir QUICKHELP_LEFT | QUICKHELP_BOTTOM ); 5617*cdf0e10cSrcweir } 5618*cdf0e10cSrcweir else 5619*cdf0e10cSrcweir { 5620*cdf0e10cSrcweir String sStr( *aArr[ nCurArrPos ] ); 5621*cdf0e10cSrcweir sStr.Erase( 0, nLen ); 5622*cdf0e10cSrcweir sal_uInt16 nL = sStr.Len(); 5623*cdf0e10cSrcweir pAttrs = new sal_uInt16[ nL ]; 5624*cdf0e10cSrcweir for( sal_uInt16 n = nL; n; ) 5625*cdf0e10cSrcweir *(pAttrs + --n ) = EXTTEXTINPUT_ATTR_DOTTEDUNDERLINE | 5626*cdf0e10cSrcweir EXTTEXTINPUT_ATTR_HIGHLIGHT; 5627*cdf0e10cSrcweir pCETID = new CommandExtTextInputData( sStr, pAttrs, nL, 5628*cdf0e10cSrcweir 0, 0, 0, sal_False ); 5629*cdf0e10cSrcweir rSh.CreateExtTextInput(rWin.GetInputLanguage()); 5630*cdf0e10cSrcweir rSh.SetExtTextInputData( *pCETID ); 5631*cdf0e10cSrcweir } 5632*cdf0e10cSrcweir } 5633*cdf0e10cSrcweir 5634*cdf0e10cSrcweir void QuickHelpData::Stop( SwWrtShell& rSh ) 5635*cdf0e10cSrcweir { 5636*cdf0e10cSrcweir if( !bIsTip ) 5637*cdf0e10cSrcweir rSh.DeleteExtTextInput( 0, sal_False ); 5638*cdf0e10cSrcweir else if( nTipId ) 5639*cdf0e10cSrcweir Help::HideTip( nTipId ); 5640*cdf0e10cSrcweir ClearCntnt(); 5641*cdf0e10cSrcweir } 5642*cdf0e10cSrcweir 5643*cdf0e10cSrcweir 5644*cdf0e10cSrcweir 5645*cdf0e10cSrcweir void QuickHelpData::FillStrArr( SwWrtShell& rSh, const String& rWord ) 5646*cdf0e10cSrcweir { 5647*cdf0e10cSrcweir salhelper::SingletonRef<SwCalendarWrapper>* pCalendar = s_getCalendarWrapper(); 5648*cdf0e10cSrcweir (*pCalendar)->LoadDefaultCalendar( rSh.GetCurLang() ); 5649*cdf0e10cSrcweir 5650*cdf0e10cSrcweir { 5651*cdf0e10cSrcweir uno::Sequence< i18n::CalendarItem > aNames( 5652*cdf0e10cSrcweir (*pCalendar)->getMonths() ); 5653*cdf0e10cSrcweir for( int n = 0; n < 2; ++n ) 5654*cdf0e10cSrcweir { 5655*cdf0e10cSrcweir for( long nPos = 0, nEnd = aNames.getLength(); nPos < nEnd; ++nPos ) 5656*cdf0e10cSrcweir { 5657*cdf0e10cSrcweir String sStr( aNames[ nPos ].FullName ); 5658*cdf0e10cSrcweir if( rWord.Len() + 1 < sStr.Len() && 5659*cdf0e10cSrcweir 5660*cdf0e10cSrcweir //!!! UNICODE: fehlendes interface 5661*cdf0e10cSrcweir // pIntl->CompareEqual( rWord, sStr.Copy( 0, rWord.Len() ), 5662*cdf0e10cSrcweir // INTN_COMPARE_IGNORECASE ) ) 5663*cdf0e10cSrcweir COMPARE_EQUAL == rWord.CompareIgnoreCaseToAscii( 5664*cdf0e10cSrcweir sStr, rWord.Len() )) 5665*cdf0e10cSrcweir { 5666*cdf0e10cSrcweir String* pNew = new String( sStr ); 5667*cdf0e10cSrcweir if( !aArr.Insert( pNew ) ) 5668*cdf0e10cSrcweir delete pNew; 5669*cdf0e10cSrcweir } 5670*cdf0e10cSrcweir } 5671*cdf0e10cSrcweir if( !n ) // get data for the second loop 5672*cdf0e10cSrcweir aNames = (*pCalendar)->getDays(); 5673*cdf0e10cSrcweir } 5674*cdf0e10cSrcweir } 5675*cdf0e10cSrcweir 5676*cdf0e10cSrcweir // and than add all words from the AutoCompleteWord-List 5677*cdf0e10cSrcweir const SwAutoCompleteWord& rACLst = rSh.GetAutoCompleteWords(); 5678*cdf0e10cSrcweir sal_uInt16 nStt, nEnd; 5679*cdf0e10cSrcweir if( rACLst.GetRange( rWord, nStt, nEnd ) ) 5680*cdf0e10cSrcweir { 5681*cdf0e10cSrcweir while( nStt < nEnd ) 5682*cdf0e10cSrcweir { 5683*cdf0e10cSrcweir const String& rS = rACLst[ nStt ]; 5684*cdf0e10cSrcweir //JP 16.06.99: Bug 66927 - only if the count of chars 5685*cdf0e10cSrcweir // from the suggest greater as the 5686*cdf0e10cSrcweir // actual word 5687*cdf0e10cSrcweir if( rS.Len() > rWord.Len() ) 5688*cdf0e10cSrcweir { 5689*cdf0e10cSrcweir String* pNew = new String( rS ); 5690*cdf0e10cSrcweir if( !aArr.Insert( pNew ) ) 5691*cdf0e10cSrcweir delete pNew; 5692*cdf0e10cSrcweir } 5693*cdf0e10cSrcweir ++nStt; 5694*cdf0e10cSrcweir } 5695*cdf0e10cSrcweir } 5696*cdf0e10cSrcweir } 5697*cdf0e10cSrcweir /* -----------------06.11.2002 12:01----------------- 5698*cdf0e10cSrcweir * 5699*cdf0e10cSrcweir * --------------------------------------------------*/ 5700*cdf0e10cSrcweir void SwEditWin::ShowAutoTextCorrectQuickHelp( 5701*cdf0e10cSrcweir const String& rWord, SvxAutoCorrCfg* pACfg, SvxAutoCorrect* pACorr, 5702*cdf0e10cSrcweir sal_Bool bFromIME ) 5703*cdf0e10cSrcweir { 5704*cdf0e10cSrcweir SwWrtShell& rSh = rView.GetWrtShell(); 5705*cdf0e10cSrcweir pQuickHlpData->ClearCntnt(); 5706*cdf0e10cSrcweir if( pACfg->IsAutoTextTip() ) 5707*cdf0e10cSrcweir { 5708*cdf0e10cSrcweir SwGlossaryList* pList = ::GetGlossaryList(); 5709*cdf0e10cSrcweir pList->HasLongName( rWord, &pQuickHlpData->aArr ); 5710*cdf0e10cSrcweir } 5711*cdf0e10cSrcweir 5712*cdf0e10cSrcweir if( pQuickHlpData->aArr.Count() ) 5713*cdf0e10cSrcweir { 5714*cdf0e10cSrcweir pQuickHlpData->bIsTip = sal_True; 5715*cdf0e10cSrcweir pQuickHlpData->bIsAutoText = sal_True; 5716*cdf0e10cSrcweir } 5717*cdf0e10cSrcweir else if( pACorr->GetSwFlags().bAutoCompleteWords ) 5718*cdf0e10cSrcweir { 5719*cdf0e10cSrcweir pQuickHlpData->bIsAutoText = sal_False; 5720*cdf0e10cSrcweir pQuickHlpData->bIsTip = bFromIME || 5721*cdf0e10cSrcweir !pACorr || 5722*cdf0e10cSrcweir pACorr->GetSwFlags().bAutoCmpltShowAsTip; 5723*cdf0e10cSrcweir 5724*cdf0e10cSrcweir pQuickHlpData->FillStrArr( rSh, rWord ); 5725*cdf0e10cSrcweir } 5726*cdf0e10cSrcweir 5727*cdf0e10cSrcweir if( pQuickHlpData->aArr.Count() ) 5728*cdf0e10cSrcweir pQuickHlpData->Start( rSh, rWord.Len() ); 5729*cdf0e10cSrcweir } 5730*cdf0e10cSrcweir 5731*cdf0e10cSrcweir /* -----------------29.03.2006 11:01----------------- 5732*cdf0e10cSrcweir * 5733*cdf0e10cSrcweir * --------------------------------------------------*/ 5734*cdf0e10cSrcweir 5735*cdf0e10cSrcweir void SwEditWin::SetUseInputLanguage( sal_Bool bNew ) 5736*cdf0e10cSrcweir { 5737*cdf0e10cSrcweir if ( bNew || bUseInputLanguage ) 5738*cdf0e10cSrcweir { 5739*cdf0e10cSrcweir SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); 5740*cdf0e10cSrcweir rBind.Invalidate( SID_ATTR_CHAR_FONT ); 5741*cdf0e10cSrcweir rBind.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); 5742*cdf0e10cSrcweir } 5743*cdf0e10cSrcweir bUseInputLanguage = bNew; 5744*cdf0e10cSrcweir } 5745*cdf0e10cSrcweir 5746*cdf0e10cSrcweir /*-- 13.11.2008 10:18:17--------------------------------------------------- 5747*cdf0e10cSrcweir 5748*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 5749*cdf0e10cSrcweir XubString SwEditWin::GetSurroundingText() const 5750*cdf0e10cSrcweir { 5751*cdf0e10cSrcweir String sReturn; 5752*cdf0e10cSrcweir SwWrtShell& rSh = rView.GetWrtShell(); 5753*cdf0e10cSrcweir if( rSh.HasSelection() && !rSh.IsMultiSelection() && rSh.IsSelOnePara() ) 5754*cdf0e10cSrcweir rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR ); 5755*cdf0e10cSrcweir else if( !rSh.HasSelection() ) 5756*cdf0e10cSrcweir { 5757*cdf0e10cSrcweir SwPosition *pPos = rSh.GetCrsr()->GetPoint(); 5758*cdf0e10cSrcweir xub_StrLen nPos = pPos->nContent.GetIndex(); 5759*cdf0e10cSrcweir 5760*cdf0e10cSrcweir // get the sentence around the cursor 5761*cdf0e10cSrcweir rSh.HideCrsr(); 5762*cdf0e10cSrcweir rSh.GoStartSentence(); 5763*cdf0e10cSrcweir rSh.SetMark(); 5764*cdf0e10cSrcweir rSh.GoEndSentence(); 5765*cdf0e10cSrcweir rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR ); 5766*cdf0e10cSrcweir 5767*cdf0e10cSrcweir pPos->nContent = nPos; 5768*cdf0e10cSrcweir rSh.ClearMark(); 5769*cdf0e10cSrcweir rSh.HideCrsr(); 5770*cdf0e10cSrcweir } 5771*cdf0e10cSrcweir 5772*cdf0e10cSrcweir return sReturn; 5773*cdf0e10cSrcweir } 5774*cdf0e10cSrcweir /*-- 13.11.2008 10:18:17--------------------------------------------------- 5775*cdf0e10cSrcweir 5776*cdf0e10cSrcweir -----------------------------------------------------------------------*/ 5777*cdf0e10cSrcweir Selection SwEditWin::GetSurroundingTextSelection() const 5778*cdf0e10cSrcweir { 5779*cdf0e10cSrcweir SwWrtShell& rSh = rView.GetWrtShell(); 5780*cdf0e10cSrcweir if( rSh.HasSelection() ) 5781*cdf0e10cSrcweir { 5782*cdf0e10cSrcweir String sReturn; 5783*cdf0e10cSrcweir rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR ); 5784*cdf0e10cSrcweir return Selection( 0, sReturn.Len() ); 5785*cdf0e10cSrcweir } 5786*cdf0e10cSrcweir else 5787*cdf0e10cSrcweir { 5788*cdf0e10cSrcweir // Return the position of the visible cursor in the sentence 5789*cdf0e10cSrcweir // around the visible cursor. 5790*cdf0e10cSrcweir SwPosition *pPos = rSh.GetCrsr()->GetPoint(); 5791*cdf0e10cSrcweir xub_StrLen nPos = pPos->nContent.GetIndex(); 5792*cdf0e10cSrcweir 5793*cdf0e10cSrcweir rSh.HideCrsr(); 5794*cdf0e10cSrcweir rSh.GoStartSentence(); 5795*cdf0e10cSrcweir xub_StrLen nStartPos = rSh.GetCrsr()->GetPoint()->nContent.GetIndex(); 5796*cdf0e10cSrcweir 5797*cdf0e10cSrcweir pPos->nContent = nPos; 5798*cdf0e10cSrcweir rSh.ClearMark(); 5799*cdf0e10cSrcweir rSh.ShowCrsr(); 5800*cdf0e10cSrcweir 5801*cdf0e10cSrcweir return Selection( nPos - nStartPos, nPos - nStartPos ); 5802*cdf0e10cSrcweir } 5803*cdf0e10cSrcweir } 5804