LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/app - docsh2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 87 844 10.3 %
Date: 2012-12-27 Functions: 8 23 34.8 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10