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