summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-01 15:13:11 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-09-01 15:13:11 +0200
commit1f01f13ddb5738edb341a00e66ec289d20faf47f (patch)
tree8969d9133afcad4ff97f97e4cfbc0f03b80f65be /sfx2
parent03ee94167cc16990ee8809f3ebe30af27ba94570 (diff)
dba33i: #i111146# SaveCurrentViewData_Impl: be less generous, only store the old view's data in the model if the new view is a print preview
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/viewfrm.hxx2
-rw-r--r--sfx2/source/view/viewfrm.cxx18
2 files changed, 12 insertions, 8 deletions
diff --git a/sfx2/inc/sfx2/viewfrm.hxx b/sfx2/inc/sfx2/viewfrm.hxx
index a0f5eadd5148..affa836486e6 100644
--- a/sfx2/inc/sfx2/viewfrm.hxx
+++ b/sfx2/inc/sfx2/viewfrm.hxx
@@ -253,7 +253,7 @@ public:
private:
SAL_DLLPRIVATE BOOL SwitchToViewShell_Impl( USHORT nNo, BOOL bIsIndex = FALSE );
SAL_DLLPRIVATE void PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell );
- SAL_DLLPRIVATE void SaveCurrentViewData_Impl();
+ SAL_DLLPRIVATE void SaveCurrentViewData_Impl( const USHORT i_nNewViewId );
/** loads the given existing document into the given frame
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index f1e6e45c5217..744a8e83568d 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2246,24 +2246,28 @@ SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, c
//--------------------------------------------------------------------
-void SfxViewFrame::SaveCurrentViewData_Impl()
+void SfxViewFrame::SaveCurrentViewData_Impl( const USHORT i_nNewViewId )
{
SfxViewShell* pCurrentShell = GetViewShell();
ENSURE_OR_RETURN_VOID( pCurrentShell != NULL, "SfxViewFrame::SaveCurrentViewData_Impl: no current view shell -> no current view data!" );
// determine the logical (API) view name
const SfxObjectFactory& rDocFactory( pCurrentShell->GetObjectShell()->GetFactory() );
- const sal_uInt16 nViewNo = rDocFactory.GetViewNo_Impl( GetCurViewId(), 0 );
- const String sViewName = rDocFactory.GetViewFactory( nViewNo ).GetAPIViewName();
- if ( sViewName.Len() == 0 )
+ const sal_uInt16 nCurViewNo = rDocFactory.GetViewNo_Impl( GetCurViewId(), 0 );
+ const String sCurrentViewName = rDocFactory.GetViewFactory( nCurViewNo ).GetAPIViewName();
+ const sal_uInt16 nNewViewNo = rDocFactory.GetViewNo_Impl( i_nNewViewId, 0 );
+ const String sNewViewName = rDocFactory.GetViewFactory( nNewViewNo ).GetAPIViewName();
+ if ( ( sCurrentViewName.Len() == 0 ) || ( sNewViewName.Len() == 0 ) )
{
// can't say anything about the view, the respective application did not yet migrate its code to
// named view factories => bail out
+ OSL_ENSURE( false, "SfxViewFrame::SaveCurrentViewData_Impl: views without API names? Shouldn't happen anymore?" );
return;
}
+ OSL_ENSURE( !sNewViewName.Equals( sCurrentViewName ), "SfxViewFrame::SaveCurrentViewData_Impl: suspicious: new and old view name are identical!" );
- // do *not* save view data when the view is a print preview
- if ( sViewName.EqualsAscii( "PrintPreview" ) )
+ // save the view data only when we're moving from a non-print-preview to the print-preview view
+ if ( !sNewViewName.EqualsAscii( "PrintPreview" ) )
return;
// retrieve the view data from the view
@@ -2371,7 +2375,7 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl
const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo;
// save the view data of the old view, so it can be restored later on (when needed)
- SaveCurrentViewData_Impl();
+ SaveCurrentViewData_Impl( nViewId );
// create and load new ViewShell
SfxViewShell* pNewSh = LoadViewIntoFrame_Impl(