viewfrm.cxx (3ea0c3d5) viewfrm.cxx (9c0c1533)
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

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

298 else ExecReload_Impl( rReq );
299}
300
301void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
302{
303 SfxFrame *pParent = GetFrame().GetParentFrame();
304 if ( rReq.GetSlot() == SID_RELOAD )
305 {
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

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

298 else ExecReload_Impl( rReq );
299}
300
301void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
302{
303 SfxFrame *pParent = GetFrame().GetParentFrame();
304 if ( rReq.GetSlot() == SID_RELOAD )
305 {
306 // Bei CTRL-Reload den aktiven Frame reloaden
306 // With CTRL-Reload reload the active frame
307 SfxViewFrame* pActFrame = this;
308 while ( pActFrame )
309 pActFrame = pActFrame->GetActiveChildFrame_Impl();
310
311 if ( pActFrame )
312 {
313 sal_uInt16 nModifier = rReq.GetModifier();
314 if ( nModifier & KEY_MOD1 )
315 {
316 pActFrame->ExecReload_Impl( rReq );
317 return;
318 }
319 }
320
307 SfxViewFrame* pActFrame = this;
308 while ( pActFrame )
309 pActFrame = pActFrame->GetActiveChildFrame_Impl();
310
311 if ( pActFrame )
312 {
313 sal_uInt16 nModifier = rReq.GetModifier();
314 if ( nModifier & KEY_MOD1 )
315 {
316 pActFrame->ExecReload_Impl( rReq );
317 return;
318 }
319 }
320
321 // Wenn nur ein Reload der Graphiken eines oder mehrerer ChildFrames
322 // gemacht werden soll
321 // If only reloading of the graphs or more child frames
322 // is needed
323 SfxFrame& rFrame = GetFrame();
324 if ( pParent == &rFrame && rFrame.GetChildFrameCount() )
325 {
326 sal_Bool bReloadAvailable = sal_False;
327 SfxFrameIterator aIter( rFrame, sal_False );
328 SfxFrame *pChild = aIter.FirstFrame();
329 while ( pChild )
330 {
331 SfxFrame *pNext = aIter.NextFrame( *pChild );
332 SfxObjectShell *pShell = pChild->GetCurrentDocument();
333 if( pShell && pShell->Get_Impl()->bReloadAvailable )
334 {
335 bReloadAvailable = sal_True;
336 pChild->GetCurrentViewFrame()->ExecuteSlot( rReq );
337 }
338 pChild = pNext;
339 }
340
323 SfxFrame& rFrame = GetFrame();
324 if ( pParent == &rFrame && rFrame.GetChildFrameCount() )
325 {
326 sal_Bool bReloadAvailable = sal_False;
327 SfxFrameIterator aIter( rFrame, sal_False );
328 SfxFrame *pChild = aIter.FirstFrame();
329 while ( pChild )
330 {
331 SfxFrame *pNext = aIter.NextFrame( *pChild );
332 SfxObjectShell *pShell = pChild->GetCurrentDocument();
333 if( pShell && pShell->Get_Impl()->bReloadAvailable )
334 {
335 bReloadAvailable = sal_True;
336 pChild->GetCurrentViewFrame()->ExecuteSlot( rReq );
337 }
338 pChild = pNext;
339 }
340
341 // Der TopLevel-Frame selbst het keine Graphiken!
341 // The TopLevel frame itself had no graphics
342 if ( bReloadAvailable )
343 return;
344 }
345 }
346 else
347 {
342 if ( bReloadAvailable )
343 return;
344 }
345 }
346 else
347 {
348 // Bei CTRL-Edit den TopFrame bearbeiten
348 // With CTRL-Edit edit the top frame
349 sal_uInt16 nModifier = rReq.GetModifier();
349 sal_uInt16 nModifier = rReq.GetModifier();
350
350 //KEY_MOD1 is the Ctrl modifier key
351 if ( ( nModifier & KEY_MOD1 ) && pParent )
352 {
353 SfxViewFrame *pTop = GetTopViewFrame();
354 pTop->ExecReload_Impl( rReq );
355 return;
356 }
357 }
358
359 SfxObjectShell* pSh = GetObjectShell();
360 switch ( rReq.GetSlot() )
361 {
362 case SID_EDITDOC:
363 {
364 if ( GetFrame().HasComponent() )
365 break;
366
351 if ( ( nModifier & KEY_MOD1 ) && pParent )
352 {
353 SfxViewFrame *pTop = GetTopViewFrame();
354 pTop->ExecReload_Impl( rReq );
355 return;
356 }
357 }
358
359 SfxObjectShell* pSh = GetObjectShell();
360 switch ( rReq.GetSlot() )
361 {
362 case SID_EDITDOC:
363 {
364 if ( GetFrame().HasComponent() )
365 break;
366
367 // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch
368 // m"oglich, da\s der Slot zwar enabled ist, aber Ctrl-Click
369 // trotzdem nicht geht!
367 // Because of double functioning of the toolbox button (with/without Ctrl)
368 // it's possible that the slot is enabled, but Ctrl-click is not.
370 if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ))
371 break;
372
373 SfxMedium* pMed = pSh->GetMedium();
374
375 SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False );
376 if ( pItem && pItem->GetValue() )
377 {

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

441 nOpenMode = SFX_STREAM_READWRITE;
442 pSh->SetReadOnlyUI( sal_False );
443
444 // if only the view was in the readonly mode then there is no need to do the reload
445 if ( !pSh->IsReadOnly() )
446 return;
447 }
448
369 if( !pSh || !pSh->HasName() || !(pSh->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ))
370 break;
371
372 SfxMedium* pMed = pSh->GetMedium();
373
374 SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, sal_False );
375 if ( pItem && pItem->GetValue() )
376 {

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

440 nOpenMode = SFX_STREAM_READWRITE;
441 pSh->SetReadOnlyUI( sal_False );
442
443 // if only the view was in the readonly mode then there is no need to do the reload
444 if ( !pSh->IsReadOnly() )
445 return;
446 }
447
449 // Parameter auswerten
448 // Evaluate parameters
450 // sal_Bool bReload = sal_True;
451 if ( rReq.IsAPI() )
452 {
449 // sal_Bool bReload = sal_True;
450 if ( rReq.IsAPI() )
451 {
453 // per API steuern ob r/w oder r/o
452 // Control through API if r/w or r/o
454 SFX_REQUEST_ARG(rReq, pEditItem, SfxBoolItem, SID_EDITDOC, sal_False);
455 if ( pEditItem )
456 nOpenMode = pEditItem->GetValue() ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY;
457 }
458
459 // doing
460
461 String aTemp;
462 utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp );
463 INetURLObject aPhysObj( aTemp );
464 SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(),
465 pVersionItem, SfxInt16Item, SID_VERSION, sal_False );
466
467 INetURLObject aMedObj( pMed->GetName() );
468
453 SFX_REQUEST_ARG(rReq, pEditItem, SfxBoolItem, SID_EDITDOC, sal_False);
454 if ( pEditItem )
455 nOpenMode = pEditItem->GetValue() ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY;
456 }
457
458 // doing
459
460 String aTemp;
461 utl::LocalFileHelper::ConvertPhysicalNameToURL( pMed->GetPhysicalName(), aTemp );
462 INetURLObject aPhysObj( aTemp );
463 SFX_ITEMSET_ARG( pSh->GetMedium()->GetItemSet(),
464 pVersionItem, SfxInt16Item, SID_VERSION, sal_False );
465
466 INetURLObject aMedObj( pMed->GetName() );
467
469 // the logic below is following, if the document seems not to need to be reloaded and the physical name is different
470 // to the logical one, then on file system it can be checked that the copy is still newer than the original and no document reload is required
471 if ( ( !bNeedsReload && ( (aMedObj.GetProtocol() == INET_PROT_FILE &&
472 aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) &&
473 !::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) ))
474 || pMed->IsRemote() ) )
475 || pVersionItem )
468 // -> i126305
469 // the logic below is following:
470 // if the document seems not to need to be reloaded
471 // and the physical name is different to the logical one,
472 // then on file system it can be checked that the copy is still newer than the original and no document reload is required.
473 // some semplification to enhance readability of the 'if' expression
474 //
475 // on the 'http/https' protocol case, the bool bPhysObjIsYounger relies upon the getlastmodified Property of a WebDAV resource.
476 // Said property should be implemented, but sometimes it's not. This happens on some small webdav servers, where it's not
477 // implemented. On this case the reload will not work properly.
478 // Details at this link: http://tools.ietf.org/html/rfc4918#section-15, section 15.7
479 // TODO: add an indication to the user? Difficult to implement I think.
480 sal_Bool bPhysObjIsYounger = ::utl::UCBContentHelper::IsYounger( aMedObj.GetMainURL( INetURLObject::NO_DECODE ), aPhysObj.GetMainURL( INetURLObject::NO_DECODE ) );
481 sal_Bool bIsHttpOrHttps = (aMedObj.GetProtocol() == INET_PROT_HTTP || aMedObj.GetProtocol() == INET_PROT_HTTPS);
482 if ( ( !bNeedsReload && ( ( aMedObj.GetProtocol() == INET_PROT_FILE &&
483 aMedObj.getFSysPath(INetURLObject::FSYS_DETECT) != aPhysObj.getFSysPath(INetURLObject::FSYS_DETECT) &&
484 !bPhysObjIsYounger )
485 || ( bIsHttpOrHttps && !bPhysObjIsYounger )
486 || ( pMed->IsRemote() && !bIsHttpOrHttps ) ) )
487 || pVersionItem )
488 // <- i126305
476 {
477 sal_Bool bOK = sal_False;
478 if ( !pVersionItem )
479 {
480 sal_Bool bHasStorage = pMed->HasStorage_Impl();
481 // switching edit mode could be possible without reload
482 if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
483 {

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

509 else
510 {
511 pMed->ResetError();
512 pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() );
513 pMed->ReOpen();
514 pSh->DoSaveCompleted( pMed );
515 }
516
489 {
490 sal_Bool bOK = sal_False;
491 if ( !pVersionItem )
492 {
493 sal_Bool bHasStorage = pMed->HasStorage_Impl();
494 // switching edit mode could be possible without reload
495 if ( bHasStorage && pMed->GetStorage() == pSh->GetStorage() )
496 {

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

522 else
523 {
524 pMed->ResetError();
525 pMed->SetOpenMode( SFX_STREAM_READONLY, pMed->IsDirect() );
526 pMed->ReOpen();
527 pSh->DoSaveCompleted( pMed );
528 }
529
517 // r/o-Doc kann nicht in Editmode geschaltet werden?
530 // r/o-Doc can not be switched to edit mode?
518 rReq.Done( sal_False );
519
520 if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
521 {
531 rReq.Done( sal_False );
532
533 if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() )
534 {
522 // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen
535 // ::com::sun::star::sdbcx::User ask to open as template (a copy of the document)
523 QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) );
536 QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) );
537 // this is the querybox that is opened when the file is asked to move from r/o to edit using the button
538 // on the toolbar
524 if ( RET_YES == aBox.Execute() )
525 {
526 SfxApplication* pApp = SFX_APP();
527 SfxAllItemSet aSet( pApp->GetPool() );
528 aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) );
529 SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False );
530 if ( pReferer )
531 aSet.Put( *pReferer );

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

