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