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 #include <com/sun/star/container/XChild.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/embed/XVisualObject.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/embed/EmbedMisc.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/embed/EmbedStates.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/embed/NoVisualAreaSizeException.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/chart2/XChartDocument.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/util/XModifiable.hpp> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #if STLPORT_VERSION>=321 41*cdf0e10cSrcweir #include <math.h> // prevent conflict between exception and std::exception 42*cdf0e10cSrcweir #endif 43*cdf0e10cSrcweir #include <hintids.hxx> 44*cdf0e10cSrcweir #include <svx/svdview.hxx> 45*cdf0e10cSrcweir #include <sot/factory.hxx> 46*cdf0e10cSrcweir #include <svl/itemiter.hxx> 47*cdf0e10cSrcweir #include <vcl/sound.hxx> 48*cdf0e10cSrcweir #include <tools/bigint.hxx> 49*cdf0e10cSrcweir #include <sot/storage.hxx> 50*cdf0e10cSrcweir #include <svtools/insdlg.hxx> 51*cdf0e10cSrcweir #include <sfx2/frmdescr.hxx> 52*cdf0e10cSrcweir #include <sfx2/ipclient.hxx> 53*cdf0e10cSrcweir #include <svtools/ehdl.hxx> 54*cdf0e10cSrcweir #include <svtools/soerr.hxx> 55*cdf0e10cSrcweir #include <tools/cachestr.hxx> 56*cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 57*cdf0e10cSrcweir #include <editeng/sizeitem.hxx> 58*cdf0e10cSrcweir #include <editeng/brkitem.hxx> 59*cdf0e10cSrcweir #include <editeng/svxacorr.hxx> 60*cdf0e10cSrcweir #include <vcl/graph.hxx> 61*cdf0e10cSrcweir #include <sfx2/printer.hxx> 62*cdf0e10cSrcweir #include <unotools/charclass.hxx> 63*cdf0e10cSrcweir #include <comphelper/storagehelper.hxx> 64*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 65*cdf0e10cSrcweir #include <svx/extrusionbar.hxx> 66*cdf0e10cSrcweir #include <svx/fontworkbar.hxx> 67*cdf0e10cSrcweir #include <frmfmt.hxx> 68*cdf0e10cSrcweir #include <fmtftn.hxx> 69*cdf0e10cSrcweir #include <fmtpdsc.hxx> 70*cdf0e10cSrcweir #include <wdocsh.hxx> 71*cdf0e10cSrcweir #include <basesh.hxx> 72*cdf0e10cSrcweir #include <swmodule.hxx> 73*cdf0e10cSrcweir #include <wrtsh.hxx> 74*cdf0e10cSrcweir #include <view.hxx> 75*cdf0e10cSrcweir #include <uitool.hxx> 76*cdf0e10cSrcweir #include <cmdid.h> 77*cdf0e10cSrcweir #include <cfgitems.hxx> 78*cdf0e10cSrcweir #include <pagedesc.hxx> 79*cdf0e10cSrcweir #include <frmmgr.hxx> 80*cdf0e10cSrcweir #include <shellio.hxx> 81*cdf0e10cSrcweir #include <uinums.hxx> // fuer Anwenden einer 82*cdf0e10cSrcweir #include <swundo.hxx> // fuer Undo-Ids 83*cdf0e10cSrcweir #include <swcli.hxx> 84*cdf0e10cSrcweir #include <poolfmt.hxx> 85*cdf0e10cSrcweir #include <wview.hxx> 86*cdf0e10cSrcweir #include <edtwin.hxx> 87*cdf0e10cSrcweir #include <fmtcol.hxx> 88*cdf0e10cSrcweir #include <swtable.hxx> 89*cdf0e10cSrcweir #include <caption.hxx> 90*cdf0e10cSrcweir #include <viscrs.hxx> 91*cdf0e10cSrcweir #include <swdtflvr.hxx> 92*cdf0e10cSrcweir #include <crsskip.hxx> 93*cdf0e10cSrcweir #include <doc.hxx> 94*cdf0e10cSrcweir #include <wrtsh.hrc> 95*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 96*cdf0e10cSrcweir #include <sfx2/request.hxx> 97*cdf0e10cSrcweir #include <paratr.hxx> 98*cdf0e10cSrcweir #include <ndtxt.hxx> 99*cdf0e10cSrcweir #include <editeng/acorrcfg.hxx> 100*cdf0e10cSrcweir #include <IMark.hxx> 101*cdf0e10cSrcweir #include <sfx2/bindings.hxx> 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // -> #111827# 104*cdf0e10cSrcweir #include <SwRewriter.hxx> 105*cdf0e10cSrcweir #include <comcore.hrc> 106*cdf0e10cSrcweir // <- #111827# 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 109*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir #include <editeng/acorrcfg.hxx> 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir #include "PostItMgr.hxx" 114*cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir using namespace sw::mark; 117*cdf0e10cSrcweir using namespace com::sun::star; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir #define COMMON_INI_LIST \ 120*cdf0e10cSrcweir fnDrag(&SwWrtShell::BeginDrag),\ 121*cdf0e10cSrcweir fnSetCrsr(&SwWrtShell::SetCrsr),\ 122*cdf0e10cSrcweir fnEndDrag(&SwWrtShell::EndDrag),\ 123*cdf0e10cSrcweir fnKillSel(&SwWrtShell::Ignore),\ 124*cdf0e10cSrcweir pModeStack(0), \ 125*cdf0e10cSrcweir ePageMove(MV_NO),\ 126*cdf0e10cSrcweir pCrsrStack(0), \ 127*cdf0e10cSrcweir rView(rShell),\ 128*cdf0e10cSrcweir bDestOnStack(sal_False), \ 129*cdf0e10cSrcweir fnLeaveSelect(&SwWrtShell::SttLeaveSelect) 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir #define BITFLD_INI_LIST \ 132*cdf0e10cSrcweir bClearMark = \ 133*cdf0e10cSrcweir bIns = sal_True;\ 134*cdf0e10cSrcweir bAddMode = \ 135*cdf0e10cSrcweir bBlockMode = \ 136*cdf0e10cSrcweir bExtMode = \ 137*cdf0e10cSrcweir bInSelect = \ 138*cdf0e10cSrcweir bCopy = \ 139*cdf0e10cSrcweir bLayoutMode = \ 140*cdf0e10cSrcweir bNoEdit = \ 141*cdf0e10cSrcweir bSelWrd = \ 142*cdf0e10cSrcweir bSelLn = \ 143*cdf0e10cSrcweir bIsInClickToEdit = \ 144*cdf0e10cSrcweir mbRetainSelection = sal_False; 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir SvxAutoCorrect* lcl_IsAutoCorr() 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir SvxAutoCorrect* pACorr = SvxAutoCorrCfg::Get()->GetAutoCorrect(); 150*cdf0e10cSrcweir if( pACorr && !pACorr->IsAutoCorrFlag( CptlSttSntnc | CptlSttWrd | 151*cdf0e10cSrcweir AddNonBrkSpace | ChgOrdinalNumber | 152*cdf0e10cSrcweir ChgToEnEmDash | SetINetAttr | Autocorrect )) 153*cdf0e10cSrcweir pACorr = 0; 154*cdf0e10cSrcweir return pACorr; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir void SwWrtShell::NoEdit(sal_Bool bHideCrsr) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir if(bHideCrsr) 160*cdf0e10cSrcweir HideCrsr(); 161*cdf0e10cSrcweir bNoEdit = sal_True; 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir void SwWrtShell::Edit() 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir if (CanInsert()) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir ShowCrsr(); 171*cdf0e10cSrcweir bNoEdit = sal_False; 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir sal_Bool SwWrtShell::IsEndWrd() 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir MV_KONTEXT(this); 180*cdf0e10cSrcweir if(IsEndPara() && !IsSttPara()) 181*cdf0e10cSrcweir return sal_True; 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir return IsEndWord(); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir /*------------------------------------------------------------------------ 188*cdf0e10cSrcweir Beschreibung: Abfrage, ob Einfuegen moeglich ist; gfs. Beep 189*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir sal_Bool SwWrtShell::_CanInsert() 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir if(!CanInsert()) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir Sound::Beep(); 198*cdf0e10cSrcweir return sal_False; 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir return sal_True; 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir /*------------------------------------------------------------------------ 203*cdf0e10cSrcweir Beschreibung: String einfuegen 204*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir void SwWrtShell::InsertByWord( const String & rStr) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir if( rStr.Len() ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir sal_Bool bDelim = GetAppCharClass().isLetterNumeric( rStr, 0 ); 211*cdf0e10cSrcweir xub_StrLen nPos = 0, nStt = 0; 212*cdf0e10cSrcweir for( ; nPos < rStr.Len(); nPos++ ) 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir sal_Bool bTmpDelim = GetAppCharClass().isLetterNumeric( rStr, nPos ); 215*cdf0e10cSrcweir if( bTmpDelim != bDelim ) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir Insert( rStr.Copy( nStt, nPos - nStt )); 218*cdf0e10cSrcweir nStt = nPos; 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir if( nStt != nPos ) 222*cdf0e10cSrcweir Insert( rStr.Copy( nStt, nPos - nStt )); 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir } 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir void SwWrtShell::Insert( const String &rStr ) 228*cdf0e10cSrcweir { 229*cdf0e10cSrcweir ResetCursorStack(); 230*cdf0e10cSrcweir if( !_CanInsert() ) 231*cdf0e10cSrcweir return; 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir sal_Bool bStarted = sal_False, bHasSel = HasSelection(), 234*cdf0e10cSrcweir bCallIns = bIns /*|| bHasSel*/; 235*cdf0e10cSrcweir bool bDeleted = false; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir if( bHasSel || ( !bIns && SelectHiddenRange() ) ) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir // nur hier klammern, da das normale Insert schon an der 240*cdf0e10cSrcweir // Editshell geklammert ist 241*cdf0e10cSrcweir StartAllAction(); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir // #111827# 244*cdf0e10cSrcweir SwRewriter aRewriter; 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, GetCrsrDescr()); 247*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG2, String(SW_RES(STR_YIELDS))); 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir String aTmpStr; 250*cdf0e10cSrcweir aTmpStr += String(SW_RES(STR_START_QUOTE)); 251*cdf0e10cSrcweir aTmpStr += rStr; 252*cdf0e10cSrcweir aTmpStr += String(SW_RES(STR_END_QUOTE)); 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG3, rStr); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir 257*cdf0e10cSrcweir StartUndo(UNDO_REPLACE, &aRewriter); 258*cdf0e10cSrcweir bStarted = sal_True; 259*cdf0e10cSrcweir bDeleted = DelRight() != 0; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir /* 263*cdf0e10cSrcweir JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das 264*cdf0e10cSrcweir naechste Zeichen. 265*cdf0e10cSrcweir if( bHasSel && !bIns && 1 < rStr.Len() ) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir // falls mehrere Zeichen anstehen, nur das erste einfuegen, 268*cdf0e10cSrcweir // der Rest muss dann aber Ueberschrieben werden. 269*cdf0e10cSrcweir SwEditShell::Insert( rStr.GetChar( 0 ) ); 270*cdf0e10cSrcweir SwEditShell::Overwrite( rStr.Copy( 1 ) ); 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir else 273*cdf0e10cSrcweir */ 274*cdf0e10cSrcweir bCallIns ? 275*cdf0e10cSrcweir SwEditShell::Insert2( rStr, bDeleted ) : SwEditShell::Overwrite( rStr ); 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir if( bStarted ) 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir EndAllAction(); 281*cdf0e10cSrcweir EndUndo(); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir // delete pChgFlg; 284*cdf0e10cSrcweir } 285*cdf0e10cSrcweir 286*cdf0e10cSrcweir /* Begrenzung auf maximale Hoehe geht nicht, da die maximale Hoehe 287*cdf0e10cSrcweir * des aktuellen Frames nicht erfragt werden kann. */ 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir void SwWrtShell::Insert( const String &rPath, const String &rFilter, 292*cdf0e10cSrcweir const Graphic &rGrf, SwFlyFrmAttrMgr *pFrmMgr, 293*cdf0e10cSrcweir sal_Bool bRule ) 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir ResetCursorStack(); 296*cdf0e10cSrcweir if ( !_CanInsert() ) 297*cdf0e10cSrcweir return; 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir StartAllAction(); 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir SwRewriter aRewriter; 302*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_GRAPHIC)); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir StartUndo(UNDO_INSERT, &aRewriter); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir if ( HasSelection() ) 307*cdf0e10cSrcweir DelRight(); 308*cdf0e10cSrcweir // eingefuegte Grafik in eigenen Absatz, falls am Ende 309*cdf0e10cSrcweir // eines nichtleeren Absatzes 310*cdf0e10cSrcweir if ( IsEndPara() && !IsSttPara() ) 311*cdf0e10cSrcweir SwFEShell::SplitNode(); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir EnterSelFrmMode(); 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir sal_Bool bSetGrfSize = sal_True; 316*cdf0e10cSrcweir sal_Bool bOwnMgr = sal_False; 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir if ( !pFrmMgr ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir bOwnMgr = sal_True; 321*cdf0e10cSrcweir pFrmMgr = new SwFlyFrmAttrMgr( sal_True, this, FRMMGR_TYPE_GRF ); 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir // VORSICHT 324*cdf0e10cSrcweir // GetAttrSet nimmt einen Abgleich vor 325*cdf0e10cSrcweir // Beim Einfuegen ist eine SwFrmSize vorhanden wegen der 326*cdf0e10cSrcweir // DEF-Rahmengroesse 327*cdf0e10cSrcweir // Diese muss fuer die optimale Groesse explizit entfernt werden 328*cdf0e10cSrcweir pFrmMgr->DelAttr(RES_FRM_SIZE); 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir else 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir Size aSz( pFrmMgr->GetSize() ); 333*cdf0e10cSrcweir if ( !aSz.Width() || !aSz.Height() ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir aSz.Width() = aSz.Height() = 567; 336*cdf0e10cSrcweir pFrmMgr->SetSize( aSz ); 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir else if ( aSz.Width() != DFLT_WIDTH && aSz.Height() != DFLT_HEIGHT ) 339*cdf0e10cSrcweir bSetGrfSize = sal_False; 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir pFrmMgr->SetHeightSizeType(ATT_FIX_SIZE); 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir // Einfuegen der Grafik 346*cdf0e10cSrcweir SwFEShell::Insert(rPath, rFilter, &rGrf, &pFrmMgr->GetAttrSet()); 347*cdf0e10cSrcweir if ( bOwnMgr ) 348*cdf0e10cSrcweir pFrmMgr->UpdateAttrMgr(); 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir if( bSetGrfSize && !bRule ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir Size aGrfSize, aBound = GetGraphicDefaultSize(); 353*cdf0e10cSrcweir GetGrfSize( aGrfSize ); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir //Die GrafikSize noch um die Randattribute vergroessern, denn die 356*cdf0e10cSrcweir //Zaehlen beim Rahmen mit. 357*cdf0e10cSrcweir aGrfSize.Width() += pFrmMgr->CalcWidthBorder(); 358*cdf0e10cSrcweir aGrfSize.Height()+= pFrmMgr->CalcHeightBorder(); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir const BigInt aTempWidth( aGrfSize.Width() ); 361*cdf0e10cSrcweir const BigInt aTempHeight( aGrfSize.Height()); 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir // ggf. Breite anpassen, Hoehe dann proportional verkleinern 364*cdf0e10cSrcweir if( aGrfSize.Width() > aBound.Width() ) 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir aGrfSize.Width() = aBound.Width(); 367*cdf0e10cSrcweir aGrfSize.Height() = ((BigInt)aBound.Width()) * aTempHeight / aTempWidth; 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir // ggf. Hoehe anpassen, Breite dann proportional verkleinern 370*cdf0e10cSrcweir if( aGrfSize.Height() > aBound.Height() ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir aGrfSize.Height() = aBound.Height(); 373*cdf0e10cSrcweir aGrfSize.Width() = ((BigInt)aBound.Height()) * aTempWidth / aTempHeight; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir pFrmMgr->SetSize( aGrfSize ); 376*cdf0e10cSrcweir pFrmMgr->UpdateFlyFrm(); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir if ( bOwnMgr ) 379*cdf0e10cSrcweir delete pFrmMgr; 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir EndUndo(); 382*cdf0e10cSrcweir EndAllAction(); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir /*------------------------------------------------------------------------ 387*cdf0e10cSrcweir Beschreibung: Fuegt ein OLE-Objekt in die CORE ein. 388*cdf0e10cSrcweir Wenn kein Object uebergeben wird, so wird eins erzeugt. 389*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir void SwWrtShell::InsertObject( const svt::EmbeddedObjectRef& xRef, SvGlobalName *pName, 393*cdf0e10cSrcweir sal_Bool bActivate, sal_uInt16 nSlotId ) 394*cdf0e10cSrcweir { 395*cdf0e10cSrcweir ResetCursorStack(); 396*cdf0e10cSrcweir if( !_CanInsert() ) 397*cdf0e10cSrcweir return; 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir if( !xRef.is() ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir // temporary storage 402*cdf0e10cSrcweir svt::EmbeddedObjectRef xObj; 403*cdf0e10cSrcweir uno::Reference < embed::XStorage > xStor = comphelper::OStorageHelper::GetTemporaryStorage(); 404*cdf0e10cSrcweir sal_Bool bDoVerb = sal_True; 405*cdf0e10cSrcweir if ( pName ) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir comphelper::EmbeddedObjectContainer aCnt( xStor ); 408*cdf0e10cSrcweir ::rtl::OUString aName; 409*cdf0e10cSrcweir // TODO/LATER: get aspect? 410*cdf0e10cSrcweir xObj.Assign( aCnt.CreateEmbeddedObject( pName->GetByteSequence(), aName ), embed::Aspects::MSOLE_CONTENT ); 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir else 413*cdf0e10cSrcweir { 414*cdf0e10cSrcweir SvObjectServerList aServerList; 415*cdf0e10cSrcweir switch (nSlotId) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir case SID_INSERT_OBJECT: 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir aServerList.FillInsertObjects(); 420*cdf0e10cSrcweir aServerList.Remove( SwDocShell::Factory().GetClassId() ); 421*cdf0e10cSrcweir // Intentionally no break! 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir // TODO/LATER: recording! Convert properties to items 425*cdf0e10cSrcweir case SID_INSERT_PLUGIN: 426*cdf0e10cSrcweir /* 427*cdf0e10cSrcweir if(pReq) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir INetURLObject* pURL = aDlg.GetURL(); 430*cdf0e10cSrcweir if(pURL) 431*cdf0e10cSrcweir pReq->AppendItem(SfxStringItem(FN_PARAM_2, pURL->GetMainURL(INetURLObject::NO_DECODE))); 432*cdf0e10cSrcweir pReq->AppendItem(SfxStringItem(FN_PARAM_3 , aDlg.GetCommands())); 433*cdf0e10cSrcweir } */ 434*cdf0e10cSrcweir case SID_INSERT_FLOATINGFRAME: 435*cdf0e10cSrcweir /* 436*cdf0e10cSrcweir if(pReq && xFloatingFrame.Is()) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir const SfxFrameDescriptor* pDescriptor = xFloatingFrame->GetFrameDescriptor(); 439*cdf0e10cSrcweir pReq->AppendItem(SfxStringItem(FN_PARAM_1, pDescriptor->GetName())); 440*cdf0e10cSrcweir pReq->AppendItem( 441*cdf0e10cSrcweir SfxStringItem( FN_PARAM_2, 442*cdf0e10cSrcweir pDescriptor->GetURL().GetMainURL(INetURLObject::NO_DECODE))); 443*cdf0e10cSrcweir pReq->AppendItem(SvxSizeItem(FN_PARAM_3, pDescriptor->GetMargin())); 444*cdf0e10cSrcweir pReq->AppendItem(SfxByteItem(FN_PARAM_4, pDescriptor->GetScrollingMode())); 445*cdf0e10cSrcweir pReq->AppendItem(SfxBoolItem(FN_PARAM_5, pDescriptor->HasFrameBorder())); 446*cdf0e10cSrcweir }*/ 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool(); 449*cdf0e10cSrcweir const SfxSlot* pSlot = pSlotPool->GetSlot(nSlotId); 450*cdf0e10cSrcweir rtl::OString aCmd(".uno:"); 451*cdf0e10cSrcweir aCmd += pSlot->GetUnoName(); 452*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 453*cdf0e10cSrcweir SfxAbstractInsertObjectDialog* pDlg = 454*cdf0e10cSrcweir pFact->CreateInsertObjectDialog( GetWin(), rtl::OUString( aCmd, aCmd.getLength(), RTL_TEXTENCODING_UTF8 ), xStor, &aServerList ); 455*cdf0e10cSrcweir if ( pDlg ) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir pDlg->Execute(); 458*cdf0e10cSrcweir bDoVerb = pDlg->IsCreateNew(); 459*cdf0e10cSrcweir ::rtl::OUString aIconMediaType; 460*cdf0e10cSrcweir uno::Reference< io::XInputStream > xIconMetaFile = pDlg->GetIconIfIconified( &aIconMediaType ); 461*cdf0e10cSrcweir xObj.Assign( pDlg->GetObject(), 462*cdf0e10cSrcweir xIconMetaFile.is() ? embed::Aspects::MSOLE_ICON : embed::Aspects::MSOLE_CONTENT ); 463*cdf0e10cSrcweir if ( xIconMetaFile.is() ) 464*cdf0e10cSrcweir xObj.SetGraphicStream( xIconMetaFile, aIconMediaType ); 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir DELETEZ( pDlg ); 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir break; 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir default: 473*cdf0e10cSrcweir break; 474*cdf0e10cSrcweir } 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir 477*cdf0e10cSrcweir if ( xObj.is() ) 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir if( InsertOleObject( xObj ) && bActivate && bDoVerb ) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir SfxInPlaceClient* pClient = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() ); 482*cdf0e10cSrcweir if ( !pClient ) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir pClient = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj ); 485*cdf0e10cSrcweir SetCheckForOLEInCaption( sal_True ); 486*cdf0e10cSrcweir } 487*cdf0e10cSrcweir 488*cdf0e10cSrcweir if ( xObj.GetViewAspect() == embed::Aspects::MSOLE_ICON ) 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir SwRect aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ); 491*cdf0e10cSrcweir aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos(); 492*cdf0e10cSrcweir MapMode aMapMode( MAP_TWIP ); 493*cdf0e10cSrcweir Size aSize = xObj.GetSize( &aMapMode ); 494*cdf0e10cSrcweir aArea.Width( aSize.Width() ); 495*cdf0e10cSrcweir aArea.Height( aSize.Height() ); 496*cdf0e10cSrcweir RequestObjectResize( aArea, xObj.GetObject() ); 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir else 499*cdf0e10cSrcweir CalcAndSetScale( xObj ); 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir //#50270# Error brauchen wir nicht handeln, das erledigt das 502*cdf0e10cSrcweir //DoVerb in der SfxViewShell 503*cdf0e10cSrcweir pClient->DoVerb( SVVERB_SHOW ); 504*cdf0e10cSrcweir 505*cdf0e10cSrcweir // TODO/LATER: set document name - should be done in Client 506*cdf0e10cSrcweir //if ( !ERRCODE_TOERROR( nErr ) ) 507*cdf0e10cSrcweir // xIPObj->SetDocumentName( GetView().GetDocShell()->GetTitle() ); 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir else 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir if( HasSelection() ) 514*cdf0e10cSrcweir DelRight(); 515*cdf0e10cSrcweir InsertOleObject( xRef ); 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir /*------------------------------------------------------------------------ 520*cdf0e10cSrcweir Beschreibung: Object in die Core einfuegen. 521*cdf0e10cSrcweir Vom ClipBoard oder Insert 522*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir sal_Bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFmt **pFlyFrmFmt ) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir ResetCursorStack(); 527*cdf0e10cSrcweir StartAllAction(); 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir StartUndo(UNDO_INSERT); 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir //Some differences between StarMath and any other objects: 532*cdf0e10cSrcweir //1. Selections should be deleted. For StarMath the Text should be 533*cdf0e10cSrcweir // passed to the Object 534*cdf0e10cSrcweir //2. If the cursor is at the end of an non empty paragraph a paragraph 535*cdf0e10cSrcweir // break should be insertet. StarMath objects are character bound and 536*cdf0e10cSrcweir // no break should be inserted. 537*cdf0e10cSrcweir //3. If an selektion is passed to a StarMath object, this object should 538*cdf0e10cSrcweir // not be activated. sal_False should be returned then. 539*cdf0e10cSrcweir sal_Bool bStarMath = sal_True; 540*cdf0e10cSrcweir sal_Bool bActivate = sal_True; 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir // set parent to get correct VisArea(in case of object needing parent printer) 543*cdf0e10cSrcweir uno::Reference < container::XChild > xChild( xRef.GetObject(), uno::UNO_QUERY ); 544*cdf0e10cSrcweir if ( xChild.is() ) 545*cdf0e10cSrcweir xChild->setParent( pDoc->GetDocShell()->GetModel() ); 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir SvGlobalName aCLSID( xRef->getClassID() ); 548*cdf0e10cSrcweir bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 ); 549*cdf0e10cSrcweir if( IsSelection() ) 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir if( bStarMath ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir String aMathData; 554*cdf0e10cSrcweir GetSelectedText( aMathData, GETSELTXT_PARABRK_TO_ONLYCR ); 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir if( aMathData.Len() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) ) 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( xRef->getComponent(), uno::UNO_QUERY ); 559*cdf0e10cSrcweir if ( xSet.is() ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir try 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("Formula"), uno::makeAny( ::rtl::OUString( aMathData ) ) ); 564*cdf0e10cSrcweir bActivate = sal_False; 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir catch ( uno::Exception& ) 567*cdf0e10cSrcweir { 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir } 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir DelRight(); 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir if ( !bStarMath ) 576*cdf0e10cSrcweir SwFEShell::SplitNode( sal_False, sal_False ); 577*cdf0e10cSrcweir 578*cdf0e10cSrcweir EnterSelFrmMode(); 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir SwFlyFrmAttrMgr aFrmMgr( sal_True, this, FRMMGR_TYPE_OLE ); 581*cdf0e10cSrcweir aFrmMgr.SetHeightSizeType(ATT_FIX_SIZE); 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir SwRect aBound; 584*cdf0e10cSrcweir CalcBoundRect( aBound, aFrmMgr.GetAnchor() ); 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir //The Size should be suggested by the OLE server 587*cdf0e10cSrcweir MapMode aMapMode( MAP_TWIP ); 588*cdf0e10cSrcweir Size aSz = xRef.GetSize( &aMapMode ); 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir //Object size can be limited 591*cdf0e10cSrcweir if ( aSz.Width() > aBound.Width() ) 592*cdf0e10cSrcweir { 593*cdf0e10cSrcweir //Immer proportional begrenzen. 594*cdf0e10cSrcweir aSz.Height() = aSz.Height() * aBound.Width() / aSz.Width(); 595*cdf0e10cSrcweir aSz.Width() = aBound.Width(); 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir aFrmMgr.SetSize( aSz ); 598*cdf0e10cSrcweir SwFlyFrmFmt *pFmt = SwFEShell::InsertObject( xRef, &aFrmMgr.GetAttrSet() ); 599*cdf0e10cSrcweir 600*cdf0e10cSrcweir // --> #i972# 601*cdf0e10cSrcweir if ( bStarMath && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) 602*cdf0e10cSrcweir AlignFormulaToBaseline( xRef.GetObject() ); 603*cdf0e10cSrcweir // <-- 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir if (pFlyFrmFmt) 606*cdf0e10cSrcweir *pFlyFrmFmt = pFmt; 607*cdf0e10cSrcweir 608*cdf0e10cSrcweir if ( SotExchange::IsChart( aCLSID ) ) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir uno::Reference< embed::XEmbeddedObject > xEmbeddedObj( xRef.GetObject(), uno::UNO_QUERY ); 611*cdf0e10cSrcweir if ( xEmbeddedObj.is() ) 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir bool bDisableDataTableDialog = false; 614*cdf0e10cSrcweir svt::EmbeddedObjectRef::TryRunningState( xEmbeddedObj ); 615*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xEmbeddedObj->getComponent(), uno::UNO_QUERY ); 616*cdf0e10cSrcweir if ( xProps.is() && 617*cdf0e10cSrcweir ( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ) ) >>= bDisableDataTableDialog ) && 618*cdf0e10cSrcweir bDisableDataTableDialog ) 619*cdf0e10cSrcweir { 620*cdf0e10cSrcweir xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableDataTableDialog" ) ), 621*cdf0e10cSrcweir uno::makeAny( sal_False ) ); 622*cdf0e10cSrcweir xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DisableComplexChartTypes" ) ), 623*cdf0e10cSrcweir uno::makeAny( sal_False ) ); 624*cdf0e10cSrcweir uno::Reference< util::XModifiable > xModifiable( xProps, uno::UNO_QUERY ); 625*cdf0e10cSrcweir if ( xModifiable.is() ) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir xModifiable->setModified( sal_True ); 628*cdf0e10cSrcweir } 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir EndAllAction(); 634*cdf0e10cSrcweir GetView().AutoCaption(OLE_CAP, &aCLSID); 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir SwRewriter aRewriter; 637*cdf0e10cSrcweir 638*cdf0e10cSrcweir if ( bStarMath ) 639*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_MATH_FORMULA)); 640*cdf0e10cSrcweir else if ( SotExchange::IsChart( aCLSID ) ) 641*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_CHART)); 642*cdf0e10cSrcweir else 643*cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_OLE)); 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir EndUndo(UNDO_INSERT, &aRewriter); 646*cdf0e10cSrcweir 647*cdf0e10cSrcweir return bActivate; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir 650*cdf0e10cSrcweir /*------------------------------------------------------------------------ 651*cdf0e10cSrcweir Beschreibung: Das aktuelle selektierte OLE-Objekt wird mit dem 652*cdf0e10cSrcweir Verb in den Server geladen. 653*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir void SwWrtShell::LaunchOLEObj( long nVerb ) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir if ( GetCntType() == CNT_OLE && 660*cdf0e10cSrcweir !GetView().GetViewFrame()->GetFrame().IsInPlace() ) 661*cdf0e10cSrcweir { 662*cdf0e10cSrcweir svt::EmbeddedObjectRef& xRef = GetOLEObject(); 663*cdf0e10cSrcweir ASSERT( xRef.is(), "OLE not found" ); 664*cdf0e10cSrcweir SfxInPlaceClient* pCli=0; 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir pCli = GetView().FindIPClient( xRef.GetObject(), &GetView().GetEditWin() ); 667*cdf0e10cSrcweir if ( !pCli ) 668*cdf0e10cSrcweir pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef ); 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir ((SwOleClient*)pCli)->SetInDoVerb( sal_True ); 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir CalcAndSetScale( xRef ); 673*cdf0e10cSrcweir pCli->DoVerb( nVerb ); 674*cdf0e10cSrcweir 675*cdf0e10cSrcweir ((SwOleClient*)pCli)->SetInDoVerb( sal_False ); 676*cdf0e10cSrcweir CalcAndSetScale( xRef ); 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir } 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir void SwWrtShell::MoveObjectIfActive( svt::EmbeddedObjectRef& xObj, const Point& rOffset ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir try 683*cdf0e10cSrcweir { 684*cdf0e10cSrcweir sal_Int32 nState = xObj->getCurrentState(); 685*cdf0e10cSrcweir if ( nState == ::com::sun::star::embed::EmbedStates::INPLACE_ACTIVE 686*cdf0e10cSrcweir || nState == ::com::sun::star::embed::EmbedStates::UI_ACTIVE ) 687*cdf0e10cSrcweir { 688*cdf0e10cSrcweir SfxInPlaceClient* pCli = 689*cdf0e10cSrcweir GetView().FindIPClient( xObj.GetObject(), &(GetView().GetEditWin()) ); 690*cdf0e10cSrcweir if ( pCli ) 691*cdf0e10cSrcweir { 692*cdf0e10cSrcweir Rectangle aArea = pCli->GetObjArea(); 693*cdf0e10cSrcweir aArea += rOffset; 694*cdf0e10cSrcweir pCli->SetObjArea( aArea ); 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir } 697*cdf0e10cSrcweir } 698*cdf0e10cSrcweir catch( uno::Exception& ) 699*cdf0e10cSrcweir {} 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, 704*cdf0e10cSrcweir const SwRect *pFlyPrtRect, 705*cdf0e10cSrcweir const SwRect *pFlyFrmRect ) 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir //Einstellen der Skalierung am Client. Diese ergibt sich aus der Differenz 708*cdf0e10cSrcweir //zwischen der VisArea des Objektes und der ObjArea. 709*cdf0e10cSrcweir ASSERT( xObj.is(), "ObjectRef not valid" ); 710*cdf0e10cSrcweir 711*cdf0e10cSrcweir sal_Int64 nAspect = xObj.GetViewAspect(); 712*cdf0e10cSrcweir if ( nAspect == embed::Aspects::MSOLE_ICON ) 713*cdf0e10cSrcweir return; // the replacement image is completely controlled by container in this case 714*cdf0e10cSrcweir 715*cdf0e10cSrcweir sal_Int64 nMisc = 0; 716*cdf0e10cSrcweir sal_Bool bLinkingChart = sal_False; 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir try 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir nMisc = xObj->getStatus( nAspect ); 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir //Das kann ja wohl nur ein nicht aktives Objekt sein. Diese bekommen 723*cdf0e10cSrcweir //auf Wunsch die neue Groesse als VisArea gesetzt (StarChart) 724*cdf0e10cSrcweir if( embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE & nMisc ) 725*cdf0e10cSrcweir { 726*cdf0e10cSrcweir // TODO/MBA: testing 727*cdf0e10cSrcweir SwRect aRect( pFlyPrtRect ? *pFlyPrtRect 728*cdf0e10cSrcweir : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() )); 729*cdf0e10cSrcweir if( !aRect.IsEmpty() ) 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir // TODO/LEAN: getMapUnit can switch object to running state 732*cdf0e10cSrcweir // xObj.TryRunningState(); 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ); 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir // TODO/LATER: needs complete VisArea?! 737*cdf0e10cSrcweir Size aSize( OutputDevice::LogicToLogic( aRect.SVRect(), MAP_TWIP, aUnit ).GetSize() ); 738*cdf0e10cSrcweir awt::Size aSz; 739*cdf0e10cSrcweir aSz.Width = aSize.Width(); 740*cdf0e10cSrcweir aSz.Height = aSize.Height(); 741*cdf0e10cSrcweir xObj->setVisualAreaSize( nAspect, aSz ); 742*cdf0e10cSrcweir // --> OD 2005-05-02 #i48419# - action 'UpdateReplacement' doesn't 743*cdf0e10cSrcweir // have to change the modified state of the document. 744*cdf0e10cSrcweir // This is only a workaround for the defect, that this action 745*cdf0e10cSrcweir // modifies a document after load, because unnecessarily the 746*cdf0e10cSrcweir // replacement graphic is updated, in spite of the fact that 747*cdf0e10cSrcweir // nothing has been changed. 748*cdf0e10cSrcweir // If the replacement graphic changes by this action, the document 749*cdf0e10cSrcweir // will be already modified via other mechanisms. 750*cdf0e10cSrcweir { 751*cdf0e10cSrcweir bool bResetEnableSetModified(false); 752*cdf0e10cSrcweir if ( GetDoc()->GetDocShell()->IsEnableSetModified() ) 753*cdf0e10cSrcweir { 754*cdf0e10cSrcweir GetDoc()->GetDocShell()->EnableSetModified( sal_False ); 755*cdf0e10cSrcweir bResetEnableSetModified = true; 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir //#i79576# don't destroy chart replacement images on load 759*cdf0e10cSrcweir //#i79578# don't request a new replacement image for charts to often 760*cdf0e10cSrcweir //a chart sends a modified call to the framework if it was changed 761*cdf0e10cSrcweir //thus the replacement update is already handled elsewhere 762*cdf0e10cSrcweir if ( !SotExchange::IsChart( xObj->getClassID() ) ) 763*cdf0e10cSrcweir xObj.UpdateReplacement(); 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir if ( bResetEnableSetModified ) 766*cdf0e10cSrcweir { 767*cdf0e10cSrcweir GetDoc()->GetDocShell()->EnableSetModified( sal_True ); 768*cdf0e10cSrcweir } 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir // <-- 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir // TODO/LATER: this is only a workaround, 774*cdf0e10cSrcweir uno::Reference< chart2::XChartDocument > xChartDocument( xObj->getComponent(), uno::UNO_QUERY ); 775*cdf0e10cSrcweir bLinkingChart = ( xChartDocument.is() && !xChartDocument->hasInternalDataProvider() ); 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir } 778*cdf0e10cSrcweir catch ( uno::Exception& ) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir // TODO/LATER: handle the error 781*cdf0e10cSrcweir return; 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir 784*cdf0e10cSrcweir SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin() ); 785*cdf0e10cSrcweir if ( !pCli ) 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc) || bLinkingChart 788*cdf0e10cSrcweir // TODO/LATER: ResizeOnPrinterChange 789*cdf0e10cSrcweir //|| SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->GetMiscStatus() 790*cdf0e10cSrcweir || nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE // non-resizable objects need to be 791*cdf0e10cSrcweir // set the size back by this method 792*cdf0e10cSrcweir ) 793*cdf0e10cSrcweir { 794*cdf0e10cSrcweir pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj ); 795*cdf0e10cSrcweir } 796*cdf0e10cSrcweir else 797*cdf0e10cSrcweir return; 798*cdf0e10cSrcweir } 799*cdf0e10cSrcweir 800*cdf0e10cSrcweir // TODO/LEAN: getMapUnit can switch object to running state 801*cdf0e10cSrcweir // xObj.TryRunningState(); 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir awt::Size aSize; 804*cdf0e10cSrcweir try 805*cdf0e10cSrcweir { 806*cdf0e10cSrcweir aSize = xObj->getVisualAreaSize( nAspect ); 807*cdf0e10cSrcweir } 808*cdf0e10cSrcweir catch( embed::NoVisualAreaSizeException& ) 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir DBG_ERROR( "Can't get visual area size!\n" ); 811*cdf0e10cSrcweir // the scaling will not be done 812*cdf0e10cSrcweir } 813*cdf0e10cSrcweir catch( uno::Exception& ) 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir // TODO/LATER: handle the error 816*cdf0e10cSrcweir DBG_ERROR( "Can't get visual area size!\n" ); 817*cdf0e10cSrcweir return; 818*cdf0e10cSrcweir } 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir Size _aVisArea( aSize.Width, aSize.Height ); 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir Fraction aScaleWidth( 1, 1 ); 823*cdf0e10cSrcweir Fraction aScaleHeight( 1, 1 ); 824*cdf0e10cSrcweir 825*cdf0e10cSrcweir sal_Bool bUseObjectSize = sal_False; 826*cdf0e10cSrcweir 827*cdf0e10cSrcweir // solange keine vernuenftige Size vom Object kommt, kann nichts 828*cdf0e10cSrcweir // skaliert werden 829*cdf0e10cSrcweir if( _aVisArea.Width() && _aVisArea.Height() ) 830*cdf0e10cSrcweir { 831*cdf0e10cSrcweir const MapMode aTmp( MAP_TWIP ); 832*cdf0e10cSrcweir MapUnit aUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( xObj->getMapUnit( nAspect ) ); 833*cdf0e10cSrcweir _aVisArea = OutputDevice::LogicToLogic( _aVisArea, aUnit, aTmp); 834*cdf0e10cSrcweir Size aObjArea; 835*cdf0e10cSrcweir if ( pFlyPrtRect ) 836*cdf0e10cSrcweir aObjArea = pFlyPrtRect->SSize(); 837*cdf0e10cSrcweir else 838*cdf0e10cSrcweir aObjArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ).SSize(); 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir // differ the aObjArea and _aVisArea by 1 Pixel then set new VisArea 841*cdf0e10cSrcweir long nX, nY; 842*cdf0e10cSrcweir SwSelPaintRects::Get1PixelInLogic( *this, &nX, &nY ); 843*cdf0e10cSrcweir if( !( _aVisArea.Width() - nX <= aObjArea.Width() && 844*cdf0e10cSrcweir _aVisArea.Width() + nX >= aObjArea.Width() && 845*cdf0e10cSrcweir _aVisArea.Height()- nY <= aObjArea.Height()&& 846*cdf0e10cSrcweir _aVisArea.Height()+ nY >= aObjArea.Height() )) 847*cdf0e10cSrcweir { 848*cdf0e10cSrcweir // TODO/LATER: MISCSTATUS_RESIZEONPRINTERCHANGE 849*cdf0e10cSrcweir /* 850*cdf0e10cSrcweir if( SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & nMisc ) 851*cdf0e10cSrcweir { 852*cdf0e10cSrcweir //This type of objects should never be resized. 853*cdf0e10cSrcweir //If this request comes from the Writer core (inaktive Object 854*cdf0e10cSrcweir //ist resized), the Object should be resized too. 855*cdf0e10cSrcweir //If this request comes from the Object itself, the Frame 856*cdf0e10cSrcweir //in the Writer core should be resized. 857*cdf0e10cSrcweir if ( pFlyPrtRect ) //Request from core? 858*cdf0e10cSrcweir { 859*cdf0e10cSrcweir xObj->SetVisArea( OutputDevice::LogicToLogic( 860*cdf0e10cSrcweir pFlyPrtRect->SVRect(), MAP_TWIP, xObj->GetMapUnit() )); 861*cdf0e10cSrcweir } 862*cdf0e10cSrcweir else 863*cdf0e10cSrcweir { 864*cdf0e10cSrcweir SwRect aTmp( Point( LONG_MIN, LONG_MIN ), _aVisArea ); 865*cdf0e10cSrcweir RequestObjectResize( aTmp, xObj ); 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir //Der Rest erledigt sich, weil wir eh wiederkommen sollten, evtl. 868*cdf0e10cSrcweir //sogar rekursiv. 869*cdf0e10cSrcweir return; 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir else*/ 872*cdf0e10cSrcweir 873*cdf0e10cSrcweir if ( nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE ) 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir // the object must not be scaled, the size stored in object must be used for restoring 876*cdf0e10cSrcweir bUseObjectSize = sal_True; 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir else 879*cdf0e10cSrcweir { 880*cdf0e10cSrcweir aScaleWidth = Fraction( aObjArea.Width(), _aVisArea.Width() ); 881*cdf0e10cSrcweir aScaleHeight = Fraction( aObjArea.Height(), _aVisArea.Height()); 882*cdf0e10cSrcweir } 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir } 885*cdf0e10cSrcweir 886*cdf0e10cSrcweir //Jetzt ist auch der guenstige Zeitpunkt die ObjArea einzustellen. 887*cdf0e10cSrcweir //Die Scalierung muss beruecksichtigt werden. 888*cdf0e10cSrcweir SwRect aArea; 889*cdf0e10cSrcweir if ( pFlyPrtRect ) 890*cdf0e10cSrcweir { 891*cdf0e10cSrcweir aArea = *pFlyPrtRect; 892*cdf0e10cSrcweir aArea += pFlyFrmRect->Pos(); 893*cdf0e10cSrcweir } 894*cdf0e10cSrcweir else 895*cdf0e10cSrcweir { 896*cdf0e10cSrcweir aArea = GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() ); 897*cdf0e10cSrcweir aArea.Pos() += GetAnyCurRect( RECT_FLY_EMBEDDED, 0, xObj.GetObject() ).Pos(); 898*cdf0e10cSrcweir } 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir if ( bUseObjectSize ) 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir // --> this moves non-resizable object so that when adding borders the baseline remains the same 903*cdf0e10cSrcweir const SwFlyFrmFmt *pFlyFrmFmt = dynamic_cast< const SwFlyFrmFmt * >( GetFlyFrmFmt() ); 904*cdf0e10cSrcweir ASSERT( pFlyFrmFmt, "Could not find fly frame." ); 905*cdf0e10cSrcweir if ( pFlyFrmFmt ) 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir const Point &rPoint = pFlyFrmFmt->GetLastFlyFrmPrtRectPos(); 908*cdf0e10cSrcweir SwRect aRect( pFlyPrtRect ? *pFlyPrtRect 909*cdf0e10cSrcweir : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() )); 910*cdf0e10cSrcweir aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct. 911*cdf0e10cSrcweir } 912*cdf0e10cSrcweir // <-- 913*cdf0e10cSrcweir aArea.Width ( _aVisArea.Width() ); 914*cdf0e10cSrcweir aArea.Height( _aVisArea.Height() ); 915*cdf0e10cSrcweir RequestObjectResize( aArea, xObj.GetObject() ); 916*cdf0e10cSrcweir } 917*cdf0e10cSrcweir else 918*cdf0e10cSrcweir { 919*cdf0e10cSrcweir aArea.Width ( Fraction( aArea.Width() ) / pCli->GetScaleWidth() ); 920*cdf0e10cSrcweir aArea.Height( Fraction( aArea.Height() ) / pCli->GetScaleHeight()); 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir 923*cdf0e10cSrcweir pCli->SetObjAreaAndScale( aArea.SVRect(), aScaleWidth, aScaleHeight ); 924*cdf0e10cSrcweir } 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir 927*cdf0e10cSrcweir 928*cdf0e10cSrcweir void SwWrtShell::ConnectObj( svt::EmbeddedObjectRef& xObj, const SwRect &rPrt, 929*cdf0e10cSrcweir const SwRect &rFrm ) 930*cdf0e10cSrcweir { 931*cdf0e10cSrcweir SfxInPlaceClient* pCli = GetView().FindIPClient( xObj.GetObject(), &GetView().GetEditWin()); 932*cdf0e10cSrcweir if ( !pCli ) 933*cdf0e10cSrcweir pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj ); 934*cdf0e10cSrcweir CalcAndSetScale( xObj, &rPrt, &rFrm ); 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir 937*cdf0e10cSrcweir /*------------------------------------------------------------------------ 938*cdf0e10cSrcweir Beschreibung: Einfuegen harter Seitenumbruch; 939*cdf0e10cSrcweir Selektionen werden ueberschrieben 940*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 941*cdf0e10cSrcweir 942*cdf0e10cSrcweir 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir void SwWrtShell::InsertPageBreak(const String *pPageDesc, sal_uInt16 nPgNum ) 945*cdf0e10cSrcweir { 946*cdf0e10cSrcweir ResetCursorStack(); 947*cdf0e10cSrcweir if( _CanInsert() ) 948*cdf0e10cSrcweir { 949*cdf0e10cSrcweir ACT_KONTEXT(this); 950*cdf0e10cSrcweir StartUndo(UNDO_UI_INSERT_PAGE_BREAK); 951*cdf0e10cSrcweir 952*cdf0e10cSrcweir if ( !IsCrsrInTbl() ) 953*cdf0e10cSrcweir { 954*cdf0e10cSrcweir if(HasSelection()) 955*cdf0e10cSrcweir DelRight(); 956*cdf0e10cSrcweir SwFEShell::SplitNode(); 957*cdf0e10cSrcweir } 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir const SwPageDesc *pDesc = pPageDesc 960*cdf0e10cSrcweir ? FindPageDescByName( *pPageDesc, sal_True ) : 0; 961*cdf0e10cSrcweir if( pDesc ) 962*cdf0e10cSrcweir { 963*cdf0e10cSrcweir SwFmtPageDesc aDesc( pDesc ); 964*cdf0e10cSrcweir aDesc.SetNumOffset( nPgNum ); 965*cdf0e10cSrcweir SetAttr( aDesc ); 966*cdf0e10cSrcweir } 967*cdf0e10cSrcweir else 968*cdf0e10cSrcweir SetAttr( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) ); 969*cdf0e10cSrcweir EndUndo(UNDO_UI_INSERT_PAGE_BREAK); 970*cdf0e10cSrcweir } 971*cdf0e10cSrcweir } 972*cdf0e10cSrcweir /*------------------------------------------------------------------------ 973*cdf0e10cSrcweir Beschreibung: Einfuegen harter Zeilenumbruch; 974*cdf0e10cSrcweir Selektionen werden ueberschrieben 975*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 976*cdf0e10cSrcweir 977*cdf0e10cSrcweir 978*cdf0e10cSrcweir void SwWrtShell::InsertLineBreak() 979*cdf0e10cSrcweir { 980*cdf0e10cSrcweir ResetCursorStack(); 981*cdf0e10cSrcweir if( _CanInsert() ) 982*cdf0e10cSrcweir { 983*cdf0e10cSrcweir if(HasSelection()) 984*cdf0e10cSrcweir DelRight(); 985*cdf0e10cSrcweir 986*cdf0e10cSrcweir const sal_Unicode cIns = 0x0A; 987*cdf0e10cSrcweir SvxAutoCorrect* pACorr = lcl_IsAutoCorr(); 988*cdf0e10cSrcweir if( pACorr ) 989*cdf0e10cSrcweir AutoCorrect( *pACorr, cIns ); 990*cdf0e10cSrcweir else 991*cdf0e10cSrcweir SwWrtShell::Insert( String( cIns ) ); 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir /*------------------------------------------------------------------------ 995*cdf0e10cSrcweir Beschreibung: Einfuegen harter Spaltenumbruch; 996*cdf0e10cSrcweir Selektionen werden ueberschrieben 997*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 998*cdf0e10cSrcweir 999*cdf0e10cSrcweir 1000*cdf0e10cSrcweir void SwWrtShell::InsertColumnBreak() 1001*cdf0e10cSrcweir { 1002*cdf0e10cSrcweir ACT_KONTEXT(this); 1003*cdf0e10cSrcweir ResetCursorStack(); 1004*cdf0e10cSrcweir if( _CanInsert() ) 1005*cdf0e10cSrcweir { 1006*cdf0e10cSrcweir StartUndo(UNDO_UI_INSERT_COLUMN_BREAK); 1007*cdf0e10cSrcweir 1008*cdf0e10cSrcweir if ( !IsCrsrInTbl() ) 1009*cdf0e10cSrcweir { 1010*cdf0e10cSrcweir if(HasSelection()) 1011*cdf0e10cSrcweir DelRight(); 1012*cdf0e10cSrcweir SwFEShell::SplitNode( sal_False, sal_False ); 1013*cdf0e10cSrcweir } 1014*cdf0e10cSrcweir SetAttr(SvxFmtBreakItem(SVX_BREAK_COLUMN_BEFORE, RES_BREAK)); 1015*cdf0e10cSrcweir 1016*cdf0e10cSrcweir EndUndo(UNDO_UI_INSERT_COLUMN_BREAK); 1017*cdf0e10cSrcweir } 1018*cdf0e10cSrcweir } 1019*cdf0e10cSrcweir 1020*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1021*cdf0e10cSrcweir Beschreibung: Einfuegen Fussnote 1022*cdf0e10cSrcweir Parameter: rStr -- optionales Fussnotenzeichen 1023*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir void SwWrtShell::InsertFootnote(const String &rStr, sal_Bool bEndNote, sal_Bool bEdit ) 1027*cdf0e10cSrcweir { 1028*cdf0e10cSrcweir ResetCursorStack(); 1029*cdf0e10cSrcweir if( _CanInsert() ) 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir if(HasSelection()) 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir //collapse cursor to the end 1034*cdf0e10cSrcweir if(!IsCrsrPtAtEnd()) 1035*cdf0e10cSrcweir SwapPam(); 1036*cdf0e10cSrcweir ClearMark(); 1037*cdf0e10cSrcweir } 1038*cdf0e10cSrcweir 1039*cdf0e10cSrcweir SwFmtFtn aFootNote( bEndNote ); 1040*cdf0e10cSrcweir if(rStr.Len()) 1041*cdf0e10cSrcweir aFootNote.SetNumStr( rStr ); 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir SetAttr(aFootNote); 1044*cdf0e10cSrcweir 1045*cdf0e10cSrcweir if( bEdit ) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir // zur Bearbeiung des Fussnotentextes 1048*cdf0e10cSrcweir Left(CRSR_SKIP_CHARS, sal_False, 1, sal_False ); 1049*cdf0e10cSrcweir GotoFtnTxt(); 1050*cdf0e10cSrcweir } 1051*cdf0e10cSrcweir } 1052*cdf0e10cSrcweir } 1053*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1054*cdf0e10cSrcweir Beschreibung: SplitNode; hier auch, da 1055*cdf0e10cSrcweir - selektierter Inhalt geloescht wird; 1056*cdf0e10cSrcweir - der Cursorstack gfs. zurueckgesetzt wird. 1057*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir 1060*cdf0e10cSrcweir void SwWrtShell::SplitNode( sal_Bool bAutoFmt, sal_Bool bCheckTableStart ) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir ResetCursorStack(); 1063*cdf0e10cSrcweir if( _CanInsert() ) 1064*cdf0e10cSrcweir { 1065*cdf0e10cSrcweir ACT_KONTEXT(this); 1066*cdf0e10cSrcweir 1067*cdf0e10cSrcweir rView.GetEditWin().FlushInBuffer(); 1068*cdf0e10cSrcweir sal_Bool bHasSel = HasSelection(); 1069*cdf0e10cSrcweir if( bHasSel ) 1070*cdf0e10cSrcweir { 1071*cdf0e10cSrcweir StartUndo( UNDO_INSERT ); 1072*cdf0e10cSrcweir DelRight(); 1073*cdf0e10cSrcweir } 1074*cdf0e10cSrcweir 1075*cdf0e10cSrcweir SwFEShell::SplitNode( bAutoFmt, bCheckTableStart ); 1076*cdf0e10cSrcweir if( bHasSel ) 1077*cdf0e10cSrcweir EndUndo( UNDO_INSERT ); 1078*cdf0e10cSrcweir } 1079*cdf0e10cSrcweir } 1080*cdf0e10cSrcweir 1081*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1082*cdf0e10cSrcweir Beschreibung: Numerierung anschalten 1083*cdf0e10cSrcweir Parameter: Optionale Angabe eines Namens fuer die benannte Liste; 1084*cdf0e10cSrcweir dieser bezeichnet eine Position, wenn er in eine 1085*cdf0e10cSrcweir Zahl konvertierbar ist und kleiner ist als nMaxRules. 1086*cdf0e10cSrcweir -------------------------------------------------------------------------*/ 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir 1089*cdf0e10cSrcweir // zum Testen der CharFormate an der Numerierung 1090*cdf0e10cSrcweir // extern void SetNumChrFmt( SwWrtShell*, SwNumRules& ); 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir // -> #i40041# 1093*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# 1094*cdf0e10cSrcweir // Preconditions (as far as OD has figured out): 1095*cdf0e10cSrcweir // - <SwEditShell::HasNumber()> is sal_False, if <bNum> is sal_True 1096*cdf0e10cSrcweir // - <SwEditShell::HasBullet()> is sal_False, if <bNum> is sal_False 1097*cdf0e10cSrcweir // Behavior of method is determined by the current situation at the current 1098*cdf0e10cSrcweir // cursor position in the document. 1099*cdf0e10cSrcweir void SwWrtShell::NumOrBulletOn(sal_Bool bNum) 1100*cdf0e10cSrcweir { 1101*cdf0e10cSrcweir // determine numbering rule found at current cursor position in the docment. 1102*cdf0e10cSrcweir const SwNumRule* pCurRule = GetCurNumRule(); 1103*cdf0e10cSrcweir 1104*cdf0e10cSrcweir StartUndo(UNDO_NUMORNONUM); 1105*cdf0e10cSrcweir 1106*cdf0e10cSrcweir const SwNumRule * pNumRule = pCurRule; 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# 1109*cdf0e10cSrcweir // - activate outline rule respectively turning on outline rule for 1110*cdf0e10cSrcweir // current text node. But, only for turning on a numbering (<bNum> == sal_True). 1111*cdf0e10cSrcweir // - overwrite found numbering rule at current cursor position, if 1112*cdf0e10cSrcweir // no numbering rule can be retrieved from the paragraph style. 1113*cdf0e10cSrcweir bool bContinueFoundNumRule( false ); 1114*cdf0e10cSrcweir bool bActivateOutlineRule( false ); 1115*cdf0e10cSrcweir int nActivateOutlineLvl( MAXLEVEL ); // only relevant, if <bActivateOutlineRule> == sal_True 1116*cdf0e10cSrcweir SwTxtFmtColl * pColl = GetCurTxtFmtColl(); 1117*cdf0e10cSrcweir if ( pColl ) 1118*cdf0e10cSrcweir { 1119*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# - retrieve numbering rule at paragraph 1120*cdf0e10cSrcweir // style, which is found at current cursor position in the document. 1121*cdf0e10cSrcweir SwNumRule* pCollRule = pDoc->FindNumRulePtr(pColl->GetNumRule().GetValue()); 1122*cdf0e10cSrcweir // --> OD 2005-10-25 #125993# - The outline numbering rule isn't allowed 1123*cdf0e10cSrcweir // to be derived from a parent paragraph style to a derived one. 1124*cdf0e10cSrcweir // Thus check, if the found outline numbering rule is directly 1125*cdf0e10cSrcweir // set at the paragraph style <pColl>. If not, set <pCollRule> to NULL 1126*cdf0e10cSrcweir if ( pCollRule && pCollRule == GetDoc()->GetOutlineNumRule() ) 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir const SwNumRule* pDirectCollRule = 1129*cdf0e10cSrcweir pDoc->FindNumRulePtr(pColl->GetNumRule( sal_False ).GetValue()); 1130*cdf0e10cSrcweir if ( !pDirectCollRule ) 1131*cdf0e10cSrcweir { 1132*cdf0e10cSrcweir pCollRule = 0; 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir } 1135*cdf0e10cSrcweir // --> OD 2006-11-20 #i71764# 1136*cdf0e10cSrcweir // Document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE has no influence 1137*cdf0e10cSrcweir // any more. 1138*cdf0e10cSrcweir // if ( pCollRule == NULL && 1139*cdf0e10cSrcweir // NO_NUMBERING != pColl->GetOutlineLevel() && 1140*cdf0e10cSrcweir // GetDoc()->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE) ) 1141*cdf0e10cSrcweir // { 1142*cdf0e10cSrcweir // pCollRule = GetDoc()->GetOutlineNumRule(); 1143*cdf0e10cSrcweir // } 1144*cdf0e10cSrcweir // <-- 1145*cdf0e10cSrcweir 1146*cdf0e10cSrcweir // <-- 1147*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# 1148*cdf0e10cSrcweir if ( !pCollRule ) 1149*cdf0e10cSrcweir { 1150*cdf0e10cSrcweir pNumRule = pCollRule; 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir // --> OD 2006-06-12 #b6435904# 1153*cdf0e10cSrcweir // no activation or continuation of outline numbering in Writer/Web document 1154*cdf0e10cSrcweir else if ( bNum && 1155*cdf0e10cSrcweir !dynamic_cast<SwWebDocShell*>(GetDoc()->GetDocShell()) && 1156*cdf0e10cSrcweir pCollRule == GetDoc()->GetOutlineNumRule() ) 1157*cdf0e10cSrcweir // <-- 1158*cdf0e10cSrcweir { 1159*cdf0e10cSrcweir if ( pNumRule == pCollRule ) 1160*cdf0e10cSrcweir { 1161*cdf0e10cSrcweir // check, if text node at current cursor positioned is counted. 1162*cdf0e10cSrcweir // If not, let it been counted. Then it has to be checked, 1163*cdf0e10cSrcweir // of the outline numbering has to be activated or continued. 1164*cdf0e10cSrcweir SwTxtNode* pTxtNode = 1165*cdf0e10cSrcweir GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); 1166*cdf0e10cSrcweir if ( pTxtNode && !pTxtNode->IsCountedInList() ) 1167*cdf0e10cSrcweir { 1168*cdf0e10cSrcweir // check, if numbering of the outline level of the pararaph 1169*cdf0e10cSrcweir // style is active. If not, activate this outline level. 1170*cdf0e10cSrcweir nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel(); 1171*cdf0e10cSrcweir ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(), //<-end,zhaojianwei 1172*cdf0e10cSrcweir "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" ); 1173*cdf0e10cSrcweir if ( pColl->IsAssignedToListLevelOfOutlineStyle() && //<-end,zhaojianwei 1174*cdf0e10cSrcweir pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType() 1175*cdf0e10cSrcweir == SVX_NUM_NUMBER_NONE ) 1176*cdf0e10cSrcweir { 1177*cdf0e10cSrcweir // activate outline numbering 1178*cdf0e10cSrcweir bActivateOutlineRule = true; 1179*cdf0e10cSrcweir } 1180*cdf0e10cSrcweir else 1181*cdf0e10cSrcweir { 1182*cdf0e10cSrcweir // turning on outline numbering at current cursor position 1183*cdf0e10cSrcweir bContinueFoundNumRule = true; 1184*cdf0e10cSrcweir } 1185*cdf0e10cSrcweir } 1186*cdf0e10cSrcweir else 1187*cdf0e10cSrcweir { 1188*cdf0e10cSrcweir // --> OD 2009-08-27 #i101234# 1189*cdf0e10cSrcweir // activate outline numbering, because from the precondition 1190*cdf0e10cSrcweir // it's known, that <SwEdit::HasNumber()> == sal_False 1191*cdf0e10cSrcweir bActivateOutlineRule = true; 1192*cdf0e10cSrcweir nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei 1193*cdf0e10cSrcweir } 1194*cdf0e10cSrcweir } 1195*cdf0e10cSrcweir else if ( !pNumRule ) 1196*cdf0e10cSrcweir { 1197*cdf0e10cSrcweir // --> OD 2009-08-27 #i101234# 1198*cdf0e10cSrcweir // Check, if corresponding list level of the outline numbering 1199*cdf0e10cSrcweir // has already a numbering format set. 1200*cdf0e10cSrcweir nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//<-end,zhaojianwei,need further consideration 1201*cdf0e10cSrcweir if ( pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType() 1202*cdf0e10cSrcweir == SVX_NUM_NUMBER_NONE ) 1203*cdf0e10cSrcweir { 1204*cdf0e10cSrcweir // activate outline numbering, because from the precondition 1205*cdf0e10cSrcweir // it's known, that <SwEdit::HasNumber()> == sal_False 1206*cdf0e10cSrcweir bActivateOutlineRule = true; 1207*cdf0e10cSrcweir } 1208*cdf0e10cSrcweir else 1209*cdf0e10cSrcweir { 1210*cdf0e10cSrcweir // turning on outline numbering at current cursor position 1211*cdf0e10cSrcweir bContinueFoundNumRule = true; 1212*cdf0e10cSrcweir } 1213*cdf0e10cSrcweir // <-- 1214*cdf0e10cSrcweir } 1215*cdf0e10cSrcweir else 1216*cdf0e10cSrcweir { 1217*cdf0e10cSrcweir // check, if numbering of the outline level of the pararaph 1218*cdf0e10cSrcweir // style is active. If not, activate this outline level. 1219*cdf0e10cSrcweir nActivateOutlineLvl = pColl->GetAssignedOutlineStyleLevel();//#outline level,zhaojianwei 1220*cdf0e10cSrcweir ASSERT( pColl->IsAssignedToListLevelOfOutlineStyle(),//#outline level,zhaojianwei 1221*cdf0e10cSrcweir "<SwWrtShell::NumOrBulletOn(..)> - paragraph style with outline rule, but no outline level" ); 1222*cdf0e10cSrcweir if ( pColl->IsAssignedToListLevelOfOutlineStyle() &&//#outline level,zhaojianwei 1223*cdf0e10cSrcweir pCollRule->Get( static_cast<sal_uInt16>(nActivateOutlineLvl) ).GetNumberingType() 1224*cdf0e10cSrcweir == SVX_NUM_NUMBER_NONE ) 1225*cdf0e10cSrcweir { 1226*cdf0e10cSrcweir // activate outline numbering 1227*cdf0e10cSrcweir bActivateOutlineRule = true; 1228*cdf0e10cSrcweir } 1229*cdf0e10cSrcweir else 1230*cdf0e10cSrcweir { 1231*cdf0e10cSrcweir // turning on outline numbering at current cursor position 1232*cdf0e10cSrcweir bContinueFoundNumRule = true; 1233*cdf0e10cSrcweir } 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir pNumRule = pCollRule; 1236*cdf0e10cSrcweir } 1237*cdf0e10cSrcweir } 1238*cdf0e10cSrcweir 1239*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# 1240*cdf0e10cSrcweir // Only automatic numbering/bullet rules should be changed. 1241*cdf0e10cSrcweir // Note: The outline numbering rule is also an automatic one. It's only 1242*cdf0e10cSrcweir // changed, if it has to be activated. 1243*cdf0e10cSrcweir if ( pNumRule ) 1244*cdf0e10cSrcweir { 1245*cdf0e10cSrcweir if ( !pNumRule->IsAutoRule() ) 1246*cdf0e10cSrcweir { 1247*cdf0e10cSrcweir pNumRule = 0; 1248*cdf0e10cSrcweir } 1249*cdf0e10cSrcweir else if ( pNumRule == GetDoc()->GetOutlineNumRule() && 1250*cdf0e10cSrcweir !bActivateOutlineRule && !bContinueFoundNumRule ) 1251*cdf0e10cSrcweir { 1252*cdf0e10cSrcweir pNumRule = 0; 1253*cdf0e10cSrcweir } 1254*cdf0e10cSrcweir } 1255*cdf0e10cSrcweir // <-- 1256*cdf0e10cSrcweir 1257*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# 1258*cdf0e10cSrcweir // Search for a previous numbering/bullet rule to continue it. 1259*cdf0e10cSrcweir // --> OD 2008-03-18 #refactorlists# 1260*cdf0e10cSrcweir String sContinuedListId; 1261*cdf0e10cSrcweir if ( !pNumRule ) 1262*cdf0e10cSrcweir { 1263*cdf0e10cSrcweir pNumRule = GetDoc()->SearchNumRule( *GetCrsr()->GetPoint(), 1264*cdf0e10cSrcweir false, bNum, false, 0, 1265*cdf0e10cSrcweir sContinuedListId ); 1266*cdf0e10cSrcweir bContinueFoundNumRule = pNumRule != 0; 1267*cdf0e10cSrcweir } 1268*cdf0e10cSrcweir // <-- 1269*cdf0e10cSrcweir 1270*cdf0e10cSrcweir if (pNumRule) 1271*cdf0e10cSrcweir { 1272*cdf0e10cSrcweir SwNumRule aNumRule(*pNumRule); 1273*cdf0e10cSrcweir 1274*cdf0e10cSrcweir // --> OD 2005-10-25 #b6340308# 1275*cdf0e10cSrcweir // do not change found numbering/bullet rule, if it should only be continued. 1276*cdf0e10cSrcweir if ( !bContinueFoundNumRule ) 1277*cdf0e10cSrcweir { 1278*cdf0e10cSrcweir SwTxtNode * pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); 1279*cdf0e10cSrcweir 1280*cdf0e10cSrcweir if (pTxtNode) 1281*cdf0e10cSrcweir { 1282*cdf0e10cSrcweir // --> OD 2005-10-26 #b6340308# - use above retrieve outline 1283*cdf0e10cSrcweir // level, if outline numbering has to be activated. 1284*cdf0e10cSrcweir int nLevel = bActivateOutlineRule ////#outline level,zhaojianwei,need more consideration 1285*cdf0e10cSrcweir ? nActivateOutlineLvl 1286*cdf0e10cSrcweir : pTxtNode->GetActualListLevel(); 1287*cdf0e10cSrcweir // <-- 1288*cdf0e10cSrcweir 1289*cdf0e10cSrcweir if (nLevel < 0) 1290*cdf0e10cSrcweir nLevel = 0; 1291*cdf0e10cSrcweir 1292*cdf0e10cSrcweir if (nLevel >= MAXLEVEL) 1293*cdf0e10cSrcweir nLevel = MAXLEVEL - 1; 1294*cdf0e10cSrcweir 1295*cdf0e10cSrcweir SwNumFmt aFmt(aNumRule.Get(static_cast<sal_uInt16>(nLevel))); 1296*cdf0e10cSrcweir 1297*cdf0e10cSrcweir if (bNum) 1298*cdf0e10cSrcweir aFmt.SetNumberingType(SVX_NUM_ARABIC); 1299*cdf0e10cSrcweir else 1300*cdf0e10cSrcweir { 1301*cdf0e10cSrcweir // --> OD 2008-06-03 #i63395# 1302*cdf0e10cSrcweir // Only apply user defined default bullet font 1303*cdf0e10cSrcweir if ( numfunc::IsDefBulletFontUserDefined() ) 1304*cdf0e10cSrcweir { 1305*cdf0e10cSrcweir const Font* pFnt = &numfunc::GetDefBulletFont(); 1306*cdf0e10cSrcweir aFmt.SetBulletFont( pFnt ); 1307*cdf0e10cSrcweir } 1308*cdf0e10cSrcweir // <-- 1309*cdf0e10cSrcweir aFmt.SetBulletChar( numfunc::GetBulletChar(static_cast<sal_uInt8>(nLevel))); 1310*cdf0e10cSrcweir aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); 1311*cdf0e10cSrcweir // #i93908# clear suffix for bullet lists 1312*cdf0e10cSrcweir aFmt.SetPrefix(::rtl::OUString()); 1313*cdf0e10cSrcweir aFmt.SetSuffix(::rtl::OUString()); 1314*cdf0e10cSrcweir } 1315*cdf0e10cSrcweir aNumRule.Set(static_cast<sal_uInt16>(nLevel), aFmt); 1316*cdf0e10cSrcweir } 1317*cdf0e10cSrcweir } 1318*cdf0e10cSrcweir // <-- 1319*cdf0e10cSrcweir 1320*cdf0e10cSrcweir // --> OD 2008-02-08 #newlistlevelattrs# 1321*cdf0e10cSrcweir // reset indent attribute on applying list style 1322*cdf0e10cSrcweir // --> OD 2008-03-27 #refactorlists# 1323*cdf0e10cSrcweir SetCurNumRule( aNumRule, false, sContinuedListId, true ); 1324*cdf0e10cSrcweir // <-- 1325*cdf0e10cSrcweir } 1326*cdf0e10cSrcweir else 1327*cdf0e10cSrcweir { 1328*cdf0e10cSrcweir // --> OD 2009-08-27 #i95907# 1329*cdf0e10cSrcweir const SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode( 1330*cdf0e10cSrcweir numfunc::GetDefaultPositionAndSpaceMode() ); 1331*cdf0e10cSrcweir // --> OD 2008-02-11 #newlistlevelattrs# 1332*cdf0e10cSrcweir SwNumRule aNumRule( GetUniqueNumRuleName(), ePosAndSpaceMode ); 1333*cdf0e10cSrcweir // <-- 1334*cdf0e10cSrcweir // <-- 1335*cdf0e10cSrcweir // Zeichenvorlage an die Numerierung haengen 1336*cdf0e10cSrcweir SwCharFmt* pChrFmt; 1337*cdf0e10cSrcweir SwDocShell* pDocSh = GetView().GetDocShell(); 1338*cdf0e10cSrcweir // --> OD 2008-06-03 #i63395# 1339*cdf0e10cSrcweir // Only apply user defined default bullet font 1340*cdf0e10cSrcweir const Font* pFnt = numfunc::IsDefBulletFontUserDefined() 1341*cdf0e10cSrcweir ? &numfunc::GetDefBulletFont() 1342*cdf0e10cSrcweir : 0; 1343*cdf0e10cSrcweir // <-- 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir if (bNum) 1346*cdf0e10cSrcweir { 1347*cdf0e10cSrcweir pChrFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); 1348*cdf0e10cSrcweir } 1349*cdf0e10cSrcweir else 1350*cdf0e10cSrcweir { 1351*cdf0e10cSrcweir pChrFmt = GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL ); 1352*cdf0e10cSrcweir } 1353*cdf0e10cSrcweir 1354*cdf0e10cSrcweir const SwTxtNode* pTxtNode = GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); 1355*cdf0e10cSrcweir const SwTwips nWidthOfTabs = pTxtNode 1356*cdf0e10cSrcweir ? pTxtNode->GetWidthOfLeadingTabs() 1357*cdf0e10cSrcweir : 0; 1358*cdf0e10cSrcweir GetDoc()->RemoveLeadingWhiteSpace( *GetCrsr()->GetPoint() ); 1359*cdf0e10cSrcweir 1360*cdf0e10cSrcweir const bool bHtml = 0 != PTR_CAST(SwWebDocShell, pDocSh); 1361*cdf0e10cSrcweir const bool bRightToLeft = IsInRightToLeftText(); 1362*cdf0e10cSrcweir for( sal_uInt8 nLvl = 0; nLvl < MAXLEVEL; ++nLvl ) 1363*cdf0e10cSrcweir { 1364*cdf0e10cSrcweir SwNumFmt aFmt( aNumRule.Get( nLvl ) ); 1365*cdf0e10cSrcweir aFmt.SetCharFmt( pChrFmt ); 1366*cdf0e10cSrcweir 1367*cdf0e10cSrcweir if (! bNum) 1368*cdf0e10cSrcweir { 1369*cdf0e10cSrcweir // --> OD 2008-06-03 #i63395# 1370*cdf0e10cSrcweir // Only apply user defined default bullet font 1371*cdf0e10cSrcweir if ( pFnt ) 1372*cdf0e10cSrcweir { 1373*cdf0e10cSrcweir aFmt.SetBulletFont( pFnt ); 1374*cdf0e10cSrcweir } 1375*cdf0e10cSrcweir aFmt.SetBulletChar( numfunc::GetBulletChar(nLvl) ); 1376*cdf0e10cSrcweir aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); 1377*cdf0e10cSrcweir // #i93908# clear suffix for bullet lists 1378*cdf0e10cSrcweir aFmt.SetPrefix(::rtl::OUString()); 1379*cdf0e10cSrcweir aFmt.SetSuffix(::rtl::OUString()); 1380*cdf0e10cSrcweir } 1381*cdf0e10cSrcweir 1382*cdf0e10cSrcweir // --> OD 2009-08-26 #i95907# 1383*cdf0e10cSrcweir if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) 1384*cdf0e10cSrcweir { 1385*cdf0e10cSrcweir if(bHtml && nLvl) 1386*cdf0e10cSrcweir { 1387*cdf0e10cSrcweir // 1/2" fuer HTML 1388*cdf0e10cSrcweir aFmt.SetLSpace(720); 1389*cdf0e10cSrcweir aFmt.SetAbsLSpace(nLvl * 720); 1390*cdf0e10cSrcweir } 1391*cdf0e10cSrcweir else if ( nWidthOfTabs > 0 ) 1392*cdf0e10cSrcweir { 1393*cdf0e10cSrcweir aFmt.SetAbsLSpace(nWidthOfTabs + nLvl * 720); 1394*cdf0e10cSrcweir } 1395*cdf0e10cSrcweir } 1396*cdf0e10cSrcweir // <-- 1397*cdf0e10cSrcweir 1398*cdf0e10cSrcweir // --> FME 2005-01-21 #i38904# Default alignment for 1399*cdf0e10cSrcweir // numbering/bullet should be rtl in rtl paragraph: 1400*cdf0e10cSrcweir if ( bRightToLeft ) 1401*cdf0e10cSrcweir { 1402*cdf0e10cSrcweir aFmt.SetNumAdjust( SVX_ADJUST_RIGHT ); 1403*cdf0e10cSrcweir } 1404*cdf0e10cSrcweir // <-- 1405*cdf0e10cSrcweir 1406*cdf0e10cSrcweir aNumRule.Set( nLvl, aFmt ); 1407*cdf0e10cSrcweir } 1408*cdf0e10cSrcweir 1409*cdf0e10cSrcweir // --> OD 2009-08-26 #i95907# 1410*cdf0e10cSrcweir if ( pTxtNode && 1411*cdf0e10cSrcweir ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) 1412*cdf0e10cSrcweir { 1413*cdf0e10cSrcweir // --> OD 2010-01-05 #b6884103# 1414*cdf0e10cSrcweir // short nTxtNodeFirstLineOffset( 0 ); 1415*cdf0e10cSrcweir // pTxtNode->GetFirstLineOfsWithNum( nTxtNodeFirstLineOffset ); 1416*cdf0e10cSrcweir // const SwTwips nTxtNodeIndent = pTxtNode->GetLeftMarginForTabCalculation() + 1417*cdf0e10cSrcweir // nTxtNodeFirstLineOffset; 1418*cdf0e10cSrcweir const SwTwips nTxtNodeIndent = pTxtNode->GetAdditionalIndentForStartingNewList(); 1419*cdf0e10cSrcweir // <-- 1420*cdf0e10cSrcweir if ( ( nTxtNodeIndent + nWidthOfTabs ) != 0 ) 1421*cdf0e10cSrcweir { 1422*cdf0e10cSrcweir // --> OD 2010-05-05 #i111172# 1423*cdf0e10cSrcweir // If text node is already inside a list, assure that the indents 1424*cdf0e10cSrcweir // are the same. Thus, adjust the indent change value by subtracting 1425*cdf0e10cSrcweir // indents of to be applied list style. 1426*cdf0e10cSrcweir SwTwips nIndentChange = nTxtNodeIndent + nWidthOfTabs; 1427*cdf0e10cSrcweir if ( pTxtNode->GetNumRule() ) 1428*cdf0e10cSrcweir { 1429*cdf0e10cSrcweir const SwNumFmt aFmt( aNumRule.Get( 0 ) ); 1430*cdf0e10cSrcweir if ( aFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) 1431*cdf0e10cSrcweir { 1432*cdf0e10cSrcweir nIndentChange -= aFmt.GetIndentAt() + aFmt.GetFirstLineIndent(); 1433*cdf0e10cSrcweir } 1434*cdf0e10cSrcweir } 1435*cdf0e10cSrcweir // <-- 1436*cdf0e10cSrcweir aNumRule.ChangeIndent( nIndentChange ); 1437*cdf0e10cSrcweir } 1438*cdf0e10cSrcweir } 1439*cdf0e10cSrcweir // <-- 1440*cdf0e10cSrcweir // --> OD 2008-02-08 #newlistlevelattrs# 1441*cdf0e10cSrcweir // reset indent attribute on applying list style 1442*cdf0e10cSrcweir // --> OD 2008-03-17 #refactorlists# 1443*cdf0e10cSrcweir // start new list 1444*cdf0e10cSrcweir SetCurNumRule( aNumRule, true, String(), true ); 1445*cdf0e10cSrcweir // <-- 1446*cdf0e10cSrcweir } 1447*cdf0e10cSrcweir 1448*cdf0e10cSrcweir EndUndo(UNDO_NUMORNONUM); 1449*cdf0e10cSrcweir } 1450*cdf0e10cSrcweir // <- #i40041# 1451*cdf0e10cSrcweir 1452*cdf0e10cSrcweir void SwWrtShell::NumOn() 1453*cdf0e10cSrcweir { 1454*cdf0e10cSrcweir NumOrBulletOn(sal_True); 1455*cdf0e10cSrcweir } 1456*cdf0e10cSrcweir 1457*cdf0e10cSrcweir void SwWrtShell::NumOrBulletOff() 1458*cdf0e10cSrcweir { 1459*cdf0e10cSrcweir const SwNumRule * pCurNumRule = GetCurNumRule(); 1460*cdf0e10cSrcweir 1461*cdf0e10cSrcweir if (pCurNumRule) 1462*cdf0e10cSrcweir { 1463*cdf0e10cSrcweir if (pCurNumRule->IsOutlineRule()) 1464*cdf0e10cSrcweir { 1465*cdf0e10cSrcweir SwNumRule aNumRule(*pCurNumRule); 1466*cdf0e10cSrcweir 1467*cdf0e10cSrcweir SwTxtNode * pTxtNode = 1468*cdf0e10cSrcweir GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); 1469*cdf0e10cSrcweir 1470*cdf0e10cSrcweir if (pTxtNode) 1471*cdf0e10cSrcweir { 1472*cdf0e10cSrcweir sal_uInt16 nLevel = sal::static_int_cast<sal_uInt16, sal_Int32>(pTxtNode->GetActualListLevel()); 1473*cdf0e10cSrcweir SwNumFmt aFmt(aNumRule.Get(nLevel)); 1474*cdf0e10cSrcweir 1475*cdf0e10cSrcweir aFmt.SetNumberingType(SVX_NUM_NUMBER_NONE); 1476*cdf0e10cSrcweir aNumRule.Set(nLevel, aFmt); 1477*cdf0e10cSrcweir 1478*cdf0e10cSrcweir // --> OD 2008-03-17 #refactorlists# 1479*cdf0e10cSrcweir // no start or continuation of a list - the outline style is only changed. 1480*cdf0e10cSrcweir SetCurNumRule( aNumRule, false ); 1481*cdf0e10cSrcweir // <-- 1482*cdf0e10cSrcweir } 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir else 1485*cdf0e10cSrcweir { 1486*cdf0e10cSrcweir DelNumRules(); 1487*cdf0e10cSrcweir } 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir // --> OD 2005-10-24 #126346# - Cursor can not be anymore in front of 1490*cdf0e10cSrcweir // a label, because numbering/bullet is switched off. 1491*cdf0e10cSrcweir SetInFrontOfLabel( sal_False ); 1492*cdf0e10cSrcweir // <-- 1493*cdf0e10cSrcweir } 1494*cdf0e10cSrcweir } 1495*cdf0e10cSrcweir // <- #i29560# 1496*cdf0e10cSrcweir 1497*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1498*cdf0e10cSrcweir Beschreibung: Default-Bulletliste erfragen 1499*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1500*cdf0e10cSrcweir 1501*cdf0e10cSrcweir void SwWrtShell::BulletOn() 1502*cdf0e10cSrcweir { 1503*cdf0e10cSrcweir NumOrBulletOn(sal_False); 1504*cdf0e10cSrcweir } 1505*cdf0e10cSrcweir 1506*cdf0e10cSrcweir 1507*cdf0e10cSrcweir /*-------------------------------------------------- 1508*cdf0e10cSrcweir 1509*cdf0e10cSrcweir --------------------------------------------------*/ 1510*cdf0e10cSrcweir SelectionType SwWrtShell::GetSelectionType() const 1511*cdf0e10cSrcweir { 1512*cdf0e10cSrcweir // ContentType kann nicht ermittelt werden innerhalb einer 1513*cdf0e10cSrcweir // Start-/Endactionklammerung. 1514*cdf0e10cSrcweir // Da es keinen ungueltigen Wert gibt, wird TEXT geliefert. 1515*cdf0e10cSrcweir // Der Wert ist egal, da in EndAction ohnehin aktualisiert wird. 1516*cdf0e10cSrcweir 1517*cdf0e10cSrcweir if ( BasicActionPend() ) 1518*cdf0e10cSrcweir return IsSelFrmMode() ? nsSelectionType::SEL_FRM : nsSelectionType::SEL_TXT; 1519*cdf0e10cSrcweir 1520*cdf0e10cSrcweir // if ( IsTableMode() ) 1521*cdf0e10cSrcweir // return nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS; 1522*cdf0e10cSrcweir 1523*cdf0e10cSrcweir SwView &_rView = ((SwView&)GetView()); 1524*cdf0e10cSrcweir if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() ) 1525*cdf0e10cSrcweir return nsSelectionType::SEL_POSTIT; 1526*cdf0e10cSrcweir int nCnt; 1527*cdf0e10cSrcweir 1528*cdf0e10cSrcweir // Rahmen einfuegen ist kein DrawMode 1529*cdf0e10cSrcweir if ( !_rView.GetEditWin().IsFrmAction() && 1530*cdf0e10cSrcweir (IsObjSelected() || (_rView.IsDrawMode() && !IsFrmSelected()) )) 1531*cdf0e10cSrcweir { 1532*cdf0e10cSrcweir if (GetDrawView()->IsTextEdit()) 1533*cdf0e10cSrcweir nCnt = nsSelectionType::SEL_DRW_TXT; 1534*cdf0e10cSrcweir else 1535*cdf0e10cSrcweir { 1536*cdf0e10cSrcweir if (GetView().IsFormMode()) // Nur Forms selektiert 1537*cdf0e10cSrcweir nCnt = nsSelectionType::SEL_DRW_FORM; 1538*cdf0e10cSrcweir else 1539*cdf0e10cSrcweir nCnt = nsSelectionType::SEL_DRW; // Irgendein Draw-Objekt 1540*cdf0e10cSrcweir 1541*cdf0e10cSrcweir if (_rView.IsBezierEditMode()) 1542*cdf0e10cSrcweir nCnt |= nsSelectionType::SEL_BEZ; 1543*cdf0e10cSrcweir else if( GetDrawView()->GetContext() == SDRCONTEXT_MEDIA ) 1544*cdf0e10cSrcweir nCnt |= nsSelectionType::SEL_MEDIA; 1545*cdf0e10cSrcweir 1546*cdf0e10cSrcweir if (svx::checkForSelectedCustomShapes( 1547*cdf0e10cSrcweir const_cast<SdrView *>(GetDrawView()), 1548*cdf0e10cSrcweir true /* bOnlyExtruded */ )) 1549*cdf0e10cSrcweir { 1550*cdf0e10cSrcweir nCnt |= nsSelectionType::SEL_EXTRUDED_CUSTOMSHAPE; 1551*cdf0e10cSrcweir } 1552*cdf0e10cSrcweir sal_uInt32 nCheckStatus = 0; 1553*cdf0e10cSrcweir if (svx::checkForSelectedFontWork( 1554*cdf0e10cSrcweir const_cast<SdrView *>(GetDrawView()), nCheckStatus )) 1555*cdf0e10cSrcweir { 1556*cdf0e10cSrcweir nCnt |= nsSelectionType::SEL_FONTWORK; 1557*cdf0e10cSrcweir } 1558*cdf0e10cSrcweir } 1559*cdf0e10cSrcweir 1560*cdf0e10cSrcweir return nCnt; 1561*cdf0e10cSrcweir } 1562*cdf0e10cSrcweir 1563*cdf0e10cSrcweir nCnt = GetCntType(); 1564*cdf0e10cSrcweir 1565*cdf0e10cSrcweir if ( IsFrmSelected() ) 1566*cdf0e10cSrcweir { 1567*cdf0e10cSrcweir if (_rView.IsDrawMode()) 1568*cdf0e10cSrcweir _rView.LeaveDrawCreate(); // Aufraeumen (Bug #45639) 1569*cdf0e10cSrcweir if ( !(nCnt & (CNT_GRF | CNT_OLE)) ) 1570*cdf0e10cSrcweir return nsSelectionType::SEL_FRM; 1571*cdf0e10cSrcweir } 1572*cdf0e10cSrcweir 1573*cdf0e10cSrcweir if ( IsCrsrInTbl() ) 1574*cdf0e10cSrcweir nCnt |= nsSelectionType::SEL_TBL; 1575*cdf0e10cSrcweir 1576*cdf0e10cSrcweir if ( IsTableMode() ) 1577*cdf0e10cSrcweir nCnt |= (nsSelectionType::SEL_TBL | nsSelectionType::SEL_TBL_CELLS); 1578*cdf0e10cSrcweir 1579*cdf0e10cSrcweir // --> FME 2005-01-12 #i39855# 1580*cdf0e10cSrcweir // Do not pop up numbering toolbar, if the text node has a numbering 1581*cdf0e10cSrcweir // of type SVX_NUM_NUMBER_NONE. 1582*cdf0e10cSrcweir const SwNumRule* pNumRule = GetCurNumRule(); 1583*cdf0e10cSrcweir if ( pNumRule ) 1584*cdf0e10cSrcweir { 1585*cdf0e10cSrcweir const SwTxtNode* pTxtNd = 1586*cdf0e10cSrcweir GetCrsr()->GetPoint()->nNode.GetNode().GetTxtNode(); 1587*cdf0e10cSrcweir 1588*cdf0e10cSrcweir // --> OD 2008-03-19 #refactorlists# 1589*cdf0e10cSrcweir if ( pTxtNd && pTxtNd->IsInList() ) 1590*cdf0e10cSrcweir // <-- 1591*cdf0e10cSrcweir { 1592*cdf0e10cSrcweir const SwNumFmt& rFmt = pNumRule->Get(sal::static_int_cast< sal_uInt8, sal_Int32>(pTxtNd->GetActualListLevel())); 1593*cdf0e10cSrcweir if ( SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() ) 1594*cdf0e10cSrcweir nCnt |= nsSelectionType::SEL_NUM; 1595*cdf0e10cSrcweir } 1596*cdf0e10cSrcweir } 1597*cdf0e10cSrcweir // <-- 1598*cdf0e10cSrcweir 1599*cdf0e10cSrcweir return nCnt; 1600*cdf0e10cSrcweir } 1601*cdf0e10cSrcweir 1602*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1603*cdf0e10cSrcweir Beschreibung: Finden der TextCollection mit dem Name rCollname 1604*cdf0e10cSrcweir Return: Pointer auf die Collection oder 0, wenn keine 1605*cdf0e10cSrcweir TextCollection mit diesem Namen existiert oder 1606*cdf0e10cSrcweir diese eine Defaultvorlage ist. 1607*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1608*cdf0e10cSrcweir 1609*cdf0e10cSrcweir 1610*cdf0e10cSrcweir SwTxtFmtColl *SwWrtShell::GetParaStyle(const String &rCollName, GetStyle eCreate ) 1611*cdf0e10cSrcweir { 1612*cdf0e10cSrcweir SwTxtFmtColl* pColl = FindTxtFmtCollByName( rCollName ); 1613*cdf0e10cSrcweir if( !pColl && GETSTYLE_NOCREATE != eCreate ) 1614*cdf0e10cSrcweir { 1615*cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); 1616*cdf0e10cSrcweir if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate ) 1617*cdf0e10cSrcweir pColl = GetTxtCollFromPool( nId ); 1618*cdf0e10cSrcweir } 1619*cdf0e10cSrcweir return pColl; 1620*cdf0e10cSrcweir } 1621*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1622*cdf0e10cSrcweir Beschreibung: Finden der Zeichenvorlage mit dem Name rCollname 1623*cdf0e10cSrcweir Return: Pointer auf die Collection oder 0, wenn keine 1624*cdf0e10cSrcweir Zeichenvorlage mit diesem Namen existiert oder 1625*cdf0e10cSrcweir diese eine Defaultvorlage oder automatische Vorlage ist. 1626*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1627*cdf0e10cSrcweir 1628*cdf0e10cSrcweir 1629*cdf0e10cSrcweir 1630*cdf0e10cSrcweir SwCharFmt *SwWrtShell::GetCharStyle(const String &rFmtName, GetStyle eCreate ) 1631*cdf0e10cSrcweir { 1632*cdf0e10cSrcweir SwCharFmt* pFmt = FindCharFmtByName( rFmtName ); 1633*cdf0e10cSrcweir if( !pFmt && GETSTYLE_NOCREATE != eCreate ) 1634*cdf0e10cSrcweir { 1635*cdf0e10cSrcweir sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); 1636*cdf0e10cSrcweir if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate ) 1637*cdf0e10cSrcweir pFmt = (SwCharFmt*)GetFmtFromPool( nId ); 1638*cdf0e10cSrcweir } 1639*cdf0e10cSrcweir return pFmt; 1640*cdf0e10cSrcweir } 1641*cdf0e10cSrcweir 1642*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1643*cdf0e10cSrcweir Beschreibung: Finden des Tabellenformates mit dem Name rFmtname 1644*cdf0e10cSrcweir Return: Pointer auf das Format oder 0, wenn kein 1645*cdf0e10cSrcweir Rahmenformat mit diesem Namen existiert oder 1646*cdf0e10cSrcweir dieses eine Defaultformat oder automatisches Format ist. 1647*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1648*cdf0e10cSrcweir 1649*cdf0e10cSrcweir 1650*cdf0e10cSrcweir 1651*cdf0e10cSrcweir SwFrmFmt *SwWrtShell::GetTblStyle(const String &rFmtName) 1652*cdf0e10cSrcweir { 1653*cdf0e10cSrcweir SwFrmFmt *pFmt = 0; 1654*cdf0e10cSrcweir for( sal_uInt16 i = GetTblFrmFmtCount(); i; ) 1655*cdf0e10cSrcweir if( !( pFmt = &GetTblFrmFmt( --i ) )->IsDefault() && 1656*cdf0e10cSrcweir pFmt->GetName() == rFmtName && IsUsed( *pFmt ) ) 1657*cdf0e10cSrcweir return pFmt; 1658*cdf0e10cSrcweir return 0; 1659*cdf0e10cSrcweir } 1660*cdf0e10cSrcweir 1661*cdf0e10cSrcweir 1662*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1663*cdf0e10cSrcweir Beschreibung: Anwenden der Vorlagen 1664*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1665*cdf0e10cSrcweir 1666*cdf0e10cSrcweir 1667*cdf0e10cSrcweir 1668*cdf0e10cSrcweir void SwWrtShell::SetPageStyle(const String &rCollName) 1669*cdf0e10cSrcweir { 1670*cdf0e10cSrcweir if( !SwCrsrShell::HasSelection() && !IsSelFrmMode() && !IsObjSelected() ) 1671*cdf0e10cSrcweir { 1672*cdf0e10cSrcweir SwPageDesc* pDesc = FindPageDescByName( rCollName, sal_True ); 1673*cdf0e10cSrcweir if( pDesc ) 1674*cdf0e10cSrcweir ChgCurPageDesc( *pDesc ); 1675*cdf0e10cSrcweir } 1676*cdf0e10cSrcweir } 1677*cdf0e10cSrcweir 1678*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1679*cdf0e10cSrcweir Beschreibung: Zugriff Vorlagen 1680*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1681*cdf0e10cSrcweir 1682*cdf0e10cSrcweir 1683*cdf0e10cSrcweir 1684*cdf0e10cSrcweir String SwWrtShell::GetCurPageStyle( const sal_Bool bCalcFrm ) const 1685*cdf0e10cSrcweir { 1686*cdf0e10cSrcweir return GetPageDesc(GetCurPageDesc( bCalcFrm )).GetName(); 1687*cdf0e10cSrcweir } 1688*cdf0e10cSrcweir 1689*cdf0e10cSrcweir /*------------------------------------------------------------------------ 1690*cdf0e10cSrcweir Beschreibung: Aktuelle Vorlage anhand der geltenden Attribute aendern 1691*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 1692*cdf0e10cSrcweir 1693*cdf0e10cSrcweir 1694*cdf0e10cSrcweir void SwWrtShell::QuickUpdateStyle() 1695*cdf0e10cSrcweir { 1696*cdf0e10cSrcweir SwTxtFmtColl *pColl = GetCurTxtFmtColl(); 1697*cdf0e10cSrcweir 1698*cdf0e10cSrcweir // Standard kann nicht geaendert werden 1699*cdf0e10cSrcweir if(pColl && !pColl->IsDefault()) 1700*cdf0e10cSrcweir { 1701*cdf0e10cSrcweir FillByEx(pColl); 1702*cdf0e10cSrcweir // Vorlage auch anwenden, um harte Attributierung 1703*cdf0e10cSrcweir // zu entfernen 1704*cdf0e10cSrcweir SetTxtFmtColl(pColl); 1705*cdf0e10cSrcweir } 1706*cdf0e10cSrcweir } 1707*cdf0e10cSrcweir 1708*cdf0e10cSrcweir 1709*cdf0e10cSrcweir void SwWrtShell::AutoUpdatePara(SwTxtFmtColl* pColl, const SfxItemSet& rStyleSet) 1710*cdf0e10cSrcweir { 1711*cdf0e10cSrcweir SfxItemSet aCoreSet( GetAttrPool(), 1712*cdf0e10cSrcweir RES_CHRATR_BEGIN, RES_CHRATR_END - 1, 1713*cdf0e10cSrcweir RES_PARATR_BEGIN, RES_PARATR_END - 1, 1714*cdf0e10cSrcweir RES_FRMATR_BEGIN, RES_FRMATR_END - 1, 1715*cdf0e10cSrcweir SID_ATTR_TABSTOP_POS, SID_ATTR_TABSTOP_POS, 1716*cdf0e10cSrcweir SID_ATTR_TABSTOP_DEFAULTS, SID_ATTR_TABSTOP_DEFAULTS, 1717*cdf0e10cSrcweir SID_ATTR_TABSTOP_OFFSET, SID_ATTR_TABSTOP_OFFSET, 1718*cdf0e10cSrcweir SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 1719*cdf0e10cSrcweir SID_ATTR_PARA_MODEL, SID_ATTR_PARA_KEEP, 1720*cdf0e10cSrcweir SID_ATTR_PARA_PAGENUM, SID_ATTR_PARA_PAGENUM, 1721*cdf0e10cSrcweir 0 ); 1722*cdf0e10cSrcweir GetCurAttr( aCoreSet ); 1723*cdf0e10cSrcweir sal_Bool bReset = sal_False; 1724*cdf0e10cSrcweir SfxItemIter aParaIter( aCoreSet ); 1725*cdf0e10cSrcweir const SfxPoolItem* pParaItem = aParaIter.FirstItem(); 1726*cdf0e10cSrcweir while( pParaItem ) 1727*cdf0e10cSrcweir { 1728*cdf0e10cSrcweir if(!IsInvalidItem(pParaItem)) 1729*cdf0e10cSrcweir { 1730*cdf0e10cSrcweir sal_uInt16 nWhich = pParaItem->Which(); 1731*cdf0e10cSrcweir if(SFX_ITEM_SET == aCoreSet.GetItemState(nWhich) && 1732*cdf0e10cSrcweir SFX_ITEM_SET == rStyleSet.GetItemState(nWhich)) 1733*cdf0e10cSrcweir { 1734*cdf0e10cSrcweir aCoreSet.ClearItem(nWhich); 1735*cdf0e10cSrcweir bReset = sal_True; 1736*cdf0e10cSrcweir } 1737*cdf0e10cSrcweir } 1738*cdf0e10cSrcweir pParaItem = aParaIter.NextItem(); 1739*cdf0e10cSrcweir } 1740*cdf0e10cSrcweir StartAction(); 1741*cdf0e10cSrcweir if(bReset) 1742*cdf0e10cSrcweir { 1743*cdf0e10cSrcweir ResetAttr(); 1744*cdf0e10cSrcweir SetAttr(aCoreSet); 1745*cdf0e10cSrcweir } 1746*cdf0e10cSrcweir pDoc->ChgFmt(*pColl, rStyleSet ); 1747*cdf0e10cSrcweir EndAction(); 1748*cdf0e10cSrcweir } 1749*cdf0e10cSrcweir 1750*cdf0e10cSrcweir /*-----------------12.03.97 12.24------------------- 1751*cdf0e10cSrcweir 1752*cdf0e10cSrcweir --------------------------------------------------*/ 1753*cdf0e10cSrcweir 1754*cdf0e10cSrcweir void SwWrtShell::AutoUpdateFrame( SwFrmFmt* pFmt, const SfxItemSet& rStyleSet ) 1755*cdf0e10cSrcweir { 1756*cdf0e10cSrcweir StartAction(); 1757*cdf0e10cSrcweir 1758*cdf0e10cSrcweir ResetFlyFrmAttr( 0, &rStyleSet ); 1759*cdf0e10cSrcweir pFmt->SetFmtAttr( rStyleSet ); 1760*cdf0e10cSrcweir 1761*cdf0e10cSrcweir EndAction(); 1762*cdf0e10cSrcweir } 1763*cdf0e10cSrcweir 1764*cdf0e10cSrcweir 1765*cdf0e10cSrcweir void SwWrtShell::AutoCorrect( SvxAutoCorrect& rACorr, sal_Unicode cChar ) 1766*cdf0e10cSrcweir { 1767*cdf0e10cSrcweir ResetCursorStack(); 1768*cdf0e10cSrcweir if(_CanInsert()) 1769*cdf0e10cSrcweir { 1770*cdf0e10cSrcweir sal_Bool bStarted = sal_False; 1771*cdf0e10cSrcweir if(HasSelection()) 1772*cdf0e10cSrcweir { 1773*cdf0e10cSrcweir // nur hier klammern, da das normale Insert schon an der 1774*cdf0e10cSrcweir // Editshell geklammert ist 1775*cdf0e10cSrcweir StartAllAction(); 1776*cdf0e10cSrcweir StartUndo(UNDO_INSERT); 1777*cdf0e10cSrcweir bStarted = sal_True; 1778*cdf0e10cSrcweir DelRight(); 1779*cdf0e10cSrcweir } 1780*cdf0e10cSrcweir SwEditShell::AutoCorrect( rACorr, IsInsMode(), cChar ); 1781*cdf0e10cSrcweir 1782*cdf0e10cSrcweir if(bStarted) 1783*cdf0e10cSrcweir { 1784*cdf0e10cSrcweir EndAllAction(); 1785*cdf0e10cSrcweir EndUndo(UNDO_INSERT); 1786*cdf0e10cSrcweir } 1787*cdf0e10cSrcweir } 1788*cdf0e10cSrcweir } 1789*cdf0e10cSrcweir 1790*cdf0e10cSrcweir 1791*cdf0e10cSrcweir /* 1792*cdf0e10cSrcweir * eine Art kontrollierter copy ctor 1793*cdf0e10cSrcweir */ 1794*cdf0e10cSrcweir 1795*cdf0e10cSrcweir SwWrtShell::SwWrtShell( SwWrtShell& rSh, Window *_pWin, SwView &rShell ) 1796*cdf0e10cSrcweir : SwFEShell( rSh, _pWin ), 1797*cdf0e10cSrcweir COMMON_INI_LIST 1798*cdf0e10cSrcweir { 1799*cdf0e10cSrcweir BITFLD_INI_LIST 1800*cdf0e10cSrcweir SET_CURR_SHELL( this ); 1801*cdf0e10cSrcweir 1802*cdf0e10cSrcweir SetSfxViewShell( (SfxViewShell *)&rShell ); 1803*cdf0e10cSrcweir SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) ); 1804*cdf0e10cSrcweir 1805*cdf0e10cSrcweir // place the cursor on the first field... 1806*cdf0e10cSrcweir IFieldmark *pBM = NULL; 1807*cdf0e10cSrcweir if ( IsFormProtected() && ( pBM = GetFieldmarkAfter( ) ) !=NULL ) { 1808*cdf0e10cSrcweir GotoFieldmark(pBM); 1809*cdf0e10cSrcweir } 1810*cdf0e10cSrcweir } 1811*cdf0e10cSrcweir 1812*cdf0e10cSrcweir 1813*cdf0e10cSrcweir SwWrtShell::SwWrtShell( SwDoc& rDoc, Window *_pWin, SwView &rShell, 1814*cdf0e10cSrcweir const SwViewOption *pViewOpt ) 1815*cdf0e10cSrcweir : SwFEShell( rDoc, _pWin, pViewOpt), 1816*cdf0e10cSrcweir COMMON_INI_LIST 1817*cdf0e10cSrcweir { 1818*cdf0e10cSrcweir BITFLD_INI_LIST 1819*cdf0e10cSrcweir SET_CURR_SHELL( this ); 1820*cdf0e10cSrcweir SetSfxViewShell( (SfxViewShell *)&rShell ); 1821*cdf0e10cSrcweir SetFlyMacroLnk( LINK(this, SwWrtShell, ExecFlyMac) ); 1822*cdf0e10cSrcweir } 1823*cdf0e10cSrcweir 1824*cdf0e10cSrcweir /* 1825*cdf0e10cSrcweir * ctor 1826*cdf0e10cSrcweir */ 1827*cdf0e10cSrcweir 1828*cdf0e10cSrcweir 1829*cdf0e10cSrcweir 1830*cdf0e10cSrcweir SwWrtShell::~SwWrtShell() 1831*cdf0e10cSrcweir { 1832*cdf0e10cSrcweir SET_CURR_SHELL( this ); 1833*cdf0e10cSrcweir while(IsModePushed()) 1834*cdf0e10cSrcweir PopMode(); 1835*cdf0e10cSrcweir while(PopCrsr(sal_False)) 1836*cdf0e10cSrcweir ; 1837*cdf0e10cSrcweir SwTransferable::ClearSelection( *this ); 1838*cdf0e10cSrcweir } 1839*cdf0e10cSrcweir 1840*cdf0e10cSrcweir sal_Bool SwWrtShell::Pop( sal_Bool bOldCrsr ) 1841*cdf0e10cSrcweir { 1842*cdf0e10cSrcweir sal_Bool bRet = SwCrsrShell::Pop( bOldCrsr ); 1843*cdf0e10cSrcweir if( bRet && IsSelection() ) 1844*cdf0e10cSrcweir { 1845*cdf0e10cSrcweir fnSetCrsr = &SwWrtShell::SetCrsrKillSel; 1846*cdf0e10cSrcweir fnKillSel = &SwWrtShell::ResetSelect; 1847*cdf0e10cSrcweir } 1848*cdf0e10cSrcweir return bRet; 1849*cdf0e10cSrcweir } 1850*cdf0e10cSrcweir 1851*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1852*cdf0e10cSrcweir Beschreibung: 1853*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1854*cdf0e10cSrcweir sal_Bool SwWrtShell::CanInsert() 1855*cdf0e10cSrcweir { 1856*cdf0e10cSrcweir return (!(IsSelFrmMode() | IsObjSelected() | (GetView().GetDrawFuncPtr() != NULL) | (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL))); 1857*cdf0e10cSrcweir } 1858*cdf0e10cSrcweir 1859*cdf0e10cSrcweir // die Core erzeugt eine Selektion, das SttSelect muss gerufen werden 1860*cdf0e10cSrcweir void SwWrtShell::NewCoreSelection() 1861*cdf0e10cSrcweir { 1862*cdf0e10cSrcweir SttSelect(); 1863*cdf0e10cSrcweir } 1864*cdf0e10cSrcweir 1865*cdf0e10cSrcweir // -------------- 1866*cdf0e10cSrcweir void SwWrtShell::ChgDBData(const SwDBData& aDBData) 1867*cdf0e10cSrcweir { 1868*cdf0e10cSrcweir SwEditShell::ChgDBData(aDBData); 1869*cdf0e10cSrcweir //notify the db-beamer if available 1870*cdf0e10cSrcweir GetView().NotifyDBChanged(); 1871*cdf0e10cSrcweir } 1872*cdf0e10cSrcweir 1873*cdf0e10cSrcweir String SwWrtShell::GetSelDescr() const 1874*cdf0e10cSrcweir { 1875*cdf0e10cSrcweir String aResult; 1876*cdf0e10cSrcweir 1877*cdf0e10cSrcweir int nSelType = GetSelectionType(); 1878*cdf0e10cSrcweir switch (nSelType) 1879*cdf0e10cSrcweir { 1880*cdf0e10cSrcweir case nsSelectionType::SEL_GRF: 1881*cdf0e10cSrcweir aResult = SW_RES(STR_GRAPHIC); 1882*cdf0e10cSrcweir 1883*cdf0e10cSrcweir break; 1884*cdf0e10cSrcweir case nsSelectionType::SEL_FRM: 1885*cdf0e10cSrcweir { 1886*cdf0e10cSrcweir const SwFrmFmt * pFrmFmt = GetCurFrmFmt(); 1887*cdf0e10cSrcweir 1888*cdf0e10cSrcweir if (pFrmFmt) 1889*cdf0e10cSrcweir aResult = pFrmFmt->GetDescription(); 1890*cdf0e10cSrcweir } 1891*cdf0e10cSrcweir break; 1892*cdf0e10cSrcweir case nsSelectionType::SEL_DRW: 1893*cdf0e10cSrcweir { 1894*cdf0e10cSrcweir aResult = SW_RES(STR_DRAWING_OBJECTS); 1895*cdf0e10cSrcweir } 1896*cdf0e10cSrcweir break; 1897*cdf0e10cSrcweir default: 1898*cdf0e10cSrcweir if (0 != pDoc) 1899*cdf0e10cSrcweir aResult = GetCrsrDescr(); 1900*cdf0e10cSrcweir } 1901*cdf0e10cSrcweir 1902*cdf0e10cSrcweir return aResult; 1903*cdf0e10cSrcweir } 1904*cdf0e10cSrcweir 1905*cdf0e10cSrcweir void SwWrtShell::ApplyViewOptions( const SwViewOption &rOpt ) 1906*cdf0e10cSrcweir { 1907*cdf0e10cSrcweir SwFEShell::ApplyViewOptions( rOpt ); 1908*cdf0e10cSrcweir //#i115062# invalidate meta character slot 1909*cdf0e10cSrcweir GetView().GetViewFrame()->GetBindings().Invalidate( FN_VIEW_META_CHARS ); 1910*cdf0e10cSrcweir } 1911*cdf0e10cSrcweir 1912*cdf0e10cSrcweir 1913