1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchHelper.hpp> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <hintids.hxx> 37*cdf0e10cSrcweir #include <tools/urlobj.hxx> 38*cdf0e10cSrcweir #include <unotools/tempfile.hxx> 39*cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 40*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 41*cdf0e10cSrcweir #include <svl/lckbitem.hxx> 42*cdf0e10cSrcweir #include <svl/eitem.hxx> 43*cdf0e10cSrcweir #include <svl/zforlist.hxx> 44*cdf0e10cSrcweir #include <svl/zformat.hxx> 45*cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 46*cdf0e10cSrcweir #include <svtools/transfer.hxx> 47*cdf0e10cSrcweir #include <sfx2/dialogs.hrc> 48*cdf0e10cSrcweir #include <sfx2/dinfdlg.hxx> 49*cdf0e10cSrcweir #include <sfx2/request.hxx> 50*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 51*cdf0e10cSrcweir #include <sfx2/new.hxx> 52*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx> 53*cdf0e10cSrcweir #include <sfx2/printer.hxx> 54*cdf0e10cSrcweir #include <sfx2/evntconf.hxx> 55*cdf0e10cSrcweir #include <svtools/sfxecode.hxx> 56*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 57*cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 58*cdf0e10cSrcweir #include <svx/svxids.hrc> 59*cdf0e10cSrcweir #include <svx/drawitem.hxx> 60*cdf0e10cSrcweir #include <editeng/svxacorr.hxx> 61*cdf0e10cSrcweir #include <editeng/langitem.hxx> 62*cdf0e10cSrcweir #include <svx/fmshell.hxx> 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir #include <svtools/htmlcfg.hxx> 65*cdf0e10cSrcweir #include <svx/ofaitem.hxx> 66*cdf0e10cSrcweir #include <SwSmartTagMgr.hxx> 67*cdf0e10cSrcweir #include <sfx2/app.hxx> 68*cdf0e10cSrcweir #include <basic/sbstar.hxx> 69*cdf0e10cSrcweir #include <basic/basmgr.hxx> 70*cdf0e10cSrcweir #include <sot/storage.hxx> 71*cdf0e10cSrcweir #include <sot/clsids.hxx> 72*cdf0e10cSrcweir #include <swunodef.hxx> 73*cdf0e10cSrcweir #include <fmtcol.hxx> 74*cdf0e10cSrcweir #include <swevent.hxx> 75*cdf0e10cSrcweir #include <view.hxx> // fuer die aktuelle Sicht 76*cdf0e10cSrcweir #include <docsh.hxx> // Dokumenterzeugung 77*cdf0e10cSrcweir #include <wrtsh.hxx> 78*cdf0e10cSrcweir #include <fldbas.hxx> 79*cdf0e10cSrcweir #include <viewopt.hxx> 80*cdf0e10cSrcweir #include <globdoc.hxx> 81*cdf0e10cSrcweir #include <fldwrap.hxx> 82*cdf0e10cSrcweir #include <redlndlg.hxx> 83*cdf0e10cSrcweir #include <docstyle.hxx> 84*cdf0e10cSrcweir #include <doc.hxx> 85*cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx> 86*cdf0e10cSrcweir #include <pagedesc.hxx> 87*cdf0e10cSrcweir #include <shellio.hxx> 88*cdf0e10cSrcweir #include <pview.hxx> 89*cdf0e10cSrcweir #include <srcview.hxx> 90*cdf0e10cSrcweir #include <poolfmt.hxx> 91*cdf0e10cSrcweir #include <usrpref.hxx> 92*cdf0e10cSrcweir #include <wdocsh.hxx> 93*cdf0e10cSrcweir #include <unotxdoc.hxx> 94*cdf0e10cSrcweir #include <acmplwrd.hxx> 95*cdf0e10cSrcweir #include <swmodule.hxx> 96*cdf0e10cSrcweir #include <unobaseclass.hxx> 97*cdf0e10cSrcweir #include <swwait.hxx> 98*cdf0e10cSrcweir #include <swcli.hxx> 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir #include <cmdid.h> 101*cdf0e10cSrcweir #include <globals.h> 102*cdf0e10cSrcweir #include <helpid.h> 103*cdf0e10cSrcweir #include <app.hrc> 104*cdf0e10cSrcweir #include <poolfmt.hrc> 105*cdf0e10cSrcweir #include <globals.hrc> 106*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp> 107*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilterManager.hpp> 108*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> 109*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> 110*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> 111*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> 112*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" 113*cdf0e10cSrcweir #ifdef FUTURE_VBA 114*cdf0e10cSrcweir #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> 115*cdf0e10cSrcweir #include <com/sun/star/script/vba/VBAEventId.hpp> 116*cdf0e10cSrcweir #endif 117*cdf0e10cSrcweir #include <editeng/acorrcfg.hxx> 118*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx> 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx> 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir #include "swabstdlg.hxx" 123*cdf0e10cSrcweir #include "dialog.hrc" 124*cdf0e10cSrcweir #include "swabstdlg.hxx" 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir #include <ndtxt.hxx> //#outline level,add by zhaojianwei 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs; 129*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 130*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 131*cdf0e10cSrcweir using namespace ::com::sun::star; 132*cdf0e10cSrcweir using ::rtl::OUString; 133*cdf0e10cSrcweir using namespace ::sfx2; 134*cdf0e10cSrcweir extern sal_Bool FindPhyStyle( SwDoc& , const String& , SfxStyleFamily ); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir /*-------------------------------------------------------------------- 137*cdf0e10cSrcweir Beschreibung: DocInfo kreieren (virtuell) 138*cdf0e10cSrcweir --------------------------------------------------------------------*/ 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog( 141*cdf0e10cSrcweir Window *pParent, const SfxItemSet &rSet) 142*cdf0e10cSrcweir { 143*cdf0e10cSrcweir SfxDocumentInfoDialog* pDlg = new SfxDocumentInfoDialog(pParent, rSet); 144*cdf0e10cSrcweir //nur mit Statistik, wenn dieses Doc auch angezeigt wird, nicht 145*cdf0e10cSrcweir //aus dem Doc-Manager 146*cdf0e10cSrcweir SwDocShell* pDocSh = (SwDocShell*) SfxObjectShell::Current(); 147*cdf0e10cSrcweir if( pDocSh == this ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir //Nicht fuer SourceView. 150*cdf0e10cSrcweir SfxViewShell *pVSh = SfxViewShell::Current(); 151*cdf0e10cSrcweir if ( pVSh && !pVSh->ISA(SwSrcView) ) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 154*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 155*cdf0e10cSrcweir pDlg->AddTabPage(TP_DOC_STAT, SW_RESSTR(STR_DOC_STAT),pFact->GetTabPageCreatorFunc( TP_DOC_STAT ),0); 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir return pDlg; 159*cdf0e10cSrcweir } 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // Disable "multiple layout" 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir void SwDocShell::ToggleBrowserMode(sal_Bool bSet, SwView* _pView ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::BROWSE_MODE, bSet ); 166*cdf0e10cSrcweir UpdateFontList(); 167*cdf0e10cSrcweir SwView* pTempView = _pView ? _pView : (SwView*)GetView(); 168*cdf0e10cSrcweir if( pTempView ) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir pTempView->GetViewFrame()->GetBindings().Invalidate(FN_SHADOWCURSOR); 171*cdf0e10cSrcweir if( !GetDoc()->getPrinter( false ) ) 172*cdf0e10cSrcweir pTempView->SetPrinter( GetDoc()->getPrinter( false ), SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP ); 173*cdf0e10cSrcweir GetDoc()->CheckDefaultPageFmt(); 174*cdf0e10cSrcweir SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this, sal_False); 175*cdf0e10cSrcweir do { 176*cdf0e10cSrcweir if( pTmpFrm != pTempView->GetViewFrame() ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir pTmpFrm->DoClose(); 179*cdf0e10cSrcweir pTmpFrm = SfxViewFrame::GetFirst(this, sal_False); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir else 182*cdf0e10cSrcweir pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this, sal_False); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir } while ( pTmpFrm ); 185*cdf0e10cSrcweir const SwViewOption& rViewOptions = *pTempView->GetWrtShell().GetViewOptions(); 186*cdf0e10cSrcweir pTempView->GetWrtShell().CheckBrowseView( sal_True ); 187*cdf0e10cSrcweir pTempView->CheckVisArea(); 188*cdf0e10cSrcweir if( bSet ) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType(); 191*cdf0e10cSrcweir if ( SVX_ZOOM_PERCENT != eType) 192*cdf0e10cSrcweir ((SwView*)GetView())->SetZoom( eType ); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir pTempView->InvalidateBorder(); 195*cdf0e10cSrcweir pTempView->SetNewWindowAllowed(!bSet); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir // End of disabled "multiple layout" 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir /// update text fields on document properties changes 201*cdf0e10cSrcweir void SwDocShell::DoFlushDocInfo() 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir if ( !pDoc ) return; 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir bool bUnlockView(true); 206*cdf0e10cSrcweir if ( pWrtShell ) { 207*cdf0e10cSrcweir bUnlockView = !pWrtShell->IsViewLocked(); 208*cdf0e10cSrcweir pWrtShell->LockView( sal_True ); // lock visible section 209*cdf0e10cSrcweir pWrtShell->StartAllAction(); 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir 212*cdf0e10cSrcweir pDoc->DocInfoChgd(); 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir if ( pWrtShell ) { 215*cdf0e10cSrcweir pWrtShell->EndAllAction(); 216*cdf0e10cSrcweir if ( bUnlockView ) { 217*cdf0e10cSrcweir pWrtShell->LockView( sal_False ); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir } 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir #ifdef FUTURE_VBA 223*cdf0e10cSrcweir void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVBAEventProcessor >& xVbaEvents, const SfxHint& rHint ) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir using namespace com::sun::star::script::vba::VBAEventId; 226*cdf0e10cSrcweir if ( rHint.ISA( SfxEventHint ) ) 227*cdf0e10cSrcweir { 228*cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs; 229*cdf0e10cSrcweir sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId(); 230*cdf0e10cSrcweir switch( nEventId ) 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir case SFX_EVENT_CREATEDOC: 233*cdf0e10cSrcweir xVbaEvents->processVbaEvent( DOCUMENT_NEW, aArgs ); 234*cdf0e10cSrcweir break; 235*cdf0e10cSrcweir case SFX_EVENT_OPENDOC: 236*cdf0e10cSrcweir xVbaEvents->processVbaEvent( DOCUMENT_OPEN, aArgs ); 237*cdf0e10cSrcweir break; 238*cdf0e10cSrcweir } 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir #endif 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir /*-------------------------------------------------------------------- 244*cdf0e10cSrcweir Beschreibung: Benachrichtigung bei geaenderter DocInfo 245*cdf0e10cSrcweir --------------------------------------------------------------------*/ 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir if( !pDoc ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir //MA: Kommt bei der OLE-Registration vor! 252*cdf0e10cSrcweir // ASSERT( !this, "DocShell ist nicht richtig initialisiert!" ); 253*cdf0e10cSrcweir return ; 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir #ifdef FUTURE_VBA 257*cdf0e10cSrcweir uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor(); 258*cdf0e10cSrcweir if( xVbaEvents.is() ) 259*cdf0e10cSrcweir lcl_processCompatibleSfxHint( xVbaEvents, rHint ); 260*cdf0e10cSrcweir #endif 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir sal_uInt16 nAction = 0; 263*cdf0e10cSrcweir if( rHint.ISA(SfxSimpleHint) ) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir // swithc for more actions 266*cdf0e10cSrcweir switch( ((SfxSimpleHint&) rHint).GetId() ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir case SFX_HINT_TITLECHANGED: 269*cdf0e10cSrcweir if( GetMedium() ) 270*cdf0e10cSrcweir nAction = 2; 271*cdf0e10cSrcweir break; 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir else if( rHint.ISA(SfxEventHint) && 275*cdf0e10cSrcweir ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir // --> OD 2004-12-03 #i38126# - own action id 278*cdf0e10cSrcweir nAction = 3; 279*cdf0e10cSrcweir // <-- 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir if( nAction ) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir sal_Bool bUnlockView = sal_True; //initializing prevents warning 285*cdf0e10cSrcweir if( pWrtShell ) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir bUnlockView = !pWrtShell->IsViewLocked(); 288*cdf0e10cSrcweir pWrtShell->LockView( sal_True ); //lock visible section 289*cdf0e10cSrcweir pWrtShell->StartAllAction(); 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir switch( nAction ) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir case 2: 294*cdf0e10cSrcweir pDoc->GetSysFldType( RES_FILENAMEFLD )->UpdateFlds(); 295*cdf0e10cSrcweir break; 296*cdf0e10cSrcweir // --> OD 2004-12-03 #i38126# - own action for event LOADFINISHED 297*cdf0e10cSrcweir // in order to avoid a modified document. 298*cdf0e10cSrcweir // --> OD 2005-02-01 #i41679# - Also for the instance of <SwDoc> 299*cdf0e10cSrcweir // it has to be assured, that it's not modified. 300*cdf0e10cSrcweir // Perform the same as for action id 1, but disable <SetModified>. 301*cdf0e10cSrcweir case 3: 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir const bool bResetModified = IsEnableSetModified(); 304*cdf0e10cSrcweir if ( bResetModified ) 305*cdf0e10cSrcweir EnableSetModified( sal_False ); 306*cdf0e10cSrcweir // --> OD 2005-02-01 #i41679# 307*cdf0e10cSrcweir const bool bIsDocModified = pDoc->IsModified(); 308*cdf0e10cSrcweir // <-- 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir pDoc->DocInfoChgd( ); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir // --> OD 2005-02-01 #i41679# 313*cdf0e10cSrcweir if ( !bIsDocModified ) 314*cdf0e10cSrcweir pDoc->ResetModified(); 315*cdf0e10cSrcweir // <-- 316*cdf0e10cSrcweir if ( bResetModified ) 317*cdf0e10cSrcweir EnableSetModified( sal_True ); 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir break; 320*cdf0e10cSrcweir // <-- 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir 323*cdf0e10cSrcweir if( pWrtShell ) 324*cdf0e10cSrcweir { 325*cdf0e10cSrcweir pWrtShell->EndAllAction(); 326*cdf0e10cSrcweir if( bUnlockView ) 327*cdf0e10cSrcweir pWrtShell->LockView( sal_False ); 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir } 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir /*-------------------------------------------------------------------- 333*cdf0e10cSrcweir Beschreibung: Benachrichtigung Doc schliessen 334*cdf0e10cSrcweir --------------------------------------------------------------------*/ 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir sal_uInt16 SwDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing ) 337*cdf0e10cSrcweir { 338*cdf0e10cSrcweir sal_uInt16 nRet = SfxObjectShell::PrepareClose( bUI, bForBrowsing ); 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir if( sal_True == nRet ) //Unbedingt auf sal_True abfragen! (RET_NEWTASK) 341*cdf0e10cSrcweir EndListening( *this ); 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir #ifdef FUTURE_VBA 344*cdf0e10cSrcweir if( pDoc && IsInPrepareClose() ) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor(); 347*cdf0e10cSrcweir if( xVbaEvents.is() ) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir using namespace com::sun::star::script::vba::VBAEventId; 350*cdf0e10cSrcweir uno::Sequence< uno::Any > aArgs; 351*cdf0e10cSrcweir xVbaEvents->processVbaEvent( DOCUMENT_CLOSE, aArgs ); 352*cdf0e10cSrcweir } 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir #endif 355*cdf0e10cSrcweir return nRet; 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir /*-------------------------------------------------------------------- 359*cdf0e10cSrcweir Beschreibung: Organizer 360*cdf0e10cSrcweir --------------------------------------------------------------------*/ 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir sal_Bool SwDocShell::Insert( SfxObjectShell &rSource, 363*cdf0e10cSrcweir sal_uInt16 nSourceIdx1, // SourcePool: oberste Inhaltsebene (Vorlagen/Makros) 364*cdf0e10cSrcweir sal_uInt16 nSourceIdx2, // Index in den Inhalt 365*cdf0e10cSrcweir sal_uInt16 nSourceIdx3, // Index in die Inhaltsebene 366*cdf0e10cSrcweir sal_uInt16 &rIdx1, // und das gleiche fuer den DestinationPool 367*cdf0e10cSrcweir sal_uInt16 &rIdx2, // "" 368*cdf0e10cSrcweir sal_uInt16 &rIdx3, // "" 369*cdf0e10cSrcweir sal_uInt16 &rRemovedIdx ) // falls doppelte geloescht werden, Pos zurueck 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir // --> OD 2005-05-10 #i48949# - actions aren't undoable. Thus, allow no undo 372*cdf0e10cSrcweir // actions 373*cdf0e10cSrcweir // Note: The undo action stack is cleared at the end of this method. 374*cdf0e10cSrcweir ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo()); 375*cdf0e10cSrcweir // <-- 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir sal_Bool bRet = sal_False; 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir if (INDEX_IGNORE == rIdx1 && CONTENT_STYLE == nSourceIdx1) 380*cdf0e10cSrcweir rIdx1 = CONTENT_STYLE; 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir if (CONTENT_STYLE == nSourceIdx1 && CONTENT_STYLE == rIdx1) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir SfxStyleSheetBasePool* pHisPool = rSource.GetStyleSheetPool(); 385*cdf0e10cSrcweir SwDocStyleSheetPool* pMyPool = 386*cdf0e10cSrcweir (SwDocStyleSheetPool*)GetStyleSheetPool(); 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir // wir koennen nicht in uns selbst hin und her moven 389*cdf0e10cSrcweir if( pHisPool == pMyPool ) 390*cdf0e10cSrcweir return sal_False; 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir if( INDEX_IGNORE == rIdx2 ) 393*cdf0e10cSrcweir rIdx2 = pMyPool->Count(); 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir // erstmal auf die Such-Maske "positionieren" 396*cdf0e10cSrcweir pHisPool->First(); 397*cdf0e10cSrcweir SfxStyleSheetBase* pHisSheet = (*pHisPool)[nSourceIdx2]; 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir // wenn so eine Vorlage schon existiert: loeschen! 400*cdf0e10cSrcweir const String& rOldName = pHisSheet->GetName(); 401*cdf0e10cSrcweir SfxStyleFamily eOldFamily( pHisSheet->GetFamily() ); 402*cdf0e10cSrcweir 403*cdf0e10cSrcweir // dflt. PageDesc und StandardZeichenvorlage nie loeschen !!! 404*cdf0e10cSrcweir if( ( SFX_STYLE_FAMILY_PAGE == eOldFamily && 405*cdf0e10cSrcweir const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetName() == 406*cdf0e10cSrcweir rOldName ) || 407*cdf0e10cSrcweir ( SFX_STYLE_FAMILY_CHAR == eOldFamily && 408*cdf0e10cSrcweir rOldName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD - 409*cdf0e10cSrcweir RES_POOLCOLL_TEXT_BEGIN ] )) 410*cdf0e10cSrcweir return sal_False; 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir SfxStyleFamily eMyOldFamily( pMyPool->GetSearchFamily() ); 413*cdf0e10cSrcweir sal_uInt16 nMySrchMask = pMyPool->GetSearchMask(); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir SfxStyleSheetBase* pExist; 416*cdf0e10cSrcweir if( ::FindPhyStyle( *pDoc, rOldName, eOldFamily ) ) 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir // Bug 20365: nur uebernehmen, wenn das gewuenscht ist! 419*cdf0e10cSrcweir if( ERRCODE_BUTTON_OK != ErrorHandler::HandleError( 420*cdf0e10cSrcweir *new MessageInfo( ERRCODE_SFXMSG_STYLEREPLACE, rOldName )) ) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir return sal_False; 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir // Da Replace den aStyleSheet-Member selbst benoetigt, muss 426*cdf0e10cSrcweir // das Ergebnis vom Find kopiert werden (s.u.)) 427*cdf0e10cSrcweir rtl::Reference< SwDocStyleSheet > xExist( new SwDocStyleSheet( 428*cdf0e10cSrcweir *(SwDocStyleSheet*)pMyPool->Find( rOldName, eOldFamily ) ) ); 429*cdf0e10cSrcweir pMyPool->Replace( *pHisSheet, *xExist.get() ); 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir // An der Reihenfolge der Vorlagen im Pool aendert sich nichts. 432*cdf0e10cSrcweir rIdx2 = rIdx1 = INDEX_IGNORE; 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir GetDoc()->SetModified(); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir return sal_True; 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir pMyPool->SetSearchMask( eOldFamily, nMySrchMask ); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir // MIB 18.12.98: SwDocStyleSheetPool::Make liefert einen 442*cdf0e10cSrcweir // Pointer auf SwDocStyleSheetPool::aStyleSheet zurueck. 443*cdf0e10cSrcweir // Der gleiche Member von SwDocStyleSheetPool::Find benutzt. 444*cdf0e10cSrcweir // Deshalb muss hier mit einer Kopie gearbeitet werden. 445*cdf0e10cSrcweir // Vorsicht: SfxStyleSheetBase::SetFollow ruft seinerseits 446*cdf0e10cSrcweir // ein SwDocStyleSheetPool::Find auf, do dass es nicht genuegt 447*cdf0e10cSrcweir // die Find-Aufrufe in dieser Methode zu eleminieren. 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir rtl::Reference< SwDocStyleSheet > xNewSheet( new SwDocStyleSheet( (SwDocStyleSheet&)pMyPool 450*cdf0e10cSrcweir ->Make(rOldName, eOldFamily, pHisSheet->GetMask() ) ) ); 451*cdf0e10cSrcweir if( SFX_STYLE_FAMILY_PAGE == eOldFamily && rSource.ISA(SwDocShell) ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir // gesondert behandeln!! 454*cdf0e10cSrcweir SwPageDesc* pDestDsc = (SwPageDesc*)xNewSheet->GetPageDesc(); 455*cdf0e10cSrcweir SwPageDesc* pCpyDsc = (SwPageDesc*)((SwDocStyleSheet*)pHisSheet)->GetPageDesc(); 456*cdf0e10cSrcweir pDoc->CopyPageDesc( *pCpyDsc, *pDestDsc ); 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir else 459*cdf0e10cSrcweir // die neue Vorlage mit den Attributen fuellen 460*cdf0e10cSrcweir xNewSheet->SetItemSet( pHisSheet->GetItemSet() ); 461*cdf0e10cSrcweir 462*cdf0e10cSrcweir pMyPool->SetSearchMask( SFX_STYLE_FAMILY_ALL, nMySrchMask ); 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir if( xNewSheet->IsUserDefined() || xNewSheet->IsUsed() ) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir // Benutzte und Benutzer-definierte Vorlagen werden angezeigt. 467*cdf0e10cSrcweir // Dshalb muss hier der Index der neuen Vorlage im Pool 468*cdf0e10cSrcweir // ermittelt werden. 469*cdf0e10cSrcweir pExist = pMyPool->First(); 470*cdf0e10cSrcweir sal_uInt16 nIdx = 0; 471*cdf0e10cSrcweir while( pExist ) 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir if( pExist->GetName() == rOldName && 474*cdf0e10cSrcweir eOldFamily == pExist->GetFamily() ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir rIdx2 = nIdx; 477*cdf0e10cSrcweir break; 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir pExist = pMyPool->Next(); 480*cdf0e10cSrcweir nIdx++; 481*cdf0e10cSrcweir } 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir else 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir // Andere Vorlagen werden nicht angezeigt. 486*cdf0e10cSrcweir rIdx1 = rIdx2 = INDEX_IGNORE; 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir 489*cdf0e10cSrcweir /* pMyPool->Count(); //interne Liste neu fuellen lassen!!!!! 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir // suchen, um die richige Insert-Position returnen zu koennen 492*cdf0e10cSrcweir pMyPool->Find( rOldName, SFX_STYLE_FAMILY_ALL, nMySrchMask ); 493*cdf0e10cSrcweir rIdx2 = pMyPool->GetFindPos();*/ 494*cdf0e10cSrcweir 495*cdf0e10cSrcweir // wer bekommt den Neuen als Parent? wer benutzt den Neuen als Follow? 496*cdf0e10cSrcweir // (immer nur ueber die Instanziierten!!!) 497*cdf0e10cSrcweir pMyPool->SetSearchMask( eOldFamily, nMySrchMask ); 498*cdf0e10cSrcweir pMyPool->SetOrganizerMode( sal_True ); 499*cdf0e10cSrcweir SfxStyleSheetBase* pTestSheet = pMyPool->First(); 500*cdf0e10cSrcweir while (pTestSheet) 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir if (pTestSheet->GetFamily() == eOldFamily && 503*cdf0e10cSrcweir pTestSheet->HasParentSupport() && 504*cdf0e10cSrcweir pTestSheet->GetParent() == rOldName) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir pTestSheet->SetParent(rOldName); // Verknuepfung neu aufbauen 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir if (pTestSheet->GetFamily() == eOldFamily && 510*cdf0e10cSrcweir pTestSheet->HasFollowSupport() && 511*cdf0e10cSrcweir pTestSheet->GetFollow() == rOldName) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir pTestSheet->SetFollow(rOldName); // Verknuepfung neu aufbauen 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir 516*cdf0e10cSrcweir pTestSheet = pMyPool->Next(); 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir // hat der Neue einen Parent? wenn ja, mit gleichem Namen bei uns suchen 521*cdf0e10cSrcweir if (pHisSheet->HasParentSupport()) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir const String& rParentName = pHisSheet->GetParent(); 524*cdf0e10cSrcweir if (0 != rParentName.Len()) 525*cdf0e10cSrcweir { 526*cdf0e10cSrcweir SfxStyleSheetBase* pParentOfNew = pMyPool->Find(rParentName, 527*cdf0e10cSrcweir eOldFamily); 528*cdf0e10cSrcweir if (pParentOfNew) 529*cdf0e10cSrcweir { 530*cdf0e10cSrcweir xNewSheet->SetParent(rParentName); 531*cdf0e10cSrcweir } 532*cdf0e10cSrcweir pMyPool->SetSearchMask( eOldFamily, nMySrchMask ); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir // hat der Neue einen Follow? wenn ja, mit gleichem Namen bei uns suchen 537*cdf0e10cSrcweir if (pHisSheet->HasFollowSupport()) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir const String& rFollowName = pHisSheet->GetFollow(); 540*cdf0e10cSrcweir if (0 != rFollowName.Len()) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir SfxStyleSheetBase* pFollowOfNew = pMyPool->Find(rFollowName, 543*cdf0e10cSrcweir eOldFamily); 544*cdf0e10cSrcweir if (pFollowOfNew) 545*cdf0e10cSrcweir { 546*cdf0e10cSrcweir xNewSheet->SetFollow(rFollowName); 547*cdf0e10cSrcweir } 548*cdf0e10cSrcweir pMyPool->SetSearchMask( eOldFamily, nMySrchMask ); 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir // Bug 27347: alte Einstellung wieder setzen 553*cdf0e10cSrcweir pMyPool->SetSearchMask( eMyOldFamily, nMySrchMask ); 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir // Model geaendert 556*cdf0e10cSrcweir ASSERT(pDoc, "Doc fehlt"); 557*cdf0e10cSrcweir GetDoc()->SetModified(); 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir bRet = sal_True; 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir else 562*cdf0e10cSrcweir bRet = SfxObjectShell::Insert( rSource, 563*cdf0e10cSrcweir nSourceIdx1, 564*cdf0e10cSrcweir nSourceIdx2, 565*cdf0e10cSrcweir nSourceIdx3, 566*cdf0e10cSrcweir rIdx1, 567*cdf0e10cSrcweir rIdx2, 568*cdf0e10cSrcweir rIdx3, 569*cdf0e10cSrcweir rRemovedIdx); 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir // --> OD 2005-05-10 #i48949# - actions aren't undoable and could have change 572*cdf0e10cSrcweir // the document node array. Thus, clear the undo action stack. 573*cdf0e10cSrcweir if (undoGuard.UndoWasEnabled()) 574*cdf0e10cSrcweir { 575*cdf0e10cSrcweir GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir // <-- 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir return bRet; 580*cdf0e10cSrcweir } 581*cdf0e10cSrcweir 582*cdf0e10cSrcweir /*-------------------------------------------------------------------- 583*cdf0e10cSrcweir Beschreibung: Vorlagen Remove 584*cdf0e10cSrcweir --------------------------------------------------------------------*/ 585*cdf0e10cSrcweir 586*cdf0e10cSrcweir sal_Bool SwDocShell::Remove(sal_uInt16 nIdx1, // siehe Insert 587*cdf0e10cSrcweir sal_uInt16 nIdx2, 588*cdf0e10cSrcweir sal_uInt16 nIdx3) 589*cdf0e10cSrcweir { 590*cdf0e10cSrcweir sal_Bool bRet = sal_False; 591*cdf0e10cSrcweir 592*cdf0e10cSrcweir if (CONTENT_STYLE == nIdx1) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir SwDocStyleSheetPool* pMyPool = (SwDocStyleSheetPool*)GetStyleSheetPool(); 595*cdf0e10cSrcweir 596*cdf0e10cSrcweir pMyPool->First(); // vorm Zugriff Pool aktualisieren!! 597*cdf0e10cSrcweir SfxStyleSheetBase* pMySheet = (*pMyPool)[nIdx2]; 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir String aName( pMySheet->GetName() ); 600*cdf0e10cSrcweir SfxStyleFamily eFamily( pMySheet->GetFamily() ); 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir // dflt. PageDesc und StandardZeichenvorlage nie loeschen !!! 603*cdf0e10cSrcweir if( ( SFX_STYLE_FAMILY_PAGE == eFamily && 604*cdf0e10cSrcweir const_cast<const SwDoc *>(pDoc)->GetPageDesc(0).GetName() 605*cdf0e10cSrcweir == aName ) || 606*cdf0e10cSrcweir ( SFX_STYLE_FAMILY_CHAR == eFamily && 607*cdf0e10cSrcweir aName == *SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_STANDARD - 608*cdf0e10cSrcweir RES_POOLCOLL_TEXT_BEGIN ] )) 609*cdf0e10cSrcweir return sal_False; 610*cdf0e10cSrcweir 611*cdf0e10cSrcweir // also loeschen 612*cdf0e10cSrcweir pMyPool->Remove( pMySheet ); 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir // jetzt noch die Parents/Follows aller Instanziierten korrigieren 615*cdf0e10cSrcweir pMyPool->SetOrganizerMode( sal_True ); 616*cdf0e10cSrcweir SfxStyleSheetBase* pTestSheet = pMyPool->First(); 617*cdf0e10cSrcweir while (pTestSheet) 618*cdf0e10cSrcweir { 619*cdf0e10cSrcweir if (pTestSheet->GetFamily() == eFamily && 620*cdf0e10cSrcweir pTestSheet->HasParentSupport() && 621*cdf0e10cSrcweir pTestSheet->GetParent() == aName) 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir pTestSheet->SetParent( aEmptyStr ); // Verknuepfung aufloesen 624*cdf0e10cSrcweir } 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir if (pTestSheet->GetFamily() == eFamily && 627*cdf0e10cSrcweir pTestSheet->HasFollowSupport() && 628*cdf0e10cSrcweir pTestSheet->GetFollow() == aName) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir pTestSheet->SetFollow( aEmptyStr ); // Verknuepfung aufloesen 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir pTestSheet = pMyPool->Next(); 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir pMyPool->SetOrganizerMode( SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir bRet = sal_True; 638*cdf0e10cSrcweir } 639*cdf0e10cSrcweir else 640*cdf0e10cSrcweir bRet = SfxObjectShell::Remove( nIdx1, 641*cdf0e10cSrcweir nIdx2, 642*cdf0e10cSrcweir nIdx3 ); 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir // Model geaendert 646*cdf0e10cSrcweir ASSERT(pDoc, "Doc fehlt"); 647*cdf0e10cSrcweir GetDoc()->SetModified(); 648*cdf0e10cSrcweir 649*cdf0e10cSrcweir return bRet; 650*cdf0e10cSrcweir } 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir /*-------------------------------------------------------------------- 653*cdf0e10cSrcweir Beschreibung: 654*cdf0e10cSrcweir --------------------------------------------------------------------*/ 655*cdf0e10cSrcweir 656*cdf0e10cSrcweir void SwDocShell::Execute(SfxRequest& rReq) 657*cdf0e10cSrcweir { 658*cdf0e10cSrcweir const SfxItemSet* pArgs = rReq.GetArgs(); 659*cdf0e10cSrcweir const SfxPoolItem* pItem; 660*cdf0e10cSrcweir sal_uInt16 nWhich = rReq.GetSlot(); 661*cdf0e10cSrcweir sal_Bool bDone = sal_False; 662*cdf0e10cSrcweir switch ( nWhich ) 663*cdf0e10cSrcweir { 664*cdf0e10cSrcweir case SID_AUTO_CORRECT_DLG: 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir SvxSwAutoFmtFlags* pAFlags = &SvxAutoCorrCfg::Get()->GetAutoCorrect()->GetSwFlags(); 667*cdf0e10cSrcweir SwAutoCompleteWord& rACW = SwDoc::GetAutoCompleteWords(); 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir sal_Bool bOldLocked = rACW.IsLockWordLstLocked(), 670*cdf0e10cSrcweir bOldAutoCmpltCollectWords = pAFlags->bAutoCmpltCollectWords; 671*cdf0e10cSrcweir 672*cdf0e10cSrcweir rACW.SetLockWordLstLocked( sal_True ); 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir SvStringsISortDtor aTmpLst; 675*cdf0e10cSrcweir aTmpLst.Insert( &rACW.GetWordList() ); 676*cdf0e10cSrcweir pAFlags->pAutoCmpltList = &aTmpLst; 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir SfxApplication* pApp = SFX_APP(); 679*cdf0e10cSrcweir SfxRequest aAppReq(SID_AUTO_CORRECT_DLG, SFX_CALLMODE_SYNCHRON, pApp->GetPool()); 680*cdf0e10cSrcweir SfxBoolItem aSwOptions( SID_AUTO_CORRECT_DLG, sal_True ); 681*cdf0e10cSrcweir aAppReq.AppendItem(aSwOptions); 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir // SMARTTAGS 684*cdf0e10cSrcweir pAFlags->pSmartTagMgr = &SwSmartTagMgr::Get(); 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir //pApp->ExecuteSlot(aAppReq); 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir SfxItemSet aSet( pApp->GetPool(), SID_AUTO_CORRECT_DLG, SID_AUTO_CORRECT_DLG, SID_OPEN_SMARTTAGOPTIONS, SID_OPEN_SMARTTAGOPTIONS, 0 ); 689*cdf0e10cSrcweir aSet.Put( aSwOptions ); 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir const SfxPoolItem* pOpenSmartTagOptionsItem = 0; 692*cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( SID_OPEN_SMARTTAGOPTIONS, sal_False, &pOpenSmartTagOptionsItem ) ) 693*cdf0e10cSrcweir aSet.Put( *static_cast<const SfxBoolItem*>(pOpenSmartTagOptionsItem) ); 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); 696*cdf0e10cSrcweir SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_OFA_AUTOCORR_DLG, NULL, &aSet, NULL ); 697*cdf0e10cSrcweir pDlg->Execute(); 698*cdf0e10cSrcweir delete pDlg; 699*cdf0e10cSrcweir 700*cdf0e10cSrcweir rACW.SetLockWordLstLocked( bOldLocked ); 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir SwEditShell::SetAutoFmtFlags( pAFlags ); 703*cdf0e10cSrcweir rACW.SetMinWordLen( pAFlags->nAutoCmpltWordLen ); 704*cdf0e10cSrcweir rACW.SetMaxCount( pAFlags->nAutoCmpltListLen ); 705*cdf0e10cSrcweir if( pAFlags->pAutoCmpltList ) // any changes? 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir rACW.CheckChangedList( aTmpLst ); 708*cdf0e10cSrcweir // clear the temp WordList pointer 709*cdf0e10cSrcweir pAFlags->pAutoCmpltList = 0; 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir // remove all pointer we never delete the strings 712*cdf0e10cSrcweir aTmpLst.Remove( (sal_uInt16)0, aTmpLst.Count() ); 713*cdf0e10cSrcweir 714*cdf0e10cSrcweir if( !bOldAutoCmpltCollectWords && bOldAutoCmpltCollectWords != 715*cdf0e10cSrcweir pAFlags->bAutoCmpltCollectWords ) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir // call on all Docs the idle formatter to start 718*cdf0e10cSrcweir // the collection of Words 719*cdf0e10cSrcweir TypeId aType = TYPE(SwDocShell); 720*cdf0e10cSrcweir for( SwDocShell *pDocSh = (SwDocShell*)SfxObjectShell::GetFirst(&aType); 721*cdf0e10cSrcweir pDocSh; 722*cdf0e10cSrcweir pDocSh = (SwDocShell*)SfxObjectShell::GetNext( *pDocSh, &aType ) ) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir SwDoc* pTmp = pDocSh->GetDoc(); 725*cdf0e10cSrcweir if ( pTmp->GetCurrentViewShell() ) //swmod 071108//swmod 071225 726*cdf0e10cSrcweir pTmp->InvalidateAutoCompleteFlag(); 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir break; 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir case SID_PRINTPREVIEW: 733*cdf0e10cSrcweir { 734*cdf0e10cSrcweir sal_Bool bSet = sal_False, bFound = sal_False, bOnly = sal_True; 735*cdf0e10cSrcweir SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this); 736*cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::Current(); 737*cdf0e10cSrcweir SwView* pCurrView = dynamic_cast< SwView *> ( pViewShell ); 738*cdf0e10cSrcweir sal_Bool bCurrent = IS_TYPE( SwPagePreView, pViewShell ); 739*cdf0e10cSrcweir 740*cdf0e10cSrcweir while( pTmpFrm ) // search PreView 741*cdf0e10cSrcweir { 742*cdf0e10cSrcweir if( IS_TYPE( SwView, pTmpFrm->GetViewShell()) ) 743*cdf0e10cSrcweir bOnly = sal_False; 744*cdf0e10cSrcweir else if( IS_TYPE( SwPagePreView, pTmpFrm->GetViewShell())) 745*cdf0e10cSrcweir { 746*cdf0e10cSrcweir pTmpFrm->GetFrame().Appear(); 747*cdf0e10cSrcweir bFound = sal_True; 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir if( bFound && !bOnly ) 750*cdf0e10cSrcweir break; 751*cdf0e10cSrcweir pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this); 752*cdf0e10cSrcweir } 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == 755*cdf0e10cSrcweir pArgs->GetItemState( SID_PRINTPREVIEW, sal_False, &pItem )) 756*cdf0e10cSrcweir bSet = ((SfxBoolItem*)pItem)->GetValue(); 757*cdf0e10cSrcweir else 758*cdf0e10cSrcweir bSet = !bCurrent; 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir sal_uInt16 nSlotId = 0; 761*cdf0e10cSrcweir if( bSet && !bFound ) // Keine gefunden, daher neue Preview anlegen 762*cdf0e10cSrcweir nSlotId = SID_VIEWSHELL1; 763*cdf0e10cSrcweir else if( bFound && !bSet ) 764*cdf0e10cSrcweir nSlotId = bOnly ? SID_VIEWSHELL0 : SID_VIEWSHELL1; 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir if( nSlotId ) 767*cdf0e10cSrcweir { 768*cdf0e10cSrcweir //JP 23.8.2001: Bug 91360 - PagePreView in the WebDocShell 769*cdf0e10cSrcweir // is found under Id ViewShell2. 770*cdf0e10cSrcweir if( ISA(SwWebDocShell) && SID_VIEWSHELL1 == nSlotId ) 771*cdf0e10cSrcweir nSlotId = SID_VIEWSHELL2; 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir if( pCurrView && pCurrView->GetDocShell() == this ) 774*cdf0e10cSrcweir pTmpFrm = pCurrView->GetViewFrame(); 775*cdf0e10cSrcweir else 776*cdf0e10cSrcweir pTmpFrm = SfxViewFrame::GetFirst( this ); 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir pTmpFrm->GetDispatcher()->Execute( nSlotId, 0, 0, SFX_CALLMODE_ASYNCHRON ); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem(SID_PRINTPREVIEW, bSet )); 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir break; 784*cdf0e10cSrcweir case SID_TEMPLATE_LOAD: 785*cdf0e10cSrcweir { 786*cdf0e10cSrcweir String aFileName; 787*cdf0e10cSrcweir static sal_Bool bText = sal_True; 788*cdf0e10cSrcweir static sal_Bool bFrame = sal_False; 789*cdf0e10cSrcweir static sal_Bool bPage = sal_False; 790*cdf0e10cSrcweir static sal_Bool bNum = sal_False; 791*cdf0e10cSrcweir static sal_Bool bMerge = sal_False; 792*cdf0e10cSrcweir sal_uInt16 nRet = USHRT_MAX; 793*cdf0e10cSrcweir 794*cdf0e10cSrcweir sal_uInt16 nFlags = bFrame ? SFX_LOAD_FRAME_STYLES : 0; 795*cdf0e10cSrcweir if(bPage) 796*cdf0e10cSrcweir nFlags|= SFX_LOAD_PAGE_STYLES; 797*cdf0e10cSrcweir if(bNum) 798*cdf0e10cSrcweir nFlags|= SFX_LOAD_NUM_STYLES; 799*cdf0e10cSrcweir if(!nFlags || bText) 800*cdf0e10cSrcweir nFlags|= SFX_LOAD_TEXT_STYLES; 801*cdf0e10cSrcweir if(bMerge) 802*cdf0e10cSrcweir nFlags|= SFX_MERGE_STYLES; 803*cdf0e10cSrcweir 804*cdf0e10cSrcweir if ( pArgs ) 805*cdf0e10cSrcweir { 806*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pTemplateItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False ); 807*cdf0e10cSrcweir if ( pTemplateItem ) 808*cdf0e10cSrcweir { 809*cdf0e10cSrcweir aFileName = pTemplateItem->GetValue(); 810*cdf0e10cSrcweir SFX_REQUEST_ARG( rReq, pFlagsItem, SfxInt32Item, SID_TEMPLATE_LOAD, sal_False ); 811*cdf0e10cSrcweir if ( pFlagsItem ) 812*cdf0e10cSrcweir nFlags = (sal_uInt16) pFlagsItem->GetValue(); 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir } 815*cdf0e10cSrcweir 816*cdf0e10cSrcweir if ( !aFileName.Len() ) 817*cdf0e10cSrcweir { 818*cdf0e10cSrcweir SvtPathOptions aPathOpt; 819*cdf0e10cSrcweir SfxNewFileDialog* pNewFileDlg = 820*cdf0e10cSrcweir new SfxNewFileDialog(&GetView()->GetViewFrame()->GetWindow(), SFXWB_LOAD_TEMPLATE); 821*cdf0e10cSrcweir pNewFileDlg->SetTemplateFlags(nFlags); 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir nRet = pNewFileDlg->Execute(); 824*cdf0e10cSrcweir if(RET_TEMPLATE_LOAD == nRet) 825*cdf0e10cSrcweir { 826*cdf0e10cSrcweir FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 ); 827*cdf0e10cSrcweir uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); 828*cdf0e10cSrcweir 829*cdf0e10cSrcweir xFP->setDisplayDirectory( aPathOpt.GetWorkPath() ); 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir SfxObjectFactory &rFact = GetFactory(); 832*cdf0e10cSrcweir SfxFilterMatcher aMatcher( String::CreateFromAscii(rFact.GetShortName()) ); 833*cdf0e10cSrcweir SfxFilterMatcherIter aIter( &aMatcher ); 834*cdf0e10cSrcweir uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); 835*cdf0e10cSrcweir const SfxFilter* pFlt = aIter.First(); 836*cdf0e10cSrcweir while( pFlt ) 837*cdf0e10cSrcweir { 838*cdf0e10cSrcweir // --> OD #i117339# 839*cdf0e10cSrcweir // if( pFlt && pFlt->IsAllowedAsTemplate() ) 840*cdf0e10cSrcweir if( pFlt && pFlt->IsAllowedAsTemplate() && 841*cdf0e10cSrcweir ( pFlt->GetUserData().EqualsAscii("CXML") || 842*cdf0e10cSrcweir pFlt->GetUserData().EqualsAscii("CXMLV") ) ) 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard(); 845*cdf0e10cSrcweir xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir pFlt = aIter.Next(); 848*cdf0e10cSrcweir } 849*cdf0e10cSrcweir sal_Bool bWeb = 0 != dynamic_cast< SwWebDocShell *>( this ); 850*cdf0e10cSrcweir const SfxFilter *pOwnFlt = 851*cdf0e10cSrcweir SwDocShell::Factory().GetFilterContainer()-> 852*cdf0e10cSrcweir GetFilter4FilterName(String::CreateFromAscii("writer8")); 853*cdf0e10cSrcweir 854*cdf0e10cSrcweir //#b6439685# make sure the default file format is also available 855*cdf0e10cSrcweir if(bWeb) 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir const String sWild = ((WildCard&)pOwnFlt->GetWildcard()).GetWildCard(); 858*cdf0e10cSrcweir xFltMgr->appendFilter( pOwnFlt->GetUIName(), sWild ); 859*cdf0e10cSrcweir } 860*cdf0e10cSrcweir 861*cdf0e10cSrcweir bool bError = false; 862*cdf0e10cSrcweir //#b6439685# catch expception if wrong filter is selected - should not happen anymore 863*cdf0e10cSrcweir try 864*cdf0e10cSrcweir { 865*cdf0e10cSrcweir xFltMgr->setCurrentFilter( pOwnFlt->GetUIName() ); 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir catch( const uno::Exception& ) 868*cdf0e10cSrcweir { 869*cdf0e10cSrcweir bError = true; 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir if( !bError && ERRCODE_NONE == aDlgHelper.Execute() ) 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir aFileName = xFP->getFiles().getConstArray()[0]; 875*cdf0e10cSrcweir } 876*cdf0e10cSrcweir } 877*cdf0e10cSrcweir else if( RET_OK == nRet) 878*cdf0e10cSrcweir { 879*cdf0e10cSrcweir aFileName = pNewFileDlg->GetTemplateFileName(); 880*cdf0e10cSrcweir } 881*cdf0e10cSrcweir 882*cdf0e10cSrcweir nFlags = pNewFileDlg->GetTemplateFlags(); 883*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aFileName ) ); 884*cdf0e10cSrcweir rReq.AppendItem( SfxInt32Item( SID_TEMPLATE_LOAD, (long) nFlags ) ); 885*cdf0e10cSrcweir delete pNewFileDlg; 886*cdf0e10cSrcweir } 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir if( aFileName.Len() ) 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir SwgReaderOption aOpt; 891*cdf0e10cSrcweir aOpt.SetTxtFmts( bText = (0 != (nFlags&SFX_LOAD_TEXT_STYLES) )); 892*cdf0e10cSrcweir aOpt.SetFrmFmts( bFrame = (0 != (nFlags&SFX_LOAD_FRAME_STYLES))); 893*cdf0e10cSrcweir aOpt.SetPageDescs( bPage = (0 != (nFlags&SFX_LOAD_PAGE_STYLES ))); 894*cdf0e10cSrcweir aOpt.SetNumRules( bNum = (0 != (nFlags&SFX_LOAD_NUM_STYLES ))); 895*cdf0e10cSrcweir //different meaning between SFX_MERGE_STYLES and aOpt.SetMerge! 896*cdf0e10cSrcweir bMerge = 0 != (nFlags&SFX_MERGE_STYLES); 897*cdf0e10cSrcweir aOpt.SetMerge( !bMerge ); 898*cdf0e10cSrcweir 899*cdf0e10cSrcweir SetError( LoadStylesFromFile( aFileName, aOpt, sal_False ), ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )); 900*cdf0e10cSrcweir if ( !GetError() ) 901*cdf0e10cSrcweir rReq.Done(); 902*cdf0e10cSrcweir } 903*cdf0e10cSrcweir } 904*cdf0e10cSrcweir break; 905*cdf0e10cSrcweir case SID_SOURCEVIEW: 906*cdf0e10cSrcweir { 907*cdf0e10cSrcweir SfxViewShell* pViewShell = GetView() 908*cdf0e10cSrcweir ? (SfxViewShell*)GetView() 909*cdf0e10cSrcweir : SfxViewShell::Current(); 910*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pViewShell->GetViewFrame(); 911*cdf0e10cSrcweir SwSrcView* pSrcView = dynamic_cast< SwSrcView *>( pViewShell ); 912*cdf0e10cSrcweir if(!pSrcView) 913*cdf0e10cSrcweir { 914*cdf0e10cSrcweir // 3 possible state: 915*cdf0e10cSrcweir // 1 - file unsaved -> save as HTML 916*cdf0e10cSrcweir // 2 - file modified and HTML filter active -> save 917*cdf0e10cSrcweir // 3 - file saved in non-HTML -> QueryBox to save as HTML 918*cdf0e10cSrcweir const SfxFilter* pHtmlFlt = 919*cdf0e10cSrcweir SwIoSystem::GetFilterOfFormat( 920*cdf0e10cSrcweir String::CreateFromAscii("HTML"), 921*cdf0e10cSrcweir SwWebDocShell::Factory().GetFilterContainer() ); 922*cdf0e10cSrcweir sal_Bool bLocalHasName = HasName(); 923*cdf0e10cSrcweir if(bLocalHasName) 924*cdf0e10cSrcweir { 925*cdf0e10cSrcweir //check for filter type 926*cdf0e10cSrcweir const SfxFilter* pFlt = GetMedium()->GetFilter(); 927*cdf0e10cSrcweir if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData()) 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir QueryBox aQuery(&pViewFrm->GetWindow(), SW_RES(MSG_SAVEAS_HTML_QUERY)); 930*cdf0e10cSrcweir if(RET_YES == aQuery.Execute()) 931*cdf0e10cSrcweir bLocalHasName = sal_False; 932*cdf0e10cSrcweir else 933*cdf0e10cSrcweir break; 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir } 936*cdf0e10cSrcweir if(!bLocalHasName) 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION, 0 ); 939*cdf0e10cSrcweir aDlgHelper.AddFilter( pHtmlFlt->GetFilterName(), pHtmlFlt->GetDefaultExtension() ); 940*cdf0e10cSrcweir aDlgHelper.SetCurrentFilter( pHtmlFlt->GetFilterName() ); 941*cdf0e10cSrcweir if( ERRCODE_NONE != aDlgHelper.Execute()) 942*cdf0e10cSrcweir { 943*cdf0e10cSrcweir break; 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir String sPath = aDlgHelper.GetPath(); 946*cdf0e10cSrcweir SfxStringItem aName(SID_FILE_NAME, sPath); 947*cdf0e10cSrcweir SfxStringItem aFilter(SID_FILTER_NAME, pHtmlFlt->GetName()); 948*cdf0e10cSrcweir const SfxBoolItem* pBool = (const SfxBoolItem*) 949*cdf0e10cSrcweir pViewFrm->GetDispatcher()->Execute( 950*cdf0e10cSrcweir SID_SAVEASDOC, SFX_CALLMODE_SYNCHRON, &aName, &aFilter, 0L ); 951*cdf0e10cSrcweir if(!pBool || !pBool->GetValue()) 952*cdf0e10cSrcweir break; 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir #ifdef DBG_UTIL 956*cdf0e10cSrcweir { 957*cdf0e10cSrcweir sal_Bool bWeb = 0 != dynamic_cast<SwWebDocShell*>(this); 958*cdf0e10cSrcweir DBG_ASSERT(bWeb == sal_True, "SourceView nur in der WebDocShell"); 959*cdf0e10cSrcweir } 960*cdf0e10cSrcweir #endif 961*cdf0e10cSrcweir // die SourceView ist fuer die SwWebDocShell die 1 962*cdf0e10cSrcweir sal_uInt16 nSlot = SID_VIEWSHELL1; 963*cdf0e10cSrcweir sal_Bool bSetModified = sal_False; 964*cdf0e10cSrcweir SfxPrinter* pSavePrinter = 0; 965*cdf0e10cSrcweir if( 0 != pSrcView) 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir SfxPrinter* pTemp = GetDoc()->getPrinter( false ); 968*cdf0e10cSrcweir if(pTemp) 969*cdf0e10cSrcweir pSavePrinter = new SfxPrinter(*pTemp); 970*cdf0e10cSrcweir bSetModified = IsModified() || pSrcView->IsModified(); 971*cdf0e10cSrcweir if(pSrcView->IsModified()||pSrcView->HasSourceSaved()) 972*cdf0e10cSrcweir { 973*cdf0e10cSrcweir utl::TempFile aTempFile; 974*cdf0e10cSrcweir aTempFile.EnableKillingFile(); 975*cdf0e10cSrcweir pSrcView->SaveContent(aTempFile.GetURL()); 976*cdf0e10cSrcweir bDone = sal_True; 977*cdf0e10cSrcweir SvxMacro aMac(aEmptyStr, aEmptyStr, STARBASIC); 978*cdf0e10cSrcweir SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_OPENDOC ), aMac, this); 979*cdf0e10cSrcweir SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEDOC ), aMac, this); 980*cdf0e10cSrcweir SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), aMac, this); 981*cdf0e10cSrcweir SfxEventConfiguration::ConfigureEvent(GlobalEventConfig::GetEventName( STR_EVENT_DEACTIVATEDOC ), aMac, this); 982*cdf0e10cSrcweir ReloadFromHtml(aTempFile.GetURL(), pSrcView); 983*cdf0e10cSrcweir nSlot = 0; 984*cdf0e10cSrcweir } 985*cdf0e10cSrcweir else 986*cdf0e10cSrcweir { 987*cdf0e10cSrcweir nSlot = SID_VIEWSHELL0; 988*cdf0e10cSrcweir } 989*cdf0e10cSrcweir } 990*cdf0e10cSrcweir /* OS 10.04.97 14.20: Im Web-Writer gibt es keinen Unterschied zwischen 991*cdf0e10cSrcweir Export in den SourceMode und dem Speichern des Docs 992*cdf0e10cSrcweir else if(IsModified()) 993*cdf0e10cSrcweir { 994*cdf0e10cSrcweir sal_uInt16 nRet = QueryBox( SFX_APPWINDOW ,SW_RES(MSG_SAVE_HTML_QUERY)).Execute(); 995*cdf0e10cSrcweir if(RET_YES == nRet) 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir S F X _DISPATCHER().Execute(SID_SAVEDOC, 998*cdf0e10cSrcweir SFX_CALLMODE_SYNCHRON); 999*cdf0e10cSrcweir // der ReturnValue von SID_SAVEDOC ist etwas schwer verstaendlich 1000*cdf0e10cSrcweir if(IsModified()) 1001*cdf0e10cSrcweir nSlot = 0; 1002*cdf0e10cSrcweir } 1003*cdf0e10cSrcweir else if( RET_CANCEL == nRet ) 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir nSlot = 0; 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir }*/ 1008*cdf0e10cSrcweir if(nSlot) 1009*cdf0e10cSrcweir pViewFrm->GetDispatcher()->Execute(nSlot, SFX_CALLMODE_SYNCHRON); 1010*cdf0e10cSrcweir if(bSetModified) 1011*cdf0e10cSrcweir GetDoc()->SetModified(); 1012*cdf0e10cSrcweir if(pSavePrinter) 1013*cdf0e10cSrcweir { 1014*cdf0e10cSrcweir GetDoc()->setPrinter( pSavePrinter, true, true); 1015*cdf0e10cSrcweir //pSavePrinter darf nicht wieder geloescht werden 1016*cdf0e10cSrcweir } 1017*cdf0e10cSrcweir pViewFrm->GetBindings().SetState(SfxBoolItem(SID_SOURCEVIEW, nSlot == SID_VIEWSHELL2)); 1018*cdf0e10cSrcweir pViewFrm->GetBindings().Invalidate( SID_NEWWINDOW ); 1019*cdf0e10cSrcweir pViewFrm->GetBindings().Invalidate( SID_BROWSER_MODE ); 1020*cdf0e10cSrcweir pViewFrm->GetBindings().Invalidate( FN_PRINT_LAYOUT ); 1021*cdf0e10cSrcweir } 1022*cdf0e10cSrcweir break; 1023*cdf0e10cSrcweir case SID_GET_COLORTABLE: 1024*cdf0e10cSrcweir { 1025*cdf0e10cSrcweir SvxColorTableItem* pColItem = (SvxColorTableItem*)GetItem(SID_COLOR_TABLE); 1026*cdf0e10cSrcweir XColorTable* pTable = pColItem->GetColorTable(); 1027*cdf0e10cSrcweir rReq.SetReturnValue(OfaPtrItem(SID_GET_COLORTABLE, pTable)); 1028*cdf0e10cSrcweir } 1029*cdf0e10cSrcweir break; 1030*cdf0e10cSrcweir case FN_ABSTRACT_STARIMPRESS: 1031*cdf0e10cSrcweir case FN_ABSTRACT_NEWDOC: 1032*cdf0e10cSrcweir { 1033*cdf0e10cSrcweir SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); 1034*cdf0e10cSrcweir DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); 1035*cdf0e10cSrcweir 1036*cdf0e10cSrcweir AbstractSwInsertAbstractDlg* pDlg = pFact->CreateSwInsertAbstractDlg(0, DLG_INSERT_ABSTRACT ); 1037*cdf0e10cSrcweir DBG_ASSERT(pDlg, "Dialogdiet fail!"); 1038*cdf0e10cSrcweir if(RET_OK == pDlg->Execute()) 1039*cdf0e10cSrcweir { 1040*cdf0e10cSrcweir sal_uInt8 nLevel = pDlg->GetLevel(); 1041*cdf0e10cSrcweir sal_uInt8 nPara = pDlg->GetPara(); 1042*cdf0e10cSrcweir SwDoc* pSmryDoc = new SwDoc(); 1043*cdf0e10cSrcweir SfxObjectShellLock xDocSh( new SwDocShell( pSmryDoc, SFX_CREATE_MODE_STANDARD)); 1044*cdf0e10cSrcweir xDocSh->DoInitNew( 0 ); 1045*cdf0e10cSrcweir 1046*cdf0e10cSrcweir sal_Bool bImpress = FN_ABSTRACT_STARIMPRESS == nWhich; 1047*cdf0e10cSrcweir pDoc->Summary( pSmryDoc, nLevel, nPara, bImpress ); 1048*cdf0e10cSrcweir if( bImpress ) 1049*cdf0e10cSrcweir { 1050*cdf0e10cSrcweir WriterRef xWrt; 1051*cdf0e10cSrcweir // mba: looks as if relative URLs don't make sense here 1052*cdf0e10cSrcweir ::GetRTFWriter( aEmptyStr, String(), xWrt ); 1053*cdf0e10cSrcweir SvMemoryStream *pStrm = new SvMemoryStream(); 1054*cdf0e10cSrcweir pStrm->SetBufferSize( 16348 ); 1055*cdf0e10cSrcweir SwWriter aWrt( *pStrm, *pSmryDoc ); 1056*cdf0e10cSrcweir ErrCode eErr = aWrt.Write( xWrt ); 1057*cdf0e10cSrcweir if( !ERRCODE_TOERROR( eErr ) ) 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); 1060*cdf0e10cSrcweir uno::Reference< frame::XDispatchProvider > xProv( 1061*cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY ); 1062*cdf0e10cSrcweir if ( xProv.is() ) 1063*cdf0e10cSrcweir { 1064*cdf0e10cSrcweir ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( "SendOutlineToImpress" ); 1065*cdf0e10cSrcweir uno::Reference< frame::XDispatchHelper > xHelper( 1066*cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY ); 1067*cdf0e10cSrcweir if ( xHelper.is() ) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir pStrm->Seek( STREAM_SEEK_TO_END ); 1070*cdf0e10cSrcweir *pStrm << '\0'; 1071*cdf0e10cSrcweir pStrm->Seek( STREAM_SEEK_TO_BEGIN ); 1072*cdf0e10cSrcweir 1073*cdf0e10cSrcweir // Transfer ownership of stream to a lockbytes object 1074*cdf0e10cSrcweir SvLockBytes aLockBytes( pStrm, sal_True ); 1075*cdf0e10cSrcweir SvLockBytesStat aStat; 1076*cdf0e10cSrcweir if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE ) 1077*cdf0e10cSrcweir { 1078*cdf0e10cSrcweir sal_uInt32 nLen = aStat.nSize; 1079*cdf0e10cSrcweir sal_uLong nRead = 0; 1080*cdf0e10cSrcweir uno::Sequence< sal_Int8 > aSeq( nLen ); 1081*cdf0e10cSrcweir aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead ); 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aArgs(1); 1084*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString::createFromAscii("RtfOutline"); 1085*cdf0e10cSrcweir aArgs[0].Value <<= aSeq; 1086*cdf0e10cSrcweir xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs ); 1087*cdf0e10cSrcweir } 1088*cdf0e10cSrcweir } 1089*cdf0e10cSrcweir } 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir else 1092*cdf0e10cSrcweir ErrorHandler::HandleError(ErrCode( eErr )); 1093*cdf0e10cSrcweir } 1094*cdf0e10cSrcweir else 1095*cdf0e10cSrcweir { 1096*cdf0e10cSrcweir // Neues Dokument erzeugen. 1097*cdf0e10cSrcweir SfxViewFrame *pFrame = SfxViewFrame::LoadDocument( *xDocSh, 0 ); 1098*cdf0e10cSrcweir SwView *pCurrView = (SwView*) pFrame->GetViewShell(); 1099*cdf0e10cSrcweir 1100*cdf0e10cSrcweir // Dokumenttitel setzen 1101*cdf0e10cSrcweir String aTmp( SW_RES(STR_ABSTRACT_TITLE) ); 1102*cdf0e10cSrcweir aTmp += GetTitle(); 1103*cdf0e10cSrcweir xDocSh->SetTitle( aTmp ); 1104*cdf0e10cSrcweir pCurrView->GetWrtShell().SetNewDoc(); 1105*cdf0e10cSrcweir pFrame->Show(); 1106*cdf0e10cSrcweir pSmryDoc->SetModified(); 1107*cdf0e10cSrcweir } 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir } 1110*cdf0e10cSrcweir delete pDlg; 1111*cdf0e10cSrcweir } 1112*cdf0e10cSrcweir break; 1113*cdf0e10cSrcweir case FN_OUTLINE_TO_CLIPBOARD: 1114*cdf0e10cSrcweir case FN_OUTLINE_TO_IMPRESS: 1115*cdf0e10cSrcweir { 1116*cdf0e10cSrcweir sal_Bool bEnable = IsEnableSetModified(); 1117*cdf0e10cSrcweir EnableSetModified( sal_False ); 1118*cdf0e10cSrcweir WriterRef xWrt; 1119*cdf0e10cSrcweir // mba: looks as if relative URLs don't make sense here 1120*cdf0e10cSrcweir ::GetRTFWriter( 'O', String(), xWrt ); 1121*cdf0e10cSrcweir SvMemoryStream *pStrm = new SvMemoryStream(); 1122*cdf0e10cSrcweir pStrm->SetBufferSize( 16348 ); 1123*cdf0e10cSrcweir SwWriter aWrt( *pStrm, *GetDoc() ); 1124*cdf0e10cSrcweir ErrCode eErr = aWrt.Write( xWrt ); 1125*cdf0e10cSrcweir EnableSetModified( bEnable ); 1126*cdf0e10cSrcweir if( !ERRCODE_TOERROR( eErr ) ) 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir pStrm->Seek( STREAM_SEEK_TO_END ); 1129*cdf0e10cSrcweir *pStrm << '\0'; 1130*cdf0e10cSrcweir pStrm->Seek( STREAM_SEEK_TO_BEGIN ); 1131*cdf0e10cSrcweir if ( nWhich == FN_OUTLINE_TO_IMPRESS ) 1132*cdf0e10cSrcweir { 1133*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xORB = ::comphelper::getProcessServiceFactory(); 1134*cdf0e10cSrcweir uno::Reference< frame::XDispatchProvider > xProv( 1135*cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.drawing.ModuleDispatcher")), UNO_QUERY ); 1136*cdf0e10cSrcweir if ( xProv.is() ) 1137*cdf0e10cSrcweir { 1138*cdf0e10cSrcweir ::rtl::OUString aCmd = ::rtl::OUString::createFromAscii( "SendOutlineToImpress" ); 1139*cdf0e10cSrcweir uno::Reference< frame::XDispatchHelper > xHelper( 1140*cdf0e10cSrcweir xORB->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.frame.DispatchHelper")), UNO_QUERY ); 1141*cdf0e10cSrcweir if ( xHelper.is() ) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir pStrm->Seek( STREAM_SEEK_TO_END ); 1144*cdf0e10cSrcweir *pStrm << '\0'; 1145*cdf0e10cSrcweir pStrm->Seek( STREAM_SEEK_TO_BEGIN ); 1146*cdf0e10cSrcweir 1147*cdf0e10cSrcweir // Transfer ownership of stream to a lockbytes object 1148*cdf0e10cSrcweir SvLockBytes aLockBytes( pStrm, sal_True ); 1149*cdf0e10cSrcweir SvLockBytesStat aStat; 1150*cdf0e10cSrcweir if ( aLockBytes.Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE ) 1151*cdf0e10cSrcweir { 1152*cdf0e10cSrcweir sal_uInt32 nLen = aStat.nSize; 1153*cdf0e10cSrcweir sal_uLong nRead = 0; 1154*cdf0e10cSrcweir uno::Sequence< sal_Int8 > aSeq( nLen ); 1155*cdf0e10cSrcweir aLockBytes.ReadAt( 0, aSeq.getArray(), nLen, &nRead ); 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aArgs(1); 1158*cdf0e10cSrcweir aArgs[0].Name = ::rtl::OUString::createFromAscii("RtfOutline"); 1159*cdf0e10cSrcweir aArgs[0].Value <<= aSeq; 1160*cdf0e10cSrcweir xHelper->executeDispatch( xProv, aCmd, ::rtl::OUString(), 0, aArgs ); 1161*cdf0e10cSrcweir } 1162*cdf0e10cSrcweir } 1163*cdf0e10cSrcweir } 1164*cdf0e10cSrcweir } 1165*cdf0e10cSrcweir else 1166*cdf0e10cSrcweir { 1167*cdf0e10cSrcweir TransferDataContainer* pClipCntnr = 1168*cdf0e10cSrcweir new TransferDataContainer; 1169*cdf0e10cSrcweir STAR_REFERENCE( datatransfer::XTransferable ) 1170*cdf0e10cSrcweir xRef( pClipCntnr ); 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir pClipCntnr->CopyAnyData( FORMAT_RTF, (sal_Char*) 1173*cdf0e10cSrcweir pStrm->GetData(), pStrm->GetEndOfData() ); 1174*cdf0e10cSrcweir pClipCntnr->CopyToClipboard( 1175*cdf0e10cSrcweir GetView()? (Window*)&GetView()->GetEditWin() : 0 ); 1176*cdf0e10cSrcweir delete pStrm; 1177*cdf0e10cSrcweir } 1178*cdf0e10cSrcweir } 1179*cdf0e10cSrcweir else 1180*cdf0e10cSrcweir ErrorHandler::HandleError(ErrCode( eErr )); 1181*cdf0e10cSrcweir } 1182*cdf0e10cSrcweir break; 1183*cdf0e10cSrcweir case SID_SPELLCHECKER_CHANGED: 1184*cdf0e10cSrcweir //! sal_False, sal_True, sal_True is on the save side but a probably overdone 1185*cdf0e10cSrcweir SW_MOD()->CheckSpellChanges(sal_False, sal_True, sal_True, sal_False ); 1186*cdf0e10cSrcweir break; 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir case SID_MAIL_PREPAREEXPORT: 1189*cdf0e10cSrcweir { 1190*cdf0e10cSrcweir //pWrtShell is not set in page preview 1191*cdf0e10cSrcweir if(pWrtShell) 1192*cdf0e10cSrcweir pWrtShell->StartAllAction(); 1193*cdf0e10cSrcweir pDoc->UpdateFlds( NULL, false ); 1194*cdf0e10cSrcweir pDoc->EmbedAllLinks(); 1195*cdf0e10cSrcweir pDoc->RemoveInvisibleContent(); 1196*cdf0e10cSrcweir if(pWrtShell) 1197*cdf0e10cSrcweir pWrtShell->EndAllAction(); 1198*cdf0e10cSrcweir } 1199*cdf0e10cSrcweir break; 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir case SID_MAIL_EXPORT_FINISHED: 1202*cdf0e10cSrcweir { 1203*cdf0e10cSrcweir if(pWrtShell) 1204*cdf0e10cSrcweir pWrtShell->StartAllAction(); 1205*cdf0e10cSrcweir //try to undo the removal of invisible content 1206*cdf0e10cSrcweir pDoc->RestoreInvisibleContent(); 1207*cdf0e10cSrcweir if(pWrtShell) 1208*cdf0e10cSrcweir pWrtShell->EndAllAction(); 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir break; 1211*cdf0e10cSrcweir case FN_NEW_HTML_DOC: 1212*cdf0e10cSrcweir case FN_NEW_GLOBAL_DOC: 1213*cdf0e10cSrcweir { 1214*cdf0e10cSrcweir bDone = sal_False; 1215*cdf0e10cSrcweir sal_Bool bCreateHtml = FN_NEW_HTML_DOC == nWhich; 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir sal_Bool bCreateByOutlineLevel = false; //#outline level,add by zhaojianwei 1218*cdf0e10cSrcweir sal_Int32 nTemplateOutlineLevel = 0 ; //#outline level,add by zhaojianwei 1219*cdf0e10cSrcweir 1220*cdf0e10cSrcweir String aFileName, aTemplateName; 1221*cdf0e10cSrcweir if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich, sal_False, &pItem ) ) 1222*cdf0e10cSrcweir { 1223*cdf0e10cSrcweir aFileName = ((const SfxStringItem*)pItem)->GetValue(); 1224*cdf0e10cSrcweir SFX_ITEMSET_ARG( pArgs, pTemplItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False ); 1225*cdf0e10cSrcweir if ( pTemplItem ) 1226*cdf0e10cSrcweir aTemplateName = pTemplItem->GetValue(); 1227*cdf0e10cSrcweir } 1228*cdf0e10cSrcweir bool bError = false; 1229*cdf0e10cSrcweir if ( !aFileName.Len() ) 1230*cdf0e10cSrcweir { 1231*cdf0e10cSrcweir FileDialogHelper aDlgHelper( TemplateDescription::FILESAVE_AUTOEXTENSION_TEMPLATE, 0 ); 1232*cdf0e10cSrcweir 1233*cdf0e10cSrcweir const sal_Int16 nControlIds[] = { 1234*cdf0e10cSrcweir CommonFilePickerElementIds::PUSHBUTTON_OK, 1235*cdf0e10cSrcweir CommonFilePickerElementIds::PUSHBUTTON_CANCEL, 1236*cdf0e10cSrcweir CommonFilePickerElementIds::LISTBOX_FILTER, 1237*cdf0e10cSrcweir CommonFilePickerElementIds::CONTROL_FILEVIEW, 1238*cdf0e10cSrcweir CommonFilePickerElementIds::EDIT_FILEURL, 1239*cdf0e10cSrcweir ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 1240*cdf0e10cSrcweir ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, 1241*cdf0e10cSrcweir 0 1242*cdf0e10cSrcweir }; 1243*cdf0e10cSrcweir 1244*cdf0e10cSrcweir const char* aHTMLHelpIds[] = 1245*cdf0e10cSrcweir { 1246*cdf0e10cSrcweir HID_SEND_HTML_CTRL_PUSHBUTTON_OK, 1247*cdf0e10cSrcweir HID_SEND_HTML_CTRL_PUSHBUTTON_CANCEL, 1248*cdf0e10cSrcweir HID_SEND_HTML_CTRL_LISTBOX_FILTER, 1249*cdf0e10cSrcweir HID_SEND_HTML_CTRL_CONTROL_FILEVIEW, 1250*cdf0e10cSrcweir HID_SEND_HTML_CTRL_EDIT_FILEURL, 1251*cdf0e10cSrcweir HID_SEND_HTML_CTRL_CHECKBOX_AUTOEXTENSION, 1252*cdf0e10cSrcweir HID_SEND_HTML_CTRL_LISTBOX_TEMPLATE, 1253*cdf0e10cSrcweir "" 1254*cdf0e10cSrcweir }; 1255*cdf0e10cSrcweir 1256*cdf0e10cSrcweir const char* aMasterHelpIds[] = 1257*cdf0e10cSrcweir { 1258*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_PUSHBUTTON_OK, 1259*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_PUSHBUTTON_CANCEL, 1260*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_LISTBOX_FILTER, 1261*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_CONTROL_FILEVIEW, 1262*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_EDIT_FILEURL, 1263*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_CHECKBOX_AUTOEXTENSION, 1264*cdf0e10cSrcweir HID_SEND_MASTER_CTRL_LISTBOX_TEMPLATE, 1265*cdf0e10cSrcweir "" 1266*cdf0e10cSrcweir }; 1267*cdf0e10cSrcweir 1268*cdf0e10cSrcweir const char** pHelpIds = bCreateHtml ? aHTMLHelpIds : aMasterHelpIds; 1269*cdf0e10cSrcweir aDlgHelper.SetControlHelpIds( nControlIds, pHelpIds ); 1270*cdf0e10cSrcweir uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); 1271*cdf0e10cSrcweir 1272*cdf0e10cSrcweir const SfxFilter* pFlt; 1273*cdf0e10cSrcweir sal_uInt16 nStrId; 1274*cdf0e10cSrcweir 1275*cdf0e10cSrcweir if( bCreateHtml ) 1276*cdf0e10cSrcweir { 1277*cdf0e10cSrcweir // fuer HTML gibts es nur einen Filter!! 1278*cdf0e10cSrcweir pFlt = SwIoSystem::GetFilterOfFormat( 1279*cdf0e10cSrcweir String::CreateFromAscii("HTML"), 1280*cdf0e10cSrcweir SwWebDocShell::Factory().GetFilterContainer() ); 1281*cdf0e10cSrcweir nStrId = STR_LOAD_HTML_DOC; 1282*cdf0e10cSrcweir } 1283*cdf0e10cSrcweir else 1284*cdf0e10cSrcweir { 1285*cdf0e10cSrcweir // Fuer Global-Dokumente bieten wir jetzt auch nur 1286*cdf0e10cSrcweir // noch den aktuellen an. 1287*cdf0e10cSrcweir pFlt = SwGlobalDocShell::Factory().GetFilterContainer()-> 1288*cdf0e10cSrcweir GetFilter4Extension( String::CreateFromAscii("odm") ); 1289*cdf0e10cSrcweir nStrId = STR_LOAD_GLOBAL_DOC; 1290*cdf0e10cSrcweir } 1291*cdf0e10cSrcweir 1292*cdf0e10cSrcweir if( pFlt ) 1293*cdf0e10cSrcweir { 1294*cdf0e10cSrcweir uno::Reference<XFilterManager> xFltMgr(xFP, UNO_QUERY); 1295*cdf0e10cSrcweir const String sWild = ((WildCard&)pFlt->GetWildcard()).GetWildCard(); 1296*cdf0e10cSrcweir xFltMgr->appendFilter( pFlt->GetUIName(), sWild ); 1297*cdf0e10cSrcweir try 1298*cdf0e10cSrcweir { 1299*cdf0e10cSrcweir xFltMgr->setCurrentFilter( pFlt->GetUIName() ) ; 1300*cdf0e10cSrcweir } 1301*cdf0e10cSrcweir catch( const uno::Exception& ) 1302*cdf0e10cSrcweir { 1303*cdf0e10cSrcweir bError = true; 1304*cdf0e10cSrcweir } 1305*cdf0e10cSrcweir } 1306*cdf0e10cSrcweir if(!bError) 1307*cdf0e10cSrcweir { 1308*cdf0e10cSrcweir uno::Reference<XFilePickerControlAccess> xCtrlAcc(xFP, UNO_QUERY); 1309*cdf0e10cSrcweir 1310*cdf0e10cSrcweir //#removed by zhaojianwei 1311*cdf0e10cSrcweir 1312*cdf0e10cSrcweir // const sal_uInt16 nCount = pDoc->GetTxtFmtColls()->Count(); 1313*cdf0e10cSrcweir // Sequence<OUString> aListBoxEntries(nCount); 1314*cdf0e10cSrcweir // OUString* pEntries = aListBoxEntries.getArray(); 1315*cdf0e10cSrcweir // sal_Int32 nIdx = 0; 1316*cdf0e10cSrcweir // sal_Int16 nSelect = 0; 1317*cdf0e10cSrcweir // OUString sStartTemplate; 1318*cdf0e10cSrcweir // SwTxtFmtColl *pFnd = 0, *pAny = 0; 1319*cdf0e10cSrcweir // for(sal_uInt16 i = 0; i < nCount; ++i) 1320*cdf0e10cSrcweir // { 1321*cdf0e10cSrcweir // SwTxtFmtColl &rTxtColl = 1322*cdf0e10cSrcweir // *pDoc->GetTxtFmtColls()->GetObject( i ); 1323*cdf0e10cSrcweir // if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() ) 1324*cdf0e10cSrcweir // { 1325*cdf0e10cSrcweir // //if( MAXLEVEL >= rTxtColl.GetOutlineLevel() && ( !pFnd || //#outline level,zhaojianwei 1326*cdf0e10cSrcweir //if( rTxtColl.IsAssignedToListLevelOfOutlineStyle() && ( !pFnd || //<-end,zhaojianwei 1327*cdf0e10cSrcweir // pFnd->GetAssignedOutlineStyleLevel() > rTxtColl.GetAssignedOutlineStyleLevel() )) 1328*cdf0e10cSrcweir // { 1329*cdf0e10cSrcweir // nSelect = (sal_Int16)nIdx; 1330*cdf0e10cSrcweir // pFnd = &rTxtColl; 1331*cdf0e10cSrcweir // sStartTemplate = rTxtColl.GetName(); 1332*cdf0e10cSrcweir // } 1333*cdf0e10cSrcweir // else if( !pAny ) 1334*cdf0e10cSrcweir // pAny = &rTxtColl; 1335*cdf0e10cSrcweir // //pEntries[nIdx++] = rTxtColl.GetName(); //#outline level,remove by zhaojianwei 1336*cdf0e10cSrcweir // pEntries[nIdx++] = sStyles + rTxtColl.GetName(); //#outline level,add by zhaojianwei 1337*cdf0e10cSrcweir // } 1338*cdf0e10cSrcweir // } 1339*cdf0e10cSrcweir // if(!sStartTemplate.getLength() && pAny) 1340*cdf0e10cSrcweir // sStartTemplate = pAny->GetName(); 1341*cdf0e10cSrcweir // aListBoxEntries.realloc(nIdx); 1342*cdf0e10cSrcweir //<-end,zhaojianwei 1343*cdf0e10cSrcweir 1344*cdf0e10cSrcweir 1345*cdf0e10cSrcweir //#outline level,add by zhaojianwei 1346*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////// 1347*cdf0e10cSrcweir 1348*cdf0e10cSrcweir bool bOutline[MAXLEVEL] = {false}; 1349*cdf0e10cSrcweir const SwOutlineNodes& rOutlNds = pDoc->GetNodes().GetOutLineNds(); 1350*cdf0e10cSrcweir if( rOutlNds.Count() ) 1351*cdf0e10cSrcweir { 1352*cdf0e10cSrcweir int nLevel; 1353*cdf0e10cSrcweir for(sal_uInt16 n = 0; n < rOutlNds.Count(); ++n ) 1354*cdf0e10cSrcweir if( ( nLevel = rOutlNds[n]->GetTxtNode()->GetAttrOutlineLevel()) > 0 && 1355*cdf0e10cSrcweir ! bOutline[nLevel-1] ) 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir bOutline[nLevel-1] = true; 1358*cdf0e10cSrcweir } 1359*cdf0e10cSrcweir } 1360*cdf0e10cSrcweir 1361*cdf0e10cSrcweir const sal_uInt16 nStyleCount = pDoc->GetTxtFmtColls()->Count(); 1362*cdf0e10cSrcweir Sequence<OUString> aListBoxEntries( MAXLEVEL + nStyleCount); 1363*cdf0e10cSrcweir OUString* pEntries = aListBoxEntries.getArray(); 1364*cdf0e10cSrcweir sal_Int32 nIdx = 0 ; 1365*cdf0e10cSrcweir 1366*cdf0e10cSrcweir OUString sOutline( SW_RESSTR(STR_FDLG_OUTLINE_LEVEL) ); 1367*cdf0e10cSrcweir for( sal_uInt16 i = 0; i < MAXLEVEL; ++i ) 1368*cdf0e10cSrcweir { 1369*cdf0e10cSrcweir if( bOutline[i] ) 1370*cdf0e10cSrcweir pEntries[nIdx++] = sOutline + String::CreateFromInt32( i+1 ); 1371*cdf0e10cSrcweir } 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir OUString sStyle( SW_RESSTR(STR_FDLG_STYLE) ); 1374*cdf0e10cSrcweir for(sal_uInt16 i = 0; i < nStyleCount; ++i) 1375*cdf0e10cSrcweir { 1376*cdf0e10cSrcweir SwTxtFmtColl &rTxtColl = 1377*cdf0e10cSrcweir *pDoc->GetTxtFmtColls()->GetObject( i ); 1378*cdf0e10cSrcweir if( !rTxtColl.IsDefault() && rTxtColl.IsAtDocNodeSet() ) 1379*cdf0e10cSrcweir { 1380*cdf0e10cSrcweir pEntries[nIdx++] = sStyle + rTxtColl.GetName(); 1381*cdf0e10cSrcweir } 1382*cdf0e10cSrcweir } 1383*cdf0e10cSrcweir 1384*cdf0e10cSrcweir aListBoxEntries.realloc(nIdx); 1385*cdf0e10cSrcweir sal_Int16 nSelect = 0; 1386*cdf0e10cSrcweir ///////////////////////////////////////////////////////////////////// 1387*cdf0e10cSrcweir //<-end,zhaojianwei 1388*cdf0e10cSrcweir 1389*cdf0e10cSrcweir try 1390*cdf0e10cSrcweir { 1391*cdf0e10cSrcweir Any aTemplates(&aListBoxEntries, ::getCppuType(&aListBoxEntries)); 1392*cdf0e10cSrcweir 1393*cdf0e10cSrcweir xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, 1394*cdf0e10cSrcweir ListboxControlActions::ADD_ITEMS , aTemplates ); 1395*cdf0e10cSrcweir Any aSelectPos(&nSelect, ::getCppuType(&nSelect)); 1396*cdf0e10cSrcweir xCtrlAcc->setValue( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, 1397*cdf0e10cSrcweir ListboxControlActions::SET_SELECT_ITEM, aSelectPos ); 1398*cdf0e10cSrcweir xCtrlAcc->setLabel( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, 1399*cdf0e10cSrcweir String(SW_RES( STR_FDLG_TEMPLATE_NAME ))); 1400*cdf0e10cSrcweir } 1401*cdf0e10cSrcweir catch(Exception& ) 1402*cdf0e10cSrcweir { 1403*cdf0e10cSrcweir DBG_ERROR("control acces failed"); 1404*cdf0e10cSrcweir } 1405*cdf0e10cSrcweir 1406*cdf0e10cSrcweir xFP->setTitle( SW_RESSTR( nStrId )); 1407*cdf0e10cSrcweir SvtPathOptions aPathOpt; 1408*cdf0e10cSrcweir xFP->setDisplayDirectory( aPathOpt.GetWorkPath() ); 1409*cdf0e10cSrcweir if( ERRCODE_NONE == aDlgHelper.Execute()) 1410*cdf0e10cSrcweir { 1411*cdf0e10cSrcweir aFileName = xFP->getFiles().getConstArray()[0]; 1412*cdf0e10cSrcweir Any aTemplateValue = xCtrlAcc->getValue( 1413*cdf0e10cSrcweir ExtendedFilePickerElementIds::LISTBOX_TEMPLATE, 1414*cdf0e10cSrcweir ListboxControlActions::GET_SELECTED_ITEM ); 1415*cdf0e10cSrcweir OUString sTmpl; 1416*cdf0e10cSrcweir aTemplateValue >>= sTmpl; 1417*cdf0e10cSrcweir //aTemplateName = sTmpl; //#outline level,removed by zhaojianwei 1418*cdf0e10cSrcweir //#outline level,add by zhaojianwei 1419*cdf0e10cSrcweir 1420*cdf0e10cSrcweir sal_Int32 nColonPos = sTmpl.indexOf( sal_Unicode(':') ); 1421*cdf0e10cSrcweir OUString sPrefix = sTmpl.copy( 0L, nColonPos ); 1422*cdf0e10cSrcweir if( sPrefix.equalsAscii("Style")) 1423*cdf0e10cSrcweir { 1424*cdf0e10cSrcweir aTemplateName = sTmpl.copy( 7L ); //get string behind "Style: " 1425*cdf0e10cSrcweir } 1426*cdf0e10cSrcweir else if( sPrefix.equalsAscii("Outline")) 1427*cdf0e10cSrcweir { 1428*cdf0e10cSrcweir nTemplateOutlineLevel = ( sTmpl.copy( 15L )).toInt32(); //get string behind "Outline: Leve "; 1429*cdf0e10cSrcweir bCreateByOutlineLevel = true; 1430*cdf0e10cSrcweir } 1431*cdf0e10cSrcweir //<-end,zhaojianwei 1432*cdf0e10cSrcweir 1433*cdf0e10cSrcweir if ( aFileName.Len() ) 1434*cdf0e10cSrcweir { 1435*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( nWhich, aFileName ) ); 1436*cdf0e10cSrcweir if( aTemplateName.Len() ) 1437*cdf0e10cSrcweir rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aTemplateName ) ); 1438*cdf0e10cSrcweir } 1439*cdf0e10cSrcweir } 1440*cdf0e10cSrcweir } 1441*cdf0e10cSrcweir } 1442*cdf0e10cSrcweir 1443*cdf0e10cSrcweir //const SwTxtFmtColl* pSplitColl = 0; //#outline level,removed by zhaojianwei 1444*cdf0e10cSrcweir // if ( aTemplateName.Len() ) 1445*cdf0e10cSrcweir // pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName); 1446*cdf0e10cSrcweir //<-end,zhaojianwei 1447*cdf0e10cSrcweir if( aFileName.Len() ) 1448*cdf0e10cSrcweir { 1449*cdf0e10cSrcweir if( PrepareClose( sal_False ) ) 1450*cdf0e10cSrcweir { 1451*cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 1452*cdf0e10cSrcweir 1453*cdf0e10cSrcweir //bDone = bCreateHtml //#outline level,removed by zhaojianwei 1454*cdf0e10cSrcweir // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl ) 1455*cdf0e10cSrcweir // : pDoc->GenerateGlobalDoc( aFileName, pSplitColl ); 1456*cdf0e10cSrcweir if ( bCreateByOutlineLevel ) //add by zhaojianwei 1457*cdf0e10cSrcweir { 1458*cdf0e10cSrcweir bDone = bCreateHtml //#outline level,removed by zhaojianwei 1459*cdf0e10cSrcweir ? pDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel ) 1460*cdf0e10cSrcweir : pDoc->GenerateGlobalDoc( aFileName, nTemplateOutlineLevel ); 1461*cdf0e10cSrcweir } 1462*cdf0e10cSrcweir else 1463*cdf0e10cSrcweir { 1464*cdf0e10cSrcweir const SwTxtFmtColl* pSplitColl = 0; 1465*cdf0e10cSrcweir if ( aTemplateName.Len() ) 1466*cdf0e10cSrcweir pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName); 1467*cdf0e10cSrcweir bDone = bCreateHtml //#outline level,removed by zhaojianwei 1468*cdf0e10cSrcweir ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl ) 1469*cdf0e10cSrcweir : pDoc->GenerateGlobalDoc( aFileName, pSplitColl ); 1470*cdf0e10cSrcweir } 1471*cdf0e10cSrcweir //<-end,zhaojianwei 1472*cdf0e10cSrcweir if( bDone ) 1473*cdf0e10cSrcweir { 1474*cdf0e10cSrcweir SfxStringItem aName( SID_FILE_NAME, aFileName ); 1475*cdf0e10cSrcweir SfxStringItem aReferer( SID_REFERER, aEmptyStr ); 1476*cdf0e10cSrcweir SfxViewShell* pViewShell = SfxViewShell::GetFirst(); 1477*cdf0e10cSrcweir while(pViewShell) 1478*cdf0e10cSrcweir { 1479*cdf0e10cSrcweir //search for the view that created the call 1480*cdf0e10cSrcweir if(pViewShell->GetObjectShell() == this && pViewShell->GetDispatcher()) 1481*cdf0e10cSrcweir { 1482*cdf0e10cSrcweir SfxFrameItem* pFrameItem = new SfxFrameItem( SID_DOCFRAME, 1483*cdf0e10cSrcweir pViewShell->GetViewFrame() ); 1484*cdf0e10cSrcweir SfxDispatcher* pDispatch = pViewShell->GetDispatcher(); 1485*cdf0e10cSrcweir pDispatch->Execute( 1486*cdf0e10cSrcweir SID_OPENDOC, 1487*cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON, 1488*cdf0e10cSrcweir &aName, 1489*cdf0e10cSrcweir &aReferer, 1490*cdf0e10cSrcweir pFrameItem, 0L ); 1491*cdf0e10cSrcweir 1492*cdf0e10cSrcweir delete pFrameItem; 1493*cdf0e10cSrcweir break; 1494*cdf0e10cSrcweir } 1495*cdf0e10cSrcweir pViewShell = SfxViewShell::GetNext(*pViewShell); 1496*cdf0e10cSrcweir } 1497*cdf0e10cSrcweir } 1498*cdf0e10cSrcweir } 1499*cdf0e10cSrcweir if( !bDone && !rReq.IsAPI() ) 1500*cdf0e10cSrcweir { 1501*cdf0e10cSrcweir InfoBox( 0, SW_RESSTR( STR_CANTCREATE )).Execute(); 1502*cdf0e10cSrcweir } 1503*cdf0e10cSrcweir } 1504*cdf0e10cSrcweir } 1505*cdf0e10cSrcweir rReq.SetReturnValue(SfxBoolItem( nWhich, bDone )); 1506*cdf0e10cSrcweir if (bDone) 1507*cdf0e10cSrcweir rReq.Done(); 1508*cdf0e10cSrcweir else 1509*cdf0e10cSrcweir rReq.Ignore(); 1510*cdf0e10cSrcweir break; 1511*cdf0e10cSrcweir 1512*cdf0e10cSrcweir case SID_ATTR_YEAR2000: 1513*cdf0e10cSrcweir if ( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nWhich , sal_False, &pItem )) 1514*cdf0e10cSrcweir { 1515*cdf0e10cSrcweir DBG_ASSERT(pItem->ISA(SfxUInt16Item), "falsches Item"); 1516*cdf0e10cSrcweir sal_uInt16 nYear2K = ((SfxUInt16Item*)pItem)->GetValue(); 1517*cdf0e10cSrcweir //ueber Views iterieren und den State an den FormShells setzen 1518*cdf0e10cSrcweir 1519*cdf0e10cSrcweir SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( this ); 1520*cdf0e10cSrcweir SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0; 1521*cdf0e10cSrcweir SwView* pCurrView = dynamic_cast< SwView* >( pViewShell ); 1522*cdf0e10cSrcweir while(pCurrView) 1523*cdf0e10cSrcweir { 1524*cdf0e10cSrcweir FmFormShell* pFormShell = pCurrView->GetFormShell(); 1525*cdf0e10cSrcweir if(pFormShell) 1526*cdf0e10cSrcweir pFormShell->SetY2KState(nYear2K); 1527*cdf0e10cSrcweir pVFrame = SfxViewFrame::GetNext( *pVFrame, this ); 1528*cdf0e10cSrcweir pViewShell = pVFrame ? pVFrame->GetViewShell() : 0; 1529*cdf0e10cSrcweir pCurrView = dynamic_cast<SwView*>( pViewShell ); 1530*cdf0e10cSrcweir } 1531*cdf0e10cSrcweir pDoc->GetNumberFormatter(sal_True)->SetYear2000(nYear2K); 1532*cdf0e10cSrcweir } 1533*cdf0e10cSrcweir break; 1534*cdf0e10cSrcweir 1535*cdf0e10cSrcweir default: DBG_ERROR("falscher Dispatcher"); 1536*cdf0e10cSrcweir } 1537*cdf0e10cSrcweir } 1538*cdf0e10cSrcweir 1539*cdf0e10cSrcweir 1540*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1541*cdf0e10cSrcweir Beschreibung: 1542*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1543*cdf0e10cSrcweir 1544*cdf0e10cSrcweir long SwDocShell::DdeGetData( const String& rItem, const String& rMimeType, 1545*cdf0e10cSrcweir uno::Any & rValue ) 1546*cdf0e10cSrcweir { 1547*cdf0e10cSrcweir return pDoc->GetData( rItem, rMimeType, rValue ); 1548*cdf0e10cSrcweir } 1549*cdf0e10cSrcweir 1550*cdf0e10cSrcweir 1551*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1552*cdf0e10cSrcweir Beschreibung: 1553*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1554*cdf0e10cSrcweir 1555*cdf0e10cSrcweir long SwDocShell::DdeSetData( const String& rItem, const String& rMimeType, 1556*cdf0e10cSrcweir const uno::Any & rValue ) 1557*cdf0e10cSrcweir { 1558*cdf0e10cSrcweir return pDoc->SetData( rItem, rMimeType, rValue ); 1559*cdf0e10cSrcweir } 1560*cdf0e10cSrcweir 1561*cdf0e10cSrcweir 1562*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1563*cdf0e10cSrcweir Beschreibung: 1564*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1565*cdf0e10cSrcweir 1566*cdf0e10cSrcweir ::sfx2::SvLinkSource* SwDocShell::DdeCreateLinkSource( const String& rItem ) 1567*cdf0e10cSrcweir { 1568*cdf0e10cSrcweir return pDoc->CreateLinkSource( rItem ); 1569*cdf0e10cSrcweir } 1570*cdf0e10cSrcweir 1571*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1572*cdf0e10cSrcweir Beschreibung: 1573*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1574*cdf0e10cSrcweir 1575*cdf0e10cSrcweir void SwDocShell::FillClass( SvGlobalName * pClassName, 1576*cdf0e10cSrcweir sal_uInt32 * pClipFormat, 1577*cdf0e10cSrcweir String * /*pAppName*/, 1578*cdf0e10cSrcweir String * pLongUserName, 1579*cdf0e10cSrcweir String * pUserName, 1580*cdf0e10cSrcweir sal_Int32 nVersion, 1581*cdf0e10cSrcweir sal_Bool bTemplate /* = sal_False */) const 1582*cdf0e10cSrcweir { 1583*cdf0e10cSrcweir if (nVersion == SOFFICE_FILEFORMAT_60) 1584*cdf0e10cSrcweir { 1585*cdf0e10cSrcweir *pClassName = SvGlobalName( SO3_SW_CLASSID_60 ); 1586*cdf0e10cSrcweir *pClipFormat = SOT_FORMATSTR_ID_STARWRITER_60; 1587*cdf0e10cSrcweir *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE); 1588*cdf0e10cSrcweir } 1589*cdf0e10cSrcweir else if (nVersion == SOFFICE_FILEFORMAT_8) 1590*cdf0e10cSrcweir { 1591*cdf0e10cSrcweir *pClassName = SvGlobalName( SO3_SW_CLASSID_60 ); 1592*cdf0e10cSrcweir *pClipFormat = bTemplate ? SOT_FORMATSTR_ID_STARWRITER_8_TEMPLATE : SOT_FORMATSTR_ID_STARWRITER_8; 1593*cdf0e10cSrcweir *pLongUserName = SW_RESSTR(STR_WRITER_DOCUMENT_FULLTYPE); 1594*cdf0e10cSrcweir } 1595*cdf0e10cSrcweir 1596*cdf0e10cSrcweir *pUserName = SW_RESSTR(STR_HUMAN_SWDOC_NAME); 1597*cdf0e10cSrcweir } 1598*cdf0e10cSrcweir 1599*cdf0e10cSrcweir 1600*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1601*cdf0e10cSrcweir Beschreibung: 1602*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1603*cdf0e10cSrcweir 1604*cdf0e10cSrcweir void SwDocShell::SetModified( sal_Bool bSet ) 1605*cdf0e10cSrcweir { 1606*cdf0e10cSrcweir SfxObjectShell::SetModified( bSet ); 1607*cdf0e10cSrcweir if( IsEnableSetModified()) 1608*cdf0e10cSrcweir { 1609*cdf0e10cSrcweir if (!pDoc->IsInCallModified() ) 1610*cdf0e10cSrcweir { 1611*cdf0e10cSrcweir EnableSetModified( sal_False ); 1612*cdf0e10cSrcweir if( bSet ) 1613*cdf0e10cSrcweir { 1614*cdf0e10cSrcweir sal_Bool bOld = pDoc->IsModified(); 1615*cdf0e10cSrcweir pDoc->SetModified(); 1616*cdf0e10cSrcweir if( !bOld ) 1617*cdf0e10cSrcweir { 1618*cdf0e10cSrcweir pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); 1619*cdf0e10cSrcweir } 1620*cdf0e10cSrcweir } 1621*cdf0e10cSrcweir else 1622*cdf0e10cSrcweir pDoc->ResetModified(); 1623*cdf0e10cSrcweir 1624*cdf0e10cSrcweir EnableSetModified( sal_True ); 1625*cdf0e10cSrcweir } 1626*cdf0e10cSrcweir 1627*cdf0e10cSrcweir UpdateChildWindows(); 1628*cdf0e10cSrcweir Broadcast(SfxSimpleHint(SFX_HINT_DOCCHANGED)); 1629*cdf0e10cSrcweir } 1630*cdf0e10cSrcweir } 1631*cdf0e10cSrcweir 1632*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1633*cdf0e10cSrcweir Beschreibung: 1634*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1635*cdf0e10cSrcweir 1636*cdf0e10cSrcweir void SwDocShell::UpdateChildWindows() 1637*cdf0e10cSrcweir { 1638*cdf0e10cSrcweir // Flddlg ggf neu initialisieren (z.B. fuer TYP_SETVAR) 1639*cdf0e10cSrcweir if(!GetView()) 1640*cdf0e10cSrcweir return; 1641*cdf0e10cSrcweir SfxViewFrame* pVFrame = GetView()->GetViewFrame(); 1642*cdf0e10cSrcweir SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame-> 1643*cdf0e10cSrcweir GetChildWindow( SwFldDlgWrapper::GetChildWindowId() ); 1644*cdf0e10cSrcweir if( pWrp ) 1645*cdf0e10cSrcweir pWrp->ReInitDlg( this ); 1646*cdf0e10cSrcweir 1647*cdf0e10cSrcweir // RedlineDlg ggf neu initialisieren 1648*cdf0e10cSrcweir SwRedlineAcceptChild *pRed = (SwRedlineAcceptChild*)pVFrame-> 1649*cdf0e10cSrcweir GetChildWindow( SwRedlineAcceptChild::GetChildWindowId() ); 1650*cdf0e10cSrcweir if( pRed ) 1651*cdf0e10cSrcweir pRed->ReInitDlg( this ); 1652*cdf0e10cSrcweir } 1653*cdf0e10cSrcweir 1654*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1655*cdf0e10cSrcweir Beschreibung: 1656*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1657*cdf0e10cSrcweir // --> OD 2005-08-02 #i48748# 1658*cdf0e10cSrcweir class SwReloadFromHtmlReader : public SwReader 1659*cdf0e10cSrcweir { 1660*cdf0e10cSrcweir public: 1661*cdf0e10cSrcweir SwReloadFromHtmlReader( SfxMedium& _rTmpMedium, 1662*cdf0e10cSrcweir const String& _rFilename, 1663*cdf0e10cSrcweir SwDoc* _pDoc ) 1664*cdf0e10cSrcweir : SwReader( _rTmpMedium, _rFilename, _pDoc ) 1665*cdf0e10cSrcweir { 1666*cdf0e10cSrcweir SetBaseURL( _rFilename ); 1667*cdf0e10cSrcweir } 1668*cdf0e10cSrcweir }; 1669*cdf0e10cSrcweir // <-- 1670*cdf0e10cSrcweir void SwDocShell::ReloadFromHtml( const String& rStreamName, SwSrcView* pSrcView ) 1671*cdf0e10cSrcweir { 1672*cdf0e10cSrcweir sal_Bool bModified = IsModified(); 1673*cdf0e10cSrcweir 1674*cdf0e10cSrcweir // MIB 23.6.97: Die HTTP-Header-Felder muessen geloescht werden, 1675*cdf0e10cSrcweir // sonst gibt es welche aus Meta-Tags hinter doppelt und dreifach. 1676*cdf0e10cSrcweir ClearHeaderAttributesForSourceViewHack(); 1677*cdf0e10cSrcweir 1678*cdf0e10cSrcweir // MIB 24.07.97: Das Dokument-Basic muss auch noch d'ran glauben ... 1679*cdf0e10cSrcweir SvxHtmlOptions* pHtmlOptions = SvxHtmlOptions::Get(); 1680*cdf0e10cSrcweir //#59620# HasBasic() zeigt an, dass es schon einen BasicManager an der DocShell 1681*cdf0e10cSrcweir // gibt. Der wurde im HTML-Import immer angelegt, wenn Macros im Quelltext 1682*cdf0e10cSrcweir // vorhanden sind. 1683*cdf0e10cSrcweir if( pHtmlOptions && pHtmlOptions->IsStarBasic() && HasBasic()) 1684*cdf0e10cSrcweir { 1685*cdf0e10cSrcweir BasicManager *pBasicMan = GetBasicManager(); 1686*cdf0e10cSrcweir if( pBasicMan && (pBasicMan != SFX_APP()->GetBasicManager()) ) 1687*cdf0e10cSrcweir { 1688*cdf0e10cSrcweir sal_uInt16 nLibCount = pBasicMan->GetLibCount(); 1689*cdf0e10cSrcweir while( nLibCount ) 1690*cdf0e10cSrcweir { 1691*cdf0e10cSrcweir StarBASIC *pBasic = pBasicMan->GetLib( --nLibCount ); 1692*cdf0e10cSrcweir if( pBasic ) 1693*cdf0e10cSrcweir { 1694*cdf0e10cSrcweir // Die IDE benachrichtigen 1695*cdf0e10cSrcweir SfxUsrAnyItem aShellItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( GetModel() ) ); 1696*cdf0e10cSrcweir String aLibName( pBasic->GetName() ); 1697*cdf0e10cSrcweir SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName ); 1698*cdf0e10cSrcweir pSrcView->GetViewFrame()->GetDispatcher()->Execute( 1699*cdf0e10cSrcweir SID_BASICIDE_LIBREMOVED, 1700*cdf0e10cSrcweir SFX_CALLMODE_SYNCHRON, 1701*cdf0e10cSrcweir &aShellItem, &aLibNameItem, 0L ); 1702*cdf0e10cSrcweir 1703*cdf0e10cSrcweir // Aus der Standard-Lib werden nur die Module geloescht 1704*cdf0e10cSrcweir if( nLibCount ) 1705*cdf0e10cSrcweir pBasicMan->RemoveLib( nLibCount, sal_True ); 1706*cdf0e10cSrcweir else 1707*cdf0e10cSrcweir pBasic->Clear(); 1708*cdf0e10cSrcweir } 1709*cdf0e10cSrcweir } 1710*cdf0e10cSrcweir 1711*cdf0e10cSrcweir ASSERT( pBasicMan->GetLibCount() <= 1, 1712*cdf0e10cSrcweir "Loschen des Basics hat nicht geklappt" ); 1713*cdf0e10cSrcweir } 1714*cdf0e10cSrcweir } 1715*cdf0e10cSrcweir sal_Bool bWasBrowseMode = pDoc->get(IDocumentSettingAccess::BROWSE_MODE); 1716*cdf0e10cSrcweir RemoveLink(); 1717*cdf0e10cSrcweir 1718*cdf0e10cSrcweir //jetzt muss auch das UNO-Model ueber das neue Doc informiert werden #51535# 1719*cdf0e10cSrcweir uno::Reference<text::XTextDocument> xDoc(GetBaseModel(), uno::UNO_QUERY); 1720*cdf0e10cSrcweir text::XTextDocument* pxDoc = xDoc.get(); 1721*cdf0e10cSrcweir ((SwXTextDocument*)pxDoc)->InitNewDoc(); 1722*cdf0e10cSrcweir 1723*cdf0e10cSrcweir AddLink(); 1724*cdf0e10cSrcweir //#116402# update font list when new document is created 1725*cdf0e10cSrcweir UpdateFontList(); 1726*cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::BROWSE_MODE, bWasBrowseMode); 1727*cdf0e10cSrcweir pSrcView->SetPool(&GetPool()); 1728*cdf0e10cSrcweir 1729*cdf0e10cSrcweir 1730*cdf0e10cSrcweir const String& rMedname = GetMedium()->GetName(); 1731*cdf0e10cSrcweir 1732*cdf0e10cSrcweir // fix #51032#: Die HTML-Vorlage muss noch gesetzt werden 1733*cdf0e10cSrcweir SetHTMLTemplate( *GetDoc() ); //Styles aus HTML.vor 1734*cdf0e10cSrcweir 1735*cdf0e10cSrcweir SfxViewShell* pViewShell = GetView() ? (SfxViewShell*)GetView() 1736*cdf0e10cSrcweir : SfxViewShell::Current(); 1737*cdf0e10cSrcweir SfxViewFrame* pViewFrm = pViewShell->GetViewFrame(); 1738*cdf0e10cSrcweir pViewFrm->GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON ); 1739*cdf0e10cSrcweir 1740*cdf0e10cSrcweir SubInitNew(); 1741*cdf0e10cSrcweir 1742*cdf0e10cSrcweir SfxMedium aMed( rStreamName, STREAM_READ, sal_False ); 1743*cdf0e10cSrcweir // --> OD 2005-08-01 #i48748# - use class <SwReloadFromHtmlReader>, because 1744*cdf0e10cSrcweir // the base URL has to be set to the filename of the document <rMedname> 1745*cdf0e10cSrcweir // and not to the base URL of the temporary file <aMed> in order to get 1746*cdf0e10cSrcweir // the URLs of the linked graphics correctly resolved. 1747*cdf0e10cSrcweir SwReloadFromHtmlReader aReader( aMed, rMedname, pDoc ); 1748*cdf0e10cSrcweir // <-- 1749*cdf0e10cSrcweir aReader.Read( *ReadHTML ); 1750*cdf0e10cSrcweir 1751*cdf0e10cSrcweir const SwView* pCurrView = GetView(); 1752*cdf0e10cSrcweir //in print layout the first page(s) may have been formatted as a mix of browse 1753*cdf0e10cSrcweir //and print layout 1754*cdf0e10cSrcweir if(!bWasBrowseMode && pCurrView) 1755*cdf0e10cSrcweir { 1756*cdf0e10cSrcweir SwWrtShell& rWrtSh = pCurrView->GetWrtShell(); 1757*cdf0e10cSrcweir if( rWrtSh.GetLayout()) 1758*cdf0e10cSrcweir rWrtSh.CheckBrowseView( sal_True ); 1759*cdf0e10cSrcweir } 1760*cdf0e10cSrcweir 1761*cdf0e10cSrcweir 1762*cdf0e10cSrcweir // MIB 23.6.97: Die HTTP-Header-Attribute wieder in die DokInfo 1763*cdf0e10cSrcweir // uebernehmen. Die Base-URL ist hier egal, da TLX zum absolutieren die 1764*cdf0e10cSrcweir // vom Dokument nimmt. 1765*cdf0e10cSrcweir SetHeaderAttributesForSourceViewHack(); 1766*cdf0e10cSrcweir 1767*cdf0e10cSrcweir if(bModified && !IsReadOnly()) 1768*cdf0e10cSrcweir SetModified(); 1769*cdf0e10cSrcweir else 1770*cdf0e10cSrcweir pDoc->ResetModified(); 1771*cdf0e10cSrcweir } 1772*cdf0e10cSrcweir 1773*cdf0e10cSrcweir sal_uLong SwDocShell::LoadStylesFromFile( const String& rURL, 1774*cdf0e10cSrcweir SwgReaderOption& rOpt, sal_Bool bUnoCall ) 1775*cdf0e10cSrcweir { 1776*cdf0e10cSrcweir sal_uLong nErr = 0; 1777*cdf0e10cSrcweir 1778*cdf0e10cSrcweir // Create a URL from filename 1779*cdf0e10cSrcweir INetURLObject aURLObj( rURL ); 1780*cdf0e10cSrcweir String sURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) ); 1781*cdf0e10cSrcweir 1782*cdf0e10cSrcweir // Filter bestimmen: 1783*cdf0e10cSrcweir // const SfxFilter* pFlt = SwIoSystem::GetFileFilter( rURL, aEmptyStr ); 1784*cdf0e10cSrcweir String sFactory(String::CreateFromAscii(SwDocShell::Factory().GetShortName())); 1785*cdf0e10cSrcweir SfxFilterMatcher aMatcher( sFactory ); 1786*cdf0e10cSrcweir 1787*cdf0e10cSrcweir //#b6445961# search for filter in WebDocShell, too 1788*cdf0e10cSrcweir SfxMedium aMed( rURL, STREAM_STD_READ, sal_False ); 1789*cdf0e10cSrcweir const SfxFilter* pFlt = 0; 1790*cdf0e10cSrcweir aMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False ); 1791*cdf0e10cSrcweir if(!pFlt) 1792*cdf0e10cSrcweir { 1793*cdf0e10cSrcweir String sWebFactory(String::CreateFromAscii(SwWebDocShell::Factory().GetShortName())); 1794*cdf0e10cSrcweir SfxFilterMatcher aWebMatcher( sWebFactory ); 1795*cdf0e10cSrcweir aWebMatcher.DetectFilter( aMed, &pFlt, sal_False, sal_False ); 1796*cdf0e10cSrcweir } 1797*cdf0e10cSrcweir // --> OD #i117339# - trigger import only for own formats 1798*cdf0e10cSrcweir // if( aMed.IsStorage() ) 1799*cdf0e10cSrcweir bool bImport( false ); 1800*cdf0e10cSrcweir { 1801*cdf0e10cSrcweir if ( aMed.IsStorage() ) 1802*cdf0e10cSrcweir { 1803*cdf0e10cSrcweir // As <SfxMedium.GetFilter().IsOwnFormat() resp. IsOwnTemplateFormat() 1804*cdf0e10cSrcweir // does not work correct (e.g., MS Word 2007 XML Template), 1805*cdf0e10cSrcweir // use workaround provided by MAV. 1806*cdf0e10cSrcweir uno::Reference< embed::XStorage > xStorage = aMed.GetStorage(); 1807*cdf0e10cSrcweir if ( xStorage.is() ) 1808*cdf0e10cSrcweir { 1809*cdf0e10cSrcweir // use <try-catch> on retrieving <MediaType> in order to check, 1810*cdf0e10cSrcweir // if the storage is one of our own ones. 1811*cdf0e10cSrcweir try 1812*cdf0e10cSrcweir { 1813*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xStorage, uno::UNO_QUERY_THROW ); 1814*cdf0e10cSrcweir const ::rtl::OUString aMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ); 1815*cdf0e10cSrcweir xProps->getPropertyValue( aMediaTypePropName ); 1816*cdf0e10cSrcweir bImport = true; 1817*cdf0e10cSrcweir } 1818*cdf0e10cSrcweir catch( const uno::Exception& ) 1819*cdf0e10cSrcweir { 1820*cdf0e10cSrcweir bImport = false; 1821*cdf0e10cSrcweir } 1822*cdf0e10cSrcweir } 1823*cdf0e10cSrcweir } 1824*cdf0e10cSrcweir } 1825*cdf0e10cSrcweir if ( bImport ) 1826*cdf0e10cSrcweir // <-- 1827*cdf0e10cSrcweir { 1828*cdf0e10cSrcweir DBG_ASSERT((pFlt ? pFlt->GetVersion() : 0) >= SOFFICE_FILEFORMAT_60, "which file version?"); 1829*cdf0e10cSrcweir SwRead pRead = ReadXML; 1830*cdf0e10cSrcweir SwReader* pReader = 0; 1831*cdf0e10cSrcweir SwPaM* pPam = 0; 1832*cdf0e10cSrcweir // the SW3IO - Reader need the pam/wrtshell, because only then he 1833*cdf0e10cSrcweir // insert the styles! 1834*cdf0e10cSrcweir if( bUnoCall ) 1835*cdf0e10cSrcweir { 1836*cdf0e10cSrcweir SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfContent(), -1 ); 1837*cdf0e10cSrcweir pPam = new SwPaM( aIdx ); 1838*cdf0e10cSrcweir pReader = new SwReader( aMed, rURL, *pPam ); 1839*cdf0e10cSrcweir } 1840*cdf0e10cSrcweir else 1841*cdf0e10cSrcweir { 1842*cdf0e10cSrcweir pReader = new SwReader( aMed, rURL, *pWrtShell->GetCrsr() ); 1843*cdf0e10cSrcweir } 1844*cdf0e10cSrcweir 1845*cdf0e10cSrcweir pRead->GetReaderOpt().SetTxtFmts( rOpt.IsTxtFmts() ); 1846*cdf0e10cSrcweir pRead->GetReaderOpt().SetFrmFmts( rOpt.IsFrmFmts() ); 1847*cdf0e10cSrcweir pRead->GetReaderOpt().SetPageDescs( rOpt.IsPageDescs() ); 1848*cdf0e10cSrcweir pRead->GetReaderOpt().SetNumRules( rOpt.IsNumRules() ); 1849*cdf0e10cSrcweir pRead->GetReaderOpt().SetMerge( rOpt.IsMerge() ); 1850*cdf0e10cSrcweir 1851*cdf0e10cSrcweir if( bUnoCall ) 1852*cdf0e10cSrcweir { 1853*cdf0e10cSrcweir UnoActionContext aAction( pDoc ); 1854*cdf0e10cSrcweir nErr = pReader->Read( *pRead ); 1855*cdf0e10cSrcweir } 1856*cdf0e10cSrcweir else 1857*cdf0e10cSrcweir { 1858*cdf0e10cSrcweir pWrtShell->StartAllAction(); 1859*cdf0e10cSrcweir nErr = pReader->Read( *pRead ); 1860*cdf0e10cSrcweir pWrtShell->EndAllAction(); 1861*cdf0e10cSrcweir } 1862*cdf0e10cSrcweir delete pPam; 1863*cdf0e10cSrcweir delete pReader; 1864*cdf0e10cSrcweir } 1865*cdf0e10cSrcweir 1866*cdf0e10cSrcweir return nErr; 1867*cdf0e10cSrcweir } 1868*cdf0e10cSrcweir 1869*cdf0e10cSrcweir /*-------------------------------------------------------------------- 1870*cdf0e10cSrcweir Get a client for an embedded object if possible. 1871*cdf0e10cSrcweir --------------------------------------------------------------------*/ 1872*cdf0e10cSrcweir SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjRef ) 1873*cdf0e10cSrcweir { 1874*cdf0e10cSrcweir SfxInPlaceClient* pResult = NULL; 1875*cdf0e10cSrcweir 1876*cdf0e10cSrcweir SwWrtShell* pShell = GetWrtShell(); 1877*cdf0e10cSrcweir if ( pShell ) 1878*cdf0e10cSrcweir { 1879*cdf0e10cSrcweir pResult = pShell->GetView().FindIPClient( xObjRef.GetObject(), (Window*)&pShell->GetView().GetEditWin() ); 1880*cdf0e10cSrcweir if ( !pResult ) 1881*cdf0e10cSrcweir pResult = new SwOleClient( &pShell->GetView(), &pShell->GetView().GetEditWin(), xObjRef ); 1882*cdf0e10cSrcweir } 1883*cdf0e10cSrcweir 1884*cdf0e10cSrcweir return pResult; 1885*cdf0e10cSrcweir } 1886*cdf0e10cSrcweir 1887