1*efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*efeef26fSAndrew Rist * distributed with this work for additional information 6*efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9*efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10*efeef26fSAndrew Rist * 11*efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*efeef26fSAndrew Rist * 13*efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*efeef26fSAndrew Rist * software distributed under the License is distributed on an 15*efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17*efeef26fSAndrew Rist * specific language governing permissions and limitations 18*efeef26fSAndrew Rist * under the License. 19*efeef26fSAndrew Rist * 20*efeef26fSAndrew Rist *************************************************************/ 21*efeef26fSAndrew Rist 22*efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <hintids.hxx> // define ITEMIDs 28cdf0e10cSrcweir #include <svl/macitem.hxx> 29cdf0e10cSrcweir #include <sfx2/frame.hxx> 30cdf0e10cSrcweir #include <vcl/msgbox.hxx> 31cdf0e10cSrcweir #include <svl/urihelper.hxx> 32cdf0e10cSrcweir #include <svl/eitem.hxx> 33cdf0e10cSrcweir #include <svl/stritem.hxx> 34cdf0e10cSrcweir #include <sfx2/docfile.hxx> 35cdf0e10cSrcweir #include <sfx2/fcontnr.hxx> 36cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 37cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 38cdf0e10cSrcweir #include <fmtinfmt.hxx> 39cdf0e10cSrcweir #include <frmatr.hxx> 40cdf0e10cSrcweir #include <swtypes.hxx> // SET_CURR_SHELL 41cdf0e10cSrcweir #include <wrtsh.hxx> 42cdf0e10cSrcweir #include <docsh.hxx> 43cdf0e10cSrcweir #include <fldbas.hxx> // Felder 44cdf0e10cSrcweir #include <expfld.hxx> 45cdf0e10cSrcweir #include <ddefld.hxx> 46cdf0e10cSrcweir #include <docufld.hxx> 47cdf0e10cSrcweir #include <reffld.hxx> 48cdf0e10cSrcweir #include <swundo.hxx> 49cdf0e10cSrcweir #include <doc.hxx> 50cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx> 51cdf0e10cSrcweir #include <viewopt.hxx> // SwViewOptions 52cdf0e10cSrcweir #include <frmfmt.hxx> // fuer UpdateTable 53cdf0e10cSrcweir #include <swtable.hxx> // fuer UpdateTable 54cdf0e10cSrcweir #include <mdiexp.hxx> 55cdf0e10cSrcweir #include <view.hxx> 56cdf0e10cSrcweir #include <swevent.hxx> 57cdf0e10cSrcweir #include <poolfmt.hxx> 58cdf0e10cSrcweir #include <section.hxx> 59cdf0e10cSrcweir #include <navicont.hxx> 60cdf0e10cSrcweir #include <navipi.hxx> 61cdf0e10cSrcweir #include <crsskip.hxx> 62cdf0e10cSrcweir #include <txtinet.hxx> 63cdf0e10cSrcweir #include <cmdid.h> 64cdf0e10cSrcweir #include <wrtsh.hrc> 65cdf0e10cSrcweir #include "swabstdlg.hxx" 66cdf0e10cSrcweir #include "fldui.hrc" 67cdf0e10cSrcweir #include <SwRewriter.hxx> 68cdf0e10cSrcweir 69cdf0e10cSrcweir #include <com/sun/star/document/XDocumentProperties.hpp> 70cdf0e10cSrcweir #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir /*------------------------------------------------------------------------ 74cdf0e10cSrcweir Beschreibung: 75cdf0e10cSrcweir ------------------------------------------------------------------------*/ 76cdf0e10cSrcweir 77cdf0e10cSrcweir void SwWrtShell::Insert(SwField &rFld) 78cdf0e10cSrcweir { 79cdf0e10cSrcweir ResetCursorStack(); 80cdf0e10cSrcweir if(!_CanInsert()) 81cdf0e10cSrcweir return; 82cdf0e10cSrcweir StartAllAction(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir SwRewriter aRewriter; 85cdf0e10cSrcweir aRewriter.AddRule(UNDO_ARG1, rFld.GetDescription()); 86cdf0e10cSrcweir 87cdf0e10cSrcweir StartUndo(UNDO_INSERT, &aRewriter); 88cdf0e10cSrcweir 89cdf0e10cSrcweir bool bDeleted = false; 90cdf0e10cSrcweir if( HasSelection() ) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir bDeleted = DelRight() != 0; 93cdf0e10cSrcweir } 94cdf0e10cSrcweir 95cdf0e10cSrcweir SwEditShell::Insert2(rFld, bDeleted); 96cdf0e10cSrcweir EndUndo(); 97cdf0e10cSrcweir EndAllAction(); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir 100cdf0e10cSrcweir /*-------------------------------------------------------------------- 101cdf0e10cSrcweir Beschreibung: Felder Update anschmeissen 102cdf0e10cSrcweir --------------------------------------------------------------------*/ 103cdf0e10cSrcweir 104cdf0e10cSrcweir 105cdf0e10cSrcweir 106cdf0e10cSrcweir void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst, sal_Bool bOnlyInSel ) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir // ueber die Liste der Eingabefelder gehen und Updaten 109cdf0e10cSrcweir SwInputFieldList* pTmp = pLst; 110cdf0e10cSrcweir if( !pTmp ) 111cdf0e10cSrcweir pTmp = new SwInputFieldList( this ); 112cdf0e10cSrcweir 113cdf0e10cSrcweir if (bOnlyInSel) 114cdf0e10cSrcweir pTmp->RemoveUnselectedFlds(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir const sal_uInt16 nCnt = pTmp->Count(); 117cdf0e10cSrcweir if(nCnt) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir pTmp->PushCrsr(); 120cdf0e10cSrcweir 121cdf0e10cSrcweir sal_Bool bCancel = sal_False; 122cdf0e10cSrcweir ByteString aDlgPos; 123cdf0e10cSrcweir for( sal_uInt16 i = 0; i < nCnt && !bCancel; ++i ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir pTmp->GotoFieldPos( i ); 126cdf0e10cSrcweir SwField* pField = pTmp->GetField( i ); 127cdf0e10cSrcweir if(pField->GetTyp()->Which() == RES_DROPDOWN) 128cdf0e10cSrcweir bCancel = StartDropDownFldDlg( pField, sal_True, &aDlgPos ); 129cdf0e10cSrcweir else 130cdf0e10cSrcweir bCancel = StartInputFldDlg( pField, sal_True, 0, &aDlgPos); 131cdf0e10cSrcweir 132cdf0e10cSrcweir // Sonst Updatefehler bei Multiselektion: 133cdf0e10cSrcweir pTmp->GetField( i )->GetTyp()->UpdateFlds(); 134cdf0e10cSrcweir } 135cdf0e10cSrcweir pTmp->PopCrsr(); 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir if( !pLst ) 139cdf0e10cSrcweir delete pTmp; 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir 143cdf0e10cSrcweir /*-------------------------------------------------------------------- 144cdf0e10cSrcweir Beschreibung: EingabeDialog fuer ein bestimmtes Feld starten 145cdf0e10cSrcweir --------------------------------------------------------------------*/ 146cdf0e10cSrcweir 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir sal_Bool SwWrtShell::StartInputFldDlg( SwField* pFld, sal_Bool bNextButton, 150cdf0e10cSrcweir Window* pParentWin, ByteString* pWindowState ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir //JP 14.08.96: Bug 30332 - nach Umbau der modularietaet im SFX, muss jetzt 153cdf0e10cSrcweir // das TopWindow der Application benutzt werden. 154cdf0e10cSrcweir // SwFldInputDlg* pDlg = new SwFldInputDlg( GetWin(), *this, pFld ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 157cdf0e10cSrcweir DBG_ASSERT(pFact, "Dialogdiet fail!"); 158cdf0e10cSrcweir AbstractFldInputDlg* pDlg = pFact->CreateFldInputDlg( DLG_FLD_INPUT, 159cdf0e10cSrcweir pParentWin, *this, pFld, bNextButton); 160cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 161cdf0e10cSrcweir if(pWindowState && pWindowState->Len()) 162cdf0e10cSrcweir pDlg->SetWindowState(*pWindowState); 163cdf0e10cSrcweir sal_Bool bRet = RET_CANCEL == pDlg->Execute(); 164cdf0e10cSrcweir if(pWindowState) 165cdf0e10cSrcweir *pWindowState = pDlg->GetWindowState(); 166cdf0e10cSrcweir 167cdf0e10cSrcweir delete pDlg; 168cdf0e10cSrcweir GetWin()->Update(); 169cdf0e10cSrcweir return bRet; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir /* -----------------17.06.2003 10:18----------------- 172cdf0e10cSrcweir 173cdf0e10cSrcweir --------------------------------------------------*/ 174cdf0e10cSrcweir sal_Bool SwWrtShell::StartDropDownFldDlg(SwField* pFld, sal_Bool bNextButton, ByteString* pWindowState) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 177cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 178cdf0e10cSrcweir 179cdf0e10cSrcweir AbstractDropDownFieldDialog* pDlg = pFact->CreateDropDownFieldDialog( NULL, *this, pFld, DLG_FLD_DROPDOWN ,bNextButton ); 180cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 181cdf0e10cSrcweir if(pWindowState && pWindowState->Len()) 182cdf0e10cSrcweir pDlg->SetWindowState(*pWindowState); 183cdf0e10cSrcweir sal_uInt16 nRet = pDlg->Execute(); 184cdf0e10cSrcweir if(pWindowState) 185cdf0e10cSrcweir *pWindowState = pDlg->GetWindowState(); 186cdf0e10cSrcweir delete pDlg; 187cdf0e10cSrcweir sal_Bool bRet = RET_CANCEL == nRet; 188cdf0e10cSrcweir GetWin()->Update(); 189cdf0e10cSrcweir if(RET_YES == nRet) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute(FN_EDIT_FIELD, SFX_CALLMODE_SYNCHRON); 192cdf0e10cSrcweir } 193cdf0e10cSrcweir return bRet; 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir /*-------------------------------------------------------------------- 197cdf0e10cSrcweir Beschreibung: Verzeichnis einfuegen Selektion loeschen 198cdf0e10cSrcweir --------------------------------------------------------------------*/ 199cdf0e10cSrcweir 200cdf0e10cSrcweir 201cdf0e10cSrcweir 202cdf0e10cSrcweir void SwWrtShell::InsertTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir if(!_CanInsert()) 205cdf0e10cSrcweir return; 206cdf0e10cSrcweir 207cdf0e10cSrcweir if(HasSelection()) 208cdf0e10cSrcweir DelRight(); 209cdf0e10cSrcweir 210cdf0e10cSrcweir SwEditShell::InsertTableOf(rTOX, pSet); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir 214cdf0e10cSrcweir /*-------------------------------------------------------------------- 215cdf0e10cSrcweir Beschreibung: Verzeichnis Updaten Selektion loeschen 216cdf0e10cSrcweir --------------------------------------------------------------------*/ 217cdf0e10cSrcweir 218cdf0e10cSrcweir sal_Bool SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir sal_Bool bResult = sal_False; 221cdf0e10cSrcweir 222cdf0e10cSrcweir if(_CanInsert()) 223cdf0e10cSrcweir { 224cdf0e10cSrcweir bResult = SwEditShell::UpdateTableOf(rTOX, pSet); 225cdf0e10cSrcweir 226cdf0e10cSrcweir if (pSet == NULL) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir SwDoc *const pDoc_ = GetDoc(); 229cdf0e10cSrcweir if (pDoc_) 230cdf0e10cSrcweir { 231cdf0e10cSrcweir pDoc_->GetIDocumentUndoRedo().DelAllUndoObj(); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir } 234cdf0e10cSrcweir } 235cdf0e10cSrcweir 236cdf0e10cSrcweir return bResult; 237cdf0e10cSrcweir } 238cdf0e10cSrcweir 239cdf0e10cSrcweir // handler for click on the field given as parameter. 240cdf0e10cSrcweir // the cursor is positioned on the field. 241cdf0e10cSrcweir 242cdf0e10cSrcweir 243cdf0e10cSrcweir void SwWrtShell::ClickToField( const SwField& rFld ) 244cdf0e10cSrcweir { 245cdf0e10cSrcweir bIsInClickToEdit = sal_True; 246cdf0e10cSrcweir switch( rFld.GetTyp()->Which() ) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir case RES_JUMPEDITFLD: 249cdf0e10cSrcweir { 250cdf0e10cSrcweir sal_uInt16 nSlotId = 0; 251cdf0e10cSrcweir switch( rFld.GetFormat() ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir case JE_FMT_TABLE: 254cdf0e10cSrcweir nSlotId = FN_INSERT_TABLE; 255cdf0e10cSrcweir break; 256cdf0e10cSrcweir 257cdf0e10cSrcweir case JE_FMT_FRAME: 258cdf0e10cSrcweir nSlotId = FN_INSERT_FRAME; 259cdf0e10cSrcweir break; 260cdf0e10cSrcweir 261cdf0e10cSrcweir case JE_FMT_GRAPHIC: nSlotId = SID_INSERT_GRAPHIC; break; 262cdf0e10cSrcweir case JE_FMT_OLE: nSlotId = SID_INSERT_OBJECT; break; 263cdf0e10cSrcweir 264cdf0e10cSrcweir // case JE_FMT_TEXT: 265cdf0e10cSrcweir } 266cdf0e10cSrcweir 267cdf0e10cSrcweir Right( CRSR_SKIP_CHARS, sal_True, 1, sal_False ); // Feld selektieren 268cdf0e10cSrcweir 269cdf0e10cSrcweir if( nSlotId ) 270cdf0e10cSrcweir { 271cdf0e10cSrcweir StartUndo( UNDO_START ); 272cdf0e10cSrcweir //#97295# immediately select the right shell 273cdf0e10cSrcweir GetView().StopShellTimer(); 274cdf0e10cSrcweir GetView().GetViewFrame()->GetDispatcher()->Execute( nSlotId, 275cdf0e10cSrcweir SFX_CALLMODE_SYNCHRON|SFX_CALLMODE_RECORD ); 276cdf0e10cSrcweir EndUndo( UNDO_END ); 277cdf0e10cSrcweir } 278cdf0e10cSrcweir } 279cdf0e10cSrcweir break; 280cdf0e10cSrcweir 281cdf0e10cSrcweir case RES_MACROFLD: 282cdf0e10cSrcweir { 283cdf0e10cSrcweir const SwMacroField *pFld = (const SwMacroField*)&rFld; 284cdf0e10cSrcweir String sText( rFld.GetPar2() ); 285cdf0e10cSrcweir String sRet( sText ); 286cdf0e10cSrcweir ExecMacro( pFld->GetSvxMacro(), &sRet ); 287cdf0e10cSrcweir 288cdf0e10cSrcweir // return Wert veraendert? 289cdf0e10cSrcweir if( sRet != sText ) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir StartAllAction(); 292cdf0e10cSrcweir ((SwField&)rFld).SetPar2( sRet ); 293cdf0e10cSrcweir ((SwField&)rFld).GetTyp()->UpdateFlds(); 294cdf0e10cSrcweir EndAllAction(); 295cdf0e10cSrcweir } 296cdf0e10cSrcweir } 297cdf0e10cSrcweir break; 298cdf0e10cSrcweir 299cdf0e10cSrcweir case RES_GETREFFLD: 300cdf0e10cSrcweir StartAllAction(); 301cdf0e10cSrcweir SwCrsrShell::GotoRefMark( ((SwGetRefField&)rFld).GetSetRefName(), 302cdf0e10cSrcweir ((SwGetRefField&)rFld).GetSubType(), 303cdf0e10cSrcweir ((SwGetRefField&)rFld).GetSeqNo() ); 304cdf0e10cSrcweir EndAllAction(); 305cdf0e10cSrcweir break; 306cdf0e10cSrcweir 307cdf0e10cSrcweir case RES_INPUTFLD: 308cdf0e10cSrcweir StartInputFldDlg( (SwField*)&rFld, sal_False ); 309cdf0e10cSrcweir break; 310cdf0e10cSrcweir 311cdf0e10cSrcweir case RES_SETEXPFLD: 312cdf0e10cSrcweir if( ((SwSetExpField&)rFld).GetInputFlag() ) 313cdf0e10cSrcweir StartInputFldDlg( (SwField*)&rFld, sal_False ); 314cdf0e10cSrcweir break; 315cdf0e10cSrcweir case RES_DROPDOWN : 316cdf0e10cSrcweir StartDropDownFldDlg( (SwField*)&rFld, sal_False ); 317cdf0e10cSrcweir break; 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir bIsInClickToEdit = sal_False; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir 324cdf0e10cSrcweir 325cdf0e10cSrcweir void SwWrtShell::ClickToINetAttr( const SwFmtINetFmt& rItem, sal_uInt16 nFilter ) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir if( !rItem.GetValue().Len() ) 328cdf0e10cSrcweir return ; 329cdf0e10cSrcweir 330cdf0e10cSrcweir bIsInClickToEdit = sal_True; 331cdf0e10cSrcweir 332cdf0e10cSrcweir // erstmal das evt. gesetzte ObjectSelect Macro ausfuehren 333cdf0e10cSrcweir const SvxMacro* pMac = rItem.GetMacro( SFX_EVENT_MOUSECLICK_OBJECT ); 334cdf0e10cSrcweir if( pMac ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir SwCallMouseEvent aCallEvent; 337cdf0e10cSrcweir aCallEvent.Set( &rItem ); 338cdf0e10cSrcweir GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent, sal_False ); 339cdf0e10cSrcweir } 340cdf0e10cSrcweir 341cdf0e10cSrcweir // damit die Vorlagenumsetzung sofort angezeigt wird 342cdf0e10cSrcweir ::LoadURL( rItem.GetValue(), this, nFilter, &rItem.GetTargetFrame() ); 343cdf0e10cSrcweir const SwTxtINetFmt* pTxtAttr = rItem.GetTxtINetFmt(); 344cdf0e10cSrcweir if( pTxtAttr ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisited( true ); 347cdf0e10cSrcweir const_cast<SwTxtINetFmt*>(pTxtAttr)->SetVisitedValid( true ); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir 350cdf0e10cSrcweir bIsInClickToEdit = sal_False; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir 354cdf0e10cSrcweir 355cdf0e10cSrcweir sal_Bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, sal_uInt16 nFilter ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir sal_Bool bRet = sal_False; 358cdf0e10cSrcweir String sURL; 359cdf0e10cSrcweir String sTargetFrameName; 360cdf0e10cSrcweir const SwFrmFmt* pFnd = IsURLGrfAtPos( rDocPt, &sURL, &sTargetFrameName ); 361cdf0e10cSrcweir if( pFnd && sURL.Len() ) 362cdf0e10cSrcweir { 363cdf0e10cSrcweir bRet = sal_True; 364cdf0e10cSrcweir // erstmal das evt. gesetzte ObjectSelect Macro ausfuehren 365cdf0e10cSrcweir const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SFX_EVENT_MOUSECLICK_OBJECT ); 366cdf0e10cSrcweir if( pMac ) 367cdf0e10cSrcweir { 368cdf0e10cSrcweir SwCallMouseEvent aCallEvent; 369cdf0e10cSrcweir aCallEvent.Set( EVENT_OBJECT_URLITEM, pFnd ); 370cdf0e10cSrcweir GetDoc()->CallEvent( SFX_EVENT_MOUSECLICK_OBJECT, aCallEvent, sal_False ); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir ::LoadURL( sURL, this, nFilter, &sTargetFrameName); 374cdf0e10cSrcweir } 375cdf0e10cSrcweir return bRet; 376cdf0e10cSrcweir } 377cdf0e10cSrcweir 378cdf0e10cSrcweir 379cdf0e10cSrcweir void LoadURL( const String& rURL, ViewShell* pVSh, sal_uInt16 nFilter, 380cdf0e10cSrcweir const String *pTargetFrameName ) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir ASSERT( rURL.Len() && pVSh, "was soll hier geladen werden?" ); 383cdf0e10cSrcweir if( !rURL.Len() || !pVSh ) 384cdf0e10cSrcweir return ; 385cdf0e10cSrcweir 386cdf0e10cSrcweir // die Shell kann auch 0 sein !!!!! 387cdf0e10cSrcweir SwWrtShell *pSh = 0; 388cdf0e10cSrcweir if ( pVSh && pVSh->ISA(SwCrsrShell) ) 389cdf0e10cSrcweir { 390cdf0e10cSrcweir //Eine CrsrShell ist auch immer eine WrtShell 391cdf0e10cSrcweir pSh = (SwWrtShell*)pVSh; 392cdf0e10cSrcweir } 393cdf0e10cSrcweir else 394cdf0e10cSrcweir return; 395cdf0e10cSrcweir 396cdf0e10cSrcweir SwDocShell* pDShell = pSh->GetView().GetDocShell(); 397cdf0e10cSrcweir DBG_ASSERT( pDShell, "No DocShell?!"); 398cdf0e10cSrcweir String sTargetFrame; 399cdf0e10cSrcweir if( pTargetFrameName && pTargetFrameName->Len() ) 400cdf0e10cSrcweir sTargetFrame = *pTargetFrameName; 401cdf0e10cSrcweir else if( pDShell ) { 402cdf0e10cSrcweir using namespace ::com::sun::star; 403cdf0e10cSrcweir uno::Reference<document::XDocumentPropertiesSupplier> xDPS( 404cdf0e10cSrcweir pDShell->GetModel(), uno::UNO_QUERY_THROW); 405cdf0e10cSrcweir uno::Reference<document::XDocumentProperties> xDocProps 406cdf0e10cSrcweir = xDPS->getDocumentProperties(); 407cdf0e10cSrcweir sTargetFrame = xDocProps->getDefaultTarget(); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir 410cdf0e10cSrcweir String sReferer; 411cdf0e10cSrcweir if( pDShell && pDShell->GetMedium() ) 412cdf0e10cSrcweir sReferer = pDShell->GetMedium()->GetName(); 413cdf0e10cSrcweir SfxViewFrame* pViewFrm = pSh->GetView().GetViewFrame(); 414cdf0e10cSrcweir SfxFrameItem aView( SID_DOCFRAME, pViewFrm ); 415cdf0e10cSrcweir SfxStringItem aName( SID_FILE_NAME, rURL ); 416cdf0e10cSrcweir SfxStringItem aTargetFrameName( SID_TARGETNAME, sTargetFrame ); 417cdf0e10cSrcweir SfxStringItem aReferer( SID_REFERER, sReferer ); 418cdf0e10cSrcweir 419cdf0e10cSrcweir SfxBoolItem aNewView( SID_OPEN_NEW_VIEW, sal_False ); 420cdf0e10cSrcweir //#39076# Silent kann lt. SFX entfernt werden. 421cdf0e10cSrcweir // SfxBoolItem aSilent( SID_SILENT, sal_True ); 422cdf0e10cSrcweir SfxBoolItem aBrowse( SID_BROWSE, sal_True ); 423cdf0e10cSrcweir 424cdf0e10cSrcweir if( nFilter & URLLOAD_NEWVIEW ) 425cdf0e10cSrcweir aTargetFrameName.SetValue( String::CreateFromAscii("_blank") ); 426cdf0e10cSrcweir 427cdf0e10cSrcweir const SfxPoolItem* aArr[] = { 428cdf0e10cSrcweir &aName, 429cdf0e10cSrcweir &aNewView, /*&aSilent,*/ 430cdf0e10cSrcweir &aReferer, 431cdf0e10cSrcweir &aView, &aTargetFrameName, 432cdf0e10cSrcweir &aBrowse, 433cdf0e10cSrcweir 0L 434cdf0e10cSrcweir }; 435cdf0e10cSrcweir 436cdf0e10cSrcweir pViewFrm->GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr, 437cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON|SFX_CALLMODE_RECORD ); 438cdf0e10cSrcweir } 439cdf0e10cSrcweir 440cdf0e10cSrcweir void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk, 441cdf0e10cSrcweir const sal_uInt16 nAction ) 442cdf0e10cSrcweir { 443cdf0e10cSrcweir if( EXCHG_IN_ACTION_COPY == nAction ) 444cdf0e10cSrcweir { 445cdf0e10cSrcweir // Einfuegen 446cdf0e10cSrcweir String sURL = rBkmk.GetURL(); 447cdf0e10cSrcweir //handelt es sich um ein Sprung innerhalb des akt. Docs? 448cdf0e10cSrcweir const SwDocShell* pDocShell = GetView().GetDocShell(); 449cdf0e10cSrcweir if(pDocShell->HasName()) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir const String rName = pDocShell->GetMedium()->GetURLObject().GetURLNoMark(); 452cdf0e10cSrcweir 453cdf0e10cSrcweir if(COMPARE_EQUAL == sURL.CompareTo(rName, rName.Len())) 454cdf0e10cSrcweir sURL.Erase(0, rName.Len()); 455cdf0e10cSrcweir } 456cdf0e10cSrcweir SwFmtINetFmt aFmt( sURL, aEmptyStr ); 457cdf0e10cSrcweir InsertURL( aFmt, rBkmk.GetDescription() ); 458cdf0e10cSrcweir } 459cdf0e10cSrcweir else 460cdf0e10cSrcweir { 461cdf0e10cSrcweir SwSectionData aSection( FILE_LINK_SECTION, GetUniqueSectionName( 0 ) ); 462cdf0e10cSrcweir String aLinkFile( rBkmk.GetURL().GetToken(0, '#') ); 463cdf0e10cSrcweir aLinkFile += sfx2::cTokenSeperator; 464cdf0e10cSrcweir aLinkFile += sfx2::cTokenSeperator; 465cdf0e10cSrcweir aLinkFile += rBkmk.GetURL().GetToken(1, '#'); 466cdf0e10cSrcweir aSection.SetLinkFileName( aLinkFile ); 467cdf0e10cSrcweir aSection.SetProtectFlag( true ); 468cdf0e10cSrcweir const SwSection* pIns = InsertSection( aSection ); 469cdf0e10cSrcweir if( EXCHG_IN_ACTION_MOVE == nAction && pIns ) 470cdf0e10cSrcweir { 471cdf0e10cSrcweir aSection = SwSectionData(*pIns); 472cdf0e10cSrcweir aSection.SetLinkFileName( aEmptyStr ); 473cdf0e10cSrcweir aSection.SetType( CONTENT_SECTION ); 474cdf0e10cSrcweir aSection.SetProtectFlag( false ); 475cdf0e10cSrcweir 476cdf0e10cSrcweir // the update of content from linked section at time delete 477cdf0e10cSrcweir // the undostack. Then the change of the section dont create 478cdf0e10cSrcweir // any undoobject. - BUG 69145 479cdf0e10cSrcweir sal_Bool bDoesUndo = DoesUndo(); 480cdf0e10cSrcweir SwUndoId nLastUndoId(UNDO_EMPTY); 481cdf0e10cSrcweir if (GetLastUndoInfo(0, & nLastUndoId)) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir if (UNDO_INSSECTION != nLastUndoId) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir DoUndo(false); 486cdf0e10cSrcweir } 487cdf0e10cSrcweir } 488cdf0e10cSrcweir UpdateSection( GetSectionFmtPos( *pIns->GetFmt() ), aSection ); 489cdf0e10cSrcweir DoUndo( bDoesUndo ); 490cdf0e10cSrcweir } 491cdf0e10cSrcweir } 492cdf0e10cSrcweir } 493cdf0e10cSrcweir 494cdf0e10cSrcweir 495