567 }
568
569 rReq.AppendItem( SfxBoolItem( SID_FORCERELOAD, sal_True) );
570 rReq.AppendItem( SfxBoolItem( SID_SILENT, sal_True ));
571 }
572
573 case SID_RELOAD:
574 {
539 if ( RET_YES == aBox.Execute() )
540 {
541 SfxApplication* pApp = SFX_APP();
542 SfxAllItemSet aSet( pApp->GetPool() );
543 aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) );
544 SFX_ITEMSET_ARG( pMed->GetItemSet(), pReferer, SfxStringItem, SID_REFERER, sal_False );
545 if ( pReferer )
546 aSet.Put( *pReferer );

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

582 }
583
584 rReq.AppendItem( SfxBoolItem( SID_FORCERELOAD, sal_True) );
585 rReq.AppendItem( SfxBoolItem( SID_SILENT, sal_True ));
586 }
587
588 case SID_RELOAD:
589 {
575 // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch
576 // m"oglich, da\s der Slot zwar enabled ist, aber Ctrl-Click
577 // trotzdem nicht geht!
590 // Because of double functioning of the toolbox button (with/without Ctrl)
591 // it's possible that the slot is enabled, but Ctrl-click is not.
578 if ( !pSh || !pSh->CanReload_Impl() )
579 break;
580 SfxApplication* pApp = SFX_APP();
581 SFX_REQUEST_ARG(rReq, pForceReloadItem, SfxBoolItem,
582 SID_FORCERELOAD, sal_False);
583 if( pForceReloadItem && !pForceReloadItem->GetValue() &&
584 !pSh->GetMedium()->IsExpired() )
585 return;

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

591 if ( pAutoLoadItem && pAutoLoadItem->GetValue() &&
592 GetFrame().IsAutoLoadLocked_Impl() )
593 return;
594
595 SfxObjectShellLock xOldObj( pSh );
596 pImp->bReloading = sal_True;
597 SFX_REQUEST_ARG(rReq, pURLItem, SfxStringItem,
598 SID_FILE_NAME, sal_False);
592 if ( !pSh || !pSh->CanReload_Impl() )
593 break;
594 SfxApplication* pApp = SFX_APP();
595 SFX_REQUEST_ARG(rReq, pForceReloadItem, SfxBoolItem,
596 SID_FORCERELOAD, sal_False);
597 if( pForceReloadItem && !pForceReloadItem->GetValue() &&
598 !pSh->GetMedium()->IsExpired() )
599 return;

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

605 if ( pAutoLoadItem && pAutoLoadItem->GetValue() &&
606 GetFrame().IsAutoLoadLocked_Impl() )
607 return;
608
609 SfxObjectShellLock xOldObj( pSh );
610 pImp->bReloading = sal_True;
611 SFX_REQUEST_ARG(rReq, pURLItem, SfxStringItem,
612 SID_FILE_NAME, sal_False);
599 // editierbar "offnen?
613 // open to edit?
600 sal_Bool bForEdit = !pSh->IsReadOnly();
601 if ( rReq.GetSlot() == SID_EDITDOC )
602 bForEdit = !bForEdit;
603
614 sal_Bool bForEdit = !pSh->IsReadOnly();
615 if ( rReq.GetSlot() == SID_EDITDOC )
616 bForEdit = !bForEdit;
617
604 // ggf. beim User nachfragen
618 // if necessary ask the user
605 sal_Bool bDo = ( GetViewShell()->PrepareClose() != sal_False );
606 SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, sal_False);
607 if ( bDo && GetFrame().DocIsModified_Impl() &&
608 !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) )
609 {
610 QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_LASTVERSION) );
611 bDo = ( RET_YES == aBox.Execute() );
612 }
613
614 if ( bDo )
615 {
616 SfxMedium *pMedium = xOldObj->GetMedium();
617
619 sal_Bool bDo = ( GetViewShell()->PrepareClose() != sal_False );
620 SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, sal_False);
621 if ( bDo && GetFrame().DocIsModified_Impl() &&
622 !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) )
623 {
624 QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_LASTVERSION) );
625 bDo = ( RET_YES == aBox.Execute() );
626 }
627
628 if ( bDo )
629 {
630 SfxMedium *pMedium = xOldObj->GetMedium();
631
618 // Frameset abziehen, bevor FramesetView evtl. verschwindet
632 //Pull frameset before FramesetView possibly disappear
619 String aURL = pURLItem ? pURLItem->GetValue() :
620 pMedium->GetName();
621
622 sal_Bool bHandsOff =
623 ( pMedium->GetURLObject().GetProtocol() == INET_PROT_FILE && !xOldObj->IsDocShared() );
624
633 String aURL = pURLItem ? pURLItem->GetValue() :
634 pMedium->GetName();
635
636 sal_Bool bHandsOff =
637 ( pMedium->GetURLObject().GetProtocol() == INET_PROT_FILE && !xOldObj->IsDocShared() );
638
625 // bestehende SfxMDIFrames f"ur dieses Doc leeren
626 // eigenes Format oder R/O jetzt editierbar "offnen?
639 // empty existing SfxMDIFrames of this Doc
640 // own format or R/O is now open editable?
627 SfxObjectShellLock xNewObj;
628
629 // collect the views of the document
630 // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should
631 // be UNOized, too
632 typedef ::std::pair< Reference< XFrame >, sal_uInt16 > ViewDescriptor;
633 ::std::list< ViewDescriptor > aViewFrames;
634 SfxViewFrame *pView = GetFirst( xOldObj );

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

699 //pNewSet = pNewMedium->GetItemSet();
700 if ( pURLItem )
701 pNewSet->Put( SfxStringItem( SID_REFERER, pMedium->GetName() ) );
702 else
703 pNewSet->Put( SfxStringItem( SID_REFERER, String() ) );
704
705 xOldObj->CancelTransfers();
706
641 SfxObjectShellLock xNewObj;
642
643 // collect the views of the document
644 // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should
645 // be UNOized, too
646 typedef ::std::pair< Reference< XFrame >, sal_uInt16 > ViewDescriptor;
647 ::std::list< ViewDescriptor > aViewFrames;
648 SfxViewFrame *pView = GetFirst( xOldObj );

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

713 //pNewSet = pNewMedium->GetItemSet();
714 if ( pURLItem )
715 pNewSet->Put( SfxStringItem( SID_REFERER, pMedium->GetName() ) );
716 else
717 pNewSet->Put( SfxStringItem( SID_REFERER, String() ) );
718
719 xOldObj->CancelTransfers();
720
707 // eigentliches Reload
721 //actual reload
708 //pNewSet->Put( SfxFrameItem ( SID_DOCFRAME, GetFrame() ) );
709
710 if ( pSilentItem && pSilentItem->GetValue() )
711 pNewSet->Put( SfxBoolItem( SID_SILENT, sal_True ) );
712
713 SFX_ITEMSET_ARG(pNewSet, pInteractionItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False);
714 SFX_ITEMSET_ARG(pNewSet, pMacroExecItem , SfxUInt16Item, SID_MACROEXECMODE , sal_False);
715 SFX_ITEMSET_ARG(pNewSet, pDocTemplateItem, SfxUInt16Item, SID_UPDATEDOCMODE , sal_False);

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

722 }
723
724 if (!pMacroExecItem)
725 pNewSet->Put( SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::USE_CONFIG) );
726 if (!pDocTemplateItem)
727 pNewSet->Put( SfxUInt16Item(SID_UPDATEDOCMODE,::com::sun::star::document::UpdateDocMode::ACCORDING_TO_CONFIG) );
728
729 xOldObj->SetModified( sal_False );
722 //pNewSet->Put( SfxFrameItem ( SID_DOCFRAME, GetFrame() ) );
723
724 if ( pSilentItem && pSilentItem->GetValue() )
725 pNewSet->Put( SfxBoolItem( SID_SILENT, sal_True ) );
726
727 SFX_ITEMSET_ARG(pNewSet, pInteractionItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False);
728 SFX_ITEMSET_ARG(pNewSet, pMacroExecItem , SfxUInt16Item, SID_MACROEXECMODE , sal_False);
729 SFX_ITEMSET_ARG(pNewSet, pDocTemplateItem, SfxUInt16Item, SID_UPDATEDOCMODE , sal_False);

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

