1efeef26fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5efeef26fSAndrew Rist * distributed with this work for additional information 6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance 9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14efeef26fSAndrew Rist * software distributed under the License is distributed on an 15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the 17efeef26fSAndrew Rist * specific language governing permissions and limitations 18efeef26fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20efeef26fSAndrew Rist *************************************************************/ 21efeef26fSAndrew Rist 22efeef26fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sw.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <hintids.hxx> 28cdf0e10cSrcweir #include <rtl/logfile.hxx> 29cdf0e10cSrcweir #include <vcl/msgbox.hxx> 30cdf0e10cSrcweir #include <vcl/svapp.hxx> 31cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 32cdf0e10cSrcweir #include <vcl/jobset.hxx> 33cdf0e10cSrcweir #include <tools/urlobj.hxx> 34cdf0e10cSrcweir #include <svl/whiter.hxx> 35cdf0e10cSrcweir #include <svl/zforlist.hxx> 36cdf0e10cSrcweir #include <svl/eitem.hxx> 37cdf0e10cSrcweir #include <svl/stritem.hxx> 38cdf0e10cSrcweir #include <svl/PasswordHelper.hxx> 39cdf0e10cSrcweir #include <editeng/adjitem.hxx> 40cdf0e10cSrcweir #include <basic/sbx.hxx> 41cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 42cdf0e10cSrcweir #include <unotools/misccfg.hxx> 43cdf0e10cSrcweir #include <sfx2/request.hxx> 44cdf0e10cSrcweir #include <sfx2/passwd.hxx> 45cdf0e10cSrcweir #include <sfx2/bindings.hxx> 46cdf0e10cSrcweir #include <sfx2/docfile.hxx> 47cdf0e10cSrcweir #include <sfx2/evntconf.hxx> 48cdf0e10cSrcweir #include <sfx2/docfilt.hxx> 49cdf0e10cSrcweir #include <sfx2/printer.hxx> 50cdf0e10cSrcweir #include <sfx2/linkmgr.hxx> 51cdf0e10cSrcweir #include <svl/srchitem.hxx> 52cdf0e10cSrcweir #include <editeng/flstitem.hxx> 53cdf0e10cSrcweir #include <svx/htmlmode.hxx> 54cdf0e10cSrcweir #include <svtools/soerr.hxx> 55cdf0e10cSrcweir #include <sot/clsids.hxx> 56cdf0e10cSrcweir #include <basic/basmgr.hxx> 57cdf0e10cSrcweir #include <basic/sbmod.hxx> 58cdf0e10cSrcweir #include <swevent.hxx> 59cdf0e10cSrcweir #include <fmtpdsc.hxx> 60cdf0e10cSrcweir #include <fmtfsize.hxx> 61cdf0e10cSrcweir #include <fmtfld.hxx> 62cdf0e10cSrcweir #include <node.hxx> 63cdf0e10cSrcweir #include <swwait.hxx> 64cdf0e10cSrcweir #include <printdata.hxx> 65cdf0e10cSrcweir #include <frmatr.hxx> 66cdf0e10cSrcweir #include <view.hxx> // fuer die aktuelle Sicht 67cdf0e10cSrcweir #include <edtwin.hxx> 68cdf0e10cSrcweir #include <PostItMgr.hxx> 69cdf0e10cSrcweir #include <wrtsh.hxx> // Verbindung zur Core 70cdf0e10cSrcweir #include <docsh.hxx> // Dokumenterzeugung 71cdf0e10cSrcweir #include <basesh.hxx> 72cdf0e10cSrcweir #include <viewopt.hxx> 73cdf0e10cSrcweir #include <wdocsh.hxx> 74cdf0e10cSrcweir #include <swmodule.hxx> 75cdf0e10cSrcweir #include <globdoc.hxx> 76cdf0e10cSrcweir #include <usrpref.hxx> 77cdf0e10cSrcweir #include <shellio.hxx> // I/O 78cdf0e10cSrcweir #include <docstyle.hxx> 79cdf0e10cSrcweir #include <doc.hxx> 80cdf0e10cSrcweir #include <IDocumentUndoRedo.hxx> 81cdf0e10cSrcweir #include <docstat.hxx> 82cdf0e10cSrcweir #include <pagedesc.hxx> 83cdf0e10cSrcweir #include <pview.hxx> 84cdf0e10cSrcweir #include <mdiexp.hxx> 85cdf0e10cSrcweir #include <swbaslnk.hxx> 86cdf0e10cSrcweir #include <srcview.hxx> 87cdf0e10cSrcweir #include <ndindex.hxx> 88cdf0e10cSrcweir #include <ndole.hxx> 89cdf0e10cSrcweir #include <swcli.hxx> 90cdf0e10cSrcweir #include <txtftn.hxx> 91cdf0e10cSrcweir #include <ftnidx.hxx> 92cdf0e10cSrcweir #include <fldbas.hxx> 93cdf0e10cSrcweir #include <docary.hxx> 94cdf0e10cSrcweir #include <swerror.h> // Fehlermeldungen 95cdf0e10cSrcweir #include <helpid.h> 96cdf0e10cSrcweir #include <cmdid.h> 97cdf0e10cSrcweir #include <globals.hrc> 98cdf0e10cSrcweir #include <app.hrc> 99cdf0e10cSrcweir 100cdf0e10cSrcweir #include <cfgid.h> 101cdf0e10cSrcweir #include <unotools/moduleoptions.hxx> 102cdf0e10cSrcweir #include <unotools/fltrcfg.hxx> 103cdf0e10cSrcweir #include <svtools/htmlcfg.hxx> 104cdf0e10cSrcweir #include <sfx2/fcontnr.hxx> 105*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 106*ca62e2c2SSteve Yin #include <sfx2/viewfrm.hxx> 107*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 108cdf0e10cSrcweir #include <sfx2/objface.hxx> 109cdf0e10cSrcweir #include <comphelper/storagehelper.hxx> 110cdf0e10cSrcweir 111cdf0e10cSrcweir #define SwDocShell 112cdf0e10cSrcweir #include <sfx2/msg.hxx> 113cdf0e10cSrcweir #include <swslots.hxx> 114cdf0e10cSrcweir #include <com/sun/star/document/UpdateDocMode.hpp> 115cdf0e10cSrcweir 116cdf0e10cSrcweir #include <com/sun/star/document/XDocumentProperties.hpp> 117cdf0e10cSrcweir #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> 118cdf0e10cSrcweir 119cdf0e10cSrcweir #include <unomid.h> 120cdf0e10cSrcweir 121cdf0e10cSrcweir #include <sfx2/Metadatable.hxx> 122cdf0e10cSrcweir #include <switerator.hxx> 123cdf0e10cSrcweir 124cdf0e10cSrcweir using rtl::OUString; 125cdf0e10cSrcweir using namespace ::com::sun::star; 126cdf0e10cSrcweir using namespace ::com::sun::star::uno; 127cdf0e10cSrcweir using namespace ::com::sun::star::script; 128cdf0e10cSrcweir using namespace ::com::sun::star::container; 129cdf0e10cSrcweir 130cdf0e10cSrcweir 131cdf0e10cSrcweir SFX_IMPL_INTERFACE( SwDocShell, SfxObjectShell, SW_RES(0) ) 132cdf0e10cSrcweir { 133cdf0e10cSrcweir SFX_CHILDWINDOW_REGISTRATION( SID_HYPERLINK_INSERT ); 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir TYPEINIT2(SwDocShell, SfxObjectShell, SfxListener); 137cdf0e10cSrcweir 138cdf0e10cSrcweir //------------------------------------------------------------------------- 139cdf0e10cSrcweir SFX_IMPL_OBJECTFACTORY(SwDocShell, SvGlobalName(SO3_SW_CLASSID), SFXOBJECTSHELL_STD_NORMAL|SFXOBJECTSHELL_HASMENU, "swriter" ) 140cdf0e10cSrcweir 141cdf0e10cSrcweir /*-------------------------------------------------------------------- 142cdf0e10cSrcweir Beschreibung: Laden vorbereiten 143cdf0e10cSrcweir --------------------------------------------------------------------*/ 144cdf0e10cSrcweir 145cdf0e10cSrcweir 146cdf0e10cSrcweir Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, 147cdf0e10cSrcweir SwCrsrShell *pCrsrShell, 148cdf0e10cSrcweir SwPaM* pPaM ) 149cdf0e10cSrcweir { 150cdf0e10cSrcweir sal_Bool bAPICall = sal_False; 151cdf0e10cSrcweir const SfxPoolItem* pApiItem; 152cdf0e10cSrcweir const SfxItemSet* pMedSet; 153cdf0e10cSrcweir if( 0 != ( pMedSet = rMedium.GetItemSet() ) && SFX_ITEM_SET == 154cdf0e10cSrcweir pMedSet->GetItemState( FN_API_CALL, sal_True, &pApiItem ) ) 155cdf0e10cSrcweir bAPICall = ((const SfxBoolItem*)pApiItem)->GetValue(); 156cdf0e10cSrcweir 157cdf0e10cSrcweir const SfxFilter* pFlt = rMedium.GetFilter(); 158cdf0e10cSrcweir if( !pFlt ) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir if(!bAPICall) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir InfoBox( 0, SW_RESSTR(STR_CANTOPEN)).Execute(); 163cdf0e10cSrcweir } 164cdf0e10cSrcweir return 0; 165cdf0e10cSrcweir } 166cdf0e10cSrcweir String aFileName( rMedium.GetName() ); 167cdf0e10cSrcweir SwRead pRead = SwReaderWriter::GetReader( pFlt->GetUserData() ); 168cdf0e10cSrcweir if( !pRead ) 169cdf0e10cSrcweir return 0; 170cdf0e10cSrcweir 171cdf0e10cSrcweir if( rMedium.IsStorage() 172cdf0e10cSrcweir ? SW_STORAGE_READER & pRead->GetReaderType() 173cdf0e10cSrcweir : SW_STREAM_READER & pRead->GetReaderType() ) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir *ppRdr = pPaM ? new SwReader( rMedium, aFileName, *pPaM ) : 176cdf0e10cSrcweir pCrsrShell ? 177cdf0e10cSrcweir new SwReader( rMedium, aFileName, *pCrsrShell->GetCrsr() ) 178cdf0e10cSrcweir : new SwReader( rMedium, aFileName, pDoc ); 179cdf0e10cSrcweir } 180cdf0e10cSrcweir else 181cdf0e10cSrcweir return 0; 182cdf0e10cSrcweir 183cdf0e10cSrcweir // PassWord Checken 184cdf0e10cSrcweir String aPasswd; 185cdf0e10cSrcweir if ((*ppRdr)->NeedsPasswd( *pRead )) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir if(!bAPICall) 188cdf0e10cSrcweir { 189cdf0e10cSrcweir SfxPasswordDialog* pPasswdDlg = 190cdf0e10cSrcweir new SfxPasswordDialog( 0 ); 191cdf0e10cSrcweir if(RET_OK == pPasswdDlg->Execute()) 192cdf0e10cSrcweir aPasswd = pPasswdDlg->GetPassword(); 193cdf0e10cSrcweir } 194cdf0e10cSrcweir else 195cdf0e10cSrcweir { 196cdf0e10cSrcweir const SfxItemSet* pSet = rMedium.GetItemSet(); 197cdf0e10cSrcweir const SfxPoolItem *pPassItem; 198cdf0e10cSrcweir if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, sal_True, &pPassItem)) 199cdf0e10cSrcweir aPasswd = ((const SfxStringItem *)pPassItem)->GetValue(); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir 202cdf0e10cSrcweir if (!(*ppRdr)->CheckPasswd( aPasswd, *pRead )) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir InfoBox( 0, SW_RES(MSG_ERROR_PASSWD)).Execute(); 205cdf0e10cSrcweir delete *ppRdr; 206cdf0e10cSrcweir return 0; 207cdf0e10cSrcweir } 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir // #i30171# set the UpdateDocMode at the SwDocShell 211cdf0e10cSrcweir SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); 212cdf0e10cSrcweir nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; 213cdf0e10cSrcweir 214cdf0e10cSrcweir if( pFlt->GetDefaultTemplate().Len() ) 215cdf0e10cSrcweir pRead->SetTemplateName( pFlt->GetDefaultTemplate() ); 216cdf0e10cSrcweir 217cdf0e10cSrcweir if( pRead == ReadAscii && 0 != rMedium.GetInStream() && 218cdf0e10cSrcweir pFlt->GetUserData().EqualsAscii( FILTER_TEXT_DLG ) ) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir SwAsciiOptions aOpt; 221cdf0e10cSrcweir const SfxItemSet* pSet; 222cdf0e10cSrcweir const SfxPoolItem* pItem; 223cdf0e10cSrcweir if( 0 != ( pSet = rMedium.GetItemSet() ) && SFX_ITEM_SET == 224cdf0e10cSrcweir pSet->GetItemState( SID_FILE_FILTEROPTIONS, sal_True, &pItem ) ) 225cdf0e10cSrcweir aOpt.ReadUserData( ((const SfxStringItem*)pItem)->GetValue() ); 226cdf0e10cSrcweir 227cdf0e10cSrcweir if( pRead ) 228cdf0e10cSrcweir pRead->GetReaderOpt().SetASCIIOpts( aOpt ); 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir return pRead; 232cdf0e10cSrcweir } 233cdf0e10cSrcweir 234cdf0e10cSrcweir /*-------------------------------------------------------------------- 235cdf0e10cSrcweir Beschreibung: Laden 236cdf0e10cSrcweir --------------------------------------------------------------------*/ 237cdf0e10cSrcweir 238cdf0e10cSrcweir sal_Bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) 239cdf0e10cSrcweir { 240cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertFrom" ); 241cdf0e10cSrcweir 242cdf0e10cSrcweir SwReader* pRdr; 243cdf0e10cSrcweir SwRead pRead = StartConvertFrom(rMedium, &pRdr); 244cdf0e10cSrcweir if (!pRead) 245cdf0e10cSrcweir return sal_False; // #129881# return if no reader is found 246cdf0e10cSrcweir SotStorageRef pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls 247cdf0e10cSrcweir 248cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 249cdf0e10cSrcweir 250cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 251cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( 252cdf0e10cSrcweir SFX_CREATE_MODE_EMBEDDED == GetCreateMode() ); 253cdf0e10cSrcweir 254cdf0e10cSrcweir pRdr->GetDoc()->set(IDocumentSettingAccess::HTML_MODE, ISA(SwWebDocShell)); 255cdf0e10cSrcweir 256cdf0e10cSrcweir /* #106748# Restore the pool default if reading a saved document. */ 257cdf0e10cSrcweir pDoc->RemoveAllFmtLanguageDependencies(); 258cdf0e10cSrcweir 259cdf0e10cSrcweir sal_uLong nErr = pRdr->Read( *pRead ); 260cdf0e10cSrcweir 261cdf0e10cSrcweir // Evtl. ein altes Doc weg 262cdf0e10cSrcweir if ( pDoc != pRdr->GetDoc() ) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir if( pDoc ) 265cdf0e10cSrcweir RemoveLink(); 266cdf0e10cSrcweir pDoc = pRdr->GetDoc(); 267cdf0e10cSrcweir 268cdf0e10cSrcweir AddLink(); 269cdf0e10cSrcweir 270cdf0e10cSrcweir if ( !mxBasePool.is() ) 271cdf0e10cSrcweir mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir 274cdf0e10cSrcweir UpdateFontList(); 275cdf0e10cSrcweir InitDraw(); 276cdf0e10cSrcweir 277cdf0e10cSrcweir delete pRdr; 278cdf0e10cSrcweir 279cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_False ); 280cdf0e10cSrcweir 281cdf0e10cSrcweir SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 282cdf0e10cSrcweir sal_Bool bOk = !IsError( nErr ); 283cdf0e10cSrcweir 284cdf0e10cSrcweir // --> OD 2006-11-07 #i59688# 285cdf0e10cSrcweir // // StartFinishedLoading rufen. Nicht bei asynchronen Filtern! 286cdf0e10cSrcweir // // Diese muessen das selbst rufen! 287cdf0e10cSrcweir // if( bOk && !pDoc->IsInLoadAsynchron() ) 288cdf0e10cSrcweir // StartLoadFinishedTimer(); 289cdf0e10cSrcweir if ( bOk && !pDoc->IsInLoadAsynchron() ) 290cdf0e10cSrcweir { 291cdf0e10cSrcweir LoadingFinished(); 292cdf0e10cSrcweir } 293cdf0e10cSrcweir // <-- 294cdf0e10cSrcweir 295cdf0e10cSrcweir pRead->setSotStorageRef(pStg); // #i45333# save sot storage ref in case of recursive calls 296cdf0e10cSrcweir 297cdf0e10cSrcweir return bOk; 298cdf0e10cSrcweir } 299cdf0e10cSrcweir 300cdf0e10cSrcweir /*-------------------------------------------------------------------- 301cdf0e10cSrcweir Beschreibung: Sichern des Default-Formats, Stg vorhanden 302cdf0e10cSrcweir --------------------------------------------------------------------*/ 303cdf0e10cSrcweir 304cdf0e10cSrcweir 305cdf0e10cSrcweir sal_Bool SwDocShell::Save() 306cdf0e10cSrcweir { 307cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::Save" ); 308cdf0e10cSrcweir //#i3370# remove quick help to prevent saving of autocorrection suggestions 309cdf0e10cSrcweir if(pView) 310cdf0e10cSrcweir pView->GetEditWin().StopQuickHelp(); 311cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 312cdf0e10cSrcweir 313cdf0e10cSrcweir CalcLayoutForOLEObjects(); // format for OLE objets 314cdf0e10cSrcweir // --> OD 2006-03-17 #i62875# 315cdf0e10cSrcweir // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible 316cdf0e10cSrcweir if ( pWrtShell && pDoc && 317cdf0e10cSrcweir pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) && 318cdf0e10cSrcweir docfunc::AllDrawObjsOnPage( *pDoc ) ) 319cdf0e10cSrcweir { 320cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); 321cdf0e10cSrcweir } 322cdf0e10cSrcweir // <-- 323cdf0e10cSrcweir 324cdf0e10cSrcweir sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; 325cdf0e10cSrcweir if( SfxObjectShell::Save() ) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir switch( GetCreateMode() ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir case SFX_CREATE_MODE_INTERNAL: 330cdf0e10cSrcweir nErr = 0; 331cdf0e10cSrcweir break; 332cdf0e10cSrcweir 333cdf0e10cSrcweir case SFX_CREATE_MODE_ORGANIZER: 334cdf0e10cSrcweir { 335cdf0e10cSrcweir WriterRef xWrt; 336cdf0e10cSrcweir ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt ); 337cdf0e10cSrcweir xWrt->SetOrganizerMode( sal_True ); 338cdf0e10cSrcweir SwWriter aWrt( *GetMedium(), *pDoc ); 339cdf0e10cSrcweir nErr = aWrt.Write( xWrt ); 340cdf0e10cSrcweir xWrt->SetOrganizerMode( sal_False ); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir break; 343cdf0e10cSrcweir 344cdf0e10cSrcweir case SFX_CREATE_MODE_EMBEDDED: 345cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 346cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_True ); 347cdf0e10cSrcweir // kein break; 348cdf0e10cSrcweir 349cdf0e10cSrcweir case SFX_CREATE_MODE_STANDARD: 350cdf0e10cSrcweir case SFX_CREATE_MODE_PREVIEW: 351cdf0e10cSrcweir default: 352cdf0e10cSrcweir { 353cdf0e10cSrcweir if( pDoc->ContainsMSVBasic() ) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir //TODO/MBA: it looks as that this code can be removed! 356cdf0e10cSrcweir //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() ); 357cdf0e10cSrcweir //aTmp.SaveOrDelMSVBAStorage( sal_False, aEmptyStr ); 358cdf0e10cSrcweir if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) 359cdf0e10cSrcweir nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) ); 360cdf0e10cSrcweir pDoc->SetContainsMSVBasic( sal_False ); 361cdf0e10cSrcweir } 362cdf0e10cSrcweir 363cdf0e10cSrcweir // TabellenBox Edit beenden! 364cdf0e10cSrcweir if( pWrtShell ) 365cdf0e10cSrcweir pWrtShell->EndAllTblBoxEdit(); 366cdf0e10cSrcweir 367cdf0e10cSrcweir WriterRef xWrt; 368cdf0e10cSrcweir ::GetXMLWriter( aEmptyStr, GetMedium()->GetBaseURL( true ), xWrt ); 369cdf0e10cSrcweir 370cdf0e10cSrcweir sal_Bool bLockedView(sal_False); 371cdf0e10cSrcweir if ( pWrtShell ) 372cdf0e10cSrcweir { 373cdf0e10cSrcweir bLockedView = pWrtShell->IsViewLocked(); 374cdf0e10cSrcweir pWrtShell->LockView( sal_True ); //lock visible section 375cdf0e10cSrcweir } 376cdf0e10cSrcweir 377cdf0e10cSrcweir SwWriter aWrt( *GetMedium(), *pDoc ); 378cdf0e10cSrcweir nErr = aWrt.Write( xWrt ); 379cdf0e10cSrcweir 380cdf0e10cSrcweir if ( pWrtShell ) 381cdf0e10cSrcweir pWrtShell->LockView( bLockedView ); 382cdf0e10cSrcweir } 383cdf0e10cSrcweir break; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_False ); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 388cdf0e10cSrcweir 389cdf0e10cSrcweir SfxViewFrame* pFrm = pWrtShell ? pWrtShell->GetView().GetViewFrame() : 0; 390cdf0e10cSrcweir if( pFrm ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir pFrm->GetBindings().SetState( SfxStringItem( SID_DOC_MODIFIED, ' ' )); 393cdf0e10cSrcweir } 394cdf0e10cSrcweir return !IsError( nErr ); 395cdf0e10cSrcweir } 396cdf0e10cSrcweir 397cdf0e10cSrcweir /*-------------------------------------------------------------------- 398cdf0e10cSrcweir Beschreibung: Sichern im Defaultformat 399cdf0e10cSrcweir --------------------------------------------------------------------*/ 400cdf0e10cSrcweir 401cdf0e10cSrcweir 402cdf0e10cSrcweir sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveAs" ); 405cdf0e10cSrcweir 406*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 407*ca62e2c2SSteve Yin pDoc->setDocAccTitle(String()); 408*ca62e2c2SSteve Yin SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this ); 409*ca62e2c2SSteve Yin if (pFrame1) 410*ca62e2c2SSteve Yin { 411*ca62e2c2SSteve Yin Window* pWindow = &pFrame1->GetWindow(); 412*ca62e2c2SSteve Yin if ( pWindow ) 413*ca62e2c2SSteve Yin { 414*ca62e2c2SSteve Yin Window* pSysWin = pWindow->GetSystemWindow(); 415*ca62e2c2SSteve Yin if ( pSysWin ) 416*ca62e2c2SSteve Yin { 417*ca62e2c2SSteve Yin pSysWin->SetAccessibleName(String()); 418*ca62e2c2SSteve Yin } 419*ca62e2c2SSteve Yin } 420*ca62e2c2SSteve Yin } 421*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 422cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 423cdf0e10cSrcweir //#i3370# remove quick help to prevent saving of autocorrection suggestions 424cdf0e10cSrcweir if(pView) 425cdf0e10cSrcweir pView->GetEditWin().StopQuickHelp(); 426cdf0e10cSrcweir 427cdf0e10cSrcweir //#i91811# mod if we have an active margin window, write back the text 428cdf0e10cSrcweir if ( pView && 429cdf0e10cSrcweir pView->GetPostItMgr() && 430cdf0e10cSrcweir pView->GetPostItMgr()->HasActiveSidebarWin() ) 431cdf0e10cSrcweir { 432cdf0e10cSrcweir pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin(); 433cdf0e10cSrcweir } 434cdf0e10cSrcweir 435cdf0e10cSrcweir if( pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) && 436cdf0e10cSrcweir !pDoc->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS) ) 437cdf0e10cSrcweir RemoveOLEObjects(); 438cdf0e10cSrcweir 439cdf0e10cSrcweir { 440cdf0e10cSrcweir // Task 75666 - is the Document imported by our Microsoft-Filters? 441cdf0e10cSrcweir const SfxFilter* pOldFilter = GetMedium()->GetFilter(); 442cdf0e10cSrcweir if( pOldFilter && 443cdf0e10cSrcweir ( pOldFilter->GetUserData().EqualsAscii( FILTER_WW8 ) || 444cdf0e10cSrcweir pOldFilter->GetUserData().EqualsAscii( "CWW6" ) || 445cdf0e10cSrcweir pOldFilter->GetUserData().EqualsAscii( "WW6" ) || 446cdf0e10cSrcweir pOldFilter->GetUserData().EqualsAscii( "WW1" ) )) 447cdf0e10cSrcweir { 448cdf0e10cSrcweir // when saving it in our own fileformat, then remove the template 449cdf0e10cSrcweir // name from the docinfo. 450cdf0e10cSrcweir uno::Reference<document::XDocumentPropertiesSupplier> xDPS( 451cdf0e10cSrcweir GetModel(), uno::UNO_QUERY_THROW); 452cdf0e10cSrcweir uno::Reference<document::XDocumentProperties> xDocProps 453cdf0e10cSrcweir = xDPS->getDocumentProperties(); 454cdf0e10cSrcweir xDocProps->setTemplateName(::rtl::OUString::createFromAscii("")); 455cdf0e10cSrcweir xDocProps->setTemplateURL(::rtl::OUString::createFromAscii("")); 456cdf0e10cSrcweir xDocProps->setTemplateDate(::util::DateTime()); 457cdf0e10cSrcweir } 458cdf0e10cSrcweir } 459cdf0e10cSrcweir 460cdf0e10cSrcweir CalcLayoutForOLEObjects(); // format for OLE objets 461cdf0e10cSrcweir // --> OD 2006-03-17 #i62875# 462cdf0e10cSrcweir // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible 463cdf0e10cSrcweir if ( pWrtShell && pDoc && 464cdf0e10cSrcweir pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) && 465cdf0e10cSrcweir docfunc::AllDrawObjsOnPage( *pDoc ) ) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); 468cdf0e10cSrcweir } 469cdf0e10cSrcweir // <-- 470cdf0e10cSrcweir 471cdf0e10cSrcweir sal_uLong nErr = ERR_SWG_WRITE_ERROR, nVBWarning = ERRCODE_NONE; 472cdf0e10cSrcweir uno::Reference < embed::XStorage > xStor = rMedium.GetOutputStorage(); 473cdf0e10cSrcweir if( SfxObjectShell::SaveAs( rMedium ) ) 474cdf0e10cSrcweir { 475cdf0e10cSrcweir if( GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) && !ISA( SwGlobalDocShell ) ) 476cdf0e10cSrcweir { 477cdf0e10cSrcweir // This is to set the correct class id if SaveAs is 478cdf0e10cSrcweir // called from SwDoc::SplitDoc to save a normal doc as 479cdf0e10cSrcweir // global doc. In this case, SaveAs is called at a 480cdf0e10cSrcweir // normal doc shell, therefore, SfxInplaceObject::SaveAs 481cdf0e10cSrcweir // will set the wrong class id. 482cdf0e10cSrcweir SvGlobalName aClassName; 483cdf0e10cSrcweir String aAppName, aLongUserName, aUserName; 484cdf0e10cSrcweir 485cdf0e10cSrcweir // The document is closed explicitly, but using SfxObjectShellLock is still more correct here 486cdf0e10cSrcweir SfxObjectShellLock xDocSh = 487cdf0e10cSrcweir new SwGlobalDocShell( SFX_CREATE_MODE_INTERNAL ); 488cdf0e10cSrcweir // the global document can not be a template 489cdf0e10cSrcweir xDocSh->SetupStorage( xStor, SotStorage::GetVersion( xStor ), sal_False ); 490cdf0e10cSrcweir xDocSh->DoClose(); 491cdf0e10cSrcweir } 492cdf0e10cSrcweir 493cdf0e10cSrcweir if( pDoc->ContainsMSVBasic() ) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir //TODO/MBA: it looks as that this code can be removed! 496cdf0e10cSrcweir //SvxImportMSVBasic aTmp( *this, pIo->GetStorage() ); 497cdf0e10cSrcweir //aTmp.SaveOrDelMSVBAStorage( sal_False, aEmptyStr ); 498cdf0e10cSrcweir if( SvtFilterOptions::Get()->IsLoadWordBasicStorage() ) 499cdf0e10cSrcweir nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this ); 500cdf0e10cSrcweir pDoc->SetContainsMSVBasic( sal_False ); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir 503cdf0e10cSrcweir // TabellenBox Edit beenden! 504cdf0e10cSrcweir if( pWrtShell ) 505cdf0e10cSrcweir pWrtShell->EndAllTblBoxEdit(); 506cdf0e10cSrcweir 507cdf0e10cSrcweir // Modified-Flag merken und erhalten ohne den Link zu Callen 508cdf0e10cSrcweir // (fuer OLE; nach Anweisung von MM) 509cdf0e10cSrcweir sal_Bool bIsModified = pDoc->IsModified(); 510cdf0e10cSrcweir pDoc->GetIDocumentUndoRedo().LockUndoNoModifiedPosition(); 511cdf0e10cSrcweir Link aOldOLELnk( pDoc->GetOle2Link() ); 512cdf0e10cSrcweir pDoc->SetOle2Link( Link() ); 513cdf0e10cSrcweir 514cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 515cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( 516cdf0e10cSrcweir SFX_CREATE_MODE_EMBEDDED == GetCreateMode() ); 517cdf0e10cSrcweir 518cdf0e10cSrcweir WriterRef xWrt; 519cdf0e10cSrcweir ::GetXMLWriter( aEmptyStr, rMedium.GetBaseURL( true ), xWrt ); 520cdf0e10cSrcweir 521cdf0e10cSrcweir sal_Bool bLockedView(sal_False); 522cdf0e10cSrcweir if ( pWrtShell ) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir bLockedView = pWrtShell->IsViewLocked(); 525cdf0e10cSrcweir pWrtShell->LockView( sal_True ); //lock visible section 526cdf0e10cSrcweir } 527cdf0e10cSrcweir 528cdf0e10cSrcweir SwWriter aWrt( rMedium, *pDoc ); 529cdf0e10cSrcweir nErr = aWrt.Write( xWrt ); 530cdf0e10cSrcweir 531cdf0e10cSrcweir if ( pWrtShell ) 532cdf0e10cSrcweir pWrtShell->LockView( bLockedView ); 533cdf0e10cSrcweir 534cdf0e10cSrcweir if( bIsModified ) 535cdf0e10cSrcweir { 536cdf0e10cSrcweir pDoc->SetModified(); 537cdf0e10cSrcweir pDoc->GetIDocumentUndoRedo().UnLockUndoNoModifiedPosition(); 538cdf0e10cSrcweir } 539cdf0e10cSrcweir pDoc->SetOle2Link( aOldOLELnk ); 540cdf0e10cSrcweir 541cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_False ); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir SetError( nErr ? nErr : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 544cdf0e10cSrcweir 545cdf0e10cSrcweir return !IsError( nErr ); 546cdf0e10cSrcweir } 547cdf0e10cSrcweir 548cdf0e10cSrcweir /*-------------------------------------------------------------------- 549cdf0e10cSrcweir Beschreibung: Sichern aller Formate 550cdf0e10cSrcweir --------------------------------------------------------------------*/ 551cdf0e10cSrcweir SwSrcView* lcl_GetSourceView( SwDocShell* pSh ) 552cdf0e10cSrcweir { 553cdf0e10cSrcweir // sind wir in der SourceView? 554cdf0e10cSrcweir SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( pSh ); 555cdf0e10cSrcweir SfxViewShell* pViewShell = pVFrame ? pVFrame->GetViewShell() : 0; 556cdf0e10cSrcweir return PTR_CAST( SwSrcView, pViewShell); 557cdf0e10cSrcweir } 558cdf0e10cSrcweir 559cdf0e10cSrcweir sal_Bool SwDocShell::ConvertTo( SfxMedium& rMedium ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::ConvertTo" ); 562cdf0e10cSrcweir const SfxFilter* pFlt = rMedium.GetFilter(); 563cdf0e10cSrcweir if( !pFlt ) 564cdf0e10cSrcweir return sal_False; 565cdf0e10cSrcweir 566cdf0e10cSrcweir WriterRef xWriter; 567cdf0e10cSrcweir SwReaderWriter::GetWriter( pFlt->GetUserData(), rMedium.GetBaseURL( true ), xWriter ); 568cdf0e10cSrcweir if( !xWriter.Is() ) 569cdf0e10cSrcweir { // Der Filter ist nicht vorhanden 570cdf0e10cSrcweir InfoBox( 0, 571cdf0e10cSrcweir SW_RESSTR(STR_DLLNOTFOUND) ).Execute(); 572cdf0e10cSrcweir return sal_False; 573cdf0e10cSrcweir } 574cdf0e10cSrcweir 575cdf0e10cSrcweir //#i3370# remove quick help to prevent saving of autocorrection suggestions 576cdf0e10cSrcweir if(pView) 577cdf0e10cSrcweir pView->GetEditWin().StopQuickHelp(); 578cdf0e10cSrcweir 579cdf0e10cSrcweir //#i91811# mod if we have an active margin window, write back the text 580cdf0e10cSrcweir if ( pView && 581cdf0e10cSrcweir pView->GetPostItMgr() && 582cdf0e10cSrcweir pView->GetPostItMgr()->HasActiveSidebarWin() ) 583cdf0e10cSrcweir { 584cdf0e10cSrcweir pView->GetPostItMgr()->UpdateDataOnActiveSidebarWin(); 585cdf0e10cSrcweir } 586cdf0e10cSrcweir 587cdf0e10cSrcweir sal_uLong nVBWarning = 0; 588cdf0e10cSrcweir 589cdf0e10cSrcweir if( pDoc->ContainsMSVBasic() ) 590cdf0e10cSrcweir { 591cdf0e10cSrcweir sal_Bool bSave = pFlt->GetUserData().EqualsAscii( "CWW8" ) 592cdf0e10cSrcweir && SvtFilterOptions::Get()->IsLoadWordBasicStorage(); 593cdf0e10cSrcweir 594cdf0e10cSrcweir if ( bSave ) 595cdf0e10cSrcweir { 596cdf0e10cSrcweir SvStorageRef xStg = new SotStorage( rMedium.GetOutStream(), sal_False ); 597cdf0e10cSrcweir DBG_ASSERT( !xStg->GetError(), "No storage available for storing VBA macros!" ); 598cdf0e10cSrcweir if ( !xStg->GetError() ) 599cdf0e10cSrcweir { 600cdf0e10cSrcweir nVBWarning = SaveOrDelMSVBAStorage( (SfxObjectShell&) *this, *xStg, bSave, String::CreateFromAscii("Macros") ); 601cdf0e10cSrcweir xStg->Commit(); 602cdf0e10cSrcweir pDoc->SetContainsMSVBasic( sal_True ); 603cdf0e10cSrcweir } 604cdf0e10cSrcweir } 605cdf0e10cSrcweir } 606cdf0e10cSrcweir 607cdf0e10cSrcweir // TabellenBox Edit beenden! 608cdf0e10cSrcweir if( pWrtShell ) 609cdf0e10cSrcweir pWrtShell->EndAllTblBoxEdit(); 610cdf0e10cSrcweir 611cdf0e10cSrcweir if( pFlt->GetUserData().EqualsAscii( "HTML") ) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir SvxHtmlOptions* pHtmlOpt = SvxHtmlOptions::Get(); 614cdf0e10cSrcweir if( !pHtmlOpt->IsStarBasic() && pHtmlOpt->IsStarBasicWarning() && HasBasic() ) 615cdf0e10cSrcweir { 616cdf0e10cSrcweir uno::Reference< XLibraryContainer > xLibCont(GetBasicContainer(), UNO_QUERY); 617cdf0e10cSrcweir uno::Reference< XNameAccess > xLib; 618cdf0e10cSrcweir Sequence<rtl::OUString> aNames = xLibCont->getElementNames(); 619cdf0e10cSrcweir const rtl::OUString* pNames = aNames.getConstArray(); 620cdf0e10cSrcweir for(sal_Int32 nLib = 0; nLib < aNames.getLength(); nLib++) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir Any aLib = xLibCont->getByName(pNames[nLib]); 623cdf0e10cSrcweir aLib >>= xLib; 624cdf0e10cSrcweir if(xLib.is()) 625cdf0e10cSrcweir { 626cdf0e10cSrcweir Sequence<rtl::OUString> aModNames = xLib->getElementNames(); 627cdf0e10cSrcweir if(aModNames.getLength()) 628cdf0e10cSrcweir { 629cdf0e10cSrcweir SetError(WARN_SWG_HTML_NO_MACROS, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 630cdf0e10cSrcweir break; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir } 633cdf0e10cSrcweir } 634cdf0e10cSrcweir } 635cdf0e10cSrcweir UpdateDocInfoForSave(); 636cdf0e10cSrcweir } 637cdf0e10cSrcweir 638cdf0e10cSrcweir // --> FME 2007-5-7 #i76360# Update document statistics 639cdf0e10cSrcweir SwDocStat aDocStat( pDoc->GetDocStat() );; 640cdf0e10cSrcweir pDoc->UpdateDocStat( aDocStat ); 641cdf0e10cSrcweir // <-- 642cdf0e10cSrcweir CalcLayoutForOLEObjects(); // format for OLE objets 643cdf0e10cSrcweir // --> OD 2006-03-17 #i62875# 644cdf0e10cSrcweir // reset compatibility flag <DoNotCaptureDrawObjsOnPage>, if possible 645cdf0e10cSrcweir if ( pWrtShell && pDoc && 646cdf0e10cSrcweir pDoc->get(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE) && 647cdf0e10cSrcweir docfunc::AllDrawObjsOnPage( *pDoc ) ) 648cdf0e10cSrcweir { 649cdf0e10cSrcweir pDoc->set(IDocumentSettingAccess::DO_NOT_CAPTURE_DRAW_OBJS_ON_PAGE, false); 650cdf0e10cSrcweir } 651cdf0e10cSrcweir // <-- 652cdf0e10cSrcweir 653cdf0e10cSrcweir if( xWriter->IsStgWriter() && 654cdf0e10cSrcweir ( /*xWriter->IsSw3Writer() ||*/ 655cdf0e10cSrcweir pFlt->GetUserData().EqualsAscii( FILTER_XML ) || 656cdf0e10cSrcweir pFlt->GetUserData().EqualsAscii( FILTER_XMLV ) || 657cdf0e10cSrcweir pFlt->GetUserData().EqualsAscii( FILTER_XMLVW ) ) ) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir // eigenen Typ ermitteln 660cdf0e10cSrcweir sal_uInt8 nMyType = 0; 661cdf0e10cSrcweir if( ISA( SwWebDocShell) ) 662cdf0e10cSrcweir nMyType = 1; 663cdf0e10cSrcweir else if( ISA( SwGlobalDocShell) ) 664cdf0e10cSrcweir nMyType = 2; 665cdf0e10cSrcweir 666cdf0e10cSrcweir // gewuenschten Typ ermitteln 667cdf0e10cSrcweir sal_uInt8 nSaveType = 0; 668cdf0e10cSrcweir sal_uLong nSaveClipId = pFlt->GetFormat(); 669cdf0e10cSrcweir if( SOT_FORMATSTR_ID_STARWRITERWEB_8 == nSaveClipId || 670cdf0e10cSrcweir SOT_FORMATSTR_ID_STARWRITERWEB_60 == nSaveClipId || 671cdf0e10cSrcweir SOT_FORMATSTR_ID_STARWRITERWEB_50 == nSaveClipId || 672cdf0e10cSrcweir SOT_FORMATSTR_ID_STARWRITERWEB_40 == nSaveClipId ) 673cdf0e10cSrcweir nSaveType = 1; 674cdf0e10cSrcweir else if( SOT_FORMATSTR_ID_STARWRITERGLOB_8 == nSaveClipId || 675cdf0e10cSrcweir SOT_FORMATSTR_ID_STARWRITERGLOB_60 == nSaveClipId || 676cdf0e10cSrcweir SOT_FORMATSTR_ID_STARWRITERGLOB_50 == nSaveClipId || 677cdf0e10cSrcweir SOT_FORMATSTR_ID_STARWRITERGLOB_40 == nSaveClipId ) 678cdf0e10cSrcweir nSaveType = 2; 679cdf0e10cSrcweir 680cdf0e10cSrcweir // Flags am Dokument entsprechend umsetzen 681cdf0e10cSrcweir sal_Bool bIsHTMLModeSave = GetDoc()->get(IDocumentSettingAccess::HTML_MODE); 682cdf0e10cSrcweir sal_Bool bIsGlobalDocSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT); 683cdf0e10cSrcweir sal_Bool bIsGlblDocSaveLinksSave = GetDoc()->get(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS); 684cdf0e10cSrcweir if( nMyType != nSaveType ) 685cdf0e10cSrcweir { 686cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::HTML_MODE, 1 == nSaveType); 687cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, 2 == nSaveType); 688cdf0e10cSrcweir if( 2 != nSaveType ) 689cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, false); 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir // if the target format is storage based, then the output storage must be already created 693cdf0e10cSrcweir if ( rMedium.IsStorage() ) 694cdf0e10cSrcweir { 695cdf0e10cSrcweir // set MediaType on target storage 696cdf0e10cSrcweir // (MediaType will be queried during SaveAs) 697cdf0e10cSrcweir try 698cdf0e10cSrcweir { 699cdf0e10cSrcweir // TODO/MBA: testing 700cdf0e10cSrcweir uno::Reference < beans::XPropertySet > xSet( rMedium.GetStorage(), uno::UNO_QUERY ); 701cdf0e10cSrcweir if ( xSet.is() ) 702cdf0e10cSrcweir xSet->setPropertyValue( ::rtl::OUString::createFromAscii("MediaType"), uno::makeAny( ::rtl::OUString( SotExchange::GetFormatMimeType( nSaveClipId ) ) ) ); 703cdf0e10cSrcweir } 704cdf0e10cSrcweir catch ( uno::Exception& ) 705cdf0e10cSrcweir { 706cdf0e10cSrcweir } 707cdf0e10cSrcweir } 708cdf0e10cSrcweir 709cdf0e10cSrcweir // Jetzt das Dokument normal speichern 710cdf0e10cSrcweir sal_Bool bRet = SaveAs( rMedium ); 711cdf0e10cSrcweir 712cdf0e10cSrcweir if( nMyType != nSaveType ) 713cdf0e10cSrcweir { 714cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::HTML_MODE, bIsHTMLModeSave ); 715cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT, bIsGlobalDocSave); 716cdf0e10cSrcweir GetDoc()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bIsGlblDocSaveLinksSave); 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir return bRet; 720cdf0e10cSrcweir } 721cdf0e10cSrcweir 722cdf0e10cSrcweir if( pFlt->GetUserData().EqualsAscii( FILTER_TEXT_DLG ) && 723cdf0e10cSrcweir ( pWrtShell || !::lcl_GetSourceView( this ) )) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir SwAsciiOptions aOpt; 726cdf0e10cSrcweir String sItemOpt; 727cdf0e10cSrcweir const SfxItemSet* pSet; 728cdf0e10cSrcweir const SfxPoolItem* pItem; 729cdf0e10cSrcweir if( 0 != ( pSet = rMedium.GetItemSet() ) ) 730cdf0e10cSrcweir { 731cdf0e10cSrcweir if( SFX_ITEM_SET == pSet->GetItemState( SID_FILE_FILTEROPTIONS, 732cdf0e10cSrcweir sal_True, &pItem ) ) 733cdf0e10cSrcweir sItemOpt = ((const SfxStringItem*)pItem)->GetValue(); 734cdf0e10cSrcweir } 735cdf0e10cSrcweir if(sItemOpt.Len()) 736cdf0e10cSrcweir aOpt.ReadUserData( sItemOpt ); 737cdf0e10cSrcweir 738cdf0e10cSrcweir xWriter->SetAsciiOptions( aOpt ); 739cdf0e10cSrcweir } 740cdf0e10cSrcweir 741cdf0e10cSrcweir // SfxProgress unterdruecken, wenn man Embedded ist 742cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( 743cdf0e10cSrcweir SFX_CREATE_MODE_EMBEDDED == GetCreateMode()); 744cdf0e10cSrcweir 745cdf0e10cSrcweir // Kontext aufspannen, um die Anzeige der Selektion zu unterbinden 746cdf0e10cSrcweir sal_uLong nErrno; 747cdf0e10cSrcweir String aFileName( rMedium.GetName() ); 748cdf0e10cSrcweir 749cdf0e10cSrcweir //Keine View also das ganze Dokument! 750cdf0e10cSrcweir if ( pWrtShell ) 751cdf0e10cSrcweir { 752cdf0e10cSrcweir SwWait aWait( *this, sal_True ); 753cdf0e10cSrcweir // --> OD 2009-12-31 #i106906# 754cdf0e10cSrcweir const sal_Bool bFormerLockView = pWrtShell->IsViewLocked(); 755cdf0e10cSrcweir pWrtShell->LockView( sal_True ); 756cdf0e10cSrcweir // <-- 757cdf0e10cSrcweir pWrtShell->StartAllAction(); 758cdf0e10cSrcweir pWrtShell->Push(); 759cdf0e10cSrcweir SwWriter aWrt( rMedium, *pWrtShell, sal_True ); 760cdf0e10cSrcweir nErrno = aWrt.Write( xWriter, &aFileName ); 761cdf0e10cSrcweir //JP 16.05.97: falls der SFX uns die View waehrend des speicherns 762cdf0e10cSrcweir // entzieht 763cdf0e10cSrcweir if( pWrtShell ) 764cdf0e10cSrcweir { 765cdf0e10cSrcweir pWrtShell->Pop(sal_False); 766cdf0e10cSrcweir pWrtShell->EndAllAction(); 767cdf0e10cSrcweir // --> OD 2009-12-31 #i106906# 768cdf0e10cSrcweir pWrtShell->LockView( bFormerLockView ); 769cdf0e10cSrcweir // <-- 770cdf0e10cSrcweir } 771cdf0e10cSrcweir } 772cdf0e10cSrcweir else 773cdf0e10cSrcweir { 774cdf0e10cSrcweir // sind wir in der SourceView? 775cdf0e10cSrcweir SwSrcView* pSrcView = ::lcl_GetSourceView( this ); 776cdf0e10cSrcweir if( pSrcView ) 777cdf0e10cSrcweir { 778cdf0e10cSrcweir pSrcView->SaveContentTo(rMedium); 779cdf0e10cSrcweir nErrno = 0; 780cdf0e10cSrcweir } 781cdf0e10cSrcweir else 782cdf0e10cSrcweir { 783cdf0e10cSrcweir SwWriter aWrt( rMedium, *pDoc ); 784cdf0e10cSrcweir nErrno = aWrt.Write( xWriter, &aFileName ); 785cdf0e10cSrcweir } 786cdf0e10cSrcweir } 787cdf0e10cSrcweir 788cdf0e10cSrcweir SW_MOD()->SetEmbeddedLoadSave( sal_False ); 789cdf0e10cSrcweir SetError( nErrno ? nErrno : nVBWarning, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); 790cdf0e10cSrcweir if( !rMedium.IsStorage() ) 791cdf0e10cSrcweir rMedium.CloseOutStream(); 792cdf0e10cSrcweir 793cdf0e10cSrcweir return !IsError( nErrno ); 794cdf0e10cSrcweir } 795cdf0e10cSrcweir 796cdf0e10cSrcweir /*-------------------------------------------------------------------- 797cdf0e10cSrcweir Beschreibung: Haende weg 798cdf0e10cSrcweir --------------------------------------------------------------------*/ 799cdf0e10cSrcweir 800cdf0e10cSrcweir 801cdf0e10cSrcweir /*-------------------------------------------------------------------- 802cdf0e10cSrcweir Beschreibung: ??? noch nicht zu aktivieren, muss sal_True liefern 803cdf0e10cSrcweir --------------------------------------------------------------------*/ 804cdf0e10cSrcweir 805cdf0e10cSrcweir 806cdf0e10cSrcweir sal_Bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor ) 807cdf0e10cSrcweir { 808cdf0e10cSrcweir RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDocShell::SaveCompleted" ); 809cdf0e10cSrcweir sal_Bool bRet = SfxObjectShell::SaveCompleted( xStor ); 810cdf0e10cSrcweir if( bRet ) 811cdf0e10cSrcweir { 812cdf0e10cSrcweir // erst hier entscheiden, ob das Speichern geklappt hat oder nicht 813cdf0e10cSrcweir if( IsModified() ) 814cdf0e10cSrcweir pDoc->SetModified(); 815cdf0e10cSrcweir else 816cdf0e10cSrcweir pDoc->ResetModified(); 817cdf0e10cSrcweir } 818cdf0e10cSrcweir 819cdf0e10cSrcweir if( pOLEChildList ) 820cdf0e10cSrcweir { 821cdf0e10cSrcweir sal_Bool bResetModified = IsEnableSetModified(); 822cdf0e10cSrcweir if( bResetModified ) 823cdf0e10cSrcweir EnableSetModified( sal_False ); 824cdf0e10cSrcweir 825cdf0e10cSrcweir uno::Sequence < rtl::OUString > aNames = pOLEChildList->GetObjectNames(); 826cdf0e10cSrcweir for( sal_Int32 n = aNames.getLength(); n; n-- ) 827cdf0e10cSrcweir { 828cdf0e10cSrcweir if ( !pOLEChildList->MoveEmbeddedObject( aNames[n-1], GetEmbeddedObjectContainer() ) ) 829cdf0e10cSrcweir { 830cdf0e10cSrcweir DBG_ERROR( "Copying of objects didn't work!" ); 831cdf0e10cSrcweir } 832cdf0e10cSrcweir 833cdf0e10cSrcweir //SvPersist* pPersist = this; 834cdf0e10cSrcweir //SvInfoObjectRef aRef( pInfList->GetObject( --n )); 835cdf0e10cSrcweir //pPersist->Move( &aRef, aRef->GetStorageName() ); 836cdf0e10cSrcweir } 837cdf0e10cSrcweir 838cdf0e10cSrcweir DELETEZ( pOLEChildList ); 839cdf0e10cSrcweir if( bResetModified ) 840cdf0e10cSrcweir EnableSetModified( sal_True ); 841cdf0e10cSrcweir } 842cdf0e10cSrcweir return bRet; 843cdf0e10cSrcweir } 844cdf0e10cSrcweir 845cdf0e10cSrcweir /*-------------------------------------------------------------------- 846cdf0e10cSrcweir Beschreibung: Draw()-Overload fuer OLE2 (Sfx) 847cdf0e10cSrcweir --------------------------------------------------------------------*/ 848cdf0e10cSrcweir 849cdf0e10cSrcweir void SwDocShell::Draw( OutputDevice* pDev, const JobSetup& rSetup, 850cdf0e10cSrcweir sal_uInt16 nAspect ) 851cdf0e10cSrcweir { 852cdf0e10cSrcweir //fix #25341# Draw sollte das Modified nicht beeinflussen 853cdf0e10cSrcweir sal_Bool bResetModified; 854cdf0e10cSrcweir if ( sal_True == (bResetModified = IsEnableSetModified()) ) 855cdf0e10cSrcweir EnableSetModified( sal_False ); 856cdf0e10cSrcweir 857cdf0e10cSrcweir //sollte am Document ein JobSetup haengen, dann kopieren wir uns diesen, 858cdf0e10cSrcweir //um nach dem PrtOle2 diesen wieder am Doc zu verankern. 859cdf0e10cSrcweir //Einen leeren JobSetup setzen wir nicht ein, denn der wuerde nur zu 860cdf0e10cSrcweir //fragwuerdigem Ergebnis nach teurer Neuformatierung fuehren (Preview!) 861cdf0e10cSrcweir JobSetup *pOrig = 0; 862cdf0e10cSrcweir if ( rSetup.GetPrinterName().Len() && ASPECT_THUMBNAIL != nAspect ) 863cdf0e10cSrcweir { 864cdf0e10cSrcweir pOrig = const_cast<JobSetup*>(pDoc->getJobsetup()); 865cdf0e10cSrcweir if( pOrig ) // dann kopieren wir uns den 866cdf0e10cSrcweir pOrig = new JobSetup( *pOrig ); 867cdf0e10cSrcweir pDoc->setJobsetup( rSetup ); 868cdf0e10cSrcweir } 869cdf0e10cSrcweir 870cdf0e10cSrcweir Rectangle aRect( nAspect == ASPECT_THUMBNAIL ? 871cdf0e10cSrcweir GetVisArea( nAspect ) : GetVisArea( ASPECT_CONTENT ) ); 872cdf0e10cSrcweir 873cdf0e10cSrcweir pDev->Push(); 874cdf0e10cSrcweir pDev->SetFillColor(); 875cdf0e10cSrcweir pDev->SetLineColor(); 876cdf0e10cSrcweir pDev->SetBackground(); 877cdf0e10cSrcweir sal_Bool bWeb = 0 != PTR_CAST(SwWebDocShell, this); 878cdf0e10cSrcweir SwPrintData aOpts; 879cdf0e10cSrcweir ViewShell::PrtOle2( pDoc, SW_MOD()->GetUsrPref(bWeb), aOpts, pDev, aRect ); 880cdf0e10cSrcweir pDev->Pop(); 881cdf0e10cSrcweir 882cdf0e10cSrcweir if( pOrig ) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir pDoc->setJobsetup( *pOrig ); 885cdf0e10cSrcweir delete pOrig; 886cdf0e10cSrcweir } 887cdf0e10cSrcweir if ( bResetModified ) 888cdf0e10cSrcweir EnableSetModified( sal_True ); 889cdf0e10cSrcweir } 890cdf0e10cSrcweir 891cdf0e10cSrcweir 892cdf0e10cSrcweir void SwDocShell::SetVisArea( const Rectangle &rRect ) 893cdf0e10cSrcweir { 894cdf0e10cSrcweir Rectangle aRect( rRect ); 895cdf0e10cSrcweir if ( pView ) 896cdf0e10cSrcweir { 897cdf0e10cSrcweir Size aSz( pView->GetDocSz() ); 898cdf0e10cSrcweir aSz.Width() += DOCUMENTBORDER; aSz.Height() += DOCUMENTBORDER; 899cdf0e10cSrcweir long nMoveX = 0, nMoveY = 0; 900cdf0e10cSrcweir if ( aRect.Right() > aSz.Width() ) 901cdf0e10cSrcweir nMoveX = aSz.Width() - aRect.Right(); 902cdf0e10cSrcweir if ( aRect.Bottom() > aSz.Height() ) 903cdf0e10cSrcweir nMoveY = aSz.Height() - aRect.Bottom(); 904cdf0e10cSrcweir aRect.Move( nMoveX, nMoveY ); 905cdf0e10cSrcweir nMoveX = aRect.Left() < 0 ? -aRect.Left() : 0; 906cdf0e10cSrcweir nMoveY = aRect.Top() < 0 ? -aRect.Top() : 0; 907cdf0e10cSrcweir aRect.Move( nMoveX, nMoveY ); 908cdf0e10cSrcweir 909cdf0e10cSrcweir //Ruft das SfxInPlaceObject::SetVisArea()! 910cdf0e10cSrcweir pView->SetVisArea( aRect, sal_True ); 911cdf0e10cSrcweir } 912cdf0e10cSrcweir else 913cdf0e10cSrcweir SfxObjectShell::SetVisArea( aRect ); 914cdf0e10cSrcweir } 915cdf0e10cSrcweir 916cdf0e10cSrcweir 917cdf0e10cSrcweir Rectangle SwDocShell::GetVisArea( sal_uInt16 nAspect ) const 918cdf0e10cSrcweir { 919cdf0e10cSrcweir if ( nAspect == ASPECT_THUMBNAIL ) 920cdf0e10cSrcweir { 921cdf0e10cSrcweir //PreView: VisArea auf die erste Seite einstellen. 922cdf0e10cSrcweir SwNodeIndex aIdx( pDoc->GetNodes().GetEndOfExtras(), 1 ); 923cdf0e10cSrcweir SwCntntNode* pNd = pDoc->GetNodes().GoNext( &aIdx ); 924cdf0e10cSrcweir 925cdf0e10cSrcweir const SwRect aPageRect = pNd->FindPageFrmRect( sal_False, 0, sal_False ); 926cdf0e10cSrcweir return aPageRect.SVRect(); 927cdf0e10cSrcweir } 928cdf0e10cSrcweir return SfxObjectShell::GetVisArea( nAspect ); 929cdf0e10cSrcweir } 930cdf0e10cSrcweir 931cdf0e10cSrcweir Printer *SwDocShell::GetDocumentPrinter() 932cdf0e10cSrcweir { 933cdf0e10cSrcweir return pDoc->getPrinter( false ); 934cdf0e10cSrcweir } 935cdf0e10cSrcweir 936cdf0e10cSrcweir OutputDevice* SwDocShell::GetDocumentRefDev() 937cdf0e10cSrcweir { 938cdf0e10cSrcweir return pDoc->getReferenceDevice( false ); 939cdf0e10cSrcweir } 940cdf0e10cSrcweir 941cdf0e10cSrcweir void SwDocShell::OnDocumentPrinterChanged( Printer * pNewPrinter ) 942cdf0e10cSrcweir { 943cdf0e10cSrcweir if ( pNewPrinter ) 944cdf0e10cSrcweir GetDoc()->setJobsetup( pNewPrinter->GetJobSetup() ); 945cdf0e10cSrcweir else 946cdf0e10cSrcweir GetDoc()->setPrinter( 0, true, true ); 947cdf0e10cSrcweir } 948cdf0e10cSrcweir 949cdf0e10cSrcweir sal_uLong SwDocShell::GetMiscStatus() const 950cdf0e10cSrcweir { 951cdf0e10cSrcweir return SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE; 952cdf0e10cSrcweir } 953cdf0e10cSrcweir 954cdf0e10cSrcweir // --> FME 2004-08-05 #i20883# Digital Signatures and Encryption 955cdf0e10cSrcweir sal_uInt16 SwDocShell::GetHiddenInformationState( sal_uInt16 nStates ) 956cdf0e10cSrcweir { 957cdf0e10cSrcweir // get global state like HIDDENINFORMATION_DOCUMENTVERSIONS 958cdf0e10cSrcweir sal_uInt16 nState = SfxObjectShell::GetHiddenInformationState( nStates ); 959cdf0e10cSrcweir 960cdf0e10cSrcweir if ( nStates & HIDDENINFORMATION_RECORDEDCHANGES ) 961cdf0e10cSrcweir { 962cdf0e10cSrcweir if ( GetDoc()->GetRedlineTbl().Count() ) 963cdf0e10cSrcweir nState |= HIDDENINFORMATION_RECORDEDCHANGES; 964cdf0e10cSrcweir } 965cdf0e10cSrcweir if ( nStates & HIDDENINFORMATION_NOTES ) 966cdf0e10cSrcweir { 967cdf0e10cSrcweir ASSERT( GetWrtShell(), "No SwWrtShell, no information" ) 968cdf0e10cSrcweir if ( GetWrtShell() ) 969cdf0e10cSrcweir { 970cdf0e10cSrcweir SwFieldType* pType = GetWrtShell()->GetFldType( RES_POSTITFLD, aEmptyStr ); 971cdf0e10cSrcweir SwIterator<SwFmtFld,SwFieldType> aIter( *pType ); 972cdf0e10cSrcweir SwFmtFld* pFirst = aIter.First(); 973cdf0e10cSrcweir while( pFirst ) 974cdf0e10cSrcweir { 975cdf0e10cSrcweir if( pFirst->GetTxtFld() && pFirst->IsFldInDoc() ) 976cdf0e10cSrcweir { 977cdf0e10cSrcweir nState |= HIDDENINFORMATION_NOTES; 978cdf0e10cSrcweir break; 979cdf0e10cSrcweir } 980cdf0e10cSrcweir pFirst = aIter.Next(); 981cdf0e10cSrcweir } 982cdf0e10cSrcweir } 983cdf0e10cSrcweir } 984cdf0e10cSrcweir 985cdf0e10cSrcweir return nState; 986cdf0e10cSrcweir } 987cdf0e10cSrcweir // <-- 988cdf0e10cSrcweir 989cdf0e10cSrcweir 990cdf0e10cSrcweir /*-------------------------------------------------------------------- 991cdf0e10cSrcweir Beschreibung: 992cdf0e10cSrcweir --------------------------------------------------------------------*/ 993cdf0e10cSrcweir 994cdf0e10cSrcweir 995cdf0e10cSrcweir void SwDocShell::GetState(SfxItemSet& rSet) 996cdf0e10cSrcweir { 997cdf0e10cSrcweir SfxWhichIter aIter(rSet); 998cdf0e10cSrcweir sal_uInt16 nWhich = aIter.FirstWhich(); 999cdf0e10cSrcweir 1000cdf0e10cSrcweir while (nWhich) 1001cdf0e10cSrcweir { 1002cdf0e10cSrcweir switch (nWhich) 1003cdf0e10cSrcweir { 1004cdf0e10cSrcweir case SID_PRINTPREVIEW: 1005cdf0e10cSrcweir { 1006cdf0e10cSrcweir sal_Bool bDisable = IsInPlaceActive(); 1007cdf0e10cSrcweir // Disable "multiple layout" 1008cdf0e10cSrcweir if ( !bDisable ) 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir SfxViewFrame *pTmpFrm = SfxViewFrame::GetFirst(this); 1011cdf0e10cSrcweir while (pTmpFrm) // Preview suchen 1012cdf0e10cSrcweir { 1013cdf0e10cSrcweir if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) && 1014cdf0e10cSrcweir ((SwView*)pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() ) 1015cdf0e10cSrcweir { 1016cdf0e10cSrcweir bDisable = sal_True; 1017cdf0e10cSrcweir break; 1018cdf0e10cSrcweir } 1019cdf0e10cSrcweir pTmpFrm = pTmpFrm->GetNext(*pTmpFrm, this); 1020cdf0e10cSrcweir } 1021cdf0e10cSrcweir } 1022cdf0e10cSrcweir // End of disabled "multiple layout" 1023cdf0e10cSrcweir if ( bDisable ) 1024cdf0e10cSrcweir rSet.DisableItem( SID_PRINTPREVIEW ); 1025cdf0e10cSrcweir else 1026cdf0e10cSrcweir { 1027cdf0e10cSrcweir SfxBoolItem aBool( SID_PRINTPREVIEW, sal_False ); 1028cdf0e10cSrcweir if( PTR_CAST( SwPagePreView, SfxViewShell::Current()) ) 1029cdf0e10cSrcweir aBool.SetValue( sal_True ); 1030cdf0e10cSrcweir rSet.Put( aBool ); 1031cdf0e10cSrcweir } 1032cdf0e10cSrcweir } 1033cdf0e10cSrcweir break; 1034cdf0e10cSrcweir case SID_SOURCEVIEW: 1035cdf0e10cSrcweir { 1036cdf0e10cSrcweir SfxViewShell* pCurrView = GetView() ? (SfxViewShell*)GetView() 1037cdf0e10cSrcweir : SfxViewShell::Current(); 1038cdf0e10cSrcweir sal_Bool bSourceView = 0 != PTR_CAST(SwSrcView, pCurrView); 1039cdf0e10cSrcweir rSet.Put(SfxBoolItem(SID_SOURCEVIEW, bSourceView)); 1040cdf0e10cSrcweir } 1041cdf0e10cSrcweir break; 1042cdf0e10cSrcweir case SID_HTML_MODE: 1043cdf0e10cSrcweir rSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(this))); 1044cdf0e10cSrcweir break; 1045cdf0e10cSrcweir 1046cdf0e10cSrcweir case FN_ABSTRACT_STARIMPRESS: 1047cdf0e10cSrcweir case FN_OUTLINE_TO_IMPRESS: 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir SvtModuleOptions aMOpt; 1050cdf0e10cSrcweir if ( !aMOpt.IsImpress() ) 1051cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1052cdf0e10cSrcweir } 1053cdf0e10cSrcweir /* no break here */ 1054cdf0e10cSrcweir case FN_ABSTRACT_NEWDOC: 1055cdf0e10cSrcweir case FN_OUTLINE_TO_CLIPBOARD: 1056cdf0e10cSrcweir { 1057cdf0e10cSrcweir if ( !GetDoc()->GetNodes().GetOutLineNds().Count() ) 1058cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1059cdf0e10cSrcweir } 1060cdf0e10cSrcweir break; 1061cdf0e10cSrcweir case SID_BROWSER_MODE: 1062cdf0e10cSrcweir case FN_PRINT_LAYOUT: 1063cdf0e10cSrcweir { 1064cdf0e10cSrcweir sal_Bool bState = GetDoc()->get(IDocumentSettingAccess::BROWSE_MODE); 1065cdf0e10cSrcweir if(FN_PRINT_LAYOUT == nWhich) 1066cdf0e10cSrcweir bState = !bState; 1067cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bState)); 1068cdf0e10cSrcweir } 1069cdf0e10cSrcweir break; 1070cdf0e10cSrcweir 1071cdf0e10cSrcweir case FN_NEW_GLOBAL_DOC: 1072cdf0e10cSrcweir if ( ISA(SwGlobalDocShell) ) 1073cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1074cdf0e10cSrcweir break; 1075cdf0e10cSrcweir 1076cdf0e10cSrcweir case FN_NEW_HTML_DOC: 1077cdf0e10cSrcweir if( ISA( SwWebDocShell ) ) 1078cdf0e10cSrcweir rSet.DisableItem( nWhich ); 1079cdf0e10cSrcweir break; 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir case SID_ATTR_YEAR2000: 1082cdf0e10cSrcweir { 1083cdf0e10cSrcweir const SvNumberFormatter* pFmtr = pDoc->GetNumberFormatter(sal_False); 1084cdf0e10cSrcweir rSet.Put( SfxUInt16Item( nWhich, 1085cdf0e10cSrcweir static_cast< sal_uInt16 >( 1086cdf0e10cSrcweir pFmtr ? pFmtr->GetYear2000() 1087cdf0e10cSrcweir : ::utl::MiscCfg().GetYear2000() ))); 1088cdf0e10cSrcweir } 1089cdf0e10cSrcweir break; 1090cdf0e10cSrcweir case SID_ATTR_CHAR_FONTLIST: 1091cdf0e10cSrcweir { 1092cdf0e10cSrcweir rSet.Put( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) ); 1093cdf0e10cSrcweir } 1094cdf0e10cSrcweir break; 1095cdf0e10cSrcweir case SID_MAIL_PREPAREEXPORT: 1096cdf0e10cSrcweir { 1097cdf0e10cSrcweir //check if linked content or possibly hidden content is available 1098cdf0e10cSrcweir //pDoc->UpdateFlds( NULL, false ); 1099cdf0e10cSrcweir sfx2::LinkManager& rLnkMgr = pDoc->GetLinkManager(); 1100cdf0e10cSrcweir const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks(); 1101cdf0e10cSrcweir sal_Bool bRet = sal_False; 1102cdf0e10cSrcweir if( rLnks.Count() ) 1103cdf0e10cSrcweir bRet = sal_True; 1104cdf0e10cSrcweir else 1105cdf0e10cSrcweir { 1106cdf0e10cSrcweir //sections with hidden flag, hidden character attribute, hidden paragraph/text or conditional text fields 1107cdf0e10cSrcweir bRet = pDoc->HasInvisibleContent(); 1108cdf0e10cSrcweir } 1109cdf0e10cSrcweir rSet.Put( SfxBoolItem( nWhich, bRet ) ); 1110cdf0e10cSrcweir } 1111cdf0e10cSrcweir break; 1112cdf0e10cSrcweir 1113cdf0e10cSrcweir default: DBG_ASSERT(!this,"Hier darfst Du nicht hinein!"); 1114cdf0e10cSrcweir 1115cdf0e10cSrcweir } 1116cdf0e10cSrcweir nWhich = aIter.NextWhich(); 1117cdf0e10cSrcweir } 1118cdf0e10cSrcweir } 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir /*-------------------------------------------------------------------- 1121cdf0e10cSrcweir Beschreibung: OLE-Hdls 1122cdf0e10cSrcweir --------------------------------------------------------------------*/ 1123cdf0e10cSrcweir 1124cdf0e10cSrcweir 1125cdf0e10cSrcweir IMPL_LINK( SwDocShell, Ole2ModifiedHdl, void *, p ) 1126cdf0e10cSrcweir { 1127cdf0e10cSrcweir // vom Doc wird der Status mitgegeben (siehe doc.cxx) 1128cdf0e10cSrcweir // Bit 0: -> alter Zustand 1129cdf0e10cSrcweir // Bit 1: -> neuer Zustand 1130cdf0e10cSrcweir long nStatus = (long)p; 1131cdf0e10cSrcweir if( IsEnableSetModified() ) 1132cdf0e10cSrcweir SetModified( (nStatus & 2) ? sal_True : sal_False ); 1133cdf0e10cSrcweir return 0; 1134cdf0e10cSrcweir } 1135cdf0e10cSrcweir 1136cdf0e10cSrcweir /*-------------------------------------------------------------------- 1137cdf0e10cSrcweir Beschreibung: Pool returnen Hier weil virtuelll 1138cdf0e10cSrcweir --------------------------------------------------------------------*/ 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir 1141cdf0e10cSrcweir SfxStyleSheetBasePool* SwDocShell::GetStyleSheetPool() 1142cdf0e10cSrcweir { 1143cdf0e10cSrcweir return mxBasePool.get(); 1144cdf0e10cSrcweir } 1145cdf0e10cSrcweir 1146cdf0e10cSrcweir 1147cdf0e10cSrcweir void SwDocShell::SetView(SwView* pVw) 1148cdf0e10cSrcweir { 1149cdf0e10cSrcweir if ( 0 != (pView = pVw) ) 1150cdf0e10cSrcweir pWrtShell = &pView->GetWrtShell(); 1151cdf0e10cSrcweir else 1152cdf0e10cSrcweir pWrtShell = 0; 1153cdf0e10cSrcweir } 1154cdf0e10cSrcweir 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir void SwDocShell::PrepareReload() 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir ::DelAllGrfCacheEntries( pDoc ); 1159cdf0e10cSrcweir } 1160cdf0e10cSrcweir 1161cdf0e10cSrcweir // --> OD 2006-11-07 #i59688# 1162cdf0e10cSrcweir // linked graphics are now loaded on demand. 1163cdf0e10cSrcweir // Thus, loading of linked graphics no longer needed and necessary for 1164cdf0e10cSrcweir // the load of document being finished. 1165cdf0e10cSrcweir void SwDocShell::LoadingFinished() 1166cdf0e10cSrcweir { 1167cdf0e10cSrcweir // --> OD 2007-10-08 #i38810# 1168cdf0e10cSrcweir // Original fix fails after integration of cws xmlsec11: 1169cdf0e10cSrcweir // interface <SfxObjectShell::EnableSetModified(..)> no longer works, because 1170cdf0e10cSrcweir // <SfxObjectShell::FinishedLoading(..)> doesn't care about its status and 1171cdf0e10cSrcweir // enables the document modification again. 1172cdf0e10cSrcweir // Thus, manuell modify the document, if its modified and its links are updated 1173cdf0e10cSrcweir // before <FinishedLoading(..)> is called. 1174cdf0e10cSrcweir const bool bHasDocToStayModified( pDoc->IsModified() && pDoc->LinksUpdated() ); 1175cdf0e10cSrcweir // // --> OD 2005-02-11 #i38810# - disable method <SetModified(..)>, if document 1176cdf0e10cSrcweir // // has stay in modified state, due to the update of its links during load. 1177cdf0e10cSrcweir // bool bResetEnableSetModified(false); 1178cdf0e10cSrcweir // if ( IsEnableSetModified() && 1179cdf0e10cSrcweir // pDoc->IsModified() && pDoc->LinksUpdated() ) 1180cdf0e10cSrcweir // { 1181cdf0e10cSrcweir // EnableSetModified( sal_False ); 1182cdf0e10cSrcweir // bResetEnableSetModified = true; 1183cdf0e10cSrcweir // } 1184cdf0e10cSrcweir // <-- 1185cdf0e10cSrcweir FinishedLoading( SFX_LOADED_ALL ); 1186cdf0e10cSrcweir // // --> OD 2005-02-11 #i38810# 1187cdf0e10cSrcweir // if ( bResetEnableSetModified ) 1188cdf0e10cSrcweir // { 1189cdf0e10cSrcweir // EnableSetModified( sal_True ); 1190cdf0e10cSrcweir // } 1191cdf0e10cSrcweir // // <-- 1192cdf0e10cSrcweir SfxViewFrame* pVFrame = SfxViewFrame::GetFirst(this); 1193cdf0e10cSrcweir if(pVFrame) 1194cdf0e10cSrcweir { 1195cdf0e10cSrcweir SfxViewShell* pShell = pVFrame->GetViewShell(); 1196cdf0e10cSrcweir if(PTR_CAST(SwSrcView, pShell)) 1197cdf0e10cSrcweir ((SwSrcView*)pShell)->Load(this); 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir 1200cdf0e10cSrcweir // --> OD 2007-10-08 #i38810# 1201cdf0e10cSrcweir if ( bHasDocToStayModified && !pDoc->IsModified() ) 1202cdf0e10cSrcweir { 1203cdf0e10cSrcweir pDoc->SetModified(); 1204cdf0e10cSrcweir } 1205cdf0e10cSrcweir // <-- 1206cdf0e10cSrcweir } 1207cdf0e10cSrcweir 1208cdf0e10cSrcweir // eine Uebertragung wird abgebrochen (wird aus dem SFX gerufen) 1209cdf0e10cSrcweir void SwDocShell::CancelTransfers() 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir // alle Links vom LinkManager Canceln 1212cdf0e10cSrcweir aFinishedTimer.Stop(); 1213cdf0e10cSrcweir pDoc->GetLinkManager().CancelTransfers(); 1214cdf0e10cSrcweir SfxObjectShell::CancelTransfers(); 1215cdf0e10cSrcweir } 1216cdf0e10cSrcweir 1217cdf0e10cSrcweir SwFEShell* SwDocShell::GetFEShell() 1218cdf0e10cSrcweir { 1219cdf0e10cSrcweir return pWrtShell; 1220cdf0e10cSrcweir } 1221cdf0e10cSrcweir 1222cdf0e10cSrcweir void SwDocShell::RemoveOLEObjects() 1223cdf0e10cSrcweir { 1224cdf0e10cSrcweir SwIterator<SwCntntNode,SwFmtColl> aIter( *pDoc->GetDfltGrfFmtColl() ); 1225cdf0e10cSrcweir for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() ) 1226cdf0e10cSrcweir { 1227cdf0e10cSrcweir SwOLENode* pOLENd = pNd->GetOLENode(); 1228cdf0e10cSrcweir if( pOLENd && ( pOLENd->IsOLEObjectDeleted() || 1229cdf0e10cSrcweir pOLENd->IsInGlobalDocSection() ) ) 1230cdf0e10cSrcweir { 1231cdf0e10cSrcweir if( !pOLEChildList ) 1232cdf0e10cSrcweir pOLEChildList = new comphelper::EmbeddedObjectContainer; 1233cdf0e10cSrcweir 1234cdf0e10cSrcweir ::rtl::OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName(); 1235cdf0e10cSrcweir GetEmbeddedObjectContainer().MoveEmbeddedObject( aObjName, *pOLEChildList ); 1236cdf0e10cSrcweir } 1237cdf0e10cSrcweir } 1238cdf0e10cSrcweir } 1239cdf0e10cSrcweir 1240cdf0e10cSrcweir // When a document is loaded, SwDoc::PrtOLENotify is called to update 1241cdf0e10cSrcweir // the sizes of math objects. However, for objects that do not have a 1242cdf0e10cSrcweir // SwFrm at this time, only a flag is set (bIsOLESizeInvalid) and the 1243cdf0e10cSrcweir // size change takes place later, while calculating the layout in the 1244cdf0e10cSrcweir // idle handler. If this document is saved now, it is saved with invalid 1245cdf0e10cSrcweir // sizes. For this reason, the layout has to be calculated before a document is 1246cdf0e10cSrcweir // saved, but of course only id there are OLE objects with bOLESizeInvalid set. 1247cdf0e10cSrcweir void SwDocShell::CalcLayoutForOLEObjects() 1248cdf0e10cSrcweir { 1249cdf0e10cSrcweir if( !pWrtShell ) 1250cdf0e10cSrcweir return; 1251cdf0e10cSrcweir 1252cdf0e10cSrcweir SwIterator<SwCntntNode,SwFmtColl> aIter( *pDoc->GetDfltGrfFmtColl() ); 1253cdf0e10cSrcweir for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() ) 1254cdf0e10cSrcweir { 1255cdf0e10cSrcweir SwOLENode* pOLENd = pNd->GetOLENode(); 1256cdf0e10cSrcweir if( pOLENd && pOLENd->IsOLESizeInvalid() ) 1257cdf0e10cSrcweir { 1258cdf0e10cSrcweir pWrtShell->CalcLayout(); 1259cdf0e10cSrcweir break; 1260cdf0e10cSrcweir } 1261cdf0e10cSrcweir } 1262cdf0e10cSrcweir } 1263cdf0e10cSrcweir 1264cdf0e10cSrcweir 1265cdf0e10cSrcweir // --> FME 2005-02-25 #i42634# Overwrites SfxObjectShell::UpdateLinks 1266cdf0e10cSrcweir // This new function is necessary to trigger update of links in docs 1267cdf0e10cSrcweir // read by the binary filter: 1268cdf0e10cSrcweir void SwDocShell::UpdateLinks() 1269cdf0e10cSrcweir { 1270cdf0e10cSrcweir GetDoc()->UpdateLinks(sal_True); 1271cdf0e10cSrcweir // --> FME 2005-07-27 #i50703# Update footnote numbers 1272cdf0e10cSrcweir SwTxtFtn::SetUniqueSeqRefNo( *GetDoc() ); 1273cdf0e10cSrcweir SwNodeIndex aTmp( GetDoc()->GetNodes() ); 1274cdf0e10cSrcweir GetDoc()->GetFtnIdxs().UpdateFtn( aTmp ); 1275cdf0e10cSrcweir // <-- 1276cdf0e10cSrcweir } 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir uno::Reference< frame::XController > 1279cdf0e10cSrcweir SwDocShell::GetController() 1280cdf0e10cSrcweir { 1281cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > aRet; 1282cdf0e10cSrcweir // --> FME 2007-10-15 #i82346# No view in page preview 1283cdf0e10cSrcweir if ( GetView() ) 1284cdf0e10cSrcweir // <-- 1285cdf0e10cSrcweir aRet = GetView()->GetController(); 1286cdf0e10cSrcweir return aRet; 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir 1289cdf0e10cSrcweir /* -----------------------------12.02.01 12:08-------------------------------- 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir ---------------------------------------------------------------------------*/ 1292*ca62e2c2SSteve Yin //IAccessibility2 Implementation 2009----- 1293*ca62e2c2SSteve Yin void SwDocShell::setDocAccTitle( const String& rTitle ) 1294*ca62e2c2SSteve Yin { 1295*ca62e2c2SSteve Yin if (pDoc ) 1296*ca62e2c2SSteve Yin { 1297*ca62e2c2SSteve Yin pDoc->setDocAccTitle( rTitle ); 1298*ca62e2c2SSteve Yin } 1299*ca62e2c2SSteve Yin } 1300*ca62e2c2SSteve Yin const String SwDocShell::getDocAccTitle() const 1301*ca62e2c2SSteve Yin { 1302*ca62e2c2SSteve Yin String sRet; 1303*ca62e2c2SSteve Yin if (pDoc) 1304*ca62e2c2SSteve Yin { 1305*ca62e2c2SSteve Yin sRet = pDoc->getDocAccTitle(); 1306*ca62e2c2SSteve Yin } 1307*ca62e2c2SSteve Yin 1308*ca62e2c2SSteve Yin return sRet; 1309*ca62e2c2SSteve Yin } 1310*ca62e2c2SSteve Yin 1311*ca62e2c2SSteve Yin void SwDocShell::setDocReadOnly( sal_Bool bReadOnly) 1312*ca62e2c2SSteve Yin { 1313*ca62e2c2SSteve Yin if (pDoc ) 1314*ca62e2c2SSteve Yin { 1315*ca62e2c2SSteve Yin pDoc->setDocReadOnly( bReadOnly ); 1316*ca62e2c2SSteve Yin } 1317*ca62e2c2SSteve Yin } 1318*ca62e2c2SSteve Yin sal_Bool SwDocShell::getDocReadOnly() const 1319*ca62e2c2SSteve Yin { 1320*ca62e2c2SSteve Yin if (pDoc) 1321*ca62e2c2SSteve Yin { 1322*ca62e2c2SSteve Yin return pDoc->getDocReadOnly(); 1323*ca62e2c2SSteve Yin } 1324*ca62e2c2SSteve Yin 1325*ca62e2c2SSteve Yin return sal_False; 1326*ca62e2c2SSteve Yin } 1327*ca62e2c2SSteve Yin //-----IAccessibility2 Implementation 2009 1328*ca62e2c2SSteve Yin 1329205b6fc7SArmin Le Grand static const char* s_EventNames[] = 1330cdf0e10cSrcweir { 1331cdf0e10cSrcweir "OnPageCountChange", 1332cdf0e10cSrcweir "OnMailMerge", 1333cdf0e10cSrcweir "OnMailMergeFinished", 1334cdf0e10cSrcweir "OnFieldMerge", 1335cdf0e10cSrcweir "OnFieldMergeFinished", 1336cdf0e10cSrcweir "OnLayoutFinished" 1337cdf0e10cSrcweir }; 1338205b6fc7SArmin Le Grand static sal_Int32 const s_nEvents(sizeof(s_EventNames)/sizeof(s_EventNames[0])); 1339cdf0e10cSrcweir 1340cdf0e10cSrcweir Sequence< OUString > SwDocShell::GetEventNames() 1341cdf0e10cSrcweir { 1342cdf0e10cSrcweir Sequence< OUString > aRet = SfxObjectShell::GetEventNames(); 1343cdf0e10cSrcweir sal_Int32 nLen = aRet.getLength(); 1344cdf0e10cSrcweir aRet.realloc(nLen + 6); 1345cdf0e10cSrcweir OUString* pNames = aRet.getArray(); 1346cdf0e10cSrcweir pNames[nLen++] = GetEventName(0); 1347cdf0e10cSrcweir pNames[nLen++] = GetEventName(1); 1348cdf0e10cSrcweir pNames[nLen++] = GetEventName(2); 1349cdf0e10cSrcweir pNames[nLen++] = GetEventName(3); 1350cdf0e10cSrcweir pNames[nLen++] = GetEventName(4); 1351cdf0e10cSrcweir pNames[nLen] = GetEventName(5); 1352cdf0e10cSrcweir 1353cdf0e10cSrcweir return aRet; 1354cdf0e10cSrcweir } 1355cdf0e10cSrcweir 1356cdf0e10cSrcweir rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex ) 1357cdf0e10cSrcweir { 1358205b6fc7SArmin Le Grand if (nIndex < s_nEvents) 1359205b6fc7SArmin Le Grand { 1360205b6fc7SArmin Le Grand return ::rtl::OUString::createFromAscii(s_EventNames[nIndex]); 1361205b6fc7SArmin Le Grand } 1362cdf0e10cSrcweir return rtl::OUString(); 1363cdf0e10cSrcweir } 1364cdf0e10cSrcweir 1365cdf0e10cSrcweir const ::sfx2::IXmlIdRegistry* SwDocShell::GetXmlIdRegistry() const 1366cdf0e10cSrcweir { 1367cdf0e10cSrcweir return pDoc ? &pDoc->GetXmlIdRegistry() : 0; 1368cdf0e10cSrcweir } 1369cdf0e10cSrcweir 1370cdf0e10cSrcweir 1371cdf0e10cSrcweir bool SwDocShell::IsChangeRecording() const 1372cdf0e10cSrcweir { 1373cdf0e10cSrcweir return (pWrtShell->GetRedlineMode() & nsRedlineMode_t::REDLINE_ON) != 0; 1374cdf0e10cSrcweir } 1375cdf0e10cSrcweir 1376cdf0e10cSrcweir 1377cdf0e10cSrcweir bool SwDocShell::HasChangeRecordProtection() const 1378cdf0e10cSrcweir { 1379cdf0e10cSrcweir return pWrtShell->getIDocumentRedlineAccess()->GetRedlinePassword().getLength() > 0; 1380cdf0e10cSrcweir } 1381cdf0e10cSrcweir 1382cdf0e10cSrcweir 1383cdf0e10cSrcweir void SwDocShell::SetChangeRecording( bool bActivate ) 1384cdf0e10cSrcweir { 1385cdf0e10cSrcweir sal_uInt16 nOn = bActivate ? nsRedlineMode_t::REDLINE_ON : 0; 1386cdf0e10cSrcweir sal_uInt16 nMode = pWrtShell->GetRedlineMode(); 1387cdf0e10cSrcweir pWrtShell->SetRedlineModeAndCheckInsMode( (nMode & ~nsRedlineMode_t::REDLINE_ON) | nOn); 1388cdf0e10cSrcweir } 1389cdf0e10cSrcweir 1390cdf0e10cSrcweir 1391cdf0e10cSrcweir bool SwDocShell::SetProtectionPassword( const String &rNewPassword ) 1392cdf0e10cSrcweir { 1393cdf0e10cSrcweir const SfxAllItemSet aSet( GetPool() ); 1394cdf0e10cSrcweir const SfxItemSet* pArgs = &aSet; 1395cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 1396cdf0e10cSrcweir 1397cdf0e10cSrcweir IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); 1398cdf0e10cSrcweir Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword(); 1399cdf0e10cSrcweir if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, sal_False, &pItem ) 1400cdf0e10cSrcweir && ((SfxBoolItem*)pItem)->GetValue() == (aPasswd.getLength() > 0)) 1401cdf0e10cSrcweir return false; 1402cdf0e10cSrcweir 1403cdf0e10cSrcweir bool bRes = false; 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir if (rNewPassword.Len()) 1406cdf0e10cSrcweir { 1407cdf0e10cSrcweir // when password protection is applied change tracking must always be active 1408cdf0e10cSrcweir SetChangeRecording( true ); 1409cdf0e10cSrcweir 1410cdf0e10cSrcweir Sequence< sal_Int8 > aNewPasswd; 1411cdf0e10cSrcweir SvPasswordHelper::GetHashPassword( aNewPasswd, rNewPassword ); 1412cdf0e10cSrcweir pIDRA->SetRedlinePassword( aNewPasswd ); 1413cdf0e10cSrcweir bRes = true; 1414cdf0e10cSrcweir } 1415cdf0e10cSrcweir else 1416cdf0e10cSrcweir { 1417cdf0e10cSrcweir pIDRA->SetRedlinePassword( Sequence< sal_Int8 >() ); 1418cdf0e10cSrcweir bRes = true; 1419cdf0e10cSrcweir } 1420cdf0e10cSrcweir 1421cdf0e10cSrcweir return bRes; 1422cdf0e10cSrcweir } 1423cdf0e10cSrcweir 1424cdf0e10cSrcweir 1425cdf0e10cSrcweir bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ) 1426cdf0e10cSrcweir { 1427cdf0e10cSrcweir bool bRes = false; 1428cdf0e10cSrcweir 1429cdf0e10cSrcweir const SfxAllItemSet aSet( GetPool() ); 1430cdf0e10cSrcweir const SfxItemSet* pArgs = &aSet; 1431cdf0e10cSrcweir const SfxPoolItem* pItem = NULL; 1432cdf0e10cSrcweir 1433cdf0e10cSrcweir IDocumentRedlineAccess* pIDRA = pWrtShell->getIDocumentRedlineAccess(); 1434cdf0e10cSrcweir Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() ); 1435cdf0e10cSrcweir if (pArgs && SFX_ITEM_SET == pArgs->GetItemState( FN_REDLINE_PROTECT, sal_False, &pItem ) 1436cdf0e10cSrcweir && ((SfxBoolItem*)pItem)->GetValue() == (aPasswdHash.getLength() != 0)) 1437cdf0e10cSrcweir return false; 1438cdf0e10cSrcweir rPasswordHash = aPasswdHash; 1439cdf0e10cSrcweir bRes = true; 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir return bRes; 1442cdf0e10cSrcweir } 1443cdf0e10cSrcweir 1444cdf0e10cSrcweir 1445