diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-01-08 22:50:33 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-01-08 22:50:33 +0100 |
commit | 6c8e917336e086756517876afe5727415a5b1a78 (patch) | |
tree | ba4ffd5f87056b71f7c27681af0665684ffab5f8 /sfx2/source/doc/objcont.cxx | |
parent | 64d9903a647efe5cb689fc6ff84175a911b69cfd (diff) | |
parent | 76d80a085464494175053ae5c8597fa0ad1d331a (diff) |
autorecovery: merge after rebase to m69
Diffstat (limited to 'sfx2/source/doc/objcont.cxx')
-rw-r--r-- | sfx2/source/doc/objcont.cxx | 253 |
1 files changed, 2 insertions, 251 deletions
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index c8253f687e..33f3f068d5 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -50,8 +50,8 @@ #include <svl/eitem.hxx> #include <svl/urihelper.hxx> #include <svl/ctloptions.hxx> -#include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> +#include <comphelper/processfactory.hxx> #include <unotools/securityoptions.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> @@ -76,7 +76,7 @@ #include "sfxhelp.hxx" #include <sfx2/dispatch.hxx> #include <sfx2/printer.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "basmgr.hxx" #include <sfx2/doctempl.hxx> #include "doc.hrc" @@ -91,9 +91,6 @@ using namespace ::com::sun::star::uno; //==================================================================== -#define SFX_WINDOWS_STREAM "SfxWindows" -#define SFX_PREVIEW_STREAM "SfxPreview" - //==================================================================== static @@ -191,252 +188,6 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( sal_Bool bFullContent, sal_Bool bHig return pFile; } -//REMOVE FASTBOOL SfxObjectShell::SaveWindows_Impl( SvStorage &rStor ) const -//REMOVE { -//REMOVE SvStorageStreamRef xStream = rStor.OpenStream( DEFINE_CONST_UNICODE( SFX_WINDOWS_STREAM ), -//REMOVE STREAM_TRUNC | STREAM_STD_READWRITE); -//REMOVE if ( !xStream ) -//REMOVE return FALSE; -//REMOVE -//REMOVE xStream->SetBufferSize(1024); -//REMOVE xStream->SetVersion( rStor.GetVersion() ); -//REMOVE -//REMOVE // "uber alle Fenster iterieren (aber aktives Window zuletzt) -//REMOVE SfxViewFrame *pActFrame = SfxViewFrame::Current(); -//REMOVE if ( !pActFrame || pActFrame->GetObjectShell() != this ) -//REMOVE pActFrame = SfxViewFrame::GetFirst(this); -//REMOVE -//REMOVE String aActWinData; -//REMOVE for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame) ); pFrame; -//REMOVE pFrame = SfxViewFrame::GetNext(*pFrame, this, TYPE(SfxTopViewFrame) ) ) -//REMOVE { -//REMOVE // Bei Dokumenten, die Outplace aktiv sind, kann beim Speichern auch schon die View weg sein! -//REMOVE if ( pFrame->GetViewShell() ) -//REMOVE { -//REMOVE SfxTopFrame* pTop = (SfxTopFrame*) pFrame->GetFrame(); -//REMOVE pTop->GetTopWindow_Impl(); -//REMOVE -//REMOVE char cToken = ','; -//REMOVE const BOOL bActWin = pActFrame == pFrame; -//REMOVE String aUserData; -//REMOVE pFrame->GetViewShell()->WriteUserData(aUserData); -//REMOVE -//REMOVE // assemble ini-data -//REMOVE String aWinData; -//REMOVE aWinData += String::CreateFromInt32( pFrame->GetCurViewId() ); -//REMOVE aWinData += cToken; -//REMOVE /* -//REMOVE if ( !pWin || pWin->IsMaximized() ) -//REMOVE aWinData += SFX_WINSIZE_MAX; -//REMOVE else if ( pWin->IsMinimized() ) -//REMOVE aWinData += SFX_WINSIZE_MIN; -//REMOVE else -//REMOVE */ -//REMOVE aWinData += cToken; -//REMOVE aWinData += aUserData; -//REMOVE -//REMOVE // aktives kennzeichnen -//REMOVE aWinData += cToken; -//REMOVE aWinData += bActWin ? '1' : '0'; -//REMOVE -//REMOVE // je nachdem merken oder abspeichern -//REMOVE if ( bActWin ) -//REMOVE aActWinData = aWinData; -//REMOVE else -//REMOVE xStream->WriteByteString( aWinData ); -//REMOVE } -//REMOVE } -//REMOVE -//REMOVE // aktives Window hinterher -//REMOVE xStream->WriteByteString( aActWinData ); -//REMOVE return !xStream->GetError(); -//REMOVE } - -//==================================================================== - -SfxViewFrame* SfxObjectShell::LoadWindows_Impl( SfxTopFrame *pPreferedFrame ) -{ - DBG_ASSERT( pPreferedFrame, "Call without preferred Frame is not supported anymore!" ); - if ( pImp->bLoadingWindows || !pPreferedFrame ) - return NULL; - - DBG_ASSERT( GetMedium(), "A Medium should exist here!"); - if( !GetMedium() ) - return 0; - - // get correct mode - SFX_APP(); - SfxViewFrame *pPrefered = pPreferedFrame ? pPreferedFrame->GetCurrentViewFrame() : 0; - SvtSaveOptions aOpt; - BOOL bLoadDocWins = aOpt.IsSaveDocWins() && !pPrefered; - - // try to get viewdata information for XML format - REFERENCE < XVIEWDATASUPPLIER > xViewDataSupplier( GetModel(), ::com::sun::star::uno::UNO_QUERY ); - REFERENCE < XINDEXACCESS > xViewData; - - if ( xViewDataSupplier.is() ) - { - xViewData = xViewDataSupplier->getViewData(); - if ( !xViewData.is() ) - return NULL; - } - else - return NULL; - - SfxViewFrame *pActiveFrame = 0; - String aWinData; - SfxItemSet *pSet = GetMedium()->GetItemSet(); - - pImp->bLoadingWindows = TRUE; - BOOL bLoaded = FALSE; - sal_Int32 nView = 0; - - // get saved information for all views - while ( TRUE ) - { - USHORT nViewId = 0; - FASTBOOL bMaximized=FALSE; - String aPosSize; - String aUserData; // used in the binary format - SEQUENCE < PROPERTYVALUE > aSeq; // used in the XML format - - // XML format - // active view is the first view in the container - FASTBOOL bActive = ( nView == 0 ); - - if ( nView == xViewData->getCount() ) - // finished - break; - - // get viewdata and look for the stored ViewId - ::com::sun::star::uno::Any aAny = xViewData->getByIndex( nView++ ); - if ( aAny >>= aSeq ) - { - for ( sal_Int32 n=0; n<aSeq.getLength(); n++ ) - { - const PROPERTYVALUE& rProp = aSeq[n]; - if ( rProp.Name.compareToAscii("ViewId") == COMPARE_EQUAL ) - { - ::rtl::OUString aId; - rProp.Value >>= aId; - String aTmp( aId ); - aTmp.Erase( 0, 4 ); // format is like in "view3" - nViewId = (USHORT) aTmp.ToInt32(); - break; - } - } - } - - // load only active view, but current item is not the active one ? - // in XML format the active view is the first one - if ( !bLoadDocWins && !bActive ) - break; - - // check for minimized/maximized/size - if ( aPosSize.EqualsAscii( "max" ) ) - bMaximized = TRUE; - else if ( aPosSize.EqualsAscii( "min" ) ) - { - bMaximized = TRUE; - bActive = FALSE; - } - else - bMaximized = FALSE; - - Point aPt; - Size aSz; - - pSet->ClearItem( SID_USER_DATA ); - SfxViewFrame *pFrame = 0; - if ( pPrefered ) - { - // use the frame from the arguments, but don't set a window size - pFrame = pPrefered; - if ( pFrame->GetViewShell() || !pFrame->GetObjectShell() ) - { - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - // avoid flickering controllers - SfxBindings &rBind = pFrame->GetBindings(); - rBind.ENTERREGISTRATIONS(); - - // set document into frame - pPreferedFrame->InsertDocument( this ); - - // restart controller updating - rBind.LEAVEREGISTRATIONS(); - } - else - { - // create new view - pFrame->CreateView_Impl( nViewId ); - } - } - else - { - if ( bLoadDocWins ) - { - // open in the background - pSet->Put( SfxUInt16Item( SID_VIEW_ZOOM_MODE, 0 ) ); - if ( !bMaximized ) - pSet->Put( SfxRectangleItem( SID_VIEW_POS_SIZE, Rectangle( aPt, aSz ) ) ); - } - - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - - if ( pPreferedFrame ) - { - // Frame "ubergeben, allerdings ist der noch leer - pPreferedFrame->InsertDocument( this ); - pFrame = pPreferedFrame->GetCurrentViewFrame(); - } - else - { - pFrame = SfxTopFrame::Create( this, nViewId, FALSE, pSet )->GetCurrentViewFrame(); - } - - // only temporary data, don't hold it in the itemset - pSet->ClearItem( SID_VIEW_POS_SIZE ); - pSet->ClearItem( SID_WIN_POSSIZE ); - pSet->ClearItem( SID_VIEW_ZOOM_MODE ); - } - - bLoaded = TRUE; - - // UserData hier einlesen, da es ansonsten immer mit bBrowse=TRUE - // aufgerufen wird, beim Abspeichern wurde aber bBrowse=FALSE verwendet - if ( pFrame && pFrame->GetViewShell() ) - { - if ( aUserData.Len() ) - pFrame->GetViewShell()->ReadUserData( aUserData, !bLoadDocWins ); - else if ( aSeq.getLength() ) - pFrame->GetViewShell()->ReadUserDataSequence( aSeq, !bLoadDocWins ); - } - - // perhaps there are more windows to load - pPreferedFrame = NULL; - - if ( bActive ) - pActiveFrame = pFrame; - - if( pPrefered || !bLoadDocWins ) - // load only active window - break; - } - - if ( pActiveFrame ) - { - if ( !pPrefered ) - // activate frame - pActiveFrame->MakeActive_Impl( TRUE ); - } - - pImp->bLoadingWindows = FALSE; - return pPrefered && bLoaded ? pPrefered : pActiveFrame; -} - //==================================================================== void SfxObjectShell::UpdateDocInfoForSave() |