diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2009-12-03 09:29:45 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2009-12-03 09:29:45 +0100 |
commit | 11e41fb8dde36b188c579fd440bfc32b3fc63673 (patch) | |
tree | 38cb217a37c49280c0f34afd5f6ef9a0a558692a | |
parent | 83768b95e11f808be8515f778761961107fd55f9 (diff) |
[CWS autorecovery] SwitchToViewShell_Impl moved into the SfxFrame
-rw-r--r-- | sfx2/inc/sfx2/frame.hxx | 4 | ||||
-rw-r--r-- | sfx2/inc/sfx2/viewfrm.hxx | 5 | ||||
-rw-r--r-- | sfx2/source/view/frame.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/view/frmload.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/view/impframe.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/topfrm.cxx | 38 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 21 |
7 files changed, 23 insertions, 62 deletions
diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx index d0f7e2bc701c..8367028b670c 100644 --- a/sfx2/inc/sfx2/frame.hxx +++ b/sfx2/inc/sfx2/frame.hxx @@ -209,8 +209,6 @@ public: SAL_DLLPRIVATE static void InsertTopFrame_Impl( SfxFrame* pFrame ); SAL_DLLPRIVATE static void RemoveTopFrame_Impl( SfxFrame* pFrame ); - SAL_DLLPRIVATE void SetItemSet_Impl( const SfxItemSet* pSet ); - SAL_DLLPRIVATE const SfxItemSet* GetItemSet_Impl(); SAL_DLLPRIVATE void SetOwnsBindings_Impl( sal_Bool bSet ); SAL_DLLPRIVATE sal_Bool OwnsBindings_Impl() const; SAL_DLLPRIVATE void InvalidateUnoControllers_Impl(); @@ -224,7 +222,7 @@ public: SAL_DLLPRIVATE void GrabFocusOnComponent_Impl(); SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool ); - SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc ); + SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ); SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock ); SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn ); SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const; diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx index 4eca86182da0..d120923bea23 100644 --- a/sfx2/inc/sfx2/viewfrm.hxx +++ b/sfx2/inc/sfx2/viewfrm.hxx @@ -152,14 +152,13 @@ protected: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); #ifndef _SFX_HXX - SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); SAL_DLLPRIVATE void KillDispatcher_Impl(); #endif virtual ~SfxViewFrame(); public: - SfxViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc = NULL, USHORT nViewId = 0 ); + SfxViewFrame( SfxFrame* pFrame, SfxObjectShell *pDoc = NULL ); TYPEINFO(); SFX_DECL_INTERFACE(SFX_INTERFACE_SFXVIEWFRM) @@ -301,6 +300,8 @@ public: SAL_DLLPRIVATE void Exec_Impl(SfxRequest &); SAL_DLLPRIVATE void INetExecute_Impl(SfxRequest &); SAL_DLLPRIVATE void INetState_Impl(SfxItemSet &); + + SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE ); //#endif private: SAL_DLLPRIVATE SfxViewShell* LoadNewView_Impl( const USHORT i_nNewViewNo, SfxViewShell* i_pOldShell ); diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 88bb9a62e805..2e8f3e1a8ab4 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -314,7 +314,7 @@ SfxViewFrame* SfxFrame::InsertDocument( SfxObjectShell& rDoc, SfxFrame*& rpTarge { if ( bHidden ) rDoc.PutItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - rpTargetFrame->InsertDocument_Impl( rDoc ); + rpTargetFrame->InsertDocument_Impl( rDoc, *rDoc.GetMedium()->GetItemSet() ); pViewFrame = rpTargetFrame->GetCurrentViewFrame(); } else @@ -760,16 +760,6 @@ void SfxFrame::SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< : GetCurrentViewFrame()->GetBindings().SetRecorder_Impl( xRecorder ); } -void SfxFrame::SetItemSet_Impl( const SfxItemSet* pSet ) -{ - pImp->pSet = pSet; -} - -const SfxItemSet* SfxFrame::GetItemSet_Impl() -{ - return pImp->pSet; -} - void SfxFrame::Appear() { if ( GetCurrentViewFrame() ) diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 64fa2fdb1289..cde8265a1842 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -327,8 +327,7 @@ sal_Bool SfxFrameLoader_Impl::impl_plugDocIntoFrame( const ::comphelper::NamedVa { SfxAllItemSet aSet( SFX_APP()->GetPool() ); TransformParameters( SID_OPENDOC, i_rDescriptor.getPropertyValues(), aSet ); - i_rTargetFrame.SetItemSet_Impl( &aSet ); - return i_rTargetFrame.InsertDocument_Impl( i_rDocument ); + return i_rTargetFrame.InsertDocument_Impl( i_rDocument, aSet ); } // -------------------------------------------------------------------------------------------------------------------- diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index 46cf52fea19f..4f27f3aedc3b 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -71,7 +71,6 @@ public: sal_Bool bReleasingComponent : 1; sal_Bool bInPlace : 1; SfxFrame* pFrame; - const SfxItemSet* pSet; SfxWorkWindow* pWorkWin; SvBorder aBorder; // formerly SfxTopFrame @@ -96,7 +95,6 @@ public: ,bReleasingComponent( sal_False ) ,bInPlace( sal_False ) ,pFrame( pAntiImplP ) - ,pSet( 0 ) ,pWorkWin( 0 ) ,pExternalWindow( NULL ) ,bHidden( false ) diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx index 4de9b44223a8..4bd01d3a2667 100644 --- a/sfx2/source/view/topfrm.cxx +++ b/sfx2/source/view/topfrm.cxx @@ -484,12 +484,11 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, bool bHidden, */ } - pFrame->SetItemSet_Impl( pSet ); if ( pDoc && pDoc != pFrame->GetCurrentDocument() ) { if ( nViewId ) pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument_Impl( *pDoc ); + pFrame->InsertDocument_Impl( *pDoc, pSet ? *pSet : *pDoc->GetMedium()->GetItemSet() ); if ( pWindow && !bHidden ) pWindow->Show(); } @@ -515,12 +514,11 @@ SfxFrame* SfxFrame::Create( SfxObjectShell* pDoc, Window& rWindow, USHORT nViewI pFrame->SetFrameInterface_Impl( xFrame ); pFrame->pImp->bHidden = bHidden; - pFrame->SetItemSet_Impl( pSet ); if ( pDoc ) { if ( nViewId ) pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument_Impl( *pDoc ); + pFrame->InsertDocument_Impl( *pDoc, pSet ? *pSet : *pDoc->GetMedium()->GetItemSet() ); } return pFrame; @@ -675,7 +673,7 @@ namespace bool lcl_getViewDataAndID( const Reference< XModel >& _rxDocument, Sequence< PropertyValue >& _o_viewData, USHORT& _o_viewId ) { _o_viewData.realloc(0); - _o_viewId = -1; + _o_viewId = 0; Reference< XViewDataSupplier > xViewDataSupplier( _rxDocument, UNO_QUERY ); Reference< XIndexAccess > xViewData; @@ -701,7 +699,7 @@ namespace } } -sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) +sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const SfxItemSet& rSet ) /* [Beschreibung] */ { @@ -719,19 +717,14 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) OSL_PRECOND( GetCurrentDocument() == NULL, "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" ); - const SfxItemSet* pSet = GetItemSet_Impl(); - if ( !pSet ) - pSet = rDoc.GetMedium()->GetItemSet(); - SetItemSet_Impl( NULL ); - - SFX_ITEMSET_ARG( pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size - SFX_ITEMSET_ARG( pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID - SFX_ITEMSET_ARG( pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom - SFX_ITEMSET_ARG( pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden - SFX_ITEMSET_ARG( pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); // view data - SFX_ITEMSET_ARG( pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only - SFX_ITEMSET_ARG( pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) - SFX_ITEMSET_ARG( pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) + SFX_ITEMSET_ARG( &rSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); // position and size + SFX_ITEMSET_ARG( &rSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); // view ID + SFX_ITEMSET_ARG( &rSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); // zoom + SFX_ITEMSET_ARG( &rSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False ); // hidden + SFX_ITEMSET_ARG( &rSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); // view data + SFX_ITEMSET_ARG( &rSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False ); // view only + SFX_ITEMSET_ARG( &rSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); // plugin (external inplace) + SFX_ITEMSET_ARG( &rSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False ); // jump (GotoBookmark) // hidden? OSL_PRECOND( !pImp->bHidden, @@ -758,7 +751,6 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) // if no view-related data exists in the set, then obtain the view data from the model if ( !pJumpItem && !pViewDataItem && !pPluginMode && !pAreaItem && !pViewIdItem && !pModeItem ) { - nViewId = 0; if ( lcl_getViewDataAndID( rDoc.GetModel(), aUserData, nViewId ) ) { SfxItemSet* pMediumSet = rDoc.GetMedium()->GetItemSet(); @@ -776,9 +768,9 @@ sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc ) if ( nPluginMode && ( nPluginMode != 2 ) ) SetInPlace_Impl( TRUE ); - SfxViewFrame* pViewFrame = new SfxViewFrame( this, &rDoc, nViewId ); - if ( !pViewFrame->GetViewShell() ) - { + SfxViewFrame* pViewFrame = new SfxViewFrame( this, &rDoc ); + if ( !pViewFrame->SwitchToViewShell_Impl( nViewId ) ) + { // TODO: better error handling? Under which conditions can this fail? OSL_ENSURE( false, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" ); pViewFrame->DoClose(); return sal_False; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b9a3a8d2d4b0..77b0840e349e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -1448,8 +1448,7 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) SfxViewFrame::SfxViewFrame ( SfxFrame* pFrame, - SfxObjectShell* pObjShell, - sal_uInt16 nViewId + SfxObjectShell* pObjShell ) /* [Beschreibung] @@ -1474,22 +1473,6 @@ SfxViewFrame::SfxViewFrame pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); pFrame->SetOwnsBindings_Impl( sal_True ); pFrame->CreateWorkWindow_Impl(); - - if ( GetFrame()->IsInPlace() ) - { - LockAdjustPosSizePixel(); - } - - if ( pObjShell && !SwitchToViewShell_Impl( nViewId ) ) - { - // TODO: better error handling? Under which conditions can this fail? - return; - } - - if ( GetFrame()->IsInPlace() ) - { - UnlockAdjustPosSizePixel(); - } } //------------------------------------------------------------------------ @@ -2322,7 +2305,7 @@ void SfxViewFrame::ExecView_Impl pFrameItem->GetValue() >>= xFrame; SfxFrame* pFrame = SfxFrame::Create( xFrame ); pMed->GetItemSet()->ClearItem( SID_HIDDEN ); - pFrame->InsertDocument_Impl( *GetObjectShell() ); + pFrame->InsertDocument_Impl( *GetObjectShell(), *pMed->GetItemSet() ); if ( !bHidden ) xFrame->getContainerWindow()->setVisible( sal_True ); } |