736 }
737
738 if (!pMacroExecItem)
739 pNewSet->Put( SfxUInt16Item(SID_MACROEXECMODE,::com::sun::star::document::MacroExecMode::USE_CONFIG) );
740 if (!pDocTemplateItem)
741 pNewSet->Put( SfxUInt16Item(SID_UPDATEDOCMODE,::com::sun::star::document::UpdateDocMode::ACCORDING_TO_CONFIG) );
742
743 xOldObj->SetModified( sal_False );
730 // Altes Dok nicht cachen! Gilt nicht, wenn anderes
731 // Doc geladen wird.
744 // Old Doc not cached! Does not apply if another Doc is loaded.
732
733 SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False);
734 SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedReferer, SfxStringItem, SID_REFERER, sal_False);
735
736 sal_Bool bHasStorage = pMedium->HasStorage_Impl();
737 if( bHandsOff )
738 {
739 if ( bHasStorage && pMedium->GetStorage() == xOldObj->GetStorage() )

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

755 TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs );
756 try
757 {
758 uno::Reference < frame::XLoadable > xLoad( xNewObj->GetModel(), uno::UNO_QUERY );
759 xLoad->load( aLoadArgs );
760 }
761 catch ( uno::Exception& )
762 {
745
746 SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False);
747 SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedReferer, SfxStringItem, SID_REFERER, sal_False);
748
749 sal_Bool bHasStorage = pMedium->HasStorage_Impl();
750 if( bHandsOff )
751 {
752 if ( bHasStorage && pMedium->GetStorage() == xOldObj->GetStorage() )

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

768 TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs );
769 try
770 {
771 uno::Reference < frame::XLoadable > xLoad( xNewObj->GetModel(), uno::UNO_QUERY );
772 xLoad->load( aLoadArgs );
773 }
774 catch ( uno::Exception& )
775 {
776 //->i126305 OBSERVATION
777 // When this exception is thrown the r/o refresh of a file locked by another user
778 // is not completed.
779 // Code flow arrives here with a 'com.sun.star.task.ErrorCodeIOException'.
780 // It's thrown at around line 1970 of main/sfx2/source/doc/sfxbasemodel.cxx,
781 // in method 'SfxBaseModel::load'.
782 // Because of this exception, the document is not reloaded when it should be.
783 // The error generating the exception is 1287, or ERRCODE_IO_ACCESSDENIED.
784 // It seems that the reason for this is the way the property PROP_READONLY seems used
785 // in MediaDescriptor: both as property of the media and a request from GUI.
786 // See main/comphelper/source/misc/mediadescriptor.cxx around line 755, where the behavior
787 // leading to the error originates in the code flow.
788 // This problem doesn't arise in WebDAV, since the stream is monodirectional (read or write) in UCB implementation.
789 //<-i126305
790 //->i126305 WORKAROUND
791 // Code flow needs to reset the reloading, since it will no longer take part in the following code.
792 // This specific flag, if not reset, will break the code flow on the next call of this method,
793 // when it appears that the toolbar button stops functioning.
794 pImp->bReloading = sal_False;
795 //<-i126305
763 xNewObj->DoClose();
764 xNewObj = 0;
765 }
766
767 DELETEZ( pNewSet );
768
769 if( !xNewObj.Is() )
770 {

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

852 aViewFrames.pop_front();
853 }
854 }
855
856 // Propagate document closure.
857 SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) );
858 }
859
796 xNewObj->DoClose();
797 xNewObj = 0;
798 }
799
800 DELETEZ( pNewSet );
801
802 if( !xNewObj.Is() )
803 {

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

885 aViewFrames.pop_front();
886 }
887 }
888
889 // Propagate document closure.
890 SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) );
891 }
892
860 // als erledigt recorden
893 // register as done
861 rReq.Done( sal_True );
862 rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_True));
863 return;
864 }
865 else
866 {
894 rReq.Done( sal_True );
895 rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_True));
896 return;
897 }
898 else
899 {
867 // als nicht erledigt recorden
900 // register as not done
868 rReq.Done();
869 rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_False));
870 pImp->bReloading = sal_False;
871 return;
872 }
873 }
874 }
875}

--- 2722 unchanged lines hidden ---
901 rReq.Done();
902 rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_False));
903 pImp->bReloading = sal_False;
904 return;
905 }
906 }
907 }
908}

--- 2722 unchanged lines hidden ---