summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-12-10 15:36:53 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-12-10 15:36:53 +0100
commitf726e1cf4c15c0d97a16bd4386af06d67b492fa4 (patch)
tree579cba5ccd60123f227f6255b19cef6bbd299d8a
parente5aa24f3c6d304f92c6eaaf0341b83d22b179125 (diff)
autorecovery: step 1 of final roll up of calling hierarchy
-rw-r--r--sfx2/inc/frmload.hxx2
-rw-r--r--sfx2/inc/sfx2/frame.hxx2
-rw-r--r--sfx2/source/view/frame2.cxx43
-rw-r--r--sfx2/source/view/frmload.cxx67
4 files changed, 47 insertions, 67 deletions
diff --git a/sfx2/inc/frmload.hxx b/sfx2/inc/frmload.hxx
index aa72dbebd1..a1e5542567 100644
--- a/sfx2/inc/frmload.hxx
+++ b/sfx2/inc/frmload.hxx
@@ -140,7 +140,7 @@ private:
::comphelper::NamedValueCollection& io_rDescriptor
);
- void impl_determineViewID_nothrow(
+ sal_Int16 impl_determineEffectiveViewId_nothrow(
const SfxObjectShell& i_rDocument,
::comphelper::NamedValueCollection& io_rDescriptor
);
diff --git a/sfx2/inc/sfx2/frame.hxx b/sfx2/inc/sfx2/frame.hxx
index c9ce04de7c..84aa3090bf 100644
--- a/sfx2/inc/sfx2/frame.hxx
+++ b/sfx2/inc/sfx2/frame.hxx
@@ -219,7 +219,7 @@ public:
SAL_DLLPRIVATE void GrabFocusOnComponent_Impl();
SAL_DLLPRIVATE void SetInPlace_Impl( sal_Bool );
- SAL_DLLPRIVATE BOOL InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs );
+ SAL_DLLPRIVATE void PrepareForDoc_Impl( SfxObjectShell& i_rDoc, const ::comphelper::NamedValueCollection& i_rArgs );
SAL_DLLPRIVATE void LockResize_Impl( BOOL bLock );
SAL_DLLPRIVATE void SetMenuBarOn_Impl( BOOL bOn );
SAL_DLLPRIVATE BOOL IsMenuBarOn_Impl() const;
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 0cce0c7702..7093fb7392 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -34,7 +34,6 @@
#include "impframe.hxx"
#include "objshimp.hxx"
#include "sfxhelp.hxx"
-#include "viewfac.hxx"
#include "workwin.hxx"
#include "sfx2/app.hxx"
@@ -466,49 +465,19 @@ void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const
}
}
-sal_Bool SfxFrame::InsertDocument_Impl( SfxObjectShell& rDoc, const ::comphelper::NamedValueCollection& i_rArgs )
-/* [Beschreibung]
- */
+void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc, const ::comphelper::NamedValueCollection& i_rArgs )
{
- OSL_PRECOND( rDoc.GetMedium(), "SfxFrame::InsertDocument_Impl: no medium -> no view!");
- if ( !rDoc.GetMedium() )
- return sal_False;
-
- OSL_PRECOND( GetCurrentViewFrame() == NULL,
- "SfxObjectShell::InsertDocument_Impl: no support (anymore) for loading into a non-empty frame!" );
- // Since some refactoring in CWS autorecovery, this shouldn't happen anymore. Frame re-usage is nowadays
- // done in higher layers, namely in the framework.
- if ( GetCurrentViewFrame() != NULL )
- return sal_False;
-
- OSL_PRECOND( GetCurrentDocument() == NULL,
- "SfxFrame::InsertDocument_Impl: re-using an Sfx(Top)Frame is not supported anymore!" );
-
- // view ID
- sal_Int16 nViewId = i_rArgs.getOrDefault( "ViewId", sal_Int16( 0 ) );
-
- // jump mark
- const bool bHasJumpMark = i_rArgs.has( "JumpMark" );
-
- // plugin mode
- sal_Int16 nPluginMode = 0;
- const bool bHasPluginMode = i_rArgs.get_ensureType( "PluginMode", nPluginMode );
-
// hidden?
+ OSL_ENSURE( !pImp->bHidden, "when does this happen?" );
pImp->bHidden = i_rArgs.getOrDefault( "Hidden", pImp->bHidden );
- UpdateDescriptor( &rDoc );
+ // update our descriptor
+ UpdateDescriptor( &i_rDoc );
+ // plugin mode
+ sal_Int16 nPluginMode = i_rArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) );
if ( nPluginMode && ( nPluginMode != 2 ) )
SetInPlace_Impl( TRUE );
-
- SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *this, rDoc, nViewId ? nViewId : rDoc.GetFactory().GetViewFactory( 0 ).GetOrdinal() );
- OSL_ENSURE( pViewFrame, "SfxFrame::InsertDocument_Impl: something went wrong while creating the SfxViewFrame!" );
- if ( !pViewFrame )
- // TODO: better error handling? Under which conditions can this fail?
- return sal_False;
-
- return GetCurrentDocument() == &rDoc;
}
bool SfxFrame::IsMarkedHidden_Impl() const
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index 28f8138c5e..4092bda904 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -33,6 +33,7 @@
#include "frmload.hxx"
#include "objshimp.hxx"
+#include "viewfac.hxx"
#include "sfx2/app.hxx"
#include "sfx2/dispatch.hxx"
#include "sfx2/docfac.hxx"
@@ -491,40 +492,46 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
}
// --------------------------------------------------------------------------------------------------------------------
-void SfxFrameLoader_Impl::impl_determineViewID_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor )
+sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, ::comphelper::NamedValueCollection& io_rDescriptor )
{
- if ( io_rDescriptor.has( "ViewId" ) )
- // nothing to do
- return;
-
+ sal_Int16 nViewId = io_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) );
try
{
- Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY );
- Reference< XIndexAccess > xViewData;
- if ( xViewDataSupplier.is() )
- xViewData.set( xViewDataSupplier->getViewData() );
-
- if ( !xViewData.is() || ( xViewData->getCount() == 0 ) )
- // no view data stored together with the model
- return;
-
- // obtain the ViewID from the view data
- Sequence< PropertyValue > aViewData;
- if ( !( xViewData->getByIndex( 0 ) >>= aViewData ) )
- return;
-
- ::comphelper::NamedValueCollection aNamedViewData( aViewData );
- ::rtl::OUString sViewId = aNamedViewData.getOrDefault( "ViewId", ::rtl::OUString() );
- if ( !sViewId.getLength() )
- return;
-
- sViewId = sViewId.copy( 4 ); // format is like in "view3"
- io_rDescriptor.put( "ViewId", sal_Int16( sViewId.toInt32() ) );
+ if ( nViewId == 0 ) do
+ {
+ Reference< XViewDataSupplier > xViewDataSupplier( i_rDocument.GetModel(), UNO_QUERY );
+ Reference< XIndexAccess > xViewData;
+ if ( xViewDataSupplier.is() )
+ xViewData.set( xViewDataSupplier->getViewData() );
+
+ if ( !xViewData.is() || ( xViewData->getCount() == 0 ) )
+ // no view data stored together with the model
+ break;
+
+ // obtain the ViewID from the view data
+ Sequence< PropertyValue > aViewData;
+ if ( !( xViewData->getByIndex( 0 ) >>= aViewData ) )
+ break;
+
+ ::comphelper::NamedValueCollection aNamedViewData( aViewData );
+ ::rtl::OUString sViewId = aNamedViewData.getOrDefault( "ViewId", ::rtl::OUString() );
+ if ( !sViewId.getLength() )
+ break;
+
+ sViewId = sViewId.copy( 4 ); // format is like in "view3"
+ nViewId = sal_Int16( sViewId.toInt32() );
+ io_rDescriptor.put( "ViewId", nViewId );
+ }
+ while ( false );
}
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
+
+ if ( nViewId == 0 )
+ nViewId = i_rDocument.GetFactory().GetViewFactory( 0 ).GetOrdinal();
+ return nViewId;
}
// --------------------------------------------------------------------------------------------------------------------
@@ -649,11 +656,15 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
SfxFrame* pTargetFrame = impl_getOrCreateEmptySfxFrame( _rTargetFrame );
wFrame = pTargetFrame;
+ // prepare it
+ pTargetFrame->PrepareForDoc_Impl( *xDoc, aDescriptor );
+
// ensure the ID of the to-be-created view is in the descriptor, if possible
- impl_determineViewID_nothrow( *xDoc, aDescriptor );
+ sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor );
// plug the document into the frame
- if ( !pTargetFrame->InsertDocument_Impl( *xDoc, aDescriptor ) )
+ SfxViewFrame* pViewFrame = SfxViewFrame::Create_Impl( *pTargetFrame, *xDoc, nViewId );
+ if ( !pViewFrame )
throw RuntimeException();
if ( !bExternalModel )