docsh2.cxx (c7be74b1) docsh2.cxx (8ef2f12b)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 228 unchanged lines hidden (view full) ---

237#endif
238
239/*--------------------------------------------------------------------
240 Beschreibung: Benachrichtigung bei geaenderter DocInfo
241 --------------------------------------------------------------------*/
242
243void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
244{
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 228 unchanged lines hidden (view full) ---

237#endif
238
239/*--------------------------------------------------------------------
240 Beschreibung: Benachrichtigung bei geaenderter DocInfo
241 --------------------------------------------------------------------*/
242
243void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
244{
245 if( !pDoc )
246 {
247//MA: Kommt bei der OLE-Registration vor!
248// ASSERT( !this, "DocShell ist nicht richtig initialisiert!" );
249 return ;
250 }
245 if( !pDoc )
246 {
247 return ;
248 }
251
252#ifdef FUTURE_VBA
253 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
254 if( xVbaEvents.is() )
255 lcl_processCompatibleSfxHint( xVbaEvents, rHint );
256#endif
257
249
250#ifdef FUTURE_VBA
251 uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
252 if( xVbaEvents.is() )
253 lcl_processCompatibleSfxHint( xVbaEvents, rHint );
254#endif
255
258 sal_uInt16 nAction = 0;
259 if( rHint.ISA(SfxSimpleHint) )
260 {
261 // swithc for more actions
262 switch( ((SfxSimpleHint&) rHint).GetId() )
263 {
264 case SFX_HINT_TITLECHANGED:
265 if( GetMedium() )
266 nAction = 2;
267 break;
256 sal_uInt16 nAction = 0;
257 if( rHint.ISA(SfxSimpleHint) )
258 {
259 // swithc for more actions
260 switch( ((SfxSimpleHint&) rHint).GetId() )
261 {
262 case SFX_HINT_TITLECHANGED:
263 if( GetMedium() )
264 nAction = 2;
265 break;
268 }
266 }
269 }
270 else if( rHint.ISA(SfxEventHint) &&
267 }
268 else if( rHint.ISA(SfxEventHint) &&
271 ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
272 {
269 ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
270 {
273 // --> OD 2004-12-03 #i38126# - own action id
274 nAction = 3;
271 nAction = 3;
275 // <--
276 }
277
272 }
273
278 if( nAction )
279 {
274 if( nAction )
275 {
280 sal_Bool bUnlockView = sal_True; //initializing prevents warning
276 sal_Bool bUnlockView = sal_True; //initializing prevents warning
281 if( pWrtShell )
282 {
283 bUnlockView = !pWrtShell->IsViewLocked();
284 pWrtShell->LockView( sal_True ); //lock visible section
285 pWrtShell->StartAllAction();
286 }
287 switch( nAction )
288 {
289 case 2:
290 pDoc->GetSysFldType( RES_FILENAMEFLD )->UpdateFlds();
291 break;
292 // --> OD 2004-12-03 #i38126# - own action for event LOADFINISHED
293 // in order to avoid a modified document.
294 // --> OD 2005-02-01 #i41679# - Also for the instance of <SwDoc>
295 // it has to be assured, that it's not modified.
277 if( pWrtShell )
278 {
279 bUnlockView = !pWrtShell->IsViewLocked();
280 pWrtShell->LockView( sal_True ); //lock visible section
281 pWrtShell->StartAllAction();
282 }
283 switch( nAction )
284 {
285 case 2:
286 pDoc->GetSysFldType( RES_FILENAMEFLD )->UpdateFlds();
287 break;
288
289 // own action for event LOADFINISHED in order to avoid a modified document.
290 // Also for the instance of <SwDoc> it has to be assured, that it's not modified.
296 // Perform the same as for action id 1, but disable <SetModified>.
297 case 3:
298 {
299 const bool bResetModified = IsEnableSetModified();
300 if ( bResetModified )
301 EnableSetModified( sal_False );
291 // Perform the same as for action id 1, but disable <SetModified>.
292 case 3:
293 {
294 const bool bResetModified = IsEnableSetModified();
295 if ( bResetModified )
296 EnableSetModified( sal_False );
302 // --> OD 2005-02-01 #i41679#
303 const bool bIsDocModified = pDoc->IsModified();
297 const bool bIsDocModified = pDoc->IsModified();
304 // <--
305
306 pDoc->DocInfoChgd( );
307
298
299 pDoc->DocInfoChgd( );
300
308 // --> OD 2005-02-01 #i41679#
309 if ( !bIsDocModified )
310 pDoc->ResetModified();
301 if ( !bIsDocModified )
302 pDoc->ResetModified();
311 // <--
312 if ( bResetModified )
313 EnableSetModified( sal_True );
314 }
315 break;
303 if ( bResetModified )
304 EnableSetModified( sal_True );
305 }
306 break;
316 // <--
317 }
307 }
318
308
319 if( pWrtShell )
320 {
321 pWrtShell->EndAllAction();
322 if( bUnlockView )
323 pWrtShell->LockView( sal_False );
324 }
325 }
309 if( pWrtShell )
310 {
311 pWrtShell->EndAllAction();
312 if( bUnlockView )
313 pWrtShell->LockView( sal_False );
314 }
315 }
326}
327
328/*--------------------------------------------------------------------
329 Beschreibung: Benachrichtigung Doc schliessen
330 --------------------------------------------------------------------*/
331
332sal_uInt16 SwDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
333{

--- 1106 unchanged lines hidden (view full) ---

1440 //const SwTxtFmtColl* pSplitColl = 0; //#outline level,removed by zhaojianwei
1441 // if ( aTemplateName.Len() )
1442 // pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName);
1443 //<-end,zhaojianwei
1444 if( aFileName.Len() )
1445 {
1446 if( PrepareClose( sal_False ) )
1447 {
316}
317
318/*--------------------------------------------------------------------
319 Beschreibung: Benachrichtigung Doc schliessen
320 --------------------------------------------------------------------*/
321
322sal_uInt16 SwDocShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
323{

--- 1106 unchanged lines hidden (view full) ---

1430 //const SwTxtFmtColl* pSplitColl = 0; //#outline level,removed by zhaojianwei
1431 // if ( aTemplateName.Len() )
1432 // pSplitColl = pDoc->FindTxtFmtCollByName(aTemplateName);
1433 //<-end,zhaojianwei
1434 if( aFileName.Len() )
1435 {
1436 if( PrepareClose( sal_False ) )
1437 {
1448 SwWait aWait( *this, sal_True );
1438 SwWait aWait( *this, true );
1449
1450 //bDone = bCreateHtml //#outline level,removed by zhaojianwei
1451 // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl )
1452 // : pDoc->GenerateGlobalDoc( aFileName, pSplitColl );
1453 if ( bCreateByOutlineLevel ) //add by zhaojianwei
1454 {
1455 bDone = bCreateHtml //#outline level,removed by zhaojianwei
1456 ? pDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel )

--- 427 unchanged lines hidden ---
1439
1440 //bDone = bCreateHtml //#outline level,removed by zhaojianwei
1441 // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl )
1442 // : pDoc->GenerateGlobalDoc( aFileName, pSplitColl );
1443 if ( bCreateByOutlineLevel ) //add by zhaojianwei
1444 {
1445 bDone = bCreateHtml //#outline level,removed by zhaojianwei
1446 ? pDoc->GenerateHTMLDoc( aFileName, nTemplateOutlineLevel )

--- 427 unchanged lines hidden ---