diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-04-17 20:34:49 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-04-17 20:34:49 +0200 |
commit | 65bff6225b635f2b5fb75b648bf46ea54d2d7843 (patch) | |
tree | 01fd07efafdb9cd5eed1da9103725313e0b67e9e /sfx2/source | |
parent | 692dac6c6e964a64909f9adfba44f936810c2646 (diff) | |
parent | a001605a190749900d3e09aa864ce56925ff848e (diff) |
CWS gnumake2: rebase to DEV300_m76; fix build problems
Diffstat (limited to 'sfx2/source')
298 files changed, 6193 insertions, 10264 deletions
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 443f00edb27e..56181846840b 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: app.cxx,v $ - * $Revision: 1.112 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -83,7 +80,7 @@ #include <vcl/svapp.hxx> #include <rtl/logfile.hxx> #include <sfx2/appuno.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/request.hxx> #include "sfxtypes.hxx" #include "sfx2/sfxresid.hxx" @@ -100,7 +97,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/viewsh.hxx> #include <sfx2/genlink.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "appdata.hxx" #include "openflag.hxx" #include "app.hrc" @@ -112,7 +109,7 @@ #include <sfx2/module.hxx> #include <sfx2/tbxctrl.hxx> #include <sfx2/sfxdlg.hxx> -#include "stbitem.hxx" +#include "sfx2/stbitem.hxx" #include "eventsupplier.hxx" #include <sfx2/dockwin.hxx> @@ -464,9 +461,6 @@ SfxDispatcher* SfxApplication::GetDispatcher_Impl() //-------------------------------------------------------------------- void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) { - if( pFrame && !pFrame->IsSetViewFrameAllowed_Impl() ) - return; - if ( pFrame != pAppData_Impl->pViewFrame ) { // get the containerframes ( if one of the frames is an InPlaceFrame ) @@ -483,12 +477,6 @@ void SfxApplication::SetViewFrame_Impl( SfxViewFrame *pFrame ) // BOOL bDocWinActivate = pOldContainerFrame && pNewContainerFrame && // pOldContainerFrame->GetTopViewFrame() == pNewContainerFrame->GetTopViewFrame(); BOOL bTaskActivate = pOldContainerFrame != pNewContainerFrame; - if ( pAppData_Impl->pViewFrame ) - { - if ( bTaskActivate ) - // prepare UI for deacivation - pAppData_Impl->pViewFrame->GetFrame()->Deactivate_Impl(); - } if ( pOldContainerFrame ) { @@ -557,11 +545,11 @@ short SfxApplication::QuerySave_Impl( SfxObjectShell& rDoc, sal_Bool /*bAutoSave String aMsg( SfxResId( STR_ISMODIFIED ) ); aMsg.SearchAndReplaceAscii( "%1", rDoc.GetTitle() ); - SfxFrame *pFrame = SfxViewFrame::GetFirst(&rDoc)->GetFrame(); - pFrame->Appear(); + SfxFrame& rFrame = SfxViewFrame::GetFirst(&rDoc)->GetFrame(); + rFrame.Appear(); WinBits nBits = WB_YES_NO_CANCEL | WB_DEF_NO; - QueryBox aBox( &pFrame->GetWindow(), nBits, aMsg ); + QueryBox aBox( &rFrame.GetWindow(), nBits, aMsg ); return aBox.Execute(); } @@ -685,7 +673,7 @@ uno::Reference< task::XStatusIndicator > SfxApplication::GetStatusIndicator() co while ( pTop->GetParentViewFrame_Impl() ) pTop = pTop->GetParentViewFrame_Impl(); - return pTop->GetFrame()->GetWorkWindow_Impl()->GetStatusIndicator(); + return pTop->GetFrame().GetWorkWindow_Impl()->GetStatusIndicator(); } SfxTbxCtrlFactArr_Impl& SfxApplication::GetTbxCtrlFactories_Impl() const @@ -802,7 +790,7 @@ SfxApplication::ChooseScript() OSL_TRACE("create selector dialog"); const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; + const SfxFrame* pFrame = pViewFrame ? &pViewFrame->GetFrame() : NULL; uno::Reference< frame::XFrame > xFrame( pFrame ? pFrame->GetFrameInterface() : uno::Reference< frame::XFrame >() ); AbstractScriptSelectorDialog* pDlg = diff --git a/sfx2/source/appl/app.hrc b/sfx2/source/appl/app.hrc index c08f46effc81..dca172269443 100644 --- a/sfx2/source/appl/app.hrc +++ b/sfx2/source/appl/app.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: app.hrc,v $ - * $Revision: 1.49 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -258,6 +255,18 @@ #define STR_DDE_ERROR (RID_SFX_APP_START + 193) #define RID_SECURITY_WARNING_NO_HYPERLINKS (RID_SFX_APP_START + 194) +#define RID_SVXSTR_FILELINK (RID_SFX_APP_START + 195) +#define RID_SVXSTR_GRAFIKLINK (RID_SFX_APP_START + 196) +#define RID_SVXSTR_EDITGRFLINK (RID_SFX_APP_START + 197) + +// strings for error messsages of OpenGraphics dialog +#define RID_SVXSTR_GRFILTER_OPENERROR (RID_SFX_APP_START + 198) +#define RID_SVXSTR_GRFILTER_IOERROR (RID_SFX_APP_START + 199) +#define RID_SVXSTR_GRFILTER_FORMATERROR (RID_SFX_APP_START + 200) +#define RID_SVXSTR_GRFILTER_VERSIONERROR (RID_SFX_APP_START + 201) +#define RID_SVXSTR_GRFILTER_FILTERERROR (RID_SFX_APP_START + 202) +#define RID_SVXSTR_GRFILTER_TOOBIG (RID_SFX_APP_START + 203) + #define MD_DDE_LINKEDIT (RID_SFX_APP_START + 1) #endif // #ifndef _SFX_APP_HRC diff --git a/sfx2/source/appl/app.src b/sfx2/source/appl/app.src index ab27b83bb889..1ecfe4dcbb40 100644 --- a/sfx2/source/appl/app.src +++ b/sfx2/source/appl/app.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: app.src,v $ - * $Revision: 1.122 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -694,11 +691,6 @@ ToolBox RID_ENVTOOLBOX }; ToolBoxItem { - Identifier = SID_BROWSE_STOP ; - Hide = TRUE; - }; - ToolBoxItem - { Type = TOOLBOXITEM_SEPARATOR ; }; ToolBoxItem @@ -1100,22 +1092,60 @@ Image IMG_MISSING_4 { ImageBitmap = Bitmap { File = "sn064.bmp" ; }; }; + String STR_STANDARD { Text [ en-US ] = "Standard" ; }; + +String RID_SVXSTR_FILELINK +{ + Text [ en-US ] = "Document" ; +}; + String STR_NONE { Text [ en-US ] = "- None -" ; }; +String RID_SVXSTR_GRAFIKLINK +{ + Text [ en-US ] = "Graphic" ; +}; String STR_SFX_FILTERNAME_ALL { Text [ en-US ] = "All files (*.*)" ; }; +String RID_SVXSTR_EDITGRFLINK +{ + Text [ en-US ] = "Link graphics" ; +}; // i66948 used in project scripting String STR_ERRUNOEVENTBINDUNG { Text [ en-US ] = "An appropriate component method %1\ncould not be found.\n\nCheck spelling of method name."; }; - +String RID_SVXSTR_GRFILTER_OPENERROR +{ + Text [ en-US ] = "Graphics file cannot be opened" ; +}; +String RID_SVXSTR_GRFILTER_IOERROR +{ + Text [ en-US ] = "Graphics file cannot be read" ; +}; +String RID_SVXSTR_GRFILTER_FORMATERROR +{ + Text [ en-US ] = "Unknown graphics format" ; +}; +String RID_SVXSTR_GRFILTER_VERSIONERROR +{ + Text [ en-US ] = "This version of the graphics file is not supported" ; +}; +String RID_SVXSTR_GRFILTER_FILTERERROR +{ + Text [ en-US ] = "Graphics filter not found" ; +}; +String RID_SVXSTR_GRFILTER_TOOBIG +{ + Text [ en-US ] = "Not enough memory to insert graphic" ; +}; diff --git a/sfx2/source/appl/appbas.cxx b/sfx2/source/appl/appbas.cxx index 977ab7a4aa36..7e775cbbb502 100644 --- a/sfx2/source/appl/appbas.cxx +++ b/sfx2/source/appl/appbas.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appbas.cxx,v $ - * $Revision: 1.52 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -81,7 +78,7 @@ #include <sfx2/dinfdlg.hxx> #include "appdata.hxx" #include "appbas.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include "sfx2/basmgr.hxx" #include "sorgitm.hxx" #include "appbaslib.hxx" @@ -89,7 +86,7 @@ #define ITEMID_SEARCH SID_SEARCH_ITEM -#include <sfx2/srchitem.hxx> +#include <svl/srchitem.hxx> #include <vos/socket.hxx> #define SFX_TYPEMAP @@ -354,7 +351,7 @@ void SfxApplication::EnterBasicCall() } // die SbxObjects der SfxShells auf den Stacks der Frames erzeugen - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,0,sal_False); + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(0,sal_False); pFrame; pFrame = SfxViewFrame::GetNext(*pFrame,0,0,sal_False) ) { @@ -425,16 +422,6 @@ void SfxApplication::PropExec_Impl( SfxRequest &rReq ) break; } - case SID_WIN_POSSIZE: - { - break; - } - - case SID_INTERACTIVEMODE: - { - break; - } - case SID_ATTR_UNDO_COUNT: { SFX_REQUEST_ARG(rReq, pCountItem, SfxUInt16Item, nSID, sal_False); diff --git a/sfx2/source/appl/appbaslib.cxx b/sfx2/source/appl/appbaslib.cxx index 35f743a5aec7..96c998b2674d 100644 --- a/sfx2/source/appl/appbaslib.cxx +++ b/sfx2/source/appl/appbaslib.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appbaslib.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index affe0d19c0ec..9481b7ff5730 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appcfg.cxx,v $ - * $Revision: 1.74 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -83,7 +80,7 @@ #include <sfx2/app.hxx> #include <sfx2/docfile.hxx> #include <sfx2/viewfrm.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include "sfxtypes.hxx" #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> @@ -271,14 +268,6 @@ BOOL SfxApplication::GetOptions( SfxItemSet& rSet ) bRet = FALSE; } break; - case SID_ATTR_SAVEDOCWINS : - { - bRet = TRUE; - if (!aSaveOptions.IsReadOnly(SvtSaveOptions::E_SAVEDOCWINS)) - if (!rSet.Put( SfxBoolItem( rPool.GetWhich( SID_ATTR_SAVEDOCWINS ), aSaveOptions.IsSaveDocWins()))) - bRet = FALSE; - } - break; case SID_ATTR_SAVEDOCVIEW : { bRet = TRUE; @@ -630,13 +619,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) aSaveOptions.SetSaveWorkingSet(((const SfxBoolItem *)pItem)->GetValue()); } - // offene Fenster speichern - if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCWINS), TRUE, &pItem)) - { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); - aSaveOptions.SetSaveDocWins(((const SfxBoolItem *)pItem)->GetValue()); - } - // Fenster-Einstellung speichern if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_SAVEDOCVIEW), TRUE, &pItem)) { diff --git a/sfx2/source/appl/appchild.cxx b/sfx2/source/appl/appchild.cxx index 5817337ae60d..b18fc905abdc 100644 --- a/sfx2/source/appl/appchild.cxx +++ b/sfx2/source/appl/appchild.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appchild.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -170,9 +167,9 @@ SfxTemplateDialog* SfxApplication::GetTemplateDialog() SfxWorkWindow* SfxApplication::GetWorkWindow_Impl(const SfxViewFrame *pFrame) const { if ( pFrame ) - return pFrame->GetFrame()->GetWorkWindow_Impl(); + return pFrame->GetFrame().GetWorkWindow_Impl(); else if ( pAppData_Impl->pViewFrame ) - return pAppData_Impl->pViewFrame->GetFrame()->GetWorkWindow_Impl(); + return pAppData_Impl->pViewFrame->GetFrame().GetWorkWindow_Impl(); else return NULL; } diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx index 468aa3fd9a01..15805526bd87 100644 --- a/sfx2/source/appl/appdata.cxx +++ b/sfx2/source/appl/appdata.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appdata.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -101,7 +98,6 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* pApp ) : pTopFrames( new SfxFrameArr_Impl ), pInitLinkList(0), pMatcher( 0 ), - pCancelMgr( 0 ), pLabelResMgr( 0 ), pAppDispatch(NULL), pTemplates( 0 ), @@ -151,7 +147,6 @@ SfxAppData_Impl::~SfxAppData_Impl() { DeInitDDE(); delete pTopFrames; - delete pCancelMgr; delete pSecureURLs; delete pBasicManager; diff --git a/sfx2/source/appl/appdde.cxx b/sfx2/source/appl/appdde.cxx index f5b3a2e6dca1..808731f8bba8 100644 --- a/sfx2/source/appl/appdde.cxx +++ b/sfx2/source/appl/appdde.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appdde.cxx,v $ - * $Revision: 1.19.142.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,7 +46,7 @@ #include "appdata.hxx" #include <sfx2/objsh.hxx> #include <sfx2/viewfrm.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include "sfxtypes.hxx" #include <sfx2/sfxsids.hrc> @@ -596,17 +593,12 @@ BOOL ImplDdeService::MakeTopic( const String& rNm ) // dann versuche die Datei zu laden: SfxStringItem aName( SID_FILE_NAME, aFile.GetMainURL( INetURLObject::NO_DECODE ) ); SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, TRUE); -// SfxBoolItem aHidden(SID_HIDDEN, TRUE); - // minimiert! - SfxUInt16Item aViewStat( SID_VIEW_ZOOM_MODE, 0 ); - SfxRectangleItem aRectItem( SID_VIEW_POS_SIZE, Rectangle() ); SfxBoolItem aSilent(SID_SILENT, TRUE); SfxDispatcher* pDispatcher = SFX_APP()->GetDispatcher_Impl(); const SfxPoolItem* pRet = pDispatcher->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, &aName, &aNewView, - &aViewStat,&aRectItem/*aHidden*/, &aSilent, 0L ); if( pRet && pRet->ISA( SfxViewFrameItem ) && @@ -632,7 +624,7 @@ String ImplDdeService::Topics() SfxObjectShell* pShell = SfxObjectShell::GetFirst( &aType ); while( pShell ) { - if( SfxViewFrame::GetFirst( pShell, TYPE(SfxTopViewFrame) )) + if( SfxViewFrame::GetFirst( pShell ) ) { if( sRet.Len() ) sRet += '\t'; diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 1bca6323f699..84b75bfa3d15 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appinit.cxx,v $ - * $Revision: 1.65 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -84,7 +81,7 @@ #include <sfx2/mnumgr.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/progress.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include "sfx2/sfxresid.hxx" #include "sfxtypes.hxx" #include <sfx2/viewsh.hxx> @@ -276,8 +273,6 @@ FASTBOOL SfxApplication::Initialize_Impl() new SfxErrorHandler( RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END); new SfxErrorHandler( - (RID_SJ_START +1), ERRCODE_AREA_JAVA, ERRCODE_AREA_JAVA_END); - new SfxErrorHandler( RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END ); // diverse Pointer diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx index 28373f81ad08..a6d89edf301d 100644 --- a/sfx2/source/appl/appmain.cxx +++ b/sfx2/source/appl/appmain.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appmain.cxx,v $ - * $Revision: 1.36 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 55785115ec2d..94b921f8122e 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appmisc.cxx,v $ - * $Revision: 1.58 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -72,7 +69,7 @@ #include "appdata.hxx" #include "arrdecl.hxx" #include <sfx2/tbxctrl.hxx> -#include "stbitem.hxx" +#include "sfx2/stbitem.hxx" #include <sfx2/mnuitem.hxx> #include <sfx2/docfac.hxx> #include <sfx2/docfile.hxx> @@ -89,7 +86,7 @@ #include <sfx2/templdlg.hxx> #include <sfx2/module.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "openflag.hxx" #include <sfx2/viewsh.hxx> #include <sfx2/objface.hxx> @@ -329,13 +326,6 @@ ISfxTemplateCommon* SfxApplication::GetCurrentTemplateCommon( SfxBindings& rBind return 0; } -SfxCancelManager* SfxApplication::GetCancelManager() const -{ - if ( !pAppData_Impl->pCancelMgr ) - pAppData_Impl->pCancelMgr = new SfxCancelManager; - return pAppData_Impl->pCancelMgr; -} - SfxResourceManager& SfxApplication::GetResourceManager() const { return *pAppData_Impl->pResMgr; } BOOL SfxApplication::IsDowning() const { return pAppData_Impl->bDowning; } SfxDispatcher* SfxApplication::GetAppDispatcher_Impl() { return pAppData_Impl->pAppDispat; } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 0ff8c1b14c7f..fa2a60a45dcc 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appopen.cxx,v $ - * $Revision: 1.121.96.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -104,7 +101,7 @@ #include "sfx2/sfxresid.hxx" #include <sfx2/viewsh.hxx> #include "app.hrc" -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/sfxuno.hxx> #include <sfx2/objface.hxx> #include <sfx2/filedlghelper.hxx> @@ -196,7 +193,7 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded // Vergleiche anhand der URLs INetURLObject aUrl( xDoc->GetMedium()->GetName() ); if ( !aUrl.HasError() && aUrl == aUrlToFind && - (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, 0, TRUE )) && + (!bForbidVisible || !SfxViewFrame::GetFirst( xDoc, TRUE )) && !xDoc->IsLoading()) { break; @@ -213,12 +210,10 @@ SfxObjectShellRef SfxApplication::DocAlreadyLoaded DBG_ASSERT( !bForbidVisible, "Unsichtbares kann nicht aktiviert werden" ); - SfxTopViewFrame *pFrame; - for( pFrame = (SfxTopViewFrame*) - SfxViewFrame::GetFirst( xDoc, TYPE(SfxTopViewFrame) ); - pFrame && !pFrame->IsVisible_Impl(); - pFrame = (SfxTopViewFrame*) - SfxViewFrame::GetNext( *pFrame, xDoc, TYPE(SfxTopViewFrame) ) ) ; + SfxViewFrame* pFrame; + for( pFrame = SfxViewFrame::GetFirst( xDoc ); + pFrame && !pFrame->IsVisible(); + pFrame = SfxViewFrame::GetNext( *pFrame, xDoc ) ) ; if ( pFrame ) { SfxViewFrame *pCur = SfxViewFrame::Current(); @@ -514,65 +509,6 @@ ULONG SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const String &rFil //-------------------------------------------------------------------- -SfxObjectShellLock SfxApplication::NewDoc_Impl( const String& rFact, const SfxItemSet *pSet ) -{ - SfxObjectShellLock xDoc; - String aFact( rFact ); - String aPrefix = String::CreateFromAscii( "private:factory/" ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) - aFact.Erase( 0, aPrefix.Len() ); - USHORT nPos = aFact.Search( '?' ); - String aParam; - if ( nPos != STRING_NOTFOUND ) - { - aParam = aFact.Copy( nPos, aFact.Len() ); - aFact.Erase( nPos, aFact.Len() ); - aParam.Erase(0,1); - } - - xDoc = SfxObjectShell::CreateObjectByFactoryName( aFact ); - aParam = INetURLObject::decode( aParam, '%', INetURLObject::DECODE_WITH_CHARSET ); - if( xDoc.Is() ) - xDoc->DoInitNew_Impl( aParam ); - - if ( xDoc.Is() ) - { - if ( pSet ) - { - // TODO/LATER: Should the other arguments be transfered as well? - SFX_ITEMSET_ARG( pSet, pDefaultPathItem, SfxStringItem, SID_DEFAULTFILEPATH, FALSE); - if ( pDefaultPathItem ) - xDoc->GetMedium()->GetItemSet()->Put( *pDefaultPathItem ); - SFX_ITEMSET_ARG( pSet, pDefaultNameItem, SfxStringItem, SID_DEFAULTFILENAME, FALSE); - if ( pDefaultNameItem ) - xDoc->GetMedium()->GetItemSet()->Put( *pDefaultNameItem ); - SFX_ITEMSET_ARG( pSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); - if ( pTitleItem ) - xDoc->GetMedium()->GetItemSet()->Put( *pTitleItem ); - } - - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel ( xDoc->GetModel(), ::com::sun::star::uno::UNO_QUERY ); - if ( xModel.is() ) - { - SfxItemSet* pNew = xDoc->GetMedium()->GetItemSet()->Clone(); - pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; - TransformItems( SID_OPENDOC, *pNew, aArgs ); - - sal_Int32 nLength = aArgs.getLength(); - aArgs.realloc( nLength + 1 ); - - aArgs[nLength].Name = DEFINE_CONST_UNICODE("Title"); - aArgs[nLength].Value <<= ::rtl::OUString( xDoc->GetTitle( SFX_TITLE_DETECT ) ); - - xModel->attachResource( ::rtl::OUString(), aArgs ); - delete pNew; - } - } - - return xDoc; -} - void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) { DBG_MEMTEST(); @@ -606,131 +542,6 @@ void SfxApplication::NewDocDirectExec_Impl( SfxRequest& rReq ) rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); } -const SfxPoolItem* SfxApplication::NewDocDirectExec_ImplOld( SfxRequest& rReq ) -{ - DBG_MEMTEST(); -/* - SFX_REQUEST_ARG(rReq, pHidden, SfxBoolItem, SID_HIDDEN, FALSE); -//(mba)/task - - if ( !pHidden || !pHidden->GetValue() ) - Application::GetAppWindow()->EnterWait(); -*/ - SfxObjectShellLock xDoc; - - // Factory-RegNo kann per Parameter angegeben sein - SfxErrorContext aEc(ERRCTX_SFX_NEWDOCDIRECT); - rReq.GetArgs(); // -Wall required?? - String aFactory; - rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - SFX_REQUEST_ARG( rReq, pFactoryName, SfxStringItem, SID_NEWDOCDIRECT, FALSE ); - if( pFactoryName ) - aFactory = pFactoryName->GetValue(); - else - aFactory = SvtModuleOptions().GetDefaultModuleName(); - - SFX_REQUEST_ARG( rReq, pFileFlagsItem, SfxStringItem, SID_OPTIONS, FALSE); - if ( pFileFlagsItem ) - { - // Werte auf einzelne Items verteilen - String aFileFlags = pFileFlagsItem->GetValue(); - aFileFlags.ToUpperAscii(); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0054 ) ) // T = 54h - rReq.AppendItem( SfxBoolItem( SID_TEMPLATE, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0048 ) ) // H = 48h - rReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0052 ) ) // R = 52h - rReq.AppendItem( SfxBoolItem( SID_DOC_READONLY, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0042 ) ) // B = 42h - rReq.AppendItem( SfxBoolItem( SID_PREVIEW, TRUE ) ); - if ( STRING_NOTFOUND != aFileFlags.Search( 0x0053 ) ) // S = 53h - rReq.AppendItem( SfxBoolItem( SID_SILENT, TRUE ) ); - } - - xDoc = NewDoc_Impl( aFactory, rReq.GetArgs() ); - if ( xDoc.Is() ) - { - SFX_REQUEST_ARG(rReq, pReadonly, SfxBoolItem, SID_DOC_READONLY, FALSE); - if ( pReadonly ) - xDoc->GetMedium()->GetItemSet()->Put( *pReadonly ); - - SFX_REQUEST_ARG(rReq, pPreview, SfxBoolItem, SID_PREVIEW, FALSE); - if ( pPreview ) - xDoc->GetMedium()->GetItemSet()->Put( *pPreview ); - - SFX_REQUEST_ARG(rReq, pSilent, SfxBoolItem, SID_SILENT, FALSE); - if ( pSilent ) - xDoc->GetMedium()->GetItemSet()->Put( *pSilent ); - - SFX_REQUEST_ARG(rReq, pFlags, SfxStringItem, SID_OPTIONS, FALSE); - if ( pFlags ) - xDoc->GetMedium()->GetItemSet()->Put( *pFlags ); - } - - // View erzeugen - if ( xDoc.Is() ) - { - SFX_REQUEST_ARG(rReq, pHidden, SfxBoolItem, SID_HIDDEN, FALSE); - BOOL bHidden = FALSE; - if ( pHidden ) - { - xDoc->GetMedium()->GetItemSet()->Put( *pHidden, SID_HIDDEN ); - bHidden = pHidden->GetValue(); - } - - SFX_REQUEST_ARG(rReq, pViewId, SfxUInt16Item, SID_VIEW_ID, FALSE); - USHORT nViewId = 0; - if ( pViewId ) - { - xDoc->GetMedium()->GetItemSet()->Put( *pViewId, SID_VIEW_ID ); - nViewId = pViewId->GetValue(); - } - - xDoc->SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); -// xDoc->Get_Impl()->nLoadedFlags = SFX_LOADED_ALL; - const SfxItemSet* pInternalArgs = rReq.GetInternalArgs_Impl(); - if( pInternalArgs ) - xDoc->GetMedium()->GetItemSet()->Put( *pInternalArgs ); - SFX_REQUEST_ARG(rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE); - - SfxFrame* pFrame = NULL; - if (pFrameItem) - pFrame = pFrameItem->GetFrame(); - else - pFrame = (SfxFrame*)SfxTopFrame::Create(xDoc, nViewId, bHidden, pInternalArgs); - if ( pFrame ) - { - if ( pFrame->GetCurrentDocument() == xDoc || pFrame->PrepareClose_Impl( TRUE, TRUE ) == TRUE ) - { - if ( bHidden ) - { - xDoc->RestoreNoDelete(); - xDoc->OwnerLock( TRUE ); - xDoc->Get_Impl()->bHiddenLockedByAPI = TRUE; - } - - if ( pFrame->GetCurrentDocument() != xDoc ) - { - if ( pFrame->InsertDocument( xDoc ) ) - rReq.SetReturnValue( SfxFrameItem( 0, pFrame ) ); - else - xDoc->DoClose(); - } - } - else - xDoc.Clear(); - } - } - - return rReq.GetReturnValue(); - -//(mba)/task -/* - if ( !pHidden || !pHidden->GetValue() ) - Application::GetAppWindow()->LeaveWait(); - */ -} - //-------------------------------------------------------------------- void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) @@ -1306,12 +1117,22 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) return; } - SFX_REQUEST_ARG(rReq, pFrmItem, SfxFrameItem, SID_DOCFRAME, FALSE); - SfxFrame *pFrame = NULL; - if ( pFrmItem ) - pFrame = pFrmItem->GetFrame(); - else if ( SfxViewFrame::Current() ) - pFrame = SfxViewFrame::Current()->GetFrame(); + SfxFrame* pTargetFrame = NULL; + Reference< XFrame > xTargetFrame; + + SFX_REQUEST_ARG(rReq, pFrameItem, SfxFrameItem, SID_DOCFRAME, FALSE); + if ( pFrameItem ) + pTargetFrame = pFrameItem->GetFrame(); + + if ( !pTargetFrame ) + { + SFX_REQUEST_ARG(rReq, pUnoFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE); + if ( pUnoFrameItem ) + xTargetFrame = pUnoFrameItem->GetFrame(); + } + + if ( !pTargetFrame && !xTargetFrame.is() && SfxViewFrame::Current() ) + pTargetFrame = &SfxViewFrame::Current()->GetFrame(); // check if caller has set a callback SFX_REQUEST_ARG(rReq, pLinkItem, SfxLinkItem, SID_DONELINK, FALSE ); @@ -1322,21 +1143,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) rReq.RemoveItem( SID_DONELINK ); - // check if caller wants to create a view - BOOL bCreateView = TRUE; - SFX_REQUEST_ARG( rReq, pCreateViewItem, SfxBoolItem, SID_VIEW, FALSE ); - if ( pCreateViewItem ) - { - if ( !pCreateViewItem->GetValue() ) - bCreateView = FALSE; - // this is an "SFX only" parameter - rReq.RemoveItem( SID_VIEW ); - } - - // we can't load without a view - switch to hidden view - if ( !bCreateView ) - rReq.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); - // check if the view must be hidden BOOL bHidden = FALSE; SFX_REQUEST_ARG(rReq, pHidItem, SfxBoolItem, SID_HIDDEN, FALSE); @@ -1388,18 +1194,24 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // { // if a frame is given, it must be used for the starting point of the targetting mechanism // this code is also used if asynchronous loading is possible, because loadComponent always is synchron - Reference < XFrame > xFrame; - if ( pFrame ) - xFrame = pFrame->GetFrameInterface(); - else - xFrame = Reference < XFrame >( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + if ( !xTargetFrame.is() ) + { + if ( pTargetFrame ) + { + xTargetFrame = pTargetFrame->GetFrameInterface(); + } + else + { + xTargetFrame.set( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop")), UNO_QUERY ); + } + } // make URL ready SFX_REQUEST_ARG( rReq, pURLItem, SfxStringItem, SID_FILE_NAME, FALSE ); aFileName = pURLItem->GetValue(); if( aFileName.Len() && aFileName.GetChar(0) == '#' ) // Mark without URL { - SfxViewFrame *pView = pFrame ? pFrame->GetCurrentViewFrame() : 0; + SfxViewFrame *pView = pTargetFrame ? pTargetFrame->GetCurrentViewFrame() : 0; if ( !pView ) pView = SfxViewFrame::Current(); pView->GetViewShell()->JumpToMark( aFileName.Copy(1) ); @@ -1417,13 +1229,13 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) // if loading must be done synchron, we must wait for completion to get a return value // find frame by myself; I must konw the exact frame to get the controller for the return value from it //if( aTarget.getLength() ) - // xFrame = xFrame->findFrame( aTarget, FrameSearchFlag::ALL ); + // xTargetFrame = xTargetFrame->findFrame( aTarget, FrameSearchFlag::ALL ); Reference < XComponent > xComp; try { - xComp = ::comphelper::SynchronousDispatch::dispatch( xFrame, aFileName, aTarget, 0, aArgs ); -// Reference < XComponentLoader > xLoader( xFrame, UNO_QUERY ); + xComp = ::comphelper::SynchronousDispatch::dispatch( xTargetFrame, aFileName, aTarget, 0, aArgs ); +// Reference < XComponentLoader > xLoader( xTargetFrame, UNO_QUERY ); // xComp = xLoader->loadComponentFromURL( aFileName, aTarget, 0, aArgs ); } catch(const RuntimeException&) @@ -1448,7 +1260,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); xTrans->parseStrict( aURL ); - Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); + Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY ); Reference < XDispatch > xDisp = xProv.is() ? xProv->queryDispatch( aURL, aTarget, FrameSearchFlag::ALL ) : Reference < XDispatch >();; RTL_LOGFILE_PRODUCT_CONTEXT( aLog2, "PERFORMANCE - SfxApplication::OpenDocExec_Impl" ); if ( xDisp.is() ) @@ -1494,7 +1306,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { if ( pShell->GetController() == xController ) { - pCntrFrame = pShell->GetViewFrame()->GetFrame(); + pCntrFrame = &pShell->GetViewFrame()->GetFrame(); break; } } @@ -1504,12 +1316,9 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) SfxObjectShell* pSh = pCntrFrame->GetCurrentDocument(); DBG_ASSERT( pSh, "Controller without ObjectShell ?!" ); - if ( bCreateView ) - rReq.SetReturnValue( SfxViewFrameItem( 0, pCntrFrame->GetCurrentViewFrame() ) ); - else - rReq.SetReturnValue( SfxObjectItem( 0, pSh ) ); + rReq.SetReturnValue( SfxViewFrameItem( 0, pCntrFrame->GetCurrentViewFrame() ) ); - if( ( bHidden || !bCreateView ) ) + if ( bHidden ) pSh->RestoreNoDelete(); } } diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx index 36f4913ff8e3..9b88feb5d8ab 100644 --- a/sfx2/source/appl/appquit.cxx +++ b/sfx2/source/appl/appquit.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appquit.cxx,v $ - * $Revision: 1.45 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -119,9 +116,6 @@ BOOL SfxApplication::QueryExit_Impl() } } */ - // alles canceln was zu canceln ist - GetCancelManager()->Cancel(TRUE); - /* SfxObjectShell *pLastDocSh = SfxObjectShell::GetFirst(); if ( bQuit ) diff --git a/sfx2/source/appl/appreg.cxx b/sfx2/source/appl/appreg.cxx index 9e688f885e3c..6af0ad9feff2 100644 --- a/sfx2/source/appl/appreg.cxx +++ b/sfx2/source/appl/appreg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appreg.cxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -39,14 +36,14 @@ #include <sfx2/app.hxx> #include "appdata.hxx" #include "arrdecl.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/templdlg.hxx> #include "objmnctl.hxx" #include "inettbc.hxx" -#include "stbitem.hxx" +#include "sfx2/stbitem.hxx" #include <sfx2/navigat.hxx> #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "partwnd.hxx" #include <sfx2/sfxsids.hrc> #include "recfloat.hxx" @@ -62,7 +59,6 @@ void SfxApplication::Registrations_Impl() SfxApplication::RegisterInterface(); SfxModule::RegisterInterface(); SfxViewFrame::RegisterInterface(); - SfxTopViewFrame::RegisterInterface(); SfxObjectShell::RegisterInterface(); SfxViewShell::RegisterInterface(); @@ -76,7 +72,6 @@ void SfxApplication::Registrations_Impl() // Controller SfxToolBoxControl::RegisterControl(SID_REPEAT); SfxURLToolBoxControl_Impl::RegisterControl(SID_OPENURL); - SfxCancelToolBoxControl_Impl::RegisterControl(SID_BROWSE_STOP); SfxAppToolBoxControl_Impl::RegisterControl( SID_NEWDOCDIRECT ); SfxAppToolBoxControl_Impl::RegisterControl( SID_AUTOPILOTMENU ); }; diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index bbf567c0b852..6f90aa848ba9 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appserv.cxx,v $ - * $Revision: 1.78 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -71,7 +68,6 @@ #include <tools/config.hxx> #include <tools/diagnose_ex.h> #include <vcl/msgbox.hxx> -#include <svl/cancel.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -96,9 +92,11 @@ #include <cppuhelper/exc_hlp.hxx> #include <com/sun/star/script/provider/XScriptProviderFactory.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include "about.hxx" +#include "frmload.hxx" #include "referers.hxx" #include <sfx2/app.hxx> #include <sfx2/request.hxx> @@ -132,13 +130,13 @@ #include "sfx2/minfitem.hxx" #include <sfx2/event.hxx> #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "sfxpicklist.hxx" #include "imestatuswindow.hxx" #include <sfx2/sfxdlg.hxx> #include <sfx2/dialogs.hrc> #include "sorgitm.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::beans; @@ -265,9 +263,9 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) Reference< XFrame > xFrame; const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); - SFX_ITEMSET_ARG( pIntSet, pFrame, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); - if (pFrame) - pFrame->GetValue() >>= xFrame; + SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + if ( pFrameItem ) + xFrame = pFrameItem->GetFrame(); SfxAbstractTabDialog* pDlg = pFact->CreateTabDialog( RID_SVXDLG_CUSTOMIZE, @@ -551,8 +549,10 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) case SID_CRASH : { - GetpApp()->Exception( EXC_SYSTEM ); - abort(); + // Provoke a crash: + char * crash = 0; + *crash = 0; + break; } case SID_SHOW_IME_STATUS_WINDOW: @@ -823,6 +823,60 @@ namespace } return _pFallback; } + + const ::rtl::OUString& lcl_getBasicIDEServiceName() + { + static const ::rtl::OUString s_sBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); + return s_sBasicName; + } + + SfxViewFrame* lcl_getBasicIDEViewFrame( SfxObjectShell* i_pBasicIDE ) + { + SfxViewFrame* pView = SfxViewFrame::GetFirst( i_pBasicIDE ); + while ( pView ) + { + if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == lcl_getBasicIDEServiceName() ) + break; + pView = SfxViewFrame::GetNext( *pView, i_pBasicIDE ); + } + return pView; + } + Reference< XFrame > lcl_findStartModuleFrame( const ::comphelper::ComponentContext& i_rContext ) + { + try + { + Reference < XFramesSupplier > xSupplier( i_rContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XIndexAccess > xContainer( xSupplier->getFrames(), UNO_QUERY_THROW ); + + Reference< XModuleManager > xCheck( i_rContext.createComponent( "com.sun.star.frame.ModuleManager" ), UNO_QUERY_THROW ); + + sal_Int32 nCount = xContainer->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) + { + try + { + Reference < XFrame > xFrame( xContainer->getByIndex(i), UNO_QUERY_THROW ); + ::rtl::OUString sModule = xCheck->identify( xFrame ); + if ( sModule.equalsAscii( "com.sun.star.frame.StartModule" ) ) + return xFrame; + } + catch( const UnknownModuleException& ) + { + // silence + } + catch(const Exception&) + { + // re-throw, caught below + throw; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; + } } void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) @@ -840,7 +894,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) const SfxPoolItem* pItem = NULL; Reference < XFrame > xFrame; if ( pArgs && pArgs->GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) - ( (SfxUnoAnyItem*)pItem )->GetValue() >>= xFrame; + { + OSL_ENSURE( pItem->ISA( SfxUnoFrameItem ), "SfxApplication::OfaExec_Impl: XFrames are to be transported via SfxUnoFrameItem by now!" ); + xFrame = static_cast< const SfxUnoFrameItem*>( pItem )->GetFrame(); + } SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) { @@ -903,26 +960,46 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) case SID_BASICIDE_APPEAR: { - SfxViewFrame* pView = SfxViewFrame::GetFirst(); - ::rtl::OUString aBasicName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ) ); - while ( pView ) - { - if ( pView->GetObjectShell()->GetFactory().GetDocumentServiceName() == aBasicName ) - break; - pView = SfxViewFrame::GetNext( *pView ); - } - + SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL ); if ( !pView ) { - SfxObjectShell* pDocShell = SfxObjectShell::CreateObject( aBasicName ); - pDocShell->DoInitNew( 0 ); - pDocShell->SetModified( FALSE ); - pView = SfxViewFrame::CreateViewFrame( *pDocShell, 0 ); - pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); + SfxObjectShell* pBasicIDE = SfxObjectShell::CreateObject( lcl_getBasicIDEServiceName() ); + pBasicIDE->DoInitNew( 0 ); + pBasicIDE->SetModified( FALSE ); + try + { + // load the Basic IDE via direct access to the SFX frame loader. A generic loadComponentFromURL + // (which could be done via SfxViewFrame::LoadDocumentIntoFrame) is not feasible here, since the Basic IDE + // does not really play nice with the framework's concept. For instance, it is a "singleton document", + // which conflicts, at the latest, with the framework's concept of loading into _blank frames. + // So, since we know that our frame loader can handle it, we skip the generic framework loader + // mechanism, and the type detection (which doesn't know about the Basic IDE). + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference< XSynchronousFrameLoader > xLoader( aContext.createComponent( + SfxFrameLoader_Impl::impl_getStaticImplementationName() ), UNO_QUERY_THROW ); + ::comphelper::NamedValueCollection aLoadArgs; + aLoadArgs.put( "Model", pBasicIDE->GetModel() ); + aLoadArgs.put( "URL", ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/sbasic" ) ) ); + + Reference< XFrame > xTargetFrame( lcl_findStartModuleFrame( aContext ) ); + if ( !xTargetFrame.is() ) + xTargetFrame = SfxFrame::CreateBlankFrame(); + ENSURE_OR_THROW( xTargetFrame.is(), "could not obtain a frameto load the Basic IDE into!" ); + + xLoader->load( aLoadArgs.getPropertyValues(), xTargetFrame ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + pView = lcl_getBasicIDEViewFrame( pBasicIDE ); + if ( pView ) + pView->SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC:1" ) ) ); } if ( pView ) - pView->GetFrame()->Appear(); + pView->GetFrame().Appear(); const SfxItemSet* pArgs = rReq.GetArgs(); if ( pArgs && pView ) @@ -989,16 +1066,15 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) Reference< XFrame > xFrame; const SfxItemSet* pIntSet = rReq.GetInternalArgs_Impl(); - SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pIntSet, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); if ( pFrameItem ) - pFrameItem->GetValue() >>= xFrame; + xFrame = pFrameItem->GetFrame(); if ( !xFrame.is() ) { const SfxViewFrame* pViewFrame = SfxViewFrame::Current(); - const SfxFrame* pFrame = pViewFrame ? pViewFrame->GetFrame() : NULL; - if ( pFrame ) - xFrame = pFrame->GetFrameInterface(); + if ( pViewFrame ) + xFrame = pViewFrame->GetFrame().GetFrameInterface(); } do // artificial loop for flow control diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 1f6aa25d0e28..6498df6ca62a 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appuno.cxx,v $ - * $Revision: 1.131 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -144,54 +141,53 @@ using namespace ::com::sun::star::io; #define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" -static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); -static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); -static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); -static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); -static const String sViewId = String::CreateFromAscii( "ViewId" ); -static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); -static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); -static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); -static const String sFrameName = String::CreateFromAscii( "FrameName" ); -static const String sMediaType = String::CreateFromAscii( "MediaType" ); -static const String sPostData = String::CreateFromAscii( "PostData" ); -static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); -static const String sInputStream = String::CreateFromAscii( "InputStream" ); -static const String sStream = String::CreateFromAscii( "Stream" ); -static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); -static const String sHidden = String::CreateFromAscii( "Hidden" ); -static const String sPreview = String::CreateFromAscii( "Preview" ); -static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); -static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); -static const String sSilent = String::CreateFromAscii( "Silent" ); -static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); -static const String sFileName = String::CreateFromAscii( "FileName" ); -static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); -static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); -static const String sModel = String::CreateFromAscii( "Model" ); -static const String sFrame = String::CreateFromAscii( "Frame" ); -static const String sViewData = String::CreateFromAscii( "ViewData" ); -static const String sFilterData = String::CreateFromAscii( "FilterData" ); -static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); -static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); -static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); -static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); -static const String sMinimized = String::CreateFromAscii( "Minimized" ); -static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); -static const String sWindowState = String::CreateFromAscii( "WindowState" ); -static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); -static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); -static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); -static const String sComponentData = String::CreateFromAscii( "ComponentData" ); -static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); -static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); -static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); -static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); -static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); -static const String sFolderName = String::CreateFromAscii( "FolderName" ); -static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); -static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); -static const String sBlackList = String::CreateFromAscii( "BlackList" ); +static const String sTemplateRegionName = String::CreateFromAscii( "TemplateRegionName" ); +static const String sTemplateName = String::CreateFromAscii( "TemplateName" ); +static const String sAsTemplate = String::CreateFromAscii( "AsTemplate" ); +static const String sOpenNewView = String::CreateFromAscii( "OpenNewView" ); +static const String sViewId = String::CreateFromAscii( "ViewId" ); +static const String sPluginMode = String::CreateFromAscii( "PluginMode" ); +static const String sReadOnly = String::CreateFromAscii( "ReadOnly" ); +static const String sStartPresentation = String::CreateFromAscii( "StartPresentation" ); +static const String sFrameName = String::CreateFromAscii( "FrameName" ); +static const String sMediaType = String::CreateFromAscii( "MediaType" ); +static const String sPostData = String::CreateFromAscii( "PostData" ); +static const String sCharacterSet = String::CreateFromAscii( "CharacterSet" ); +static const String sInputStream = String::CreateFromAscii( "InputStream" ); +static const String sStream = String::CreateFromAscii( "Stream" ); +static const String sOutputStream = String::CreateFromAscii( "OutputStream" ); +static const String sHidden = String::CreateFromAscii( "Hidden" ); +static const String sPreview = String::CreateFromAscii( "Preview" ); +static const String sViewOnly = String::CreateFromAscii( "ViewOnly" ); +static const String sDontEdit = String::CreateFromAscii( "DontEdit" ); +static const String sSilent = String::CreateFromAscii( "Silent" ); +static const String sJumpMark = String::CreateFromAscii( "JumpMark" ); +static const String sFileName = String::CreateFromAscii( "FileName" ); +static const String sSalvageURL = String::CreateFromAscii( "SalvagedFile" ); +static const String sStatusInd = String::CreateFromAscii( "StatusIndicator" ); +static const String sModel = String::CreateFromAscii( "Model" ); +static const String sFrame = String::CreateFromAscii( "Frame" ); +static const String sViewData = String::CreateFromAscii( "ViewData" ); +static const String sFilterData = String::CreateFromAscii( "FilterData" ); +static const String sSelectionOnly = String::CreateFromAscii( "SelectionOnly" ); +static const String sFilterFlags = String::CreateFromAscii( "FilterFlags" ); +static const String sMacroExecMode = String::CreateFromAscii( "MacroExecutionMode" ); +static const String sUpdateDocMode = String::CreateFromAscii( "UpdateDocMode" ); +static const String sMinimized = String::CreateFromAscii( "Minimized" ); +static const String sInteractionHdl = String::CreateFromAscii( "InteractionHandler" ); +static const String sUCBContent = String::CreateFromAscii( "UCBContent" ); +static const String sRepairPackage = String::CreateFromAscii( "RepairPackage" ); +static const String sDocumentTitle = String::CreateFromAscii( "DocumentTitle" ); +static const String sComponentData = String::CreateFromAscii( "ComponentData" ); +static const String sComponentContext = String::CreateFromAscii( "ComponentContext" ); +static const String sDocumentBaseURL = String::CreateFromAscii( "DocumentBaseURL" ); +static const String sHierarchicalDocumentName = String::CreateFromAscii( "HierarchicalDocumentName" ); +static const String sCopyStreamIfPossible = String::CreateFromAscii( "CopyStreamIfPossible" ); +static const String sNoAutoSave = String::CreateFromAscii( "NoAutoSave" ); +static const String sFolderName = String::CreateFromAscii( "FolderName" ); +static const String sUseSystemDialog = String::CreateFromAscii( "UseSystemDialog" ); +static const String sStandardDir = String::CreateFromAscii( "StandardDir" ); +static const String sBlackList = String::CreateFromAscii( "BlackList" ); void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -468,7 +464,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; String aName = rProp.Name; if ( aName == sFrame ) - rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); + { + Reference< XFrame > xFrame; + OSL_VERIFY( rProp.Value >>= xFrame ); + rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); + } else if ( aName == sHidden ) { @@ -560,11 +560,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque } else if ( aName == sFrame ) { - Reference< XFrame > xVal; - sal_Bool bOK = (rProp.Value >>= xVal); + Reference< XFrame > xFrame; + sal_Bool bOK = (rProp.Value >>= xFrame); DBG_ASSERT( bOK, "invalid type for Frame" ); if (bOK) - rSet.Put( SfxUnoAnyItem( SID_FILLFRAME, rProp.Value ) ); + rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); } else if ( aName == sAsTemplate ) { @@ -738,14 +738,6 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); } - else if ( aName == sWindowState ) - { - ::rtl::OUString sVal; - sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); - DBG_ASSERT( bOK, "invalid type or value for WindowState" ); - if (bOK) - rSet.Put( SfxStringItem( SID_WIN_POSSIZE, sVal ) ); - } else if ( aName == sTemplateName ) { ::rtl::OUString sVal; @@ -1015,10 +1007,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET ) nAdditional++; - if ( rSet.GetItemState( SID_WIN_POSSIZE ) == SFX_ITEM_SET ) - nAdditional++; - // if ( rSet.GetItemState( SID_VIEW_POS_SIZE ) == SFX_ITEM_SET ) - // nAdditional++; if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET ) nAdditional++; if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET ) @@ -1174,8 +1162,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta continue; if ( nId == SID_CONTENTTYPE ) continue; - if ( nId == SID_WIN_POSSIZE ) - continue; if ( nId == SID_TEMPLATE_NAME ) continue; if ( nId == SID_TEMPLATE_REGIONNAME ) @@ -1392,7 +1378,15 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sFrame; - pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); + if ( pItem->ISA( SfxUsrAnyItem ) ) + { + OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); + pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); + } + else if ( pItem->ISA( SfxUnoFrameItem ) ) + pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); + else + OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" ); } if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) { @@ -1497,11 +1491,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = sMediaType; pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } - if ( rSet.GetItemState( SID_WIN_POSSIZE, sal_False, &pItem ) == SFX_ITEM_SET ) - { - pValue[nActProp].Name = sWindowState; - pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); - } if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sTemplateName; @@ -1518,12 +1507,6 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } - SFX_ITEMSET_ARG( &rSet, pRectItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); - if ( pRectItem ) - { - DBG_ERROR("PosSizeItem not supported yet!"); - } - if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) { pValue[nActProp].Name = sCharacterSet; diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index 23a08e71356f..b8e8a92da1b8 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: childwin.cxx,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/dde.hrc b/sfx2/source/appl/dde.hrc index 8ea6d5618e6c..d3e178606809 100644 --- a/sfx2/source/appl/dde.hrc +++ b/sfx2/source/appl/dde.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dde.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/dde.src b/sfx2/source/appl/dde.src index e2f765e44d0c..22df8eff16ba 100644 --- a/sfx2/source/appl/dde.src +++ b/sfx2/source/appl/dde.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dde.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx new file mode 100644 index 000000000000..cb53305e4b01 --- /dev/null +++ b/sfx2/source/appl/fileobj.cxx @@ -0,0 +1,706 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include <vcl/wrkwin.hxx> +#include <vcl/msgbox.hxx> +#include <tools/urlobj.hxx> +#include <tools/stream.hxx> +#include <sot/formats.hxx> +#include <svtools/filter.hxx> +#include <sfx2/lnkbase.hxx> +#include <sfx2/app.hxx> +#include <sfx2/progress.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sot/exchange.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <sfx2/docfac.hxx> +#include <com/sun/star/document/XTypeDetection.hpp> +#include <comphelper/mediadescriptor.hxx> +#include <comphelper/processfactory.hxx> +#include <sfx2/linkmgr.hxx> +#include <sfx2/opengrf.hxx> +#include "sfx2/sfxresid.hxx" +#include "fileobj.hxx" +#include "app.hrc" + +namespace css = ::com::sun::star; + +#define FILETYPE_TEXT 1 +#define FILETYPE_GRF 2 +#define FILETYPE_OBJECT 3 + +struct Impl_DownLoadData +{ + Graphic aGrf; + Timer aTimer; + + Impl_DownLoadData( const Link& rLink ) + { + aTimer.SetTimeout( 100 ); + aTimer.SetTimeoutHdl( rLink ); + aGrf.SetDefaultType(); + } + ~Impl_DownLoadData() + { + aTimer.Stop(); + } +}; + +// -------------------------------------------------------------------------- + + +SvFileObject::SvFileObject() : + pDownLoadData( NULL ), pOldParent( NULL ), nType( FILETYPE_TEXT ) +{ + bLoadAgain = TRUE; + bSynchron = bLoadError = bWaitForData = bDataReady = bNativFormat = + bClearMedium = bStateChangeCalled = bInCallDownLoad = FALSE; +} + + +SvFileObject::~SvFileObject() +{ + if ( xMed.Is() ) + { + xMed->SetDataAvailableLink( Link() ); + xMed->SetDoneLink( Link() ); + xMed.Clear(); + } + delete pDownLoadData; +} + + +BOOL SvFileObject::GetData( ::com::sun::star::uno::Any & rData, + const String & rMimeType, + BOOL bGetSynchron ) +{ + ULONG nFmt = SotExchange::GetFormatStringId( rMimeType ); + switch( nType ) + { + case FILETYPE_TEXT: + if( FORMAT_FILE == nFmt ) + { + // das Medium muss in der Applikation geoffnet werden, um die + // relativen Datei Links aufzuloesen!!!! Wird ueber den + // LinkManager und damit von dessen Storage erledigt. + rData <<= rtl::OUString( sFileNm ); + } + break; + + case FILETYPE_GRF: + if( !bLoadError ) + { + SfxMediumRef xTmpMed; + + if( FORMAT_GDIMETAFILE == nFmt || FORMAT_BITMAP == nFmt || + SOT_FORMATSTR_ID_SVXB == nFmt ) + { + Graphic aGrf; + + //JP 15.07.98: Bug 52959 + // falls das Nativformat doch erwuenscht ist, muss am + // Ende das Flag zurueckgesetzt werden. +// wird einzig und allein im sw/ndgrf.cxx benutzt, wenn der Link vom +// GraphicNode entfernt wird. + BOOL bOldNativFormat = bNativFormat; +//!!?? bNativFormat = 0 != (ASPECT_ICON & pSvData->GetAspect()); + + // falls gedruckt werden soll, warten wir bis die + // Daten vorhanden sind + if( bGetSynchron ) + { + // testhalber mal ein LoadFile rufen um das nach- + // laden ueberahaupt anzustossen + if( !xMed.Is() ) + LoadFile_Impl(); + + if( !bInCallDownLoad ) + { + xTmpMed = xMed; + while( bWaitForData ) + Application::Reschedule(); + + xMed = xTmpMed; + bClearMedium = TRUE; + } + } + + if( pDownLoadData || + ( !bWaitForData && ( xMed.Is() || // wurde als URL geladen + ( bSynchron && LoadFile_Impl() && xMed.Is() ) )) ) + { + // falls + + // falls es uebers Internet gesogen wurde, nicht + // wieder versuchen + if( !bGetSynchron ) + bLoadAgain = !xMed->IsRemote(); + bLoadError = !GetGraphic_Impl( aGrf, xMed->GetInStream() ); + } + else if( !LoadFile_Impl() || + !GetGraphic_Impl( aGrf, xMed.Is() ? xMed->GetInStream() : 0 )) + { + if( !xMed.Is() ) + break; + aGrf.SetDefaultType(); + } + + if( SOT_FORMATSTR_ID_SVXB != nFmt ) + nFmt = (bLoadError || GRAPHIC_BITMAP == aGrf.GetType()) + ? FORMAT_BITMAP + : FORMAT_GDIMETAFILE; + + SvMemoryStream aMemStm( 0, 65535 ); + switch ( nFmt ) + { + case SOT_FORMATSTR_ID_SVXB: + if( GRAPHIC_NONE != aGrf.GetType() ) + { + aMemStm.SetVersion( SOFFICE_FILEFORMAT_50 ); + aMemStm << aGrf; + } + break; + + case FORMAT_BITMAP: + if( !aGrf.GetBitmap().IsEmpty()) + aMemStm << aGrf.GetBitmap(); + break; + + default: + if( aGrf.GetGDIMetaFile().GetActionCount() ) + { + GDIMetaFile aMeta( aGrf.GetGDIMetaFile() ); + aMeta.Write( aMemStm ); + } + } + rData <<= css::uno::Sequence< sal_Int8 >( (sal_Int8*) aMemStm.GetData(), + aMemStm.Seek( STREAM_SEEK_TO_END ) ); + + bNativFormat = bOldNativFormat; + + // alles fertig? + if( xMed.Is() && !bSynchron && bClearMedium ) + { + xMed.Clear(); + bClearMedium = FALSE; + } + } + } + break; + case FILETYPE_OBJECT: + // TODO/LATER: possibility to insert a new object + rData <<= rtl::OUString( sFileNm ); + break; + } + return sal_True/*0 != aTypeList.Count()*/; +} + + + + +BOOL SvFileObject::Connect( sfx2::SvBaseLink* pLink ) +{ + if( !pLink || !pLink->GetLinkManager() ) + return FALSE; + + // teste doch mal, ob nicht ein anderer Link mit der gleichen + // Verbindung schon existiert + pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sFileNm, 0, &sFilter ); + + if( OBJECT_CLIENT_GRF == pLink->GetObjType() ) + { + SfxObjectShellRef pShell = pLink->GetLinkManager()->GetPersist(); + if( pShell.Is() ) + { + if( pShell->IsAbortingImport() ) + return FALSE; + + if( pShell->GetMedium() ) + sReferer = pShell->GetMedium()->GetName(); + } + } + + switch( pLink->GetObjType() ) + { + case OBJECT_CLIENT_GRF: + nType = FILETYPE_GRF; + bSynchron = pLink->IsSynchron(); + break; + + case OBJECT_CLIENT_FILE: + nType = FILETYPE_TEXT; + break; + + case OBJECT_CLIENT_OLE: + nType = FILETYPE_OBJECT; + // TODO/LATER: introduce own type to be used for exchanging + break; + + default: + return FALSE; + } + + SetUpdateTimeout( 0 ); + + // und jetzt bei diesem oder gefundenem Pseudo-Object anmelden + AddDataAdvise( pLink, SotExchange::GetFormatMimeType( pLink->GetContentType()), 0 ); + return TRUE; +} + + +BOOL SvFileObject::LoadFile_Impl() +{ + // wir sind noch im Laden!! + if( bWaitForData || !bLoadAgain || xMed.Is() || pDownLoadData ) + return FALSE; + + // z.Z. nur auf die aktuelle DocShell + xMed = new SfxMedium( sFileNm, STREAM_STD_READ, TRUE ); + SvLinkSource::StreamToLoadFrom aStreamToLoadFrom = + getStreamToLoadFrom(); + xMed->setStreamToLoadFrom( + aStreamToLoadFrom.m_xInputStreamToLoadFrom, + aStreamToLoadFrom.m_bIsReadOnly); + // setStreamToLoadFrom(0,0); + if( sReferer.Len() ) + xMed->SetReferer( sReferer ); + + if( !bSynchron ) + { + bLoadAgain = bDataReady = bInNewData = FALSE; + bWaitForData = TRUE; + + SfxMediumRef xTmpMed = xMed; + xMed->SetDataAvailableLink( STATIC_LINK( this, SvFileObject, LoadGrfNewData_Impl ) ); + bInCallDownLoad = TRUE; + xMed->DownLoad( STATIC_LINK( this, SvFileObject, LoadGrfReady_Impl ) ); + bInCallDownLoad = FALSE; + + bClearMedium = !xMed.Is(); + if( bClearMedium ) + xMed = xTmpMed; // falls gleich im DownLoad schon schluss ist + return bDataReady; + } + + bWaitForData = TRUE; + bDataReady = bInNewData = FALSE; + xMed->DownLoad(); + bLoadAgain = !xMed->IsRemote(); + bWaitForData = FALSE; + + // Grafik ist fertig, also DataChanged von der Statusaederung schicken: + SendStateChg_Impl( xMed->GetInStream() && xMed->GetInStream()->GetError() + ? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK ); + return TRUE; +} + + +BOOL SvFileObject::GetGraphic_Impl( Graphic& rGrf, SvStream* pStream ) +{ + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + + const USHORT nFilter = sFilter.Len() && pGF->GetImportFormatCount() + ? pGF->GetImportFormatNumber( sFilter ) + : GRFILTER_FORMAT_DONTKNOW; + + String aEmptyStr; + int nRes; + + // vermeiden, dass ein native Link angelegt wird + if( ( !pStream || !pDownLoadData ) && !rGrf.IsLink() && + !rGrf.GetContext() && !bNativFormat ) + rGrf.SetLink( GfxLink() ); + + if( !pStream ) + nRes = xMed.Is() ? GRFILTER_OPENERROR + : pGF->ImportGraphic( rGrf, INetURLObject(sFileNm), + nFilter ); + else if( !pDownLoadData ) + { + pStream->Seek( STREAM_SEEK_TO_BEGIN ); + nRes = pGF->ImportGraphic( rGrf, aEmptyStr, *pStream, nFilter ); + } + else + { + nRes = pGF->ImportGraphic( pDownLoadData->aGrf, aEmptyStr, + *pStream, nFilter ); + + if( pDownLoadData ) + { + rGrf = pDownLoadData->aGrf; + if( GRAPHIC_NONE == rGrf.GetType() ) + rGrf.SetDefaultType(); + + + if( !pDownLoadData->aGrf.GetContext() ) + { + xMed->SetDataAvailableLink( Link() ); +// xMed->SetDoneLink( Link() ); + delete pDownLoadData, pDownLoadData = 0; + bDataReady = TRUE; + bWaitForData = FALSE; + } + else if( FALSE ) + { + // Timer aufsetzen, um zurueck zukehren + pDownLoadData->aTimer.Start(); + } + } + } + + if( pStream && ERRCODE_IO_PENDING == pStream->GetError() ) + pStream->ResetError(); + +#ifdef DBG_UTIL + if( nRes ) + { + if( xMed.Is() && !pStream ) + { + DBG_WARNING3( "GrafikFehler [%d] - [%s] URL[%s]", + nRes, + xMed->GetPhysicalName().GetBuffer(), + sFileNm.GetBuffer() ); + } + else + { + DBG_WARNING2( "GrafikFehler [%d] - [%s]", + nRes, sFileNm.GetBuffer() ); + } + } +#endif + + return GRFILTER_OK == nRes; +} + +/** detect the filter of the given file + + @param _rURL + specifies the URL of the file which filter is to detected.<br/> + If the URL doesn't denote a valid (existent and accessible) file, the + request is silently dropped. +*/ +String impl_getFilter( const String& _rURL ) +{ + String sFilter; + if ( _rURL.Len() == 0 ) + return sFilter; + + try + { + css::uno::Reference< ::com::sun::star::document::XTypeDetection > xTypeDetection( + ::comphelper::getProcessServiceFactory()->createInstance( + ::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection") ), + css::uno::UNO_QUERY ); + if ( xTypeDetection.is() ) + { + ::comphelper::MediaDescriptor aDescr; + aDescr[ ::comphelper::MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( _rURL ); + css::uno::Sequence< css::beans::PropertyValue > aDescrList = + aDescr.getAsConstPropertyValueList(); + ::rtl::OUString sType = xTypeDetection->queryTypeByDescriptor( aDescrList, sal_True ); + if ( sType.getLength() ) + { + css::uno::Reference< css::container::XNameAccess > xTypeCont( xTypeDetection, + css::uno::UNO_QUERY ); + if ( xTypeCont.is() ) + { + ::comphelper::SequenceAsHashMap lTypeProps( xTypeCont->getByName( sType ) ); + sFilter = lTypeProps.getUnpackedValueOrDefault( + ::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString() ); + } + } + } + } + catch( const css::uno::Exception& ) + { + } + + return sFilter; +} + +void SvFileObject::Edit( Window* pParent, sfx2::SvBaseLink* pLink, const Link& rEndEditHdl ) +{ + aEndEditLink = rEndEditHdl; + String sFile, sRange, sTmpFilter; + if( pLink && pLink->GetLinkManager() ) + { + pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sFile, &sRange, &sTmpFilter ); + + switch( pLink->GetObjType() ) + { + case OBJECT_CLIENT_GRF: + { + nType = FILETYPE_GRF; // falls noch nicht gesetzt + + SvxOpenGraphicDialog aDlg(SfxResId(RID_SVXSTR_EDITGRFLINK)); + aDlg.EnableLink(sal_False); + aDlg.SetPath( sFile, sal_True ); + aDlg.SetCurrentFilter( sTmpFilter ); + + if( !aDlg.Execute() ) + { + sFile = aDlg.GetPath(); + sFile += ::sfx2::cTokenSeperator; + sFile += ::sfx2::cTokenSeperator; + sFile += aDlg.GetCurrentFilter(); + + if ( aEndEditLink.IsSet() ) + aEndEditLink.Call( &sFile ); + } + else + sFile.Erase(); + } + break; + + case OBJECT_CLIENT_OLE: + { + nType = FILETYPE_OBJECT; // if not set already + pOldParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( pParent ); + + ::sfx2::FileDialogHelper* pFileDlg = + pLink->GetFileDialog( (SFXWB_INSERT | WB_3DLOOK), String() ); + pFileDlg->StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) ); + } + break; + + case OBJECT_CLIENT_FILE: + { + nType = FILETYPE_TEXT; // if not set already + pOldParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( pParent ); + + String sFactory; + SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); + if ( pShell ) + sFactory = pShell->GetFactory().GetFactoryName(); + + ::sfx2::FileDialogHelper* pFileDlg = + pLink->GetFileDialog( (SFXWB_INSERT | WB_3DLOOK), sFactory ); + pFileDlg->StartExecuteModal( LINK( this, SvFileObject, DialogClosedHdl ) ); + } + break; + + default: + sFile.Erase(); + } + } +} + +IMPL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void*, EMPTYARG ) +{ + // wenn wir von hier kommen, kann es kein Fehler mehr sein + pThis->bLoadError = FALSE; + pThis->bWaitForData = FALSE; + pThis->bInCallDownLoad = FALSE; + + if( !pThis->bInNewData && !pThis->bDataReady ) + { + // Grafik ist fertig, also DataChanged von der Status- + // aederung schicken: + pThis->bDataReady = TRUE; + pThis->SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_OK ); + + // und dann nochmal die Daten senden + pThis->NotifyDataChanged(); + } + + if( pThis->bDataReady ) + { + pThis->bLoadAgain = TRUE; + if( pThis->xMed.Is() ) + { + pThis->xMed->SetDataAvailableLink( Link() ); + pThis->xMed->SetDoneLink( Link() ); + + Application::PostUserEvent( + STATIC_LINK( pThis, SvFileObject, DelMedium_Impl ), + new SfxMediumRef( pThis->xMed )); + pThis->xMed.Clear(); + } + if( pThis->pDownLoadData ) + delete pThis->pDownLoadData, pThis->pDownLoadData = 0; + } + + return 0; +} + +IMPL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, pDelMed ) +{ + (void)pThis; + delete pDelMed; + return 0; +} + +IMPL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void*, EMPTYARG ) +{ + // wenn wir von hier kommen, kann es kein Fehler mehr sein + if( pThis->bInNewData ) + return 0; + + pThis->bInNewData = TRUE; + pThis->bLoadError = FALSE; + + if( !pThis->pDownLoadData ) + { + pThis->pDownLoadData = new Impl_DownLoadData( + STATIC_LINK( pThis, SvFileObject, LoadGrfNewData_Impl ) ); + + // Null-Link setzen, damit keine temporaeren Grafiken + // rausgeswapt werden; der Filter prueft, ob schon + // ein Link gesetzt ist => falls dies zutrifft, wird + // _kein_ neuer Link gesetzt; der Link muss hier gesetzt werden, + // (bevor das erste Mal gefiltert wird), um zu verhindern, + // dass der Kontext zurueckgesetzt wird (aynchrones Laden) + if( !pThis->bNativFormat ) + { + static GfxLink aDummyLink; + pThis->pDownLoadData->aGrf.SetLink( aDummyLink ); + } + } + + pThis->NotifyDataChanged(); + + SvStream* pStrm = pThis->xMed.Is() ? pThis->xMed->GetInStream() : 0; + if( pStrm && pStrm->GetError() ) + { + if( ERRCODE_IO_PENDING == pStrm->GetError() ) + pStrm->ResetError(); + + // im DataChanged ein DataReady? + else if( pThis->bWaitForData && pThis->pDownLoadData ) + { + pThis->bLoadError = TRUE; + } + } + + if( pThis->bDataReady ) + { + // Grafik ist fertig, also DataChanged von der Status- + // aederung schicken: + pThis->SendStateChg_Impl( pStrm->GetError() ? sfx2::LinkManager::STATE_LOAD_ERROR : sfx2::LinkManager::STATE_LOAD_OK ); + } + + pThis->bInNewData = FALSE; + return 0; +} + +IMPL_LINK( SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg ) +{ + String sFile; + Application::SetDefDialogParent( pOldParent ); + + if ( FILETYPE_TEXT == nType || FILETYPE_OBJECT == nType ) + { + if ( _pFileDlg && _pFileDlg->GetError() == ERRCODE_NONE ) + { + String sURL( _pFileDlg->GetPath() ); + sFile = sURL; + sFile += ::sfx2::cTokenSeperator; + sFile += ::sfx2::cTokenSeperator; + sFile += impl_getFilter( sURL ); + } + } + else + { + DBG_ERRORFILE( "SvFileObject::DialogClosedHdl(): wrong file type" ); + } + + if ( aEndEditLink.IsSet() ) + aEndEditLink.Call( &sFile ); + return 0; +} + +/* [Beschreibung] + + Die Methode stellt fest, ob aus einem DDE-Object die Daten gelesen + werden kann. + Zurueckgegeben wird: + ERRCODE_NONE wenn sie komplett gelesen wurde + ERRCODE_SO_PENDING wenn sie noch nicht komplett gelesen wurde + ERRCODE_SO_FALSE sonst +*/ +BOOL SvFileObject::IsPending() const +{ + return FILETYPE_GRF == nType && !bLoadError && + ( pDownLoadData || bWaitForData ); +} +BOOL SvFileObject::IsDataComplete() const +{ + BOOL bRet = FALSE; + if( FILETYPE_GRF != nType ) + bRet = TRUE; + else if( !bLoadError && ( !bWaitForData && !pDownLoadData )) + { + SvFileObject* pThis = (SvFileObject*)this; + if( bDataReady || + ( bSynchron && pThis->LoadFile_Impl() && xMed.Is() ) ) + bRet = TRUE; + else + { + INetURLObject aUrl( sFileNm ); + if( aUrl.HasError() || + INET_PROT_NOT_VALID == aUrl.GetProtocol() ) + bRet = TRUE; + } + } + return bRet; +} + + + +void SvFileObject::CancelTransfers() +{ + // und aus dem Cache austragen, wenn man mitten im Laden ist + if( !bDataReady ) + { + // nicht noch mal aufsetzen + bLoadAgain = FALSE; + bDataReady = bLoadError = bWaitForData = TRUE; + SendStateChg_Impl( sfx2::LinkManager::STATE_LOAD_ABORT ); + } +} + + +void SvFileObject::SendStateChg_Impl( sfx2::LinkManager::LinkState nState ) +{ + if( !bStateChangeCalled && HasDataLinks() ) + { + css::uno::Any aAny; + aAny <<= rtl::OUString::valueOf( (sal_Int32)nState ); + DataChanged( SotExchange::GetFormatName( + sfx2::LinkManager::RegisterStatusInfoId()), aAny ); + bStateChangeCalled = TRUE; + } +} + + diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx new file mode 100644 index 000000000000..50f934a75436 --- /dev/null +++ b/sfx2/source/appl/fileobj.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FILEOBJ_HXX +#define _FILEOBJ_HXX + +#include <tools/string.hxx> +#include <sfx2/linksrc.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/linkmgr.hxx> + +class Graphic; +struct Impl_DownLoadData; +namespace sfx2 { class FileDialogHelper; } + +class SvFileObject : public sfx2::SvLinkSource +{ + String sFileNm; + String sFilter; + String sReferer; + Link aEndEditLink; + SfxMediumRef xMed; + Impl_DownLoadData* pDownLoadData; + Window* pOldParent; + + BYTE nType; + + BOOL bLoadAgain : 1; + BOOL bSynchron : 1; + BOOL bLoadError : 1; + BOOL bWaitForData : 1; + BOOL bInNewData : 1; + BOOL bDataReady : 1; + BOOL bMedUseCache : 1; + BOOL bNativFormat : 1; + BOOL bClearMedium : 1; + BOOL bStateChangeCalled : 1; + BOOL bInCallDownLoad : 1; + + BOOL GetGraphic_Impl( Graphic&, SvStream* pStream = 0 ); + BOOL LoadFile_Impl(); + void SendStateChg_Impl( sfx2::LinkManager::LinkState nState ); + + DECL_STATIC_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef* ); + DECL_STATIC_LINK( SvFileObject, LoadGrfReady_Impl, void* ); + DECL_STATIC_LINK( SvFileObject, LoadGrfNewData_Impl, void* ); + DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper* ); + +protected: + virtual ~SvFileObject(); + +public: + SvFileObject(); + + virtual BOOL GetData( ::com::sun::star::uno::Any & rData /*out param*/, + const String & rMimeType, + BOOL bSynchron = FALSE ); + + virtual BOOL Connect( sfx2::SvBaseLink* ); + virtual void Edit( Window *, sfx2::SvBaseLink *, const Link& rEndEditHdl ); + + // erfrage ob das man direkt auf die Daten zugreifen kann oder ob das + // erst angestossen werden muss + virtual BOOL IsPending() const; + virtual BOOL IsDataComplete() const; + + void CancelTransfers(); +}; + + +#endif + diff --git a/sfx2/source/appl/fwkhelper.cxx b/sfx2/source/appl/fwkhelper.cxx index e053eb97a8ed..1909bcac2e17 100644 --- a/sfx2/source/appl/fwkhelper.cxx +++ b/sfx2/source/appl/fwkhelper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fwkhelper.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/helpdispatch.cxx b/sfx2/source/appl/helpdispatch.cxx index a11c7728a445..2e1128aea277 100644 --- a/sfx2/source/appl/helpdispatch.cxx +++ b/sfx2/source/appl/helpdispatch.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpdispatch.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/helpdispatch.hxx b/sfx2/source/appl/helpdispatch.hxx index 71321346a484..b9d1e7b17b63 100644 --- a/sfx2/source/appl/helpdispatch.hxx +++ b/sfx2/source/appl/helpdispatch.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpdispatch.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index c164fe2f7f80..2d997dcc26ff 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpinterceptor.cxx,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/helpinterceptor.hxx b/sfx2/source/appl/helpinterceptor.hxx index 2841318ceddb..3476f0d305b5 100644 --- a/sfx2/source/appl/helpinterceptor.hxx +++ b/sfx2/source/appl/helpinterceptor.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpinterceptor.hxx,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/imagemgr.cxx b/sfx2/source/appl/imagemgr.cxx index 8efebe016640..d9b678677dc6 100644 --- a/sfx2/source/appl/imagemgr.cxx +++ b/sfx2/source/appl/imagemgr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imagemgr.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx index ae5d84786bf2..3cdc3064fb81 100644 --- a/sfx2/source/appl/imestatuswindow.cxx +++ b/sfx2/source/appl/imestatuswindow.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imestatuswindow.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx index 2110771cf5ef..71c0b371f796 100644 --- a/sfx2/source/appl/imestatuswindow.hxx +++ b/sfx2/source/appl/imestatuswindow.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imestatuswindow.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx index e6bfaaf0d797..02763d0480dd 100644 --- a/sfx2/source/appl/impldde.cxx +++ b/sfx2/source/appl/impldde.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impldde.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/impldde.hxx b/sfx2/source/appl/impldde.hxx index 67b8f816e70d..b361df4468d3 100644 --- a/sfx2/source/appl/impldde.hxx +++ b/sfx2/source/appl/impldde.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impldde.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index b51d8a31c175..934b4051a638 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: linkmgr2.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,37 +28,54 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" - -#include <tools/debug.hxx> #include <sfx2/linkmgr.hxx> - +#include <com/sun/star/document/UpdateDocMode.hpp> +#include <sfx2/objsh.hxx> +#include <svl/urihelper.hxx> +#include <sot/formats.hxx> +#include <tools/urlobj.hxx> +#include <sot/exchange.hxx> +#include <tools/debug.hxx> #include <vcl/msgbox.hxx> #include <sfx2/lnkbase.hxx> -//#include <sfx2/linksrc.hxx> +#include <sfx2/app.hxx> +#include <vcl/graph.hxx> +#include <svl/stritem.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <unotools/localfilehelper.hxx> +#include <i18npool/mslangid.hxx> +#include <sfx2/request.hxx> + +#include "fileobj.hxx" #include "impldde.hxx" -//#include "svuidlg.hrc" -//#include "iface.hxx" - #include "app.hrc" #include "sfx2/sfxresid.hxx" #define _SVSTDARR_STRINGSDTOR - #include <svl/svstdarr.hxx> - namespace sfx2 { +class SvxInternalLink : public sfx2::SvLinkSource +{ +public: + SvxInternalLink() {} + + virtual BOOL Connect( sfx2::SvBaseLink* ); +}; + + SV_IMPL_PTRARR( SvBaseLinks, SvBaseLinkRefPtr ) -SvLinkManager::SvLinkManager() - : pPersist( 0 ) +LinkManager::LinkManager(SfxObjectShell* p) + : pPersist( p ) { } -SvLinkManager::~SvLinkManager() +LinkManager::~LinkManager() { SvBaseLinkRef** ppRef = (SvBaseLinkRef**)aLinkTbl.GetData(); for( USHORT n = aLinkTbl.Count(); n; --n, ++ppRef ) @@ -77,12 +91,12 @@ SvLinkManager::~SvLinkManager() /************************************************************************ -|* SvLinkManager::Remove() +|* LinkManager::Remove() |* |* Beschreibung *************************************************************************/ -void SvLinkManager::Remove( SvBaseLink *pLink ) +void LinkManager::Remove( SvBaseLink *pLink ) { // keine Links doppelt einfuegen int bFound = FALSE; @@ -110,7 +124,7 @@ void SvLinkManager::Remove( SvBaseLink *pLink ) } -void SvLinkManager::Remove( USHORT nPos, USHORT nCnt ) +void LinkManager::Remove( USHORT nPos, USHORT nCnt ) { if( nCnt && nPos < aLinkTbl.Count() ) { @@ -132,7 +146,7 @@ void SvLinkManager::Remove( USHORT nPos, USHORT nCnt ) } -BOOL SvLinkManager::Insert( SvBaseLink* pLink ) +BOOL LinkManager::Insert( SvBaseLink* pLink ) { // keine Links doppelt einfuegen for( USHORT n = 0; n < aLinkTbl.Count(); ++n ) @@ -152,7 +166,7 @@ BOOL SvLinkManager::Insert( SvBaseLink* pLink ) } -BOOL SvLinkManager::InsertLink( SvBaseLink * pLink, +BOOL LinkManager::InsertLink( SvBaseLink * pLink, USHORT nObjType, USHORT nUpdateMode, const String* pName ) @@ -166,7 +180,7 @@ BOOL SvLinkManager::InsertLink( SvBaseLink * pLink, } -BOOL SvLinkManager::InsertDDELink( SvBaseLink * pLink, +BOOL LinkManager::InsertDDELink( SvBaseLink * pLink, const String& rServer, const String& rTopic, const String& rItem ) @@ -183,7 +197,7 @@ BOOL SvLinkManager::InsertDDELink( SvBaseLink * pLink, } -BOOL SvLinkManager::InsertDDELink( SvBaseLink * pLink ) +BOOL LinkManager::InsertDDELink( SvBaseLink * pLink ) { DBG_ASSERT( OBJECT_CLIENT_SO & pLink->GetObjType(), "no OBJECT_CLIENT_SO" ); if( !( OBJECT_CLIENT_SO & pLink->GetObjType() ) ) @@ -197,34 +211,70 @@ BOOL SvLinkManager::InsertDDELink( SvBaseLink * pLink ) // erfrage die Strings fuer den Dialog -BOOL SvLinkManager::GetDisplayNames( const SvBaseLink * pLink, +BOOL LinkManager::GetDisplayNames( const SvBaseLink * pLink, String* pType, String* pFile, String* pLinkStr, - String* /*pFilter*/ ) const + String* pFilter ) const { BOOL bRet = FALSE; - String aLN = pLink->GetLinkSourceName(); - if( aLN.Len() != 0 && pLink->GetObjType() == OBJECT_CLIENT_DDE ) + const String sLNm( pLink->GetLinkSourceName() ); + if( sLNm.Len() ) { - USHORT nTmp = 0; - String sCmd( aLN ); - String sServer( sCmd.GetToken( 0, cTokenSeperator, nTmp ) ); - String sTopic( sCmd.GetToken( 0, cTokenSeperator, nTmp ) ); - - if( pType ) - *pType = sServer; - if( pFile ) - *pFile = sTopic; - if( pLinkStr ) - *pLinkStr = sCmd.Copy( nTmp ); - bRet = TRUE; + switch( pLink->GetObjType() ) + { + case OBJECT_CLIENT_FILE: + case OBJECT_CLIENT_GRF: + case OBJECT_CLIENT_OLE: + { + USHORT nPos = 0; + String sFile( sLNm.GetToken( 0, ::sfx2::cTokenSeperator, nPos ) ); + String sRange( sLNm.GetToken( 0, ::sfx2::cTokenSeperator, nPos ) ); + + if( pFile ) + *pFile = sFile; + if( pLinkStr ) + *pLinkStr = sRange; + if( pFilter ) + *pFilter = sLNm.Copy( nPos ); + + if( pType ) + { + sal_uInt16 nObjType = pLink->GetObjType(); + *pType = String( SfxResId( + ( OBJECT_CLIENT_FILE == nObjType || OBJECT_CLIENT_OLE == nObjType ) + ? RID_SVXSTR_FILELINK + : RID_SVXSTR_GRAFIKLINK )); + } + bRet = TRUE; + } + break; + case OBJECT_CLIENT_DDE: + { + USHORT nTmp = 0; + String sCmd( sLNm ); + String sServer( sCmd.GetToken( 0, cTokenSeperator, nTmp ) ); + String sTopic( sCmd.GetToken( 0, cTokenSeperator, nTmp ) ); + + if( pType ) + *pType = sServer; + if( pFile ) + *pFile = sTopic; + if( pLinkStr ) + *pLinkStr = sCmd.Copy( nTmp ); + bRet = TRUE; + } + break; + default: + break; + } } + return bRet; } -void SvLinkManager::UpdateAllLinks( +void LinkManager::UpdateAllLinks( BOOL bAskUpdate, BOOL /*bCallErrHdl*/, BOOL bUpdateGrfLinks, @@ -287,14 +337,24 @@ void SvLinkManager::UpdateAllLinks( |* Beschreibung *************************************************************************/ -SvLinkSourceRef SvLinkManager::CreateObj( SvBaseLink * pLink ) +SvLinkSourceRef LinkManager::CreateObj( SvBaseLink * pLink ) { - if( OBJECT_CLIENT_DDE == pLink->GetObjType() ) - return new SvDDEObject(); - return SvLinkSourceRef(); + switch( pLink->GetObjType() ) + { + case OBJECT_CLIENT_FILE: + case OBJECT_CLIENT_GRF: + case OBJECT_CLIENT_OLE: + return new SvFileObject; + case OBJECT_INTERN: + return new SvxInternalLink; + case OBJECT_CLIENT_DDE: + return new SvDDEObject; + default: + return SvLinkSourceRef(); + } } -BOOL SvLinkManager::InsertServer( SvLinkSource* pObj ) +BOOL LinkManager::InsertServer( SvLinkSource* pObj ) { // keine doppelt einfuegen if( !pObj || USHRT_MAX != aServerTbl.GetPos( pObj ) ) @@ -305,7 +365,7 @@ BOOL SvLinkManager::InsertServer( SvLinkSource* pObj ) } -void SvLinkManager::RemoveServer( SvLinkSource* pObj ) +void LinkManager::RemoveServer( SvLinkSource* pObj ) { USHORT nPos = aServerTbl.GetPos( pObj ); if( USHRT_MAX != nPos ) @@ -327,6 +387,249 @@ void MakeLnkName( String& rName, const String* pType, const String& rFile, ((rName += cTokenSeperator ) += *pFilter).EraseLeadingChars().EraseTrailingChars(); } +BOOL LinkManager::InsertFileLink( sfx2::SvBaseLink& rLink, + USHORT nFileType, + const String& rFileNm, + const String* pFilterNm, + const String* pRange ) +{ + if( !( OBJECT_CLIENT_SO & rLink.GetObjType() )) + return FALSE; + + String sCmd( rFileNm ); + sCmd += ::sfx2::cTokenSeperator; + if( pRange ) + sCmd += *pRange; + if( pFilterNm ) + ( sCmd += ::sfx2::cTokenSeperator ) += *pFilterNm; + + return InsertLink( &rLink, nFileType, sfx2::LINKUPDATE_ONCALL, &sCmd ); +} + +BOOL LinkManager::InsertFileLink( sfx2::SvBaseLink& rLink ) +{ + if( OBJECT_CLIENT_FILE == ( OBJECT_CLIENT_FILE & rLink.GetObjType() )) + return InsertLink( &rLink, rLink.GetObjType(), sfx2::LINKUPDATE_ONCALL ); + return FALSE; +} + +// eine Uebertragung wird abgebrochen, also alle DownloadMedien canceln +// (ist zur Zeit nur fuer die FileLinks interressant!) +void LinkManager::CancelTransfers() +{ + SvFileObject* pFileObj; + sfx2::SvBaseLink* pLnk; + + const sfx2::SvBaseLinks& rLnks = GetLinks(); + for( USHORT n = rLnks.Count(); n; ) + if( 0 != ( pLnk = &(*rLnks[ --n ])) && + OBJECT_CLIENT_FILE == (OBJECT_CLIENT_FILE & pLnk->GetObjType()) && + 0 != ( pFileObj = (SvFileObject*)pLnk->GetObj() ) ) +// 0 != ( pFileObj = (SvFileObject*)SvFileObject::ClassFactory()-> +// CastAndAddRef( pLnk->GetObj() )) ) + pFileObj->CancelTransfers(); +} + + // um Status Informationen aus dem FileObject an den BaseLink zu + // senden, gibt es eine eigene ClipBoardId. Das SvData-Object hat + // dann die entsprechenden Informationen als String. + // Wird zur Zeit fuer FileObject in Verbindung mit JavaScript benoetigt + // - das braucht Informationen ueber Load/Abort/Error +ULONG LinkManager::RegisterStatusInfoId() +{ + static ULONG nFormat = 0; + + if( !nFormat ) + { +// wie sieht die neue Schnittstelle aus? +// nFormat = Exchange::RegisterFormatName( "StatusInfo vom SvxInternalLink" ); + nFormat = SotExchange::RegisterFormatName( + String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( + "StatusInfo vom SvxInternalLink" ))); + } + return nFormat; +} + +// ---------------------------------------------------------------------- + +BOOL LinkManager::GetGraphicFromAny( const String& rMimeType, + const ::com::sun::star::uno::Any & rValue, + Graphic& rGrf ) +{ + BOOL bRet = FALSE; + ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; + if( rValue.hasValue() && ( rValue >>= aSeq ) ) + { + SvMemoryStream aMemStm( (void*)aSeq.getConstArray(), aSeq.getLength(), + STREAM_READ ); + aMemStm.Seek( 0 ); + + switch( SotExchange::GetFormatIdFromMimeType( rMimeType ) ) + { + case SOT_FORMATSTR_ID_SVXB: + { + aMemStm >> rGrf; + bRet = TRUE; + } + break; + case FORMAT_GDIMETAFILE: + { + GDIMetaFile aMtf; + aMtf.Read( aMemStm ); + rGrf = aMtf; + bRet = TRUE; + } + break; + case FORMAT_BITMAP: + { + Bitmap aBmp; + aMemStm >> aBmp; + rGrf = aBmp; + bRet = TRUE; + } + break; + } + } + return bRet; +} + + +// ---------------------------------------------------------------------- +String lcl_DDE_RelToAbs( const String& rTopic, const String& rBaseURL ) +{ + String sRet; + INetURLObject aURL( rTopic ); + if( INET_PROT_NOT_VALID == aURL.GetProtocol() ) + utl::LocalFileHelper::ConvertSystemPathToURL( rTopic, rBaseURL, sRet ); + if( !sRet.Len() ) + sRet = URIHelper::SmartRel2Abs( INetURLObject(rBaseURL), rTopic, URIHelper::GetMaybeFileHdl(), true ); + return sRet; +} + +BOOL SvxInternalLink::Connect( sfx2::SvBaseLink* pLink ) +{ + SfxObjectShell* pFndShell = 0; + USHORT nUpdateMode = com::sun::star::document::UpdateDocMode::NO_UPDATE; + String sTopic, sItem, sReferer; + if( pLink->GetLinkManager() && + pLink->GetLinkManager()->GetDisplayNames( pLink, 0, &sTopic, &sItem ) + && sTopic.Len() ) + { + // erstmal nur ueber die DocumentShells laufen und die mit dem + // Namen heraussuchen: + + com::sun::star::lang::Locale aLocale; + MsLangId::convertLanguageToLocale( LANGUAGE_SYSTEM, aLocale ); + CharClass aCC( aLocale ); + + String sNm( sTopic ), sTmp; + aCC.toLower( sNm ); + + TypeId aType( TYPE(SfxObjectShell) ); + + BOOL bFirst = TRUE; + SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); + if( pShell && pShell->GetMedium() ) + { + sReferer = pShell->GetMedium()->GetBaseURL(); + SFX_ITEMSET_ARG( pShell->GetMedium()->GetItemSet(), pItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False ); + if ( pItem ) + nUpdateMode = pItem->GetValue(); + } + + String sNmURL( lcl_DDE_RelToAbs( sTopic, sReferer ) ); + aCC.toLower( sNmURL ); + + if ( !pShell ) + { + bFirst = FALSE; + pShell = SfxObjectShell::GetFirst( &aType, sal_False ); + } + + while( pShell ) + { + if( !sTmp.Len() ) + { + sTmp = pShell->GetTitle( SFX_TITLE_FULLNAME ); + sTmp = lcl_DDE_RelToAbs(sTmp, sReferer ); + } + + + aCC.toLower( sTmp ); + if( sTmp == sNmURL ) // die wollen wir haben + { + pFndShell = pShell; + break; + } + + if( bFirst ) + { + bFirst = FALSE; + pShell = SfxObjectShell::GetFirst( &aType, sal_False ); + } + else + pShell = SfxObjectShell::GetNext( *pShell, &aType, sal_False ); + + sTmp.Erase(); + } + } + + // empty topics are not allowed - which document is it + if( !sTopic.Len() ) + return FALSE; + + if( !pFndShell ) + { + // dann versuche die Datei zu laden: + INetURLObject aURL( sTopic ); + INetProtocol eOld = aURL.GetProtocol(); + aURL.SetURL( sTopic = lcl_DDE_RelToAbs( sTopic, sReferer ) ); + if( INET_PROT_NOT_VALID != eOld || + INET_PROT_HTTP != aURL.GetProtocol() ) + { + SfxStringItem aName( SID_FILE_NAME, sTopic ); + SfxBoolItem aMinimized(SID_MINIMIZED, TRUE); + SfxBoolItem aHidden(SID_HIDDEN, TRUE); + SfxStringItem aTarget( SID_TARGETNAME, String::CreateFromAscii("_blank") ); + SfxStringItem aReferer( SID_REFERER, sReferer ); + SfxUInt16Item aUpdate( SID_UPDATEDOCMODE, nUpdateMode ); + SfxBoolItem aReadOnly(SID_DOC_READONLY, TRUE); + + // #i14200# (DDE-link crashes wordprocessor) + SfxAllItemSet aArgs( SFX_APP()->GetPool() ); + aArgs.Put(aReferer); + aArgs.Put(aTarget); + aArgs.Put(aHidden); + aArgs.Put(aMinimized); + aArgs.Put(aName); + aArgs.Put(aUpdate); + aArgs.Put(aReadOnly); + pFndShell = SfxObjectShell::CreateAndLoadObject( aArgs ); + } + } + + BOOL bRet = FALSE; + if( pFndShell ) + { + sfx2::SvLinkSource* pNewSrc = pFndShell->DdeCreateLinkSource( sItem ); + if( pNewSrc ) + { + bRet = TRUE; + + ::com::sun::star::datatransfer::DataFlavor aFl; + SotExchange::GetFormatDataFlavor( pLink->GetContentType(), aFl ); + + pLink->SetObj( pNewSrc ); + pNewSrc->AddDataAdvise( pLink, aFl.MimeType, + sfx2::LINKUPDATE_ONCALL == pLink->GetUpdateMode() + ? ADVISEMODE_ONLYONCE + : 0 ); + } + } + return bRet; +} + + } diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index f7ff7b161588..e9fbde42328f 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: linksrc.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index c6568dc4f298..6a51783a8a04 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: lnkbase2.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -37,19 +34,12 @@ #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <vcl/msgbox.hxx> - #include <sfx2/linkmgr.hxx> -//#include "svuidlg.hrc" -//#include "iface.hxx" #include <vcl/svapp.hxx> -//#include <soerr.hxx> - #include "app.hrc" #include "sfx2/sfxresid.hxx" #include <sfx2/filedlghelper.hxx> - #include <tools/debug.hxx> - #include <svl/svdde.hxx> using namespace ::com::sun::star::uno; @@ -66,7 +56,7 @@ class ImplDdeItem; struct BaseLink_Impl { Link m_aEndEditLink; - SvLinkManager* m_pLinkMgr; + LinkManager* m_pLinkMgr; Window* m_pParentWin; FileDialogHelper* m_pFileDlg; bool m_bIsConnect; @@ -472,17 +462,17 @@ BOOL SvBaseLink::SetContentType( ULONG nType ) return FALSE; } -SvLinkManager* SvBaseLink::GetLinkManager() +LinkManager* SvBaseLink::GetLinkManager() { return pImpl->m_pLinkMgr; } -const SvLinkManager* SvBaseLink::GetLinkManager() const +const LinkManager* SvBaseLink::GetLinkManager() const { return pImpl->m_pLinkMgr; } -void SvBaseLink::SetLinkManager( SvLinkManager* _pMgr ) +void SvBaseLink::SetLinkManager( LinkManager* _pMgr ) { pImpl->m_pLinkMgr = _pMgr; } diff --git a/sfx2/source/appl/makefile.mk b/sfx2/source/appl/makefile.mk index d72cf8718a0b..274e06b13cdf 100644 --- a/sfx2/source/appl/makefile.mk +++ b/sfx2/source/appl/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.56 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -94,6 +90,7 @@ SFX_OBJECTS = \ $(SLO)$/appuno.obj \ $(SLO)$/appbaslib.obj \ $(SLO)$/childwin.obj \ + $(SLO)$/fileobj.obj \ $(SLO)$/helpdispatch.obj \ $(SLO)$/helpinterceptor.obj \ $(SLO)$/imagemgr.obj\ @@ -104,6 +101,7 @@ SFX_OBJECTS = \ $(SLO)$/lnkbase2.obj \ $(SLO)$/module.obj \ $(SLO)$/newhelp.obj \ + $(SLO)$/opengrf.obj \ $(SLO)$/sfxdll.obj \ $(SLO)$/sfxhelp.obj \ $(SLO)$/sfxpicklist.obj \ @@ -144,8 +142,10 @@ EXCEPTIONSFILES=\ $(SLO)$/appmisc.obj \ $(SLO)$/appinit.obj \ $(SLO)$/appcfg.obj \ + $(SLO)$/fileobj.obj \ $(SLO)$/helpinterceptor.obj \ $(SLO)$/newhelp.obj \ + $(SLO)$/opengrf.obj \ $(SLO)$/sfxhelp.obj \ $(SLO)$/shutdownicon.obj \ $(SLO)$/shutdowniconw32.obj \ diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx index d1c6e14c74d4..f0abf079f58e 100644 --- a/sfx2/source/appl/module.cxx +++ b/sfx2/source/appl/module.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: module.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -44,13 +41,14 @@ #include "sfx2/sfxresid.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/tbxctrl.hxx> -#include "stbitem.hxx" +#include "sfx2/stbitem.hxx" #include <sfx2/mnuitem.hxx> #include <sfx2/childwin.hxx> #include <sfx2/mnumgr.hxx> #include <sfx2/docfac.hxx> #include <sfx2/objface.hxx> #include <sfx2/viewfrm.hxx> +#include <svl/intitem.hxx> #define SfxModule #include "sfxslots.hxx" @@ -411,3 +409,29 @@ SfxModule* SfxModule::GetActiveModule( SfxViewFrame* pFrame ) pSh = pFrame->GetObjectShell(); return pSh ? pSh->GetModule() : 0; } + +FieldUnit SfxModule::GetCurrentFieldUnit() +{ + FieldUnit eUnit = FUNIT_INCH; + SfxModule* pModule = GetActiveModule(); + if ( pModule ) + { + const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); + DBG_ASSERT( pItem, "GetFieldUnit(): no item" ); + if ( pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + } + else + DBG_ERRORFILE( "GetModuleFieldUnit(): no module found" ); + return eUnit; +} + +FieldUnit SfxModule::GetFieldUnit() const +{ + FieldUnit eUnit = FUNIT_INCH; + const SfxPoolItem* pItem = GetItem( SID_ATTR_METRIC ); + DBG_ASSERT( pItem, "GetFieldUnit(): no item" ); + if ( pItem ) + eUnit = (FieldUnit)( (SfxUInt16Item*)pItem )->GetValue(); + return eUnit; +} diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 3649f31943e5..49c89cf32fa9 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newhelp.cxx,v $ - * $Revision: 1.130 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,7 +39,7 @@ #include "panelist.hxx" #include "sfx2/imgmgr.hxx" #include "srchdlg.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include "app.hrc" #include "newhelp.hrc" diff --git a/sfx2/source/appl/newhelp.hrc b/sfx2/source/appl/newhelp.hrc index fbc8d74a5678..7bb9aa85678c 100644 --- a/sfx2/source/appl/newhelp.hrc +++ b/sfx2/source/appl/newhelp.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newhelp.hrc,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/newhelp.hxx b/sfx2/source/appl/newhelp.hxx index acda2cf312e7..95a5bfe52230 100644 --- a/sfx2/source/appl/newhelp.hxx +++ b/sfx2/source/appl/newhelp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newhelp.hxx,v $ - * $Revision: 1.59 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/newhelp.src b/sfx2/source/appl/newhelp.src index e4a4f8a6929b..8a2b4f760f7e 100644 --- a/sfx2/source/appl/newhelp.src +++ b/sfx2/source/appl/newhelp.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newhelp.src,v $ - * $Revision: 1.97 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx new file mode 100644 index 000000000000..53907f875fe8 --- /dev/null +++ b/sfx2/source/appl/opengrf.cxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include <tools/urlobj.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> +#include <com/sun/star/ui/dialogs/ListboxControlActions.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerListener.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerNotifier.hpp> +#include <com/sun/star/ui/dialogs/XFilePreview.hpp> +#include <com/sun/star/ui/dialogs/XFilterManager.hpp> +#include <svl/urihelper.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <svtools/transfer.hxx> +#include <sot/formats.hxx> +#include <vcl/msgbox.hxx> +#include <sfx2/filedlghelper.hxx> +#include <sfx2/docfile.hxx> +#include <unotools/pathoptions.hxx> +#include <sfx2/opengrf.hxx> +#include "app.hrc" +#include "sfx2/sfxresid.hxx" + +//----------------------------------------------------------------------------- + +using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::ui::dialogs; +using namespace ::com::sun::star::uno; +using namespace ::rtl; +using namespace ::cppu; + + +//----------------------------------------------------------------------------- + +USHORT SvxOpenGrfErr2ResId( short err ) +{ + switch( err ) + { + case GRFILTER_OPENERROR: + return RID_SVXSTR_GRFILTER_OPENERROR; + case GRFILTER_IOERROR: + return RID_SVXSTR_GRFILTER_IOERROR; + case GRFILTER_VERSIONERROR: + return RID_SVXSTR_GRFILTER_VERSIONERROR; + case GRFILTER_FILTERERROR: + return RID_SVXSTR_GRFILTER_FILTERERROR; + case GRFILTER_FORMATERROR: + default: + return RID_SVXSTR_GRFILTER_FORMATERROR; + } +} + + +struct SvxOpenGrf_Impl +{ + SvxOpenGrf_Impl (); + + sfx2::FileDialogHelper aFileDlg; + uno::Reference < XFilePickerControlAccess > xCtrlAcc; +}; + + +SvxOpenGrf_Impl::SvxOpenGrf_Impl() : + aFileDlg(SFXWB_GRAPHIC) +{ + uno::Reference < XFilePicker > xFP = aFileDlg.GetFilePicker(); + xCtrlAcc = uno::Reference < XFilePickerControlAccess >(xFP, UNO_QUERY); +} + + +SvxOpenGraphicDialog::SvxOpenGraphicDialog( const String& rTitle ) : + mpImpl( new SvxOpenGrf_Impl ) +{ + mpImpl->aFileDlg.SetTitle(rTitle); +} + + +SvxOpenGraphicDialog::~SvxOpenGraphicDialog() +{ +} + + +short SvxOpenGraphicDialog::Execute() +{ + USHORT nImpRet; + BOOL bQuitLoop(FALSE); + + while( bQuitLoop == FALSE && + mpImpl->aFileDlg.Execute() == ERRCODE_NONE ) + { + if( GetPath().Len() ) + { + GraphicFilter* pFilter = GraphicFilter::GetGraphicFilter(); + INetURLObject aObj( GetPath() ); + + // check whether we can load the graphic + String aCurFilter( GetCurrentFilter() ); + USHORT nFormatNum = pFilter->GetImportFormatNumber( aCurFilter ); + USHORT nRetFormat = 0; + USHORT nFound = USHRT_MAX; + + // non-local? + if ( INET_PROT_FILE != aObj.GetProtocol() ) + { + SfxMedium aMed( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ, TRUE ); + aMed.DownLoad(); + SvStream* pStream = aMed.GetInStream(); + + if( pStream ) + nImpRet = pFilter->CanImportGraphic( aObj.GetMainURL( INetURLObject::NO_DECODE ), *pStream, nFormatNum, &nRetFormat ); + else + nImpRet = pFilter->CanImportGraphic( aObj, nFormatNum, &nRetFormat ); + + if ( GRFILTER_OK != nImpRet ) + { + if ( !pStream ) + nImpRet = pFilter->CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); + else + nImpRet = pFilter->CanImportGraphic( aObj.GetMainURL( INetURLObject::NO_DECODE ), *pStream, + GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); + } + } + else + { + if( (nImpRet=pFilter->CanImportGraphic( aObj, nFormatNum, &nRetFormat )) != GRFILTER_OK ) + nImpRet = pFilter->CanImportGraphic( aObj, GRFILTER_FORMAT_DONTKNOW, &nRetFormat ); + } + + if ( GRFILTER_OK == nImpRet ) + nFound = nRetFormat; + + // could not load? + if ( nFound == USHRT_MAX ) + { + WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, String( SfxResId( SvxOpenGrfErr2ResId(nImpRet) ) ) ); + bQuitLoop = aWarningBox.Execute()==RET_RETRY ? FALSE : TRUE; + } + else + { + // setup appropriate filter (so next time, it will work) + if( pFilter->GetImportFormatCount() ) + { + String aFormatName(pFilter->GetImportFormatName(nFound)); + SetCurrentFilter(aFormatName); + } + + return nImpRet; + } + } + } + + // cancel + return -1; +} + + +void SvxOpenGraphicDialog::SetPath( const String& rPath ) +{ + mpImpl->aFileDlg.SetDisplayDirectory(rPath); +} + +void SvxOpenGraphicDialog::SetPath( const String& rPath, sal_Bool bLinkState ) +{ + SetPath(rPath); + AsLink(bLinkState); +} + + +void SvxOpenGraphicDialog::EnableLink( sal_Bool state ) +{ + if( mpImpl->xCtrlAcc.is() ) + { + try + { + mpImpl->xCtrlAcc->enableControl( ExtendedFilePickerElementIds::CHECKBOX_LINK, state ); + } + catch(IllegalArgumentException) + { +#ifdef DBG_UTIL + DBG_ERROR( "Cannot enable \"link\" checkbox" ); +#endif + } + } +} + + +void SvxOpenGraphicDialog::AsLink(sal_Bool bState) +{ + if( mpImpl->xCtrlAcc.is() ) + { + try + { + Any aAny; aAny <<= bState; + mpImpl->xCtrlAcc->setValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aAny ); + } + catch(IllegalArgumentException) + { +#ifdef DBG_UTIL + DBG_ERROR( "Cannot check \"link\" checkbox" ); +#endif + } + } +} + + +sal_Bool SvxOpenGraphicDialog::IsAsLink() const +{ + try + { + if( mpImpl->xCtrlAcc.is() ) + { + Any aVal = mpImpl->xCtrlAcc->getValue( ExtendedFilePickerElementIds::CHECKBOX_LINK, 0 ); + DBG_ASSERT(aVal.hasValue(), "Value CBX_INSERT_AS_LINK not found"); + return aVal.hasValue() ? *(sal_Bool*) aVal.getValue() : sal_False; + } + } + catch(IllegalArgumentException) + { +#ifdef DBG_UTIL + DBG_ERROR( "Cannot access \"link\" checkbox" ); +#endif + } + + return sal_False; +} + + +int SvxOpenGraphicDialog::GetGraphic(Graphic& rGraphic) const +{ + return mpImpl->aFileDlg.GetGraphic(rGraphic); +} + + +String SvxOpenGraphicDialog::GetPath() const +{ + return mpImpl->aFileDlg.GetPath(); +} + + +String SvxOpenGraphicDialog::GetCurrentFilter() const +{ + return mpImpl->aFileDlg.GetCurrentFilter(); +} + + +void SvxOpenGraphicDialog::SetCurrentFilter(const String& rStr) +{ + mpImpl->aFileDlg.SetCurrentFilter(rStr); +} + +void SvxOpenGraphicDialog::SetControlHelpIds( const INT16* _pControlId, const INT32* _pHelpId ) +{ + mpImpl->aFileDlg.SetControlHelpIds( _pControlId, _pHelpId ); +} + +void SvxOpenGraphicDialog::SetDialogHelpId( const INT32 _nHelpId ) +{ + mpImpl->aFileDlg.SetDialogHelpId( _nHelpId ); +} diff --git a/sfx2/source/appl/panelist.hxx b/sfx2/source/appl/panelist.hxx index 167c8d67d225..2406709aede9 100644 --- a/sfx2/source/appl/panelist.hxx +++ b/sfx2/source/appl/panelist.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: panelist.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/sfx.src b/sfx2/source/appl/sfx.src index 9be3d778013b..c3b734e327de 100644 --- a/sfx2/source/appl/sfx.src +++ b/sfx2/source/appl/sfx.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfx.src,v $ - * $Revision: 1.47 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/sfxdll.cxx b/sfx2/source/appl/sfxdll.cxx index 8ca92b8cb8c7..956a61b3e247 100644 --- a/sfx2/source/appl/sfxdll.cxx +++ b/sfx2/source/appl/sfxdll.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxdll.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index eea3097e83f9..f8ce2023a205 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxhelp.cxx,v $ - * $Revision: 1.82.78.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,16 +28,14 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <algorithm> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XComponent.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/PosSize.hpp> @@ -60,13 +55,11 @@ #include <tools/urlobj.hxx> #include <unotools/configmgr.hxx> #include <ucbhelper/content.hxx> - #include <unotools/pathoptions.hxx> #include <rtl/ustring.hxx> #include <osl/process.h> #include <osl/file.hxx> #include <unotools/bootstrap.hxx> - #include <rtl/uri.hxx> #include <vcl/msgbox.hxx> #include <svtools/ehdl.hxx> @@ -76,16 +69,15 @@ #define _SVSTDARR_ULONGSSORT #include <svl/svstdarr.hxx> -#include <sfx2/sfxsids.hrc> -#include <sfx2/app.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/msgpool.hxx> #include "newhelp.hxx" #include <sfx2/objsh.hxx> #include <sfx2/docfac.hxx> #include "sfx2/sfxresid.hxx" #include "helper.hxx" #include "app.hrc" +#include <sfx2/sfxuno.hxx> +#include <vcl/svapp.hxx> +#include <sfx2/frame.hxx> using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; @@ -132,7 +124,8 @@ rtl::OUString HelpLocaleString() Any aLocale = ::utl::ConfigManager::GetConfigManager()->GetDirectConfigProperty( ::utl::ConfigManager::LOCALE ); - bool bOk = (aLocale >>= aLocaleStr); + aLocale >>= aLocaleStr; + bool bOk = aLocaleStr.getLength() != 0; if ( bOk ) { rtl::OUString aBaseInstallPath; @@ -967,26 +960,39 @@ String SfxHelp::CreateHelpURL( const String& aCommandURL, const String& rModuleN return aURL; } -void SfxHelp::OpenHelpAgent( SfxFrame *pFrame, ULONG nHelpId ) +void SfxHelp::OpenHelpAgent( SfxFrame*, ULONG nHelpId ) { - if ( SvtHelpOptions().IsHelpAgentAutoStartMode() ) - { SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() ); if ( pHelp ) - { - SfxHelpOptions_Impl *pOpt = pHelp->pImp->GetOptions(); + pHelp->OpenHelpAgent( nHelpId ); +} + +void SfxHelp::OpenHelpAgent( ULONG nHelpId ) +{ + if ( SvtHelpOptions().IsHelpAgentAutoStartMode() ) + { +// SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() ); +// if ( pHelp ) +// { + SfxHelpOptions_Impl *pOpt = pImp->GetOptions(); if ( !pOpt->HasId( nHelpId ) ) return; try { URL aURL; - aURL.Complete = pHelp->CreateHelpURL_Impl( nHelpId, pHelp->GetHelpModuleName_Impl() ); + aURL.Complete = CreateHelpURL_Impl( nHelpId, GetHelpModuleName_Impl() ); Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" ) ), UNO_QUERY ); xTrans->parseStrict(aURL); - Reference< XDispatchProvider > xDispProv( pFrame->GetTopFrame()->GetFrameInterface(), UNO_QUERY ); + Reference < XFrame > xCurrentFrame; + Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + if ( xDesktop.is() ) + xCurrentFrame = xDesktop->getCurrentFrame(); + + Reference< XDispatchProvider > xDispProv( xCurrentFrame, UNO_QUERY ); Reference< XDispatch > xHelpDispatch; if ( xDispProv.is() ) xHelpDispatch = xDispProv->queryDispatch( @@ -1001,7 +1007,7 @@ void SfxHelp::OpenHelpAgent( SfxFrame *pFrame, ULONG nHelpId ) { DBG_ERRORFILE( "OpenHelpAgent: caught an exception while executing the dispatch!" ); } - } +// } } } diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 48b7ecdd1540..0074faac192f 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxpicklist.cxx,v $ - * $Revision: 1.34 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -449,7 +446,7 @@ void SfxPickList::Notify( SfxBroadcaster&, const SfxHint& rHint ) return; // ignore hidden documents - if ( !SfxViewFrame::GetFirst( pDocSh, 0, TRUE ) ) + if ( !SfxViewFrame::GetFirst( pDocSh, TRUE ) ) return; ::rtl::OUString aTitle = pDocSh->GetTitle(SFX_TITLE_PICKLIST); diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 1a6e31b7769c..b533ffb55d7e 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shutdownicon.cxx,v $ - * $Revision: 1.64 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/shutdowniconOs2.cxx b/sfx2/source/appl/shutdowniconOs2.cxx index f4108950db22..936d6f925053 100644 --- a/sfx2/source/appl/shutdowniconOs2.cxx +++ b/sfx2/source/appl/shutdowniconOs2.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shutdowniconOs2.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/shutdowniconaqua.mm b/sfx2/source/appl/shutdowniconaqua.mm index 27aa37e05c74..14f12c79b53b 100644 --- a/sfx2/source/appl/shutdowniconaqua.mm +++ b/sfx2/source/appl/shutdowniconaqua.mm @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shutdowniconaqua.mm,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index 676a46ab584f..c334fd750fc6 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shutdowniconw32.cxx,v $ - * $Revision: 1.48 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 1ca17aa97478..0051cee06841 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: workwin.cxx,v $ - * $Revision: 1.75 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,7 +38,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/app.hxx> #include "workwin.hxx" -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "arrdecl.hxx" #include <sfx2/viewfrm.hxx> #include <sfx2/module.hxx> @@ -1434,8 +1431,8 @@ sal_Bool SfxWorkWindow::IsPluginMode( SfxObjectShell* pObjShell ) if ( pDispatcher ) { SfxViewFrame* pFrame = pDispatcher->GetFrame(); - if ( pFrame && pFrame->GetFrame() ) - xFrame = pFrame->GetFrame()->GetFrameInterface(); + if ( pFrame ) + xFrame = pFrame->GetFrame().GetFrameInterface(); } return xFrame; diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index e104bf24ba93..6e6606a67041 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xpackcreator.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/appl/xpackcreator.hxx b/sfx2/source/appl/xpackcreator.hxx index 18d5c00ec263..ff3b84dbec64 100644 --- a/sfx2/source/appl/xpackcreator.hxx +++ b/sfx2/source/appl/xpackcreator.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: xpackcreator.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/bastyp.hrc b/sfx2/source/bastyp/bastyp.hrc index 76de07671dd6..b585ac79f035 100644 --- a/sfx2/source/bastyp/bastyp.hrc +++ b/sfx2/source/bastyp/bastyp.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bastyp.hrc,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/bastyp.src b/sfx2/source/bastyp/bastyp.src index cd09badc13f2..5ef74f5874b3 100644 --- a/sfx2/source/bastyp/bastyp.src +++ b/sfx2/source/bastyp/bastyp.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bastyp.src,v $ - * $Revision: 1.34 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/bitset.cxx b/sfx2/source/bastyp/bitset.cxx index ed640a5f06bb..df35593a9a18 100644 --- a/sfx2/source/bastyp/bitset.cxx +++ b/sfx2/source/bastyp/bitset.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bitset.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index 074a3052b443..12f824ea4255 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fltfnc.cxx,v $ - * $Revision: 1.79 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -113,7 +110,7 @@ using namespace ::vos; #include <svtools/sfxecode.hxx> #include <unotools/syslocale.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include "sfxbasic.hxx" #include <sfx2/docfilt.hxx> #include <sfx2/docfac.hxx> @@ -127,7 +124,7 @@ using namespace ::vos; #include <sfx2/doctempl.hxx> #include <sfx2/frame.hxx> #include <sfx2/dispatch.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "helper.hxx" #include "fltlst.hxx" #include <sfx2/request.hxx> diff --git a/sfx2/source/bastyp/fltfnc.src b/sfx2/source/bastyp/fltfnc.src index 6de0adbc75e1..4203163eceeb 100644 --- a/sfx2/source/bastyp/fltfnc.src +++ b/sfx2/source/bastyp/fltfnc.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fltfnc.src,v $ - * $Revision: 1.31 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/fltlst.cxx b/sfx2/source/bastyp/fltlst.cxx index e3383e1e9317..aab358b50220 100644 --- a/sfx2/source/bastyp/fltlst.cxx +++ b/sfx2/source/bastyp/fltlst.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fltlst.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/fltlst.hxx b/sfx2/source/bastyp/fltlst.hxx index b08281967144..b3afb425634d 100644 --- a/sfx2/source/bastyp/fltlst.hxx +++ b/sfx2/source/bastyp/fltlst.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fltlst.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/frmhtml.cxx b/sfx2/source/bastyp/frmhtml.cxx index 5cb4f0200614..8ecfa6b3081a 100644 --- a/sfx2/source/bastyp/frmhtml.cxx +++ b/sfx2/source/bastyp/frmhtml.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frmhtml.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index 96ee65bc0b0a..e17151c6e322 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frmhtmlw.cxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index 3c0adfd5c873..091651fedbc2 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helper.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -552,9 +549,17 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) } } } - catch( uno::Exception& ) - { - DBG_ERRORFILE( "GetResultSet: Any other exception" ); + catch( uno::Exception& e ) + { + (void) e; + DBG_ERRORFILE( + rtl::OUStringToOString( + (rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "GetResultSet: Any other exception: ")) + + e.Message), + RTL_TEXTENCODING_UTF8). + getStr()); } if ( pList ) diff --git a/sfx2/source/bastyp/makefile.mk b/sfx2/source/bastyp/makefile.mk index 926107a6e965..75c0cace40d6 100644 --- a/sfx2/source/bastyp/makefile.mk +++ b/sfx2/source/bastyp/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 24f988d18a58..4154ddc6301b 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mieclip.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/minarray.cxx b/sfx2/source/bastyp/minarray.cxx index 04437b5e4745..978239239cea 100644 --- a/sfx2/source/bastyp/minarray.cxx +++ b/sfx2/source/bastyp/minarray.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: minarray.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/misc.cxx b/sfx2/source/bastyp/misc.cxx index 254edcae44b4..49938c729b36 100644 --- a/sfx2/source/bastyp/misc.cxx +++ b/sfx2/source/bastyp/misc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: misc.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 813640aa327c..1398cf6f55a8 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: progress.cxx,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -80,7 +77,7 @@ void AddNumber_Impl( String& aNumber, sal_uInt32 nArg ) } } -struct SfxProgress_Impl : public SfxCancellable +struct SfxProgress_Impl { Reference < XStatusIndicator > xStatusInd; String aText, aStateText; @@ -144,11 +141,9 @@ void SfxProgress_Impl::Enable_Impl( BOOL bEnable ) // ----------------------------------------------------------------------- -SfxProgress_Impl::SfxProgress_Impl( const String &rTitle ) - : SfxCancellable( SFX_APP()->GetCancelManager(), rTitle ), - pActiveProgress( 0 ) +SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ ) + : pActiveProgress( 0 ) { - SFX_APP()->GetCancelManager()->RemoveCancellable(this); } // ----------------------------------------------------------------------- @@ -186,21 +181,6 @@ SfxProgress::SfxProgress pImp->bRunning = TRUE; pImp->bAllowRescheduling = Application::IsInExecute();; - if ( pObjSh ) - { - for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjSh ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pObjSh ) ) - { - pFrame->GetCancelManager()->InsertCancellable( pImp ); -/* - SfxBindings& rBindings = pFrame->GetBindings(); - rBindings.Invalidate( SID_BROWSE_STOP ); - if ( !rBindings.IsInRegistrations() ) - rBindings.Update( SID_BROWSE_STOP ); - rBindings.Invalidate( SID_BROWSE_STOP ); - */ - } - } - pImp->xObjSh = pObjSh; pImp->aText = rText; pImp->nMax = nRange; @@ -241,14 +221,6 @@ SfxProgress::~SfxProgress() if( pImp->bIsStatusText == TRUE ) GetpApp()->HideStatusText( ); - SfxObjectShell* pDoc = pImp->xObjSh; - if ( pDoc ) - { - for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pDoc ) ) - pFrame->GetCancelManager()->RemoveCancellable( pImp );//Invalidate( SID_BROWSE_STOP ); - } - else - SFX_APP()->Invalidate( SID_BROWSE_STOP ); delete pImp; } @@ -390,8 +362,8 @@ BOOL SfxProgress::SetState { // wurde via Stop-Button angehalten? - if ( pImp->IsCancelled() ) - return FALSE; +// if ( pImp->IsCancelled() ) +// return FALSE; if( pImp->pActiveProgress ) return TRUE; diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx index 794ee142708c..6132e958b900 100644 --- a/sfx2/source/bastyp/sfxhtml.cxx +++ b/sfx2/source/bastyp/sfxhtml.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxhtml.cxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -357,40 +354,6 @@ IMPL_STATIC_LINK( SfxHTMLParser, FileDownloadDone, void*, EMPTYARG ) return 0; } -rtl_TextEncoding SfxHTMLParser::GetEncodingByHttpHeader( SvKeyValueIterator *pHTTPHeader ) -{ - rtl_TextEncoding eRet = RTL_TEXTENCODING_DONTKNOW; - if( pHTTPHeader ) - { - SvKeyValue aKV; - for( BOOL bCont = pHTTPHeader->GetFirst( aKV ); bCont; - bCont = pHTTPHeader->GetNext( aKV ) ) - { - if( aKV.GetKey().EqualsIgnoreCaseAscii( OOO_STRING_SVTOOLS_HTML_META_content_type ) ) - { - if( aKV.GetValue().Len() ) - { - eRet = SfxHTMLParser::GetEncodingByMIME( aKV.GetValue() ); - } - } - } - } - return eRet; -} - -BOOL SfxHTMLParser::SetEncodingByHTTPHeader( - SvKeyValueIterator *pHTTPHeader ) -{ - BOOL bRet = FALSE; - rtl_TextEncoding eEnc = SfxHTMLParser::GetEncodingByHttpHeader( pHTTPHeader ); - if(RTL_TEXTENCODING_DONTKNOW != eEnc) - { - SetSrcEncoding( eEnc ); - bRet = TRUE; - } - return bRet; -} - void SfxHTMLParser::GetScriptType_Impl( SvKeyValueIterator *pHTTPHeader ) { aScriptType = DEFINE_CONST_UNICODE(SVX_MACRO_LANGUAGE_JAVASCRIPT); diff --git a/sfx2/source/bastyp/sfxresid.cxx b/sfx2/source/bastyp/sfxresid.cxx index dc82a0b5f80a..cf1cd983f76e 100644 --- a/sfx2/source/bastyp/sfxresid.cxx +++ b/sfx2/source/bastyp/sfxresid.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxresid.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/config/config.hrc b/sfx2/source/config/config.hrc index 3aed60ebb8e2..582a2972f913 100644 --- a/sfx2/source/config/config.hrc +++ b/sfx2/source/config/config.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: config.hrc,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/config/config.src b/sfx2/source/config/config.src index e67c47c5997f..cb3259e09ad0 100644 --- a/sfx2/source/config/config.src +++ b/sfx2/source/config/config.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: config.src,v $ - * $Revision: 1.47 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx index a20101006d67..8da7e4f10ce1 100644 --- a/sfx2/source/config/evntconf.cxx +++ b/sfx2/source/config/evntconf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: evntconf.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/config/makefile.mk b/sfx2/source/config/makefile.mk index cf2e07e0b5c1..d090babd1505 100644 --- a/sfx2/source/config/makefile.mk +++ b/sfx2/source/config/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.10 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 7bf2c1c6dfe7..40f6346de8ee 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: bindings.cxx,v $ - * $Revision: 1.53.46.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -71,7 +68,7 @@ #include <sfx2/unoctitm.hxx> #include <sfx2/sfx.hrc> #include <sfx2/sfxuno.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/objsh.hxx> #include <sfx2/msgpool.hxx> @@ -722,7 +719,7 @@ void SfxBindings::InvalidateAll pImp->pCaches->GetObject(n)->Invalidate(bWithMsg); /* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); if ( bWithMsg && xFrame.is() ) xFrame->contextChanged(); @@ -1384,7 +1381,7 @@ void SfxBindings::UpdateSlotServer_Impl() if ( !nRegLevel ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); //if ( xFrame.is() ) // xFrame->contextChanged(); pImp->bContextChanged = FALSE; @@ -1926,7 +1923,7 @@ void SfxBindings::LeaveRegistrations( sal_uInt16 nLevel, const char *pFile, int pImp->bContextChanged = FALSE; /* ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame - ( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); if ( xFrame.is() ) xFrame->contextChanged();*/ } @@ -2033,7 +2030,7 @@ void SfxBindings::SetDispatcher( SfxDispatcher *pDisp ) ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > xProv; if ( pDisp ) xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > - ( pDisp->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY ); + ( pDisp->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY ); SetDispatchProvider_Impl( xProv ); InvalidateAll( sal_True ); @@ -2316,7 +2313,7 @@ void SfxBindings::SetActiveFrame( const ::com::sun::star::uno::Reference< ::com: SetDispatchProvider_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > ( rFrame, ::com::sun::star::uno::UNO_QUERY ) ); else SetDispatchProvider_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > ( - pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ) ); + pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ) ); } const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxBindings::GetActiveFrame() const @@ -2325,7 +2322,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SfxBin if ( xFrame.is() || !pDispatcher ) return xFrame; else - return pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(); + return pDispatcher->GetFrame()->GetFrame().GetFrameInterface(); } void SfxBindings::SetDispatchProvider_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & rProv ) @@ -2352,8 +2349,8 @@ SystemWindow* SfxBindings::GetSystemWindow() const SfxViewFrame *pFrame = pDispatcher->GetFrame(); while ( pFrame->GetParentViewFrame_Impl() ) pFrame = pFrame->GetParentViewFrame_Impl(); - SfxTopViewFrame* pTop = PTR_CAST( SfxTopViewFrame, pFrame->GetTopViewFrame() ); - return pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + SfxViewFrame* pTop = pFrame->GetTopViewFrame(); + return pTop->GetFrame().GetTopWindow_Impl(); } BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) @@ -2377,7 +2374,7 @@ BOOL SfxBindings::ExecuteCommand_Impl( const String& rCommand ) xServiceManager->createInstance(our_aModuleManagerName) , ::com::sun::star::uno::UNO_QUERY_THROW); ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame > xFrame( - pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY_THROW); + pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), UNO_QUERY_THROW); sAppName = xModuleManager->identify(xFrame); } catch(::com::sun::star::uno::Exception&) {} Sequence<beans::PropertyValue> source; diff --git a/sfx2/source/control/ctrlitem.cxx b/sfx2/source/control/ctrlitem.cxx index f39c480fbdeb..9376b81fa0ff 100644 --- a/sfx2/source/control/ctrlitem.cxx +++ b/sfx2/source/control/ctrlitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ctrlitem.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index fa3330059859..dc496258d091 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dispatch.cxx,v $ - * $Revision: 1.56.126.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -60,7 +57,7 @@ // wg. nAutoPageID #include "appdata.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/dispatch.hxx> #include <sfx2/minstack.hxx> #include <sfx2/msg.hxx> @@ -79,7 +76,7 @@ #include <sfx2/docfac.hxx> #include <sfx2/msgpool.hxx> #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <sfx2/sfxuno.hxx> #include <sfx2/docfile.hxx> #include <sfx2/mnumgr.hxx> @@ -242,14 +239,13 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest SFX_STACK(SfxDispatcher::Call_Impl); // darf der Slot gerufen werden (i.S.v. enabled) - SfxApplication *pSfxApp = SFX_APP(); if ( rSlot.IsMode(SFX_SLOT_FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) ) { if ( GetFrame() ) { // ggf. Recording anwerfen com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrame()->GetFrameInterface(), + GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( @@ -273,19 +269,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest // Alles holen, was gebraucht wird, da der Slot den Execute evtl. nicht // "uberlebt, falls es ein 'Pseudoslot' f"ur Macros oder Verben ist sal_Bool bAutoUpdate = rSlot.IsMode(SFX_SLOT_AUTOUPDATE); - SFX_REQUEST_ARG(rReq, pOrigItem, SfxExecuteItem, SID_SUBREQUEST, sal_False); - SfxExecuteItem *pExecuteItem = pOrigItem - ? (SfxExecuteItem*)pOrigItem->Clone() - : 0; - - // ggf. TabPage-ID setzen - SfxAppData_Impl *pAppData = pSfxApp->Get_Impl(); - SFX_REQUEST_ARG(rReq, pTabPageItem, SfxUInt16Item, SID_TABPAGE, sal_False); - if ( pTabPageItem ) - { - pAppData->nAutoTabPageId = pTabPageItem->GetValue(); - rReq.RemoveItem( SID_TABPAGE ); // sonst ArgCount > 0 => Seiteneff. - } // API-Call-Klammerung und Document-Lock w"ahrend des Calls { @@ -298,7 +281,7 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest if ( !pView ) pView = SfxViewFrame::Current(); if ( pView ) - SfxHelp::OpenHelpAgent( pView->GetFrame(), rReq.GetSlot() ); + SfxHelp::OpenHelpAgent( &pView->GetFrame(), rReq.GetSlot() ); SfxExecFunc pFunc = rSlot.GetExecFnc(); rShell.CallExec( pFunc, rReq ); @@ -319,16 +302,6 @@ int SfxDispatcher::Call_Impl( SfxShell& rShell, const SfxSlot &rSlot, SfxRequest } } - // TabPage-ID und Executing-SID zurueck setzen - if ( pTabPageItem ) - pAppData->nAutoTabPageId = 0; - - if( pExecuteItem ) - { - Execute( *pExecuteItem ); - delete pExecuteItem; - } - if ( rReq.IsDone() ) { SfxBindings *pBindings = GetBindings(); @@ -522,7 +495,7 @@ void SfxDispatcher::Pop SfxApplication *pSfxApp = SFX_APP(); #ifdef DBG_UTIL - ByteString aMsg( "SfxDispatcher(" ); + ByteString aMsg( "-SfxDispatcher(" ); aMsg += ByteString::CreateFromInt64( (sal_uIntPtr) this ); aMsg += bPush ? ")::Push(" : ")::Pop("; if ( rShell.GetInterface() ) @@ -530,6 +503,7 @@ void SfxDispatcher::Pop else aMsg += ByteString::CreateFromInt64( (sal_uIntPtr) &rShell ); aMsg += bDelete ? ") with delete" : ")"; + if ( bUntil ) aMsg += " (up to)"; DbgTrace( aMsg.GetBuffer() ); #endif @@ -800,7 +774,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( pBindings ) { pBindings->SetDispatcher(this); - pBindings->SetActiveFrame( pImp->pFrame->GetFrame()->GetFrameInterface() ); + pBindings->SetActiveFrame( pImp->pFrame->GetFrame().GetFrameInterface() ); } } else @@ -820,7 +794,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) if ( bMDI && pImp->pFrame ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -828,7 +802,7 @@ void SfxDispatcher::DoActivate_Impl( sal_Bool bMDI, SfxViewFrame* /* pOld */ ) pBind = pBind->GetSubBindings_Impl(); } - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->HidePopups_Impl( FALSE, FALSE, 1 ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( FALSE, FALSE, 1 ); } if ( pImp->aToDoStack.Count() ) @@ -886,7 +860,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( pImp->pFrame && !(pImp->pFrame->GetObjectShell()->IsInPlaceActive() ) ) { - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); if ( pWorkWin ) { for (sal_uInt16 n=0; n<pImp->aChildWins.Count();) @@ -914,10 +888,10 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( pNew && pImp->pFrame ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xOldFrame( - pNew->GetFrame()->GetFrameInterface()->getCreator(), com::sun::star::uno::UNO_QUERY ); + pNew->GetFrame().GetFrameInterface()->getCreator(), com::sun::star::uno::UNO_QUERY ); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xMyFrame( - GetFrame()->GetFrame()->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + GetFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xOldFrame == xMyFrame ) bHidePopups = FALSE; @@ -925,7 +899,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) if ( bHidePopups ) { - //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + //SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxBindings *pBind = GetBindings(); while ( pBind ) { @@ -933,7 +907,7 @@ void SfxDispatcher::DoDeactivate_Impl( sal_Bool bMDI, SfxViewFrame* pNew ) pBind = pBind->GetSubBindings_Impl(); } - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->HidePopups_Impl( TRUE, FALSE, 1 ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->HidePopups_Impl( TRUE, FALSE, 1 ); } Flush(); @@ -1676,13 +1650,13 @@ void SfxDispatcher::SetMenu_Impl() { if ( pImp->pFrame ) { - SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxTopFrame* pFrm = pTop->GetTopFrame_Impl(); - if ( pFrm->IsMenuBarOn_Impl() ) + SfxFrame& rFrame = pTop->GetFrame(); + if ( rFrame.IsMenuBarOn_Impl() ) { - com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xPropSet.is() ) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -1715,7 +1689,7 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) sal_Bool bUpdate = bForce; while ( pDisp && pDisp->pImp->pFrame ) { - SfxWorkWindow *pWork = pDisp->pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWork = pDisp->pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); if ( pAct == pDisp || pAct == this ) { @@ -1729,10 +1703,10 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) pDisp = pDisp->pImp->pParent; } - if ( !bUpdate || pImp->pFrame->GetFrame()->IsClosing_Impl() ) + if ( !bUpdate || pImp->pFrame->GetFrame().IsClosing_Impl() ) return 0; - SfxTopViewFrame* pTop = pImp->pFrame ? PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ) : NULL; + SfxViewFrame* pTop = pImp->pFrame ? pImp->pFrame->GetTopViewFrame() : NULL; sal_Bool bUIActive = pTop && pTop->GetBindings().GetDispatcher() == this; if ( !bUIActive && pTop && GetBindings() == &pTop->GetBindings() ) @@ -1766,14 +1740,14 @@ long SfxDispatcher::Update_Impl( sal_Bool bForce ) if ( bUIActive && /* !bIsIPActive && */ ( !pClient || !pClient->IsObjectUIActive() ) ) SetMenu_Impl(); - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); - SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); + SfxWorkWindow *pTaskWin = pImp->pFrame->GetTopFrame().GetWorkWindow_Impl(); pTaskWin->ResetStatusBar_Impl(); SfxDispatcher *pDispat = this; while ( pDispat ) { - SfxWorkWindow *pWork = pDispat->pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWork = pDispat->pImp->pFrame->GetFrame().GetWorkWindow_Impl(); SfxDispatcher *pAct = pWork->GetBindings().GetDispatcher_Impl(); if ( pAct == pDispat || pAct == this ) { @@ -1811,7 +1785,7 @@ sal_uInt32 SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, { sal_uInt32 nHelpId = 0; SFX_APP(); - SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pImp->pFrame->GetFrame().GetWorkWindow_Impl(); sal_Bool bIsActive = sal_False; sal_Bool bIsTaskActive = sal_False; SfxDispatcher *pActDispat = pWorkWin->GetBindings().GetDispatcher_Impl(); @@ -1973,7 +1947,7 @@ sal_uInt32 SfxDispatcher::_Update_Impl( sal_Bool bUIActive, sal_Bool bIsMDIApp, { // internal frames also may control statusbar SfxBindings& rBindings = pImp->pFrame->GetBindings(); - pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->SetStatusBar_Impl( nStatBarId, pStatusBarShell, rBindings ); + pImp->pFrame->GetFrame().GetWorkWindow_Impl()->SetStatusBar_Impl( nStatBarId, pStatusBarShell, rBindings ); } } @@ -2250,7 +2224,7 @@ sal_Bool SfxDispatcher::_TryIntercept_Impl sal_uInt16 nLevels = pImp->aStack.Count(); while ( pParent && pParent->pImp->pFrame ) { - if ( pParent->pImp->pFrame->GetFrame()->HasComponent() ) + if ( pParent->pImp->pFrame->GetFrame().HasComponent() ) { // Components d"urfen intercepten if ( pParent->_TryIntercept_Impl( nSlot, rServer, sal_True ) ) @@ -2324,7 +2298,7 @@ sal_Bool SfxDispatcher::_FindServer { SFX_STACK(SfxDispatcher::_FindServer); - // Dispatcher gelockt? (SID_BROWSE_STOP und SID_HELP_PI trotzdem durchlassen) + // Dispatcher gelockt? (SID_HELP_PI trotzdem durchlassen) SfxApplication *pSfxApp = SFX_APP(); if ( IsLocked(nSlot) ) { @@ -2744,7 +2718,7 @@ SfxPopupMenuManager* SfxDispatcher::Popup( sal_uInt16 nConfigId,Window *pWin, co nShLevel = rDisp.pImp->aStack.Count(); } - Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); @@ -2784,7 +2758,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin nShLevel = rDisp.pImp->aStack.Count(); } - Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : rDisp.pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); for ( pSh = rDisp.GetShell(nShLevel); pSh; ++nShLevel, pSh = rDisp.GetShell(nShLevel) ) { const ResId& rResId = pSh->GetInterface()->GetPopupMenuResId(); @@ -2807,7 +2781,7 @@ void SfxDispatcher::ExecutePopup( sal_uInt16 nConfigId, Window *pWin, const Poin //---------------------------------------------------------------------- void SfxDispatcher::ExecutePopup( const ResId &rId, Window *pWin, const Point *pPos ) { - Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame()->GetWorkWindow_Impl()->GetWindow(); + Window *pWindow = pWin ? pWin : pImp->pFrame->GetFrame().GetWorkWindow_Impl()->GetWindow(); /* SfxPopupMenuManager aPop( rId, *GetBindings() ); aPop.AddClipboardFunctions(); @@ -2911,13 +2885,13 @@ void SfxDispatcher::HideUI( sal_Bool bHide ) pImp->bNoUI = bHide; if ( pImp->pFrame ) { - SfxTopViewFrame* pTop= PTR_CAST( SfxTopViewFrame, pImp->pFrame->GetTopViewFrame() ); + SfxViewFrame* pTop = pImp->pFrame->GetTopViewFrame(); if ( pTop && pTop->GetBindings().GetDispatcher() == this ) { - SfxTopFrame* pFrm = pTop->GetTopFrame_Impl(); - if ( pFrm->IsMenuBarOn_Impl() ) + SfxFrame& rFrame = pTop->GetFrame(); + if ( rFrame.IsMenuBarOn_Impl() ) { - com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( pFrm->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xPropSet.is() ) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; @@ -3160,27 +3134,6 @@ void SfxDispatcher::InvalidateBindings_Impl( sal_Bool bModify ) pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) pFrame->GetBindings().InvalidateAll(bModify); -/* - // alle Bindings sind betroffen - for ( SfxInPlaceFrame *pIPFrame = (SfxInPlaceFrame*) - SfxViewFrame::GetFirst(0, TYPE(SfxInPlaceFrame)); - pIPFrame; - pIPFrame = (SfxInPlaceFrame*) - SfxViewFrame::GetNext(*pIPFrame, 0, TYPE(SfxInPlaceFrame)) ) - pIPFrame->GetBindings().InvalidateAll(bModify); - - for ( SfxPlugInFrame *pPIFrame = (SfxPlugInFrame*) - SfxViewFrame::GetFirst(0, TYPE(SfxPlugInFrame)); - pPIFrame; - pPIFrame = (SfxPlugInFrame*) - SfxViewFrame::GetNext(*pPIFrame, 0, TYPE(SfxPlugInFrame)) ) - pPIFrame->GetBindings().InvalidateAll(bModify); - - for ( SfxTask* pTask = SfxTask::GetFirst(); pTask; - pTask = SfxTask::GetNext( *pTask ) ) - if ( !pTask->IsExternal() ) - pTask->GetBindings()->InvalidateAll(bModify); -*/ } else { @@ -3215,3 +3168,14 @@ sal_uInt32 SfxDispatcher::GetDisableFlags() const return pImp->nDisableFlags; } +SfxModule* SfxDispatcher::GetModule() const +{ + for ( sal_uInt16 nShell = 0;; ++nShell ) + { + SfxShell *pSh = GetShell(nShell); + if ( pSh == NULL ) + return 0; + if ( pSh->ISA(SfxModule) ) + return (SfxModule*) pSh; + } +} diff --git a/sfx2/source/control/macrconf.cxx b/sfx2/source/control/macrconf.cxx index fcbe65c6826a..079c7180ac1a 100644 --- a/sfx2/source/control/macrconf.cxx +++ b/sfx2/source/control/macrconf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: macrconf.cxx,v $ - * $Revision: 1.25.142.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/macro.cxx b/sfx2/source/control/macro.cxx index 0337bc7c0b68..04a820d8e0ac 100644 --- a/sfx2/source/control/macro.cxx +++ b/sfx2/source/control/macro.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: macro.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/makefile.mk b/sfx2/source/control/makefile.mk index 9d936549b5b3..86797589e3aa 100644 --- a/sfx2/source/control/makefile.mk +++ b/sfx2/source/control/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.10 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -68,7 +64,6 @@ SLOFILES = \ $(SLO)$/sfxstatuslistener.obj \ $(SLO)$/shell.obj \ $(SLO)$/sorgitm.obj \ - $(SLO)$/srchitem.obj \ $(SLO)$/statcach.obj \ $(SLO)$/unoctitm.obj diff --git a/sfx2/source/control/minfitem.cxx b/sfx2/source/control/minfitem.cxx index 53aa3a3b694d..b0cdd58d2645 100644 --- a/sfx2/source/control/minfitem.cxx +++ b/sfx2/source/control/minfitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: minfitem.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx index 0b0a8d2480ed..0aa4df6902ee 100644 --- a/sfx2/source/control/msg.cxx +++ b/sfx2/source/control/msg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msg.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx index 69948bfabd9e..10359ba20f73 100644 --- a/sfx2/source/control/msgpool.cxx +++ b/sfx2/source/control/msgpool.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: msgpool.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index b17c6364fe3a..d0ce2abae773 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objface.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/querystatus.cxx b/sfx2/source/control/querystatus.cxx index f57d3a3d32f2..8688740ce0fb 100644 --- a/sfx2/source/control/querystatus.cxx +++ b/sfx2/source/control/querystatus.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: querystatus.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index ef47fc088e32..88a52d0ad0bf 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: request.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -869,7 +866,7 @@ com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > SfxRe com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - (pView ? pView : SfxViewFrame::Current())->GetFrame()->GetFrameInterface(), + (pView ? pView : SfxViewFrame::Current())->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); if(xSet.is()) diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx index f7bf79f8a0f6..f6bb2b2c3004 100644 --- a/sfx2/source/control/sfxstatuslistener.cxx +++ b/sfx2/source/control/sfxstatuslistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxstatuslistener.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 7c88c4bef24a..f3df5dc36d0c 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shell.cxx,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1260,7 +1257,7 @@ long DispatcherUpdate_Impl( void*, void* pArg ) void SfxShell::UIFeatureChanged() { SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->IsVisible_Impl() ) + if ( pFrame && pFrame->IsVisible() ) { // Auch dann Update erzwingen, wenn Dispatcher schon geupdated ist, // sonst bleibt evtl. irgendwas in den gebunkerten Tools stecken. diff --git a/sfx2/source/control/sorgitm.cxx b/sfx2/source/control/sorgitm.cxx index e38c91001456..cb24fe34e9b6 100644 --- a/sfx2/source/control/sorgitm.cxx +++ b/sfx2/source/control/sorgitm.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sorgitm.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/control/srchitem.cxx b/sfx2/source/control/srchitem.cxx deleted file mode 100644 index 5702103e3398..000000000000 --- a/sfx2/source/control/srchitem.cxx +++ /dev/null @@ -1,665 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: srchitem.cxx,v $ - * $Revision: 1.24 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -// include --------------------------------------------------------------- - -#ifndef __SBX_SBXVARIABLE_HXX -#include <basic/sbxvar.hxx> -#endif -#include <unotools/searchopt.hxx> -#include <com/sun/star/util/XReplaceable.hpp> -#include <com/sun/star/util/XSearchable.hpp> -#include <com/sun/star/util/XSearchDescriptor.hpp> -#include <com/sun/star/util/XPropertyReplace.hpp> -#include <com/sun/star/util/XReplaceDescriptor.hpp> -#include <com/sun/star/lang/Locale.hpp> - -#include <svl/memberid.hrc> -#include <i18npool/mslangid.hxx> - -#ifndef GCC -#endif - -#define _SVX_SRCHITEM_CXX - -#include <sfx2/sfxsids.hrc> -#define ITEMID_SEARCH SID_SEARCH_ITEM -#include <sfx2/srchitem.hxx> - -#include <sfx2/sfxuno.hxx> - -using namespace utl; -using namespace com::sun::star::beans; -using namespace com::sun::star::i18n; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::util; - -#define CFG_ROOT_NODE "Office.Common/SearchOptions" - -#define SRCH_PARAMS 11 -#define SRCH_PARA_OPTIONS "Options" -#define SRCH_PARA_FAMILY "Family" -#define SRCH_PARA_COMMAND "Command" -#define SRCH_PARA_CELLTYPE "CellType" -#define SRCH_PARA_APPFLAG "AppFlag" -#define SRCH_PARA_ROWDIR "RowDirection" -#define SRCH_PARA_ALLTABLES "AllTables" -#define SRCH_PARA_BACKWARD "Backward" -#define SRCH_PARA_PATTERN "Pattern" -#define SRCH_PARA_CONTENT "Content" -#define SRCH_PARA_ASIANOPT "AsianOptions" - -// STATIC DATA ----------------------------------------------------------- - -TYPEINIT1_FACTORY(SvxSearchItem, SfxPoolItem, new SvxSearchItem(0)); - -// ----------------------------------------------------------------------- - -static Sequence< ::rtl::OUString > lcl_GetNotifyNames() -{ - // names of transliteration relevant properties - static const char* aTranslitNames[] = - { - "IsMatchCase", // 0 - "Japanese/IsMatchFullHalfWidthForms", // 1 - "Japanese/IsMatchHiraganaKatakana", // 2 - "Japanese/IsMatchContractions", // 3 - "Japanese/IsMatchMinusDashCho-on", // 4 - "Japanese/IsMatchRepeatCharMarks", // 5 - "Japanese/IsMatchVariantFormKanji", // 6 - "Japanese/IsMatchOldKanaForms", // 7 - "Japanese/IsMatch_DiZi_DuZu", // 8 - "Japanese/IsMatch_BaVa_HaFa", // 9 - "Japanese/IsMatch_TsiThiChi_DhiZi", // 10 - "Japanese/IsMatch_HyuIyu_ByuVyu", // 11 - "Japanese/IsMatch_SeShe_ZeJe", // 12 - "Japanese/IsMatch_IaIya", // 13 - "Japanese/IsMatch_KiKu", // 14 - "Japanese/IsIgnorePunctuation", // 15 - "Japanese/IsIgnoreWhitespace", // 16 - "Japanese/IsIgnoreProlongedSoundMark", // 17 - "Japanese/IsIgnoreMiddleDot" // 18 - }; - - const int nCount = sizeof( aTranslitNames ) / sizeof( aTranslitNames[0] ); - Sequence< ::rtl::OUString > aNames( nCount ); - ::rtl::OUString* pNames = aNames.getArray(); - for (INT32 i = 0; i < nCount; ++i) - pNames[i] = ::rtl::OUString::createFromAscii( aTranslitNames[i] ); - - return aNames; -} - -// ----------------------------------------------------------------------- -SvxSearchItem::SvxSearchItem( const sal_uInt16 nId ) : - - SfxPoolItem( nId ), - ConfigItem( ::rtl::OUString::createFromAscii( CFG_ROOT_NODE ) ), - - aSearchOpt ( SearchAlgorithms_ABSOLUTE, - SearchFlags::LEV_RELAXED, - ::rtl::OUString(), - ::rtl::OUString(), - Locale(), - 2, 2, 2, - TransliterationModules_IGNORE_CASE ), - eFamily ( SFX_STYLE_FAMILY_PARA ), - nCommand ( 0 ), - nCellType ( SVX_SEARCHIN_FORMULA ), - nAppFlag ( SVX_SEARCHAPP_WRITER ), - bRowDirection ( sal_True ), - bAllTables ( sal_False ), - bNotes ( sal_False), - bBackward ( sal_False ), - bPattern ( sal_False ), - bContent ( sal_False ), - bAsianOptions ( FALSE ) -{ - EnableNotification( lcl_GetNotifyNames() ); - - SvtSearchOptions aOpt; - - bBackward = aOpt.IsBackwards(); - bAsianOptions = aOpt.IsUseAsianOptions(); - bNotes = aOpt.IsNotes(); - - if (aOpt.IsUseRegularExpression()) - aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; - if (aOpt.IsSimilaritySearch()) - aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; - if (aOpt.IsWholeWordsOnly()) - aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY; - - INT32 &rFlags = aSearchOpt.transliterateFlags; - - if (!aOpt.IsMatchCase()) - rFlags |= TransliterationModules_IGNORE_CASE; - if ( aOpt.IsMatchFullHalfWidthForms()) - rFlags |= TransliterationModules_IGNORE_WIDTH; - if ( aOpt.IsMatchHiraganaKatakana()) - rFlags |= TransliterationModules_IGNORE_KANA; - if ( aOpt.IsMatchContractions()) - rFlags |= TransliterationModules_ignoreSize_ja_JP; - if ( aOpt.IsMatchMinusDashChoon()) - rFlags |= TransliterationModules_ignoreMinusSign_ja_JP; - if ( aOpt.IsMatchRepeatCharMarks()) - rFlags |= TransliterationModules_ignoreIterationMark_ja_JP; - if ( aOpt.IsMatchVariantFormKanji()) - rFlags |= TransliterationModules_ignoreTraditionalKanji_ja_JP; - if ( aOpt.IsMatchOldKanaForms()) - rFlags |= TransliterationModules_ignoreTraditionalKana_ja_JP; - if ( aOpt.IsMatchDiziDuzu()) - rFlags |= TransliterationModules_ignoreZiZu_ja_JP; - if ( aOpt.IsMatchBavaHafa()) - rFlags |= TransliterationModules_ignoreBaFa_ja_JP; - if ( aOpt.IsMatchTsithichiDhizi()) - rFlags |= TransliterationModules_ignoreTiJi_ja_JP; - if ( aOpt.IsMatchHyuiyuByuvyu()) - rFlags |= TransliterationModules_ignoreHyuByu_ja_JP; - if ( aOpt.IsMatchSesheZeje()) - rFlags |= TransliterationModules_ignoreSeZe_ja_JP; - if ( aOpt.IsMatchIaiya()) - rFlags |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP; - if ( aOpt.IsMatchKiku()) - rFlags |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP; - if ( aOpt.IsIgnorePunctuation()) - rFlags |= TransliterationModules_ignoreSeparator_ja_JP; - if ( aOpt.IsIgnoreWhitespace()) - rFlags |= TransliterationModules_ignoreSpace_ja_JP; - if ( aOpt.IsIgnoreProlongedSoundMark()) - rFlags |= TransliterationModules_ignoreProlongedSoundMark_ja_JP; - if ( aOpt.IsIgnoreMiddleDot()) - rFlags |= TransliterationModules_ignoreMiddleDot_ja_JP; -} - -// ----------------------------------------------------------------------- - -SvxSearchItem::SvxSearchItem( const SvxSearchItem& rItem ) : - - SfxPoolItem ( rItem ), - ConfigItem( ::rtl::OUString::createFromAscii( CFG_ROOT_NODE ) ), - - aSearchOpt ( rItem.aSearchOpt ), - eFamily ( rItem.eFamily ), - nCommand ( rItem.nCommand ), - nCellType ( rItem.nCellType ), - nAppFlag ( rItem.nAppFlag ), - bRowDirection ( rItem.bRowDirection ), - bAllTables ( rItem.bAllTables ), - bNotes ( rItem.bNotes), - bBackward ( rItem.bBackward ), - bPattern ( rItem.bPattern ), - bContent ( rItem.bContent ), - bAsianOptions ( rItem.bAsianOptions ) -{ - EnableNotification( lcl_GetNotifyNames() ); -} - -// ----------------------------------------------------------------------- - -SvxSearchItem::~SvxSearchItem() -{ -} - -// ----------------------------------------------------------------------- -SfxPoolItem* SvxSearchItem::Clone( SfxItemPool *) const -{ - return new SvxSearchItem(*this); -} - -// ----------------------------------------------------------------------- - -//! used below -static BOOL operator == ( const SearchOptions& rItem1, const SearchOptions& rItem2 ) -{ - return rItem1.algorithmType == rItem2.algorithmType && - rItem1.searchFlag == rItem2.searchFlag && - rItem1.searchString == rItem2.searchString && - rItem1.replaceString == rItem2.replaceString && - //rItem1.Locale == rItem2.Locale && - rItem1.changedChars == rItem2.changedChars && - rItem1.deletedChars == rItem2.deletedChars && - rItem1.insertedChars == rItem2.insertedChars && - rItem1.transliterateFlags == rItem2.transliterateFlags; -} - - -int SvxSearchItem::operator==( const SfxPoolItem& rItem ) const -{ - DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal which or type" ); - const SvxSearchItem &rSItem = (SvxSearchItem &) rItem; - return ( nCommand == rSItem.nCommand ) && - ( bBackward == rSItem.bBackward ) && - ( bPattern == rSItem.bPattern ) && - ( bContent == rSItem.bContent ) && - ( eFamily == rSItem.eFamily ) && - ( bRowDirection == rSItem.bRowDirection ) && - ( bAllTables == rSItem.bAllTables ) && - ( nCellType == rSItem.nCellType ) && - ( nAppFlag == rSItem.nAppFlag ) && - ( bAsianOptions == rSItem.bAsianOptions ) && - ( aSearchOpt == rSItem.aSearchOpt ) && - ( bNotes == rSItem.bNotes ); -} - - -//------------------------------------------------------------------------ - -SfxItemPresentation SvxSearchItem::GetPresentation -( - SfxItemPresentation , - SfxMapUnit , - SfxMapUnit , - XubString& , - const IntlWrapper * -) const -{ - return SFX_ITEM_PRESENTATION_NONE; -} - -void SvxSearchItem::GetFromDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor >& rDescr ) -{ - SetSearchString( rDescr->getSearchString() ); - ::com::sun::star::uno::Any aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchWords") ); - sal_Bool bTemp = false; - aAny >>= bTemp ; - SetWordOnly( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchCaseSensitive") ); - aAny >>= bTemp ; - SetExact( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchBackwards") ); - aAny >>= bTemp ; - SetBackward( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchInSelection") ); - aAny >>= bTemp ; - SetSelection( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchRegularExpression") ); - aAny >>= bTemp ; - SetRegExp( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarity") ); - aAny >>= bTemp ; - SetLevenshtein( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRelax") ); - aAny >>= bTemp ; - SetLEVRelaxed( bTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityExchange") ); - sal_Int16 nTemp = 0; - aAny >>= nTemp ; - SetLEVOther( nTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRemove") ); - aAny >>= nTemp ; - SetLEVShorter( nTemp ); - aAny = rDescr->getPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityAdd") ); - aAny >>= nTemp ; - SetLEVLonger( nTemp ); -} - -void SvxSearchItem::SetToDescriptor( ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > & rDescr ) -{ - rDescr->setSearchString( GetSearchString() ); - ::com::sun::star::uno::Any aAny; - aAny <<= GetWordOnly() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchWords"), aAny ); - aAny <<= GetExact() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchCaseSensitive"), aAny ); - aAny <<= GetBackward() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchBackwards"), aAny ); - aAny <<= GetSelection() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchInSelection"), aAny ); - aAny <<= GetRegExp() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchRegularExpression"), aAny ); - aAny <<= IsLevenshtein() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarity"), aAny ); - aAny <<= IsLEVRelaxed() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRelax"), aAny ); - aAny <<= GetLEVOther() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityExchange"), aAny ); - aAny <<= GetLEVShorter() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityRemove"), aAny ); - aAny <<= GetLEVLonger() ; - rDescr->setPropertyValue( DEFINE_CONST_UNICODE("SearchSimilarityAdd"), aAny ); -} - - -void SvxSearchItem::Notify( const Sequence< ::rtl::OUString > & ) -{ - // applies transliteration changes in the configuration database - // to the current SvxSearchItem - SetTransliterationFlags( SvtSearchOptions().GetTransliterationFlags() ); -} - -void SvxSearchItem::Commit() -{ -} - -void SvxSearchItem::SetMatchFullHalfWidthForms( sal_Bool bVal ) -{ - if (bVal) - aSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_WIDTH; - else - aSearchOpt.transliterateFlags &= ~TransliterationModules_IGNORE_WIDTH; -} - - -void SvxSearchItem::SetWordOnly( sal_Bool bVal ) -{ - if (bVal) - aSearchOpt.searchFlag |= SearchFlags::NORM_WORD_ONLY; - else - aSearchOpt.searchFlag &= ~SearchFlags::NORM_WORD_ONLY; -} - - -void SvxSearchItem::SetExact( sal_Bool bVal ) -{ - if (!bVal) - aSearchOpt.transliterateFlags |= TransliterationModules_IGNORE_CASE; - else - aSearchOpt.transliterateFlags &= ~TransliterationModules_IGNORE_CASE; -} - - -void SvxSearchItem::SetSelection( sal_Bool bVal ) -{ - if (bVal) - { - aSearchOpt.searchFlag |= (SearchFlags::REG_NOT_BEGINOFLINE | - SearchFlags::REG_NOT_ENDOFLINE); - } - else - { - aSearchOpt.searchFlag &= ~(SearchFlags::REG_NOT_BEGINOFLINE | - SearchFlags::REG_NOT_ENDOFLINE); - } -} - - -void SvxSearchItem::SetRegExp( sal_Bool bVal ) -{ - if ( bVal ) - aSearchOpt.algorithmType = SearchAlgorithms_REGEXP; - else if ( SearchAlgorithms_REGEXP == aSearchOpt.algorithmType ) - aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; -} - - -void SvxSearchItem::SetLEVRelaxed( sal_Bool bVal ) -{ - if (bVal) - aSearchOpt.searchFlag |= SearchFlags::LEV_RELAXED; - else - aSearchOpt.searchFlag &= ~SearchFlags::LEV_RELAXED; -} - - -void SvxSearchItem::SetLevenshtein( sal_Bool bVal ) -{ - if ( bVal ) - aSearchOpt.algorithmType = SearchAlgorithms_APPROXIMATE; - else if ( SearchAlgorithms_APPROXIMATE == aSearchOpt.algorithmType ) - aSearchOpt.algorithmType = SearchAlgorithms_ABSOLUTE; -} - - -void SvxSearchItem::SetTransliterationFlags( sal_Int32 nFlags ) -{ - aSearchOpt.transliterateFlags = nFlags; -} - -sal_Bool SvxSearchItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId ) const -{ - nMemberId &= ~CONVERT_TWIPS; - switch ( nMemberId ) - { - case 0 : - { - Sequence< PropertyValue > aSeq( SRCH_PARAMS ); - aSeq[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_OPTIONS ) ); - aSeq[0].Value <<= aSearchOpt; - aSeq[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_FAMILY )); - aSeq[1].Value <<= sal_Int16( eFamily ); - aSeq[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_COMMAND )); - aSeq[2].Value <<= nCommand; - aSeq[3].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_CELLTYPE )); - aSeq[3].Value <<= nCellType; - aSeq[4].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_APPFLAG )); - aSeq[4].Value <<= nAppFlag; - aSeq[5].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_ROWDIR )); - aSeq[5].Value <<= bRowDirection; - aSeq[6].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_ALLTABLES )); - aSeq[6].Value <<= bAllTables; - aSeq[7].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_BACKWARD )); - aSeq[7].Value <<= bBackward; - aSeq[8].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_PATTERN )); - aSeq[8].Value <<= bPattern; - aSeq[9].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_CONTENT )); - aSeq[9].Value <<= bContent; - aSeq[10].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SRCH_PARA_ASIANOPT )); - aSeq[10].Value <<= bAsianOptions; - rVal <<= aSeq; - } - break; - case MID_SEARCH_COMMAND: - rVal <<= (sal_Int16) nCommand; break; - case MID_SEARCH_STYLEFAMILY: - rVal <<= (sal_Int16) eFamily; break; - case MID_SEARCH_CELLTYPE: - rVal <<= (sal_Int32) nCellType; break; - case MID_SEARCH_ROWDIRECTION: - rVal <<= (sal_Bool) bRowDirection; break; - case MID_SEARCH_ALLTABLES: - rVal <<= (sal_Bool) bAllTables; break; - case MID_SEARCH_BACKWARD: - rVal <<= (sal_Bool) bBackward; break; - case MID_SEARCH_PATTERN: - rVal <<= (sal_Bool) bPattern; break; - case MID_SEARCH_CONTENT: - rVal <<= (sal_Bool) bContent; break; - case MID_SEARCH_ASIANOPTIONS: - rVal <<= (sal_Bool) bAsianOptions; break; - case MID_SEARCH_ALGORITHMTYPE: - rVal <<= (sal_Int16) aSearchOpt.algorithmType; break; - case MID_SEARCH_FLAGS: - rVal <<= aSearchOpt.searchFlag; break; - case MID_SEARCH_SEARCHSTRING: - rVal <<= aSearchOpt.searchString; break; - case MID_SEARCH_REPLACESTRING: - rVal <<= aSearchOpt.replaceString; break; - case MID_SEARCH_CHANGEDCHARS: - rVal <<= aSearchOpt.changedChars; break; - case MID_SEARCH_DELETEDCHARS: - rVal <<= aSearchOpt.deletedChars; break; - case MID_SEARCH_INSERTEDCHARS: - rVal <<= aSearchOpt.insertedChars; break; - case MID_SEARCH_TRANSLITERATEFLAGS: - rVal <<= aSearchOpt.transliterateFlags; break; - case MID_SEARCH_LOCALE: - { - sal_Int16 nLocale; - if (aSearchOpt.Locale.Language.getLength() || aSearchOpt.Locale.Country.getLength() ) - nLocale = MsLangId::convertLocaleToLanguage( aSearchOpt.Locale ); - else - nLocale = LANGUAGE_NONE; - rVal <<= nLocale; - break; - } - - default: - DBG_ERRORFILE( "SvxSearchItem::QueryValue(): Unknown MemberId" ); - return sal_False; - } - - return sal_True; -} - -// ----------------------------------------------------------------------- - -sal_Bool SvxSearchItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId ) -{ - nMemberId &= ~CONVERT_TWIPS; - sal_Bool bRet = sal_False; - sal_Int32 nInt = 0; - switch ( nMemberId ) - { - case 0 : - { - Sequence< PropertyValue > aSeq; - if ( ( rVal >>= aSeq ) && ( aSeq.getLength() == SRCH_PARAMS ) ) - { - sal_Int16 nConvertedCount( 0 ); - for ( sal_Int32 i = 0; i < aSeq.getLength(); ++i ) - { - if ( aSeq[i].Name.equalsAscii( SRCH_PARA_OPTIONS ) ) - { - if ( ( aSeq[i].Value >>= aSearchOpt ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_FAMILY ) ) - { - sal_uInt16 nTemp( 0 ); - if ( ( aSeq[i].Value >>= nTemp ) == sal_True ) - { - eFamily = SfxStyleFamily( nTemp ); - ++nConvertedCount; - } - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_COMMAND ) ) - { - if ( ( aSeq[i].Value >>= nCommand ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_CELLTYPE ) ) - { - if ( ( aSeq[i].Value >>= nCellType ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_APPFLAG ) ) - { - if ( ( aSeq[i].Value >>= nAppFlag ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_ROWDIR ) ) - { - if ( ( aSeq[i].Value >>= bRowDirection ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_ALLTABLES ) ) - { - if ( ( aSeq[i].Value >>= bAllTables ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_BACKWARD ) ) - { - if ( ( aSeq[i].Value >>= bBackward ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_PATTERN ) ) - { - if ( ( aSeq[i].Value >>= bPattern ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_CONTENT ) ) - { - if ( ( aSeq[i].Value >>= bContent ) == sal_True ) - ++nConvertedCount; - } - else if ( aSeq[i].Name.equalsAscii( SRCH_PARA_ASIANOPT ) ) - { - if ( ( aSeq[i].Value >>= bAsianOptions ) == sal_True ) - ++nConvertedCount; - } - } - - bRet = ( nConvertedCount == SRCH_PARAMS ); - } - break; - } - case MID_SEARCH_COMMAND: - bRet = (rVal >>= nInt); nCommand = (sal_uInt16) nInt; break; - case MID_SEARCH_STYLEFAMILY: - bRet = (rVal >>= nInt); eFamily = (SfxStyleFamily) (sal_Int16) nInt; break; - case MID_SEARCH_CELLTYPE: - bRet = (rVal >>= nInt); nCellType = (sal_uInt16) nInt; break; - case MID_SEARCH_ROWDIRECTION: - bRet = (rVal >>= bRowDirection); break; - case MID_SEARCH_ALLTABLES: - bRet = (rVal >>= bAllTables); break; - case MID_SEARCH_BACKWARD: - bRet = (rVal >>= bBackward); break; - case MID_SEARCH_PATTERN: - bRet = (rVal >>= bPattern); break; - case MID_SEARCH_CONTENT: - bRet = (rVal >>= bContent); break; - case MID_SEARCH_ASIANOPTIONS: - bRet = (rVal >>= bAsianOptions); break; - case MID_SEARCH_ALGORITHMTYPE: - bRet = (rVal >>= nInt); aSearchOpt.algorithmType = (SearchAlgorithms)(sal_Int16)nInt; break; - case MID_SEARCH_FLAGS: - bRet = (rVal >>= aSearchOpt.searchFlag); break; - case MID_SEARCH_SEARCHSTRING: - bRet = (rVal >>= aSearchOpt.searchString); break; - case MID_SEARCH_REPLACESTRING: - bRet = (rVal >>= aSearchOpt.replaceString); break; - case MID_SEARCH_CHANGEDCHARS: - bRet = (rVal >>= aSearchOpt.changedChars); break; - case MID_SEARCH_DELETEDCHARS: - bRet = (rVal >>= aSearchOpt.deletedChars); break; - case MID_SEARCH_INSERTEDCHARS: - bRet = (rVal >>= aSearchOpt.insertedChars); break; - case MID_SEARCH_TRANSLITERATEFLAGS: - bRet = (rVal >>= aSearchOpt.transliterateFlags); break; - case MID_SEARCH_LOCALE: - { - bRet = (rVal >>= nInt); - if ( bRet ) - { - if ( nInt == LANGUAGE_NONE ) - { - aSearchOpt.Locale = ::com::sun::star::lang::Locale(); - } - else - { - MsLangId::convertLanguageToLocale( (sal_Int16) nInt, aSearchOpt.Locale ); - } - } - break; - } - default: - DBG_ERROR( "Unknown MemberId" ); - } - - return bRet; -} - - diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 527851e7664a..3fdd14369856 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: statcach.cxx,v $ - * $Revision: 1.36.180.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -345,7 +342,7 @@ const SfxSlotServer* SfxStateCache::GetSlotServer( SfxDispatcher &rDispat , cons else if ( rDispat.GetFrame() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > xFrameProv( - rDispat.GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + rDispat.GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); if ( xFrameProv != xProv ) return GetSlotServer( rDispat, xFrameProv ); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index f33f898237f9..d2ad8c645eb7 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: unoctitm.cxx,v $ - * $Revision: 1.58 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -220,8 +217,8 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !pBindings->GetDispatcher_Impl() || !pBindings->GetDispatcher_Impl()->GetFrame() ) return; - SfxFrame *pFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); - SfxFrame *pParent = pFrame->GetParentFrame(); + SfxFrame& rFrame = pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(); + SfxFrame *pParent = rFrame.GetParentFrame(); if ( pParent ) // parent may intercept xDispatch = TryGetDispatch( pParent ); @@ -229,7 +226,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !xDispatch.is() ) { // no interception - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = rFrame.GetFrameInterface(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) xDispatch = xProv->queryDispatch( aCommand, ::rtl::OUString(), 0 ); @@ -253,7 +250,7 @@ void SfxUnoControllerItem::GetNewDispatch() if ( !xDisp.is() && pFrame->HasComponent() ) { // no interception - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame = pFrame->GetFrameInterface(); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) xDisp = xProv->queryDispatch( aCommand, ::rtl::OUString(), 0 ); @@ -755,11 +752,11 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util { SfxViewFrame* pViewFrame = pDispatcher->GetFrame(); if (pViewFrame) - xFrameRef = pViewFrame->GetFrame()->GetFrameInterface(); + xFrameRef = pViewFrame->GetFrame().GetFrameInterface(); } SfxAllItemSet aInternalSet( SFX_APP()->GetPool() ); if (xFrameRef.is()) // an empty set is no problem ... but an empty frame reference can be a problem ! - aInternalSet.Put( SfxUnoAnyItem( SID_FILLFRAME, css::uno::makeAny(xFrameRef) ) ); + aInternalSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrameRef ) ); sal_Bool bSuccess = sal_False; sal_Bool bFailure = sal_False; diff --git a/sfx2/source/dialog/about.cxx b/sfx2/source/dialog/about.cxx index 6aed793a2daa..15f9452fd903 100644 --- a/sfx2/source/dialog/about.cxx +++ b/sfx2/source/dialog/about.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: about.cxx,v $ - * $Revision: 1.41.4.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,6 +38,8 @@ #include <unotools/bootstrap.hxx> #include <com/sun/star/uno/Any.h> #include <unotools/configmgr.hxx> +#include <vcl/graph.hxx> +#include <svtools/filter.hxx> #include <sfx2/sfxuno.hxx> #include "about.hxx" #include "sfx2/sfxresid.hxx" @@ -84,8 +83,15 @@ static bool impl_loadBitmap( SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { - Bitmap aBmp; - aStrm >> aBmp; + // Use graphic class to also support more graphic formats (bmp,png,...) + Graphic aGraphic; + + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + + // Default case, we load the intro bitmap from a seperate file + // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) + BitmapEx aBmp = aGraphic.GetBitmapEx(); rLogo = Image( aBmp ); return true; } @@ -103,6 +109,7 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS aDeveloperAry ( ResId( ABOUT_STR_DEVELOPER_ARY, *rId.GetResMgr() ) ), aDevVersionStr ( rVerStr ), aAccelStr ( ResId( ABOUT_STR_ACCEL, *rId.GetResMgr() ) ), + aCopyrightTextStr( ResId( ABOUT_STR_COPYRIGHT, *rId.GetResMgr() ) ), aTimer (), nOff ( 0 ), m_nDeltaWidth ( 0 ), @@ -149,14 +156,22 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS { bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program/edition" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); } if ( !bLoaded ) { bLoaded = impl_loadBitmap( rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), - rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); + rtl::OUString::createFromAscii( "about.png" ), aAppLogo ); + if ( !bLoaded ) + bLoaded = impl_loadBitmap( + rtl::OUString::createFromAscii( "$BRAND_BASE_DIR/program" ), + rtl::OUString::createFromAscii( "about.bmp" ), aAppLogo ); } // Transparenter Font @@ -229,46 +244,40 @@ AboutDialog::AboutDialog( Window* pParent, const ResId& rId, const String& rVerS // determine size and position of the dialog & elements Size aAppLogoSiz = aAppLogo.GetSizePixel(); - Size aOutSiz = GetOutputSizePixel(); - aOutSiz.Width() = aAppLogoSiz.Width(); - // spacing to the margin - Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); - long nDlgMargin = a6Size.Width() * 4 ; - // The URL (if found in copyright text) should not be line-wrapped - if ( aCopyrightText.GetText().Search( WELCOME_URL ) != STRING_NOTFOUND ) - { - long nURLWidth = GetTextWidth( WELCOME_URL ) + nDlgMargin + (2*SPACE_OFFSET); - if ( nURLWidth > aAppLogoSiz.Width() ) - { - // pb: can be used to align the position of the logo - // m_nDeltaWidth = nURLWidth - aOutSiz.Width(); + Size aOutSiz = GetOutputSizePixel(); + aOutSiz.Width() = aAppLogoSiz.Width(); - aOutSiz.Width() = nURLWidth; - } - } + Size a6Size = aVersionText.LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); + long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); + long nDlgMargin = a6Size.Width() * 4 ; + long nCtrlMargin = a6Size.Height() * 2; + long nTextWidth = aOutSiz.Width() - nDlgMargin; - // layout the text-elements - long nTextWidth = aOutSiz.Width() - nDlgMargin; - long nY = aAppLogoSiz.Height() + ( a6Size.Height() * 2 ); + aCopyrightText.SetText( aCopyrightTextStr ); layoutText( aVersionText, nY, nTextWidth, a6Size ); - nY += ( a6Size.Height() / 3 ); - layoutText( aCopyrightText, nY, nTextWidth, a6Size ); - nY += ( a6Size.Height() / 3 ); - if( aBuildString.Len() > 0 ) - { - layoutText( aBuildData, nY, nTextWidth, a6Size ); - nY += ( a6Size.Height() / 2 ); - } + nY += nCtrlMargin; // OK-Button-Position (at the bottom and centered) Size aOKSiz = aOKButton.GetSizePixel(); Point aOKPnt = aOKButton.GetPosPixel(); + + // Multiline edit with Copyright-Text + Point aCopyPnt = aCopyrightText.GetPosPixel(); + Size aCopySize = aCopyrightText.GetSizePixel(); + aCopySize.Width() = nTextWidth; + aCopySize.Height() = aOutSiz.Height() - nY - ( aOKSiz.Height() * 2 ) - nCtrlMargin; + + aCopyPnt.X() = ( aOutSiz.Width() - aCopySize.Width() ) / 2; + aCopyPnt.Y() = nY; + aCopyrightText.SetPosSizePixel( aCopyPnt, aCopySize ); + + nY += aCopySize.Height() + nCtrlMargin; aOKPnt.X() = ( aOutSiz.Width() - aOKSiz.Width() ) / 2; - aOKPnt.Y() = nY + 8; + aOKPnt.Y() = nY; aOKButton.SetPosPixel( aOKPnt ); - nY = aOKPnt.Y() + aOKSiz.Height() + a6Size.Height(); - aOutSiz.Height() = nY; + + // Change the width of the dialog SetOutputSizePixel( aOutSiz ); FreeResource(); diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index 90c5b4cdfbae..13a0433b7be5 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: alienwarn.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/alienwarn.hrc b/sfx2/source/dialog/alienwarn.hrc index 74630c9724d4..e3a23dc57836 100644 --- a/sfx2/source/dialog/alienwarn.hrc +++ b/sfx2/source/dialog/alienwarn.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: alienwarn.hrc,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/alienwarn.src b/sfx2/source/dialog/alienwarn.src index 5047735ae9d6..7aa6f3230778 100644 --- a/sfx2/source/dialog/alienwarn.src +++ b/sfx2/source/dialog/alienwarn.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: alienwarn.src,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index 59f51449c3f1..5b0a42a20444 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: basedlgs.cxx,v $ - * $Revision: 1.33 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -50,7 +47,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/childwin.hxx> #include <sfx2/viewsh.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include "workwin.hxx" #include "sfx2/sfxresid.hxx" #include "dialog.hrc" @@ -429,7 +426,7 @@ long SfxModelessDialog::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); } else if ( rEvt.GetType() == EVENT_LOSEFOCUS && !HasChildPathFocus() ) { @@ -531,7 +528,7 @@ long SfxFloatingWindow::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); } else if ( rEvt.GetType() == EVENT_LOSEFOCUS ) { diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index 44d9c7e346cf..f1e100e17cf5 100644 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dialog.hrc,v $ - * $Revision: 1.32.70.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index c50b17436ca6..a54d2c340d04 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dialog.src,v $ - * $Revision: 1.58 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 7d76e3ea0ad8..80ad4ee7ae22 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dinfdlg.cxx,v $ - * $Revision: 1.43.42.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1603,8 +1600,8 @@ class DurationDialog_Impl : public ModalDialog NumericField aMinuteNF; FixedText aSecondFT; NumericField aSecondNF; - FixedText aHSecondFT; - NumericField aHSecondNF; + FixedText aMSecondFT; + NumericField aMSecondNF; public: @@ -1616,8 +1613,9 @@ public: /*-- 20.11.2009 15:40:46--------------------------------------------------- -----------------------------------------------------------------------*/ -DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& rDuration ) : - ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), +DurationDialog_Impl::DurationDialog_Impl( + Window* pParent, const util::Duration& rDuration) + : ModalDialog( pParent, SfxResId( RID_EDIT_DURATIONS ) ), aDurationFL(this, SfxResId( FL_DURATION )), aOKPB( this, SfxResId( PB_OK )), aCancelPB( this, SfxResId( PB_CANCEL )), @@ -1635,8 +1633,8 @@ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& aMinuteNF( this, SfxResId( ED_MINUTE )), aSecondFT( this, SfxResId( FT_SECOND )), aSecondNF( this, SfxResId( ED_SECOND )), - aHSecondFT( this, SfxResId( FT_HSECOND )), - aHSecondNF( this, SfxResId( ED_HSECOND )) + aMSecondFT( this, SfxResId( FT_MSECOND )), + aMSecondNF( this, SfxResId( ED_MSECOND )) { FreeResource(); aNegativeCB.Check(rDuration.Negative); @@ -1646,7 +1644,7 @@ DurationDialog_Impl::DurationDialog_Impl( Window* pParent, const util::Duration& aHourNF.SetValue(rDuration.Hours ); aMinuteNF.SetValue(rDuration.Minutes); aSecondNF.SetValue(rDuration.Seconds); - aHSecondNF.SetValue(rDuration.HundredthSeconds); + aMSecondNF.SetValue(rDuration.MilliSeconds); } /*-- 20.11.2009 16:08:55--------------------------------------------------- @@ -1667,7 +1665,7 @@ util::Duration DurationDialog_Impl::GetDuration() const aRet.Hours = aHourNF.GetValue( ); aRet.Minutes = aMinuteNF.GetValue(); aRet.Seconds = aSecondNF.GetValue(); - aRet.HundredthSeconds = aHSecondNF.GetValue(); + aRet.MilliSeconds = aMSecondNF.GetValue(); return aRet; } diff --git a/sfx2/source/dialog/dinfdlg.hrc b/sfx2/source/dialog/dinfdlg.hrc index 49647c40e3ee..5453e3606026 100644 --- a/sfx2/source/dialog/dinfdlg.hrc +++ b/sfx2/source/dialog/dinfdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dinfdlg.hrc,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -172,8 +169,8 @@ #define ED_MINUTE 113 #define FT_SECOND 114 #define ED_SECOND 115 -#define FT_HSECOND 116 -#define ED_HSECOND 117 +#define FT_MSECOND 116 +#define ED_MSECOND 117 #define FL_DURATION 118 #endif diff --git a/sfx2/source/dialog/dinfdlg.src b/sfx2/source/dialog/dinfdlg.src index 3cad63ecb565..99a062c4aecf 100644 --- a/sfx2/source/dialog/dinfdlg.src +++ b/sfx2/source/dialog/dinfdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dinfdlg.src,v $ - * $Revision: 1.55 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -880,14 +877,14 @@ ModalDialog RID_EDIT_DURATIONS SpinSize = 1 ; Value = 0 ; }; - FixedText FT_HSECOND + FixedText FT_MSECOND { Pos = MAP_APPFONT ( 6 , 122 ) ; Size = MAP_APPFONT ( 60 , RSC_CD_FIXEDTEXT_HEIGHT ) ; Left = TRUE ; - Text [ en-US ] = "1/100 se~conds" ; + Text [ en-US ] = "Millise~conds" ; }; - NumericField ED_HSECOND + NumericField ED_MSECOND { Border = TRUE ; Pos = MAP_APPFONT ( 70 , 120 ) ; @@ -896,7 +893,7 @@ ModalDialog RID_EDIT_DURATIONS Spin = TRUE ; Minimum = 0 ; First = 1 ; - Last = 100 ; + Last = 1000 ; SpinSize = 1 ; Value = 0 ; }; diff --git a/sfx2/source/dialog/dinfedt.cxx b/sfx2/source/dialog/dinfedt.cxx index 185f026bf868..5c250f7cc912 100644 --- a/sfx2/source/dialog/dinfedt.cxx +++ b/sfx2/source/dialog/dinfedt.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dinfedt.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/dinfedt.hrc b/sfx2/source/dialog/dinfedt.hrc index 9a1824bc9c7f..ef52362af2cb 100644 --- a/sfx2/source/dialog/dinfedt.hrc +++ b/sfx2/source/dialog/dinfedt.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dinfedt.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/dinfedt.src b/sfx2/source/dialog/dinfedt.src index edfa6c631bd4..7f4875487536 100644 --- a/sfx2/source/dialog/dinfedt.src +++ b/sfx2/source/dialog/dinfedt.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dinfedt.src,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index 0b278a55872b..c78568757b77 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: dockwin.cxx,v $ - * $Revision: 1.48 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -47,7 +44,7 @@ #include "workwin.hxx" #include "splitwin.hxx" #include <sfx2/viewsh.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/objsh.hxx> #include <com/sun/star/frame/XController.hpp> @@ -164,7 +161,7 @@ SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd , if (xFactoryMgr.is()) { SfxDispatcher* pDispatcher = pBindings->GetDispatcher(); - uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY ); + uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); uno::Sequence< uno::Any > aArgs(2); beans::PropertyValue aPropValue; aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); @@ -1855,7 +1852,7 @@ long SfxDockingWindow::Notify( NotifyEvent& rEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame(), nHelpId ); // In VCL geht Notify zun"achst an das Fenster selbst, // also base class rufen, sonst erf"ahrt der parent nichts diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 1b5c9a6f4606..98834e93f912 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlghelper.cxx,v $ - * $Revision: 1.144 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -801,7 +798,9 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG ) aData << aBmp; - Sequence < sal_Int8 > aBuffer( (sal_Int8*) aData.GetData(), aData.GetSize() ); + const Sequence < sal_Int8 > aBuffer( + static_cast< const sal_Int8* >(aData.GetData()), + aData.GetEndOfData() ); aAny <<= aBuffer; } diff --git a/sfx2/source/dialog/filedlghelper.src b/sfx2/source/dialog/filedlghelper.src index cb025bf569e8..61df13350510 100644 --- a/sfx2/source/dialog/filedlghelper.src +++ b/sfx2/source/dialog/filedlghelper.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlghelper.src,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 2f9a7574bb2f..b023b8fb53a9 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filedlgimpl.hxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 23d016e2edc4..ab75d777c5ff 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtergrouping.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/filtergrouping.hxx b/sfx2/source/dialog/filtergrouping.hxx index f6978bb4f7f2..8075186614dd 100644 --- a/sfx2/source/dialog/filtergrouping.hxx +++ b/sfx2/source/dialog/filtergrouping.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: filtergrouping.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/intro.cxx b/sfx2/source/dialog/intro.cxx index 07f20b0801b8..637b89898a3a 100644 --- a/sfx2/source/dialog/intro.cxx +++ b/sfx2/source/dialog/intro.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: intro.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/itemconnect.cxx b/sfx2/source/dialog/itemconnect.cxx index 211afd11bc6d..51ed3bc5304a 100644 --- a/sfx2/source/dialog/itemconnect.cxx +++ b/sfx2/source/dialog/itemconnect.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: itemconnect.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 013855c2cdfc..aadaba176285 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mailmodel.cxx,v $ - * $Revision: 1.51 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/mailmodelapi.cxx b/sfx2/source/dialog/mailmodelapi.cxx deleted file mode 100644 index 75781551ca93..000000000000 --- a/sfx2/source/dialog/mailmodelapi.cxx +++ /dev/null @@ -1,712 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: mailmodelapi.cxx,v $ - * $Revision: 1.10 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -// includes -------------------------------------------------------------- -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/io/XActiveDataSink.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/mozilla/XPluginInstance.hpp> -#include <com/sun/star/ucb/XDataContainer.hpp> -#include <com/sun/star/ucb/CommandAbortedException.hpp> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/system/XSimpleMailClientSupplier.hpp> -#include <com/sun/star/system/SimpleMailClientFlags.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <rtl/textenc.h> -#include <vos/mutex.hxx> -#include <rtl/uri.h> -#include <rtl/uri.hxx> -#include <rtl/ustrbuf.hxx> -#include <unotools/streamhelper.hxx> -#include <unotools/configitem.hxx> -#include <comphelper/mediadescriptor.hxx> -#include <vos/thread.hxx> -#include <vcl/msgbox.hxx> - -#include "sfx2/mailmodelapi.hxx" -#include <sfx2/docfilt.hxx> -#include <sfx2/docfac.hxx> -#include "sfxtypes.hxx" - -#include "dialog.hrc" -#include "sfx2/sfxresid.hxx" -#include <sfx2/sfxuno.hxx> -#include <sfx2/fcontnr.hxx> -#include "guisaveas.hxx" - -#include <unotools/tempfile.hxx> -#include <vcl/svapp.hxx> -#include <svl/stritem.hxx> -#include <svl/eitem.hxx> -#include <unotools/useroptions.hxx> -#include <comphelper/processfactory.hxx> -#include <comphelper/extract.hxx> -#include <ucbhelper/content.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <tools/urlobj.hxx> - -extern sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, String& rPasswd ); - -// -------------------------------------------------------------- -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::mozilla; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::system; -using namespace ::rtl; - -namespace -{ - // functions ------------------------------------------------------------- - - BOOL CreateFromAddress_Impl( String& rFrom ) - - /* [Beschreibung] - - Diese Funktion versucht mit Hilfe des IniManagers eine From-Adresse - zu erzeugen. daf"ur werden die Felder 'Vorname', 'Name' und 'EMail' - aus der Applikations-Ini-Datei ausgelesen. Sollten diese Felder - nicht gesetzt sein, wird FALSE zur"uckgegeben. - - [R"uckgabewert] - - TRUE: Adresse konnte erzeugt werden. - FALSE: Adresse konnte nicht erzeugt werden. - */ - - { - SvtUserOptions aUserCFG; - String aName = aUserCFG.GetLastName (); - String aFirstName = aUserCFG.GetFirstName (); - if ( aFirstName.Len() || aName.Len() ) - { - if ( aFirstName.Len() ) - { - rFrom = TRIM( aFirstName ); - - if ( aName.Len() ) - rFrom += ' '; - } - rFrom += TRIM( aName ); - // unerlaubte Zeichen entfernen - rFrom.EraseAllChars( '<' ); - rFrom.EraseAllChars( '>' ); - rFrom.EraseAllChars( '@' ); - } - String aEmailName = aUserCFG.GetEmail(); - // unerlaubte Zeichen entfernen - aEmailName.EraseAllChars( '<' ); - aEmailName.EraseAllChars( '>' ); - - if ( aEmailName.Len() ) - { - if ( rFrom.Len() ) - rFrom += ' '; - ( ( rFrom += '<' ) += TRIM( aEmailName ) ) += '>'; - } - else - rFrom.Erase(); - return ( rFrom.Len() > 0 ); - } - -} - -// class OThread -class OMailSendThreadImpl : public ::vos::OThread -{ - public: - OMailSendThreadImpl( - Reference< XSimpleMailClient > xSimpleMailClient, - Reference< XSimpleMailMessage > xSimpleMailMessage, - const Reference< XFrame >& _xCurrentFrame, - long nSendFlags ) : - m_nSendFlags( nSendFlags ), - m_bSend( sal_False ), - m_xSimpleMailClient( xSimpleMailClient ), - m_xSimpleMailMessage( xSimpleMailMessage ), - m_xCurrentFrame(_xCurrentFrame) {} - - virtual ~OMailSendThreadImpl(); - - virtual void SAL_CALL run(); - virtual void SAL_CALL onTerminated(); - - private: - long m_nSendFlags; - sal_Bool m_bSend; - Reference< XSimpleMailClient > m_xSimpleMailClient; - Reference< XSimpleMailMessage > m_xSimpleMailMessage; - Reference< XFrame > m_xCurrentFrame; -}; - -OMailSendThreadImpl::~OMailSendThreadImpl() -{ -} - -void SAL_CALL OMailSendThreadImpl::run() -{ - try - { - m_xSimpleMailClient->sendSimpleMailMessage( m_xSimpleMailMessage, m_nSendFlags ); - m_bSend = sal_True; - } - catch ( IllegalArgumentException& ) - { - m_bSend = sal_False; - } - catch ( Exception& ) - { - m_bSend = sal_False; - } - - if ( m_bSend == sal_False ) - { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - Reference< ::com::sun::star::awt::XWindow > xParentWindow = m_xCurrentFrame->getContainerWindow(); - Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); - - ErrorBox aBox( pParentWindow, SfxResId( RID_ERRBOX_MAIL_CONFIG )); - aBox.Execute(); - } -} - -void SAL_CALL OMailSendThreadImpl::onTerminated() -{ - delete this; -} - -// class AddressList_Impl ------------------------------------------------ - -typedef String* AddressItemPtr_Impl; -DECLARE_LIST( AddressList_Impl, AddressItemPtr_Impl ) - -// class SfxMailModel ----------------------------------------------- - -void SfxMailModel::ClearList( AddressList_Impl* pList ) -{ - if ( pList ) - { - ULONG i, nCount = pList->Count(); - for ( i = 0; i < nCount; ++i ) - delete pList->GetObject(i); - pList->Clear(); - } -} - -void SfxMailModel::MakeValueList( AddressList_Impl* pList, String& rValueList ) -{ - rValueList.Erase(); - if ( pList ) - { - ULONG i, nCount = pList->Count(); - for ( i = 0; i < nCount; ++i ) - { - if ( rValueList.Len() > 0 ) - rValueList += ','; - rValueList += *pList->GetObject(i); - } - } -} -namespace -{ - String lcl_getFactoryName(const Reference<XInterface>& _xModel) - { - rtl::OUString sModuleIdentifier; - rtl::OUString sFactoryShortName; - Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")) ), UNO_QUERY ); - - if ( _xModel.is() ) - { - try - { - sModuleIdentifier = xModuleManager->identify( _xModel ); - } - catch ( ::com::sun::star::frame::UnknownModuleException& ) - { - DBG_WARNING( "SfxHelp::GetHelpModuleName_Impl(): unknown module (help in help?)" ); - } - catch ( Exception& ) - { - DBG_ERRORFILE( "SfxHelp::GetHelpModuleName_Impl(): exception of XModuleManager::identif y()" ); - } - } - - return sModuleIdentifier; - } - - String lcl_createTempFileName(const Reference < XModel >& _xModel,const ::rtl::OUString& _sAttachmentTitle) - { - // create temp file name with leading chars and extension - Reference < XStorable > xStor( _xModel, UNO_QUERY ); - String aLeadingStr; - if ( xStor.is() ) - { - sal_Bool bHasName = xStor->hasLocation(); - - if ( !bHasName ) - { - if ( _sAttachmentTitle.getLength() ) - aLeadingStr = _sAttachmentTitle; - else - aLeadingStr = String( DEFINE_CONST_UNICODE("noname") ); - } - else - { - INetURLObject aFileObj(_xModel->getURL()); - if ( aFileObj.hasExtension() ) - { - aFileObj.removeExtension(); - if ( _sAttachmentTitle.getLength() ) - aLeadingStr = _sAttachmentTitle; - else - aLeadingStr = aFileObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - aLeadingStr += String::CreateFromAscii( "_" ); - } - else - { - if ( _sAttachmentTitle.getLength() ) - aLeadingStr = _sAttachmentTitle; - else - aLeadingStr = aFileObj.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - aLeadingStr += String::CreateFromAscii( "_" ); - } - } - } - return aLeadingStr; - } - -} -SfxMailModel::SaveResult SfxMailModel::SaveDocument( const ::rtl::OUString& _sAttachmentTitle - , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _xModel - , String& rFileName) -{ - SaveResult eRet = SAVE_CANCELLED; - try - { - Reference<XModifiable> xMod(_xModel,UNO_QUERY); - - // save the document - if ( xMod.is() ) - { - // save old settings -/* - BOOL bModified = xMod->isModified(); - // prepare for mail export - TODO - SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher(); - pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON ); -*/ - // detect filter - const SfxFilter* pFilter = SfxFilter::GetDefaultFilter(lcl_getFactoryName(_xModel)); -// sal_Bool bHasFilter = pFilter != NULL; - - sal_Bool bRet = sal_False; - // create temp file name with leading chars and extension - Reference < XStorable > xStor( _xModel, UNO_QUERY ); - if ( xStor.is() ) - { - String* pExt = NULL; - INetURLObject aFileObj(_xModel->getURL()); - if ( aFileObj.hasExtension() ) - pExt = new String( String::CreateFromAscii( "." ) + (OUString) aFileObj.getExtension() ); - - String aLeadingStr = lcl_createTempFileName(_xModel,_sAttachmentTitle); - - if ( pFilter && !pExt ) - { - pExt = new String( pFilter->GetWildcard()().GetToken(0) ); - // erase the '*' from the extension (e.g. "*.sdw") - pExt->Erase( 0, 1 ); - } - - { - ::utl::TempFile aTempFile( aLeadingStr, pExt ); - rFileName = aTempFile.GetURL(); - } - delete pExt; - // save document to temp file - - // save document to temp file - Sequence < PropertyValue > aArgs( _xModel->getArgs() ); - ::comphelper::MediaDescriptor aMedia(aArgs); - - if ( pFilter ) - { - ::rtl::OUString sFilter(pFilter->GetFilterName()); - ::rtl::OUString sFilterName(RTL_CONSTASCII_USTRINGPARAM("FilterName")); - if ( !aMedia.createItemIfMissing(sFilterName,sFilter) ) - aMedia[sFilterName] <<= sFilter; - } - - ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("URL")); - if ( !aMedia.createItemIfMissing(sURL,::rtl::OUString(rFileName)) ) - aMedia[sURL] <<= ::rtl::OUString(rFileName); - - ::rtl::OUString sSaveTo(RTL_CONSTASCII_USTRINGPARAM("SaveTo")); - if ( !aMedia.createItemIfMissing(sSaveTo,sal_True) ) - aMedia[sSaveTo] <<= sal_True; - - ::rtl::OUString sReadOnly(RTL_CONSTASCII_USTRINGPARAM("ReadOnly")); - if ( !aMedia.createItemIfMissing(sReadOnly,sal_False) ) - aMedia[sReadOnly] <<= sal_False; - - aMedia >> aArgs; - - try - { - Reference < XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory(); - SfxStoringHelper aHelper(xMgr); - aHelper.GUIStoreModel(_xModel,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SaveAs")),aArgs, sal_False, ::rtl::OUString() ); - // xStor->storeToURL(rFileName,aArgs); - bRet = sal_True; - } - catch(Exception&) - { - } - } - - // restore old settings -/* TODO - if ( !bModified && xDocShell->IsEnableSetModified() ) - xDocShell->SetModified( FALSE ); -*/ - eRet = bRet ? SAVE_SUCCESSFULL : SAVE_ERROR; - } - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception catched!"); - } - - return eRet; -} -SfxMailModel::SaveResult SfxMailModel::SaveDocAsPDF( const ::rtl::OUString& _sAttachmentTitle - , const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _xModel - , String& rFileName) -{ - SaveResult eRet = SAVE_CANCELLED; - try - { - Reference<XModifiable> xMod(_xModel,UNO_QUERY); - - // save the document - if ( xMod.is() ) - { - /* TODO - // save old settings - BOOL bModified = xMod->isModified(); - // prepare for mail export - SfxDispatcher* pDisp = pTopViewFrm->GetDispatcher(); - pDisp->Execute( SID_MAIL_PREPAREEXPORT, SFX_CALLMODE_SYNCHRON ); - */ - - // Get PDF Filter from document - ::rtl::OUString sPDFMediaType(RTL_CONSTASCII_USTRINGPARAM("application/pdf")); - - sal_Bool bRet = sal_False; - // create temp file name with leading chars and extension - Reference < XStorable > xStor( _xModel, UNO_QUERY ); - if ( xStor.is() ) - { - String aLeadingStr = lcl_createTempFileName(_xModel,_sAttachmentTitle); - String aPDFExtension = String::CreateFromAscii( ".pdf" ); - ::utl::TempFile aTempFile( aLeadingStr, &aPDFExtension ); - - rFileName = aTempFile.GetURL(); - - // save document to temp file - Sequence < PropertyValue > aArgs( _xModel->getArgs() ); - ::comphelper::MediaDescriptor aMedia(aArgs); - - ::rtl::OUString sMediaType(RTL_CONSTASCII_USTRINGPARAM("MediaType")); - if ( !aMedia.createItemIfMissing(sMediaType,sPDFMediaType) ) - aMedia[sMediaType] <<= sPDFMediaType; - - ::rtl::OUString sURL(RTL_CONSTASCII_USTRINGPARAM("URL")); - if ( !aMedia.createItemIfMissing(sURL,::rtl::OUString(rFileName)) ) - aMedia[sURL] <<= ::rtl::OUString(rFileName); - aMedia >> aArgs; - - try - { - Reference < XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory(); - SfxStoringHelper aHelper(xMgr); - aHelper.GUIStoreModel(_xModel,::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExportToPDF")),aArgs, sal_False, ::rtl::OUString); - // xStor->storeToURL(rFileName,aArgs); - bRet = sal_True; - } - catch(Exception&) - { - } - - eRet = bRet ? SAVE_SUCCESSFULL : SAVE_CANCELLED; - - // restore old settings - /* TODO - if ( !bModified && xDocShell->IsEnableSetModified() ) - xDocShell->SetModified( FALSE ); - */ - } - } - } - catch(Exception&) - { - OSL_ENSURE(0,"Exception catched!"); - } - - return eRet; -} -// ----------------------------------------------------------------------------- -SfxMailModel::SendMailResult SfxMailModel::AttachDocument( MailDocType _eMailDocType - , const Reference< XModel >& _xModel - , const ::rtl::OUString& _sAttachmentTitle) -{ - SaveResult eSaveResult; - String aFileName; - -// sal_Bool bSuccessfull = sal_False; - if ( _eMailDocType == TYPE_SELF ) - eSaveResult = SaveDocument( _sAttachmentTitle,_xModel,aFileName); - else - eSaveResult = SaveDocAsPDF( _sAttachmentTitle,_xModel,aFileName); - - if ( eSaveResult == SAVE_SUCCESSFULL && aFileName.Len() ) - maAttachedDocuments.push_back(aFileName); - return eSaveResult == SAVE_SUCCESSFULL ? SEND_MAIL_OK : SEND_MAIL_ERROR; -} -// ----------------------------------------------------------------------------- - -IMPL_LINK_INLINE_START( SfxMailModel, DoneHdl, void*, EMPTYARG ) -{ - mbLoadDone = sal_True; - return 0; -} -// ----------------------------------------------------------------------------- -IMPL_LINK_INLINE_END( SfxMailModel, DoneHdl, void*, EMPTYARG ) - -SfxMailModel::SfxMailModel( const Reference< XFrame >& _xFrame) : - - mpToList ( NULL ), - mpCcList ( NULL ), - mpBccList ( NULL ), - m_xCurrentFrame ( _xFrame ), - mePriority ( PRIO_NORMAL ), - mbLoadDone ( sal_True ) - -{ -} - -SfxMailModel::~SfxMailModel() -{ - ClearList( mpToList ); - delete mpToList; - ClearList( mpCcList ); - delete mpCcList; - ClearList( mpBccList ); - delete mpBccList; -} - -void SfxMailModel::AddAddress( const String& rAddress, AddressRole eRole ) -{ - // don't add a empty address - if ( rAddress.Len() > 0 ) - { - AddressList_Impl* pList = NULL; - if ( ROLE_TO == eRole ) - { - if ( !mpToList ) - // create the list - mpToList = new AddressList_Impl; - pList = mpToList; - } - else if ( ROLE_CC == eRole ) - { - if ( !mpCcList ) - // create the list - mpCcList = new AddressList_Impl; - pList = mpCcList; - } - else if ( ROLE_BCC == eRole ) - { - if ( !mpBccList ) - // create the list - mpBccList = new AddressList_Impl; - pList = mpBccList; - } - else - { - DBG_ERRORFILE( "invalid address role" ); - } - - if ( pList ) - { - // add address to list - AddressItemPtr_Impl pAddress = new String( rAddress ); - pList->Insert( pAddress, LIST_APPEND ); - } - } -} - -SfxMailModel::SendMailResult SfxMailModel::Send( ) -{ - OSL_ENSURE(!maAttachedDocuments.empty(),"No document added!"); - SendMailResult eResult = SEND_MAIL_ERROR; - if ( !maAttachedDocuments.empty() ) - { - - Reference < XMultiServiceFactory > xMgr = ::comphelper::getProcessServiceFactory(); - if ( xMgr.is() ) - { - Reference< XSimpleMailClientSupplier > xSimpleMailClientSupplier; - - // Prefer the SimpleSystemMail service if available - xSimpleMailClientSupplier = Reference< XSimpleMailClientSupplier >( - xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SimpleSystemMail" ))), - UNO_QUERY ); - - if ( ! xSimpleMailClientSupplier.is() ) - { - xSimpleMailClientSupplier = Reference< XSimpleMailClientSupplier >( - xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SimpleCommandMail" ))), - UNO_QUERY ); - } - - if ( xSimpleMailClientSupplier.is() ) - { - Reference< XSimpleMailClient > xSimpleMailClient = xSimpleMailClientSupplier->querySimpleMailClient(); - - if ( !xSimpleMailClient.is() ) - { - // no mail client support => message box! - return SEND_MAIL_ERROR; - } - - // we have a simple mail client - Reference< XSimpleMailMessage > xSimpleMailMessage = xSimpleMailClient->createSimpleMailMessage(); - if ( xSimpleMailMessage.is() ) - { - sal_Int32 nSendFlags = SimpleMailClientFlags::DEFAULTS; - if ( maFromAddress.Len() == 0 ) - { - // from address not set, try figure out users e-mail address - CreateFromAddress_Impl( maFromAddress ); - } - xSimpleMailMessage->setOriginator( maFromAddress ); - - sal_Int32 nToCount = mpToList ? mpToList->Count() : 0; - sal_Int32 nCcCount = mpCcList ? mpCcList->Count() : 0; - sal_Int32 nCcSeqCount = nCcCount; - - // set recipient (only one) for this simple mail server!! - if ( nToCount > 1 ) - { - nCcSeqCount = nToCount - 1 + nCcCount; - xSimpleMailMessage->setRecipient( *mpToList->GetObject( 0 )); - nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE; - } - else if ( nToCount == 1 ) - { - xSimpleMailMessage->setRecipient( *mpToList->GetObject( 0 )); - nSendFlags = SimpleMailClientFlags::NO_USER_INTERFACE; - } - - // all other recipient must be handled with CC recipients! - if ( nCcSeqCount > 0 ) - { - sal_Int32 nIndex = 0; - Sequence< OUString > aCcRecipientSeq; - - aCcRecipientSeq.realloc( nCcSeqCount ); - if ( nCcSeqCount > nCcCount ) - { - for ( sal_Int32 i = 1; i < nToCount; ++i ) - { - aCcRecipientSeq[nIndex++] = *mpToList->GetObject(i); - } - } - - for ( sal_Int32 i = 0; i < nCcCount; i++ ) - { - aCcRecipientSeq[nIndex++] = *mpCcList->GetObject(i); - } - xSimpleMailMessage->setCcRecipient( aCcRecipientSeq ); - } - - sal_Int32 nBccCount = mpBccList ? mpBccList->Count() : 0; - if ( nBccCount > 0 ) - { - Sequence< OUString > aBccRecipientSeq( nBccCount ); - for ( sal_Int32 i = 0; i < nBccCount; ++i ) - { - aBccRecipientSeq[i] = *mpBccList->GetObject(i); - } - xSimpleMailMessage->setBccRecipient( aBccRecipientSeq ); - } - - Sequence< OUString > aAttachmentSeq(&(maAttachedDocuments[0]),maAttachedDocuments.size()); - - xSimpleMailMessage->setSubject( maSubject ); - xSimpleMailMessage->setAttachement( aAttachmentSeq ); - - // Bugfix: #95743# - // Due to the current clipboard implementation we cannot stop the main thread - // because the clipboard implementation calls the main thread from another thread - // and this would result in a deadlock! - // Currently we create a thread to send a message and process all remaining error - // handling in this thread!! - - OMailSendThreadImpl* pMailSendThread = new OMailSendThreadImpl( xSimpleMailClient, xSimpleMailMessage, m_xCurrentFrame,nSendFlags ); - pMailSendThread->create(); - - // Return always true as the real error handling occurss in the OMailSendThreadImpl-implementation! - eResult = SEND_MAIL_OK; - } - } - } - } - else - eResult = SEND_MAIL_CANCELLED; - - return eResult; -} diff --git a/sfx2/source/dialog/mailwindow.src b/sfx2/source/dialog/mailwindow.src index 1a925d88ace9..e5648e7f414f 100644 --- a/sfx2/source/dialog/mailwindow.src +++ b/sfx2/source/dialog/mailwindow.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mailwindow.src,v $ - * $Revision: 1.39 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/makefile.mk b/sfx2/source/dialog/makefile.mk index 7e044f0fb528..5382eb92e3cd 100644 --- a/sfx2/source/dialog/makefile.mk +++ b/sfx2/source/dialog/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.43 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 73fb36cafc5f..4a2886e6fa3c 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mgetempl.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/mgetempl.hrc b/sfx2/source/dialog/mgetempl.hrc index fa15c6189981..e998baba939d 100644 --- a/sfx2/source/dialog/mgetempl.hrc +++ b/sfx2/source/dialog/mgetempl.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mgetempl.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/mgetempl.src b/sfx2/source/dialog/mgetempl.src index 2fc170f04683..f07d0873e454 100644 --- a/sfx2/source/dialog/mgetempl.src +++ b/sfx2/source/dialog/mgetempl.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mgetempl.src,v $ - * $Revision: 1.34 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx index eb2b84e3bdb4..290886528e24 100644 --- a/sfx2/source/dialog/navigat.cxx +++ b/sfx2/source/dialog/navigat.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: navigat.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx index 3e29562679ec..8235333857d5 100644 --- a/sfx2/source/dialog/newstyle.cxx +++ b/sfx2/source/dialog/newstyle.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newstyle.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/newstyle.hrc b/sfx2/source/dialog/newstyle.hrc index fe68c7bee36d..0efc04869ba9 100644 --- a/sfx2/source/dialog/newstyle.hrc +++ b/sfx2/source/dialog/newstyle.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newstyle.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/newstyle.src b/sfx2/source/dialog/newstyle.src index 405d3f781342..fa5fa62a2ee4 100644 --- a/sfx2/source/dialog/newstyle.src +++ b/sfx2/source/dialog/newstyle.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: newstyle.src,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index 64461c49d850..cbbe20bfa203 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: partwnd.cxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -181,7 +178,7 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl if ( pBind->GetDispatcher() ) { ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFramesSupplier > - xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); + xSupp ( pBind->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); if ( xSupp.is() ) xSupp->getFrames()->append( xFrame ); } diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index db73330c867f..3a4e2e7637b2 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: passwd.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/passwd.hrc b/sfx2/source/dialog/passwd.hrc index 28f357d3595e..5be0446fd752 100644 --- a/sfx2/source/dialog/passwd.hrc +++ b/sfx2/source/dialog/passwd.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: passwd.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/passwd.src b/sfx2/source/dialog/passwd.src index 7c80b2792d9c..fc58ecfda219 100644 --- a/sfx2/source/dialog/passwd.src +++ b/sfx2/source/dialog/passwd.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: passwd.src,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index 962befe73c87..6b26cf9fb504 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printopt.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/printopt.hrc b/sfx2/source/dialog/printopt.hrc index 796c877c6d91..38c766c9f56a 100644 --- a/sfx2/source/dialog/printopt.hrc +++ b/sfx2/source/dialog/printopt.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printopt.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/printopt.src b/sfx2/source/dialog/printopt.src index fe7128206687..4217539a3af8 100644 --- a/sfx2/source/dialog/printopt.src +++ b/sfx2/source/dialog/printopt.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printopt.src,v $ - * $Revision: 1.42 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 1cd257874e1f..aaabdd3e5d74 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: recfloat.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/recfloat.src b/sfx2/source/dialog/recfloat.src index 365ba423c3d2..5bdde1f57ab6 100644 --- a/sfx2/source/dialog/recfloat.src +++ b/sfx2/source/dialog/recfloat.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: recfloat.src,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/sfxdlg.cxx b/sfx2/source/dialog/sfxdlg.cxx index 4b88851f82dd..afad5053a5f7 100644 --- a/sfx2/source/dialog/sfxdlg.cxx +++ b/sfx2/source/dialog/sfxdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxdlg.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,5 +38,9 @@ SfxAbstractDialogFactory* SfxAbstractDialogFactory::Create() { - return (SfxAbstractDialogFactory*) VclAbstractDialogFactory::Create(); + return dynamic_cast <SfxAbstractDialogFactory*>( VclAbstractDialogFactory::Create() ); +} + +SfxAbstractDialogFactory::~SfxAbstractDialogFactory() +{ } diff --git a/sfx2/source/dialog/sfxurl.cxx b/sfx2/source/dialog/sfxurl.cxx index bd85c842c88d..90c52e6e8ec4 100644 --- a/sfx2/source/dialog/sfxurl.cxx +++ b/sfx2/source/dialog/sfxurl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxurl.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 569d3ec69c99..d4cc7950612f 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: splitwin.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/srchdlg.cxx b/sfx2/source/dialog/srchdlg.cxx index ead9ae9557a7..f4d2392c9017 100644 --- a/sfx2/source/dialog/srchdlg.cxx +++ b/sfx2/source/dialog/srchdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: srchdlg.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/srchdlg.hrc b/sfx2/source/dialog/srchdlg.hrc index b202addc615f..55fe9ce47d26 100644 --- a/sfx2/source/dialog/srchdlg.hrc +++ b/sfx2/source/dialog/srchdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: srchdlg.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/srchdlg.src b/sfx2/source/dialog/srchdlg.src index b4291dbe8b26..0947f3932981 100644 --- a/sfx2/source/dialog/srchdlg.src +++ b/sfx2/source/dialog/srchdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: srchdlg.src,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/styfitem.cxx b/sfx2/source/dialog/styfitem.cxx index 1b58f90e93d4..a33677c6b2ae 100644 --- a/sfx2/source/dialog/styfitem.cxx +++ b/sfx2/source/dialog/styfitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: styfitem.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index ca84402c4b24..e1d01de94955 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: styledlg.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 8709ad210ea6..df010f6bf292 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tabdlg.cxx,v $ - * $Revision: 1.38 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -46,7 +43,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/app.hxx> #include "sfx2/sfxresid.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/ctrlitem.hxx> #include <sfx2/bindings.hxx> #include <sfx2/sfxdlg.hxx> @@ -1791,7 +1788,7 @@ long SfxTabDialog::Notify( NotifyEvent& rNEvt ) } if ( nHelpId ) - SfxHelp::OpenHelpAgent( pViewFrame->GetFrame(), nHelpId ); + SfxHelp::OpenHelpAgent( &pViewFrame->GetFrame(), nHelpId ); } } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index d1afc08cda10..299cd594e47d 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templdlg.cxx,v $ - * $Revision: 1.58.46.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -51,7 +48,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XModuleManager.hpp> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/bindings.hxx> diff --git a/sfx2/source/dialog/templdlg.hrc b/sfx2/source/dialog/templdlg.hrc index 54b71fb64460..58563fb9c160 100644 --- a/sfx2/source/dialog/templdlg.hrc +++ b/sfx2/source/dialog/templdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templdlg.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/templdlg.src b/sfx2/source/dialog/templdlg.src index ccf1b1b6236a..a4adcd77b6d3 100644 --- a/sfx2/source/dialog/templdlg.src +++ b/sfx2/source/dialog/templdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templdlg.src,v $ - * $Revision: 1.39 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx index 060a1046bf40..0e03106b0d5e 100644 --- a/sfx2/source/dialog/tplcitem.cxx +++ b/sfx2/source/dialog/tplcitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tplcitem.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx index 3caae405721a..566c379df508 100644 --- a/sfx2/source/dialog/tplpitem.cxx +++ b/sfx2/source/dialog/tplpitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tplpitem.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 25a905861380..a640dad447e2 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: versdlg.cxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/versdlg.hrc b/sfx2/source/dialog/versdlg.hrc index 4f07b8fbcf3e..2de7596221e1 100644 --- a/sfx2/source/dialog/versdlg.hrc +++ b/sfx2/source/dialog/versdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: versdlg.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/dialog/versdlg.src b/sfx2/source/dialog/versdlg.src index 015b219c6f90..60aeb2777542 100644 --- a/sfx2/source/dialog/versdlg.src +++ b/sfx2/source/dialog/versdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: versdlg.src,v $ - * $Revision: 1.37 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx index 112183a4efbe..9625ea958830 100644 --- a/sfx2/source/doc/DocumentMetadataAccess.cxx +++ b/sfx2/source/doc/DocumentMetadataAccess.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: DocumentMetadataAccess.cxx,v $ - * $Revision: 1.1.2.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index 2ad27856c7cc..b1b69e5ac74f 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SwMetadatable.cxx,v $ - * $Revision: 1.1.2.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx index 65de7a6dafd1..1907e54246ab 100644 --- a/sfx2/source/doc/QuerySaveDocument.cxx +++ b/sfx2/source/doc/QuerySaveDocument.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: QuerySaveDocument.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 476d6f5186a5..f46f3583cfd8 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SfxDocumentMetaData.cxx,v $ - * $Revision: 1.10.32.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -588,7 +585,9 @@ sal_Int32 textToDuration(::rtl::OUString const& i_rText) throw () { css::util::Duration d; if (textToDuration(d, i_rText)) { - return (d.Days * (24*3600)) + // #i107372#: approximate years/months + const sal_Int32 days( (d.Years * 365) + (d.Months * 30) + d.Days ); + return (days * (24*3600)) + (d.Hours * 3600) + (d.Minutes * 60) + d.Seconds; } else { return 0; // default @@ -611,7 +610,7 @@ sal_Int32 textToDuration(::rtl::OUString const& i_rText) throw () ud.Hours = static_cast<sal_Int16>((i_value % (24 * 3600)) / 3600); ud.Minutes = static_cast<sal_Int16>((i_value % 3600) / 60); ud.Seconds = static_cast<sal_Int16>(i_value % 60); - ud.HundredthSeconds = 0; + ud.MilliSeconds = 0; return durationToText(ud); } @@ -928,8 +927,13 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet) values.push_back(s); // #i90847# OOo 2.x does stupid things if value-type="string"; // fortunately string is default anyway, so we can just omit it -// as.push_back(std::make_pair(vt, -// ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")))); +// #i107502#: however, OOo 2.x only reads 4 user-defined without @value-type +// => best backward compatibility: first 4 without @value-type, rest with + if (4 <= i) + { + as.push_back(std::make_pair(vt, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("string")))); + } } else if (type == ::cppu::UnoType<css::util::DateTime>::get()) { css::util::DateTime dt; any >>= dt; @@ -951,7 +955,7 @@ propsToStrings(css::uno::Reference<css::beans::XPropertySet> const & i_xPropSet) ud.Hours = ut.Hours; ud.Minutes = ut.Minutes; ud.Seconds = ut.Seconds; - ud.HundredthSeconds = ut.HundredthSeconds; + ud.MilliSeconds = 10 * ut.HundredthSeconds; values.push_back(durationToText(ud)); as.push_back(std::make_pair(vt, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time")))); diff --git a/sfx2/source/doc/applet.cxx b/sfx2/source/doc/applet.cxx deleted file mode 100644 index 8a98a1f8bd70..000000000000 --- a/sfx2/source/doc/applet.cxx +++ /dev/null @@ -1,386 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: applet.cxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#include "applet.hxx" -#include <sfx2/sfxdlg.hxx> -#include <sfx2/sfxsids.hrc> - -#include "com/sun/star/uno/XComponentContext.hpp" -#include "cppuhelper/factory.hxx" -#include <tools/urlobj.hxx> -#include <tools/debug.hxx> -#include <sj2/sjapplet.hxx> -#include <vcl/syschild.hxx> -#include <rtl/ustring.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <unotools/javaoptions.hxx> -#include <svtools/miscopt.hxx> -#include <comphelper/TypeGeneration.hxx> - -using namespace ::com::sun::star; -using namespace ::comphelper; - -namespace sfx2 -{ -class AppletWindow_Impl : public SystemChildWindow -{ -public: - SjApplet2* pApplet; - AppletWindow_Impl( Window* pParent, SjApplet2* pApp ) - : SystemChildWindow( pParent, WB_CLIPCHILDREN ) - , pApplet(pApp) - {} - - virtual void Resize(); -}; - -void AppletWindow_Impl::Resize() -{ - Size aSize( GetOutputSizePixel() ); - if ( pApplet ) - pApplet->setSizePixel( aSize ); -} - -class AppletWrapper_Impl : public SjApplet2 -{ - virtual void appletResize( const Size & ); - virtual void showDocument( const INetURLObject &, const XubString & ); - virtual void showStatus( const XubString & ); -}; - -void AppletWrapper_Impl::appletResize( const Size & ) {} -void AppletWrapper_Impl::showDocument( const INetURLObject &, const XubString & ) {} -void AppletWrapper_Impl::showStatus( const XubString & ) {} - -#define PROPERTY_UNBOUND 0 -#define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID - -#define WID_APPLET_CODE 1 -#define WID_APPLET_CODEBASE 2 -#define WID_APPLET_COMMANDS 3 -#define WID_APPLET_DOCBASE 4 -#define WID_APPLET_ISSCRIPT 5 -#define WID_APPLET_NAME 6 -const SfxItemPropertyMapEntry* lcl_GetAppletPropertyMap_Impl() -{ - static SfxItemPropertyMapEntry aAppletPropertyMap_Impl[] = - { - { MAP_CHAR_LEN("AppletCode") , WID_APPLET_CODE , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, - { MAP_CHAR_LEN("AppletCodeBase"), WID_APPLET_CODEBASE , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, - { MAP_CHAR_LEN("AppletCommands"), WID_APPLET_COMMANDS , CPPU_E2T(CPPUTYPE_PROPERTYVALUE), PROPERTY_UNBOUND, 0 }, - { MAP_CHAR_LEN("AppletDocBase"), WID_APPLET_DOCBASE , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, - { MAP_CHAR_LEN("AppletIsScript"), WID_APPLET_ISSCRIPT , CPPU_E2T(CPPUTYPE_BOOLEAN), PROPERTY_UNBOUND, 0 }, - { MAP_CHAR_LEN("AppletName") , WID_APPLET_NAME , CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_UNBOUND, 0 }, - {0,0,0,0,0,0} - }; -return aAppletPropertyMap_Impl; -} - -::rtl::OUString AppletObject::getImplementationName() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return impl_getStaticImplementationName(); -} - -::sal_Bool AppletObject::supportsService( const ::rtl::OUString& sServiceName ) - throw( ::com::sun::star::uno::RuntimeException ) -{ - ::com::sun::star::uno::Sequence< ::rtl::OUString > seqServiceNames = - getSupportedServiceNames(); - const ::rtl::OUString* pArray = seqServiceNames.getConstArray(); - for ( ::sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); - nCounter++ ) - { - if ( pArray[nCounter] == sServiceName ) - { - return sal_True ; - } - } - return sal_False ; -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > -AppletObject::getSupportedServiceNames() - throw( ::com::sun::star::uno::RuntimeException ) -{ - return impl_getStaticSupportedServiceNames(); -} - -::com::sun::star::uno::Sequence< ::rtl::OUString > -AppletObject::impl_getStaticSupportedServiceNames() -{ - ::com::sun::star::uno::Sequence< ::rtl::OUString > seqServiceNames( 1 ); - seqServiceNames.getArray() [0] = ::rtl::OUString::createFromAscii( - "com.sun.star.embed.SpecialEmbeddedObject" ); - return seqServiceNames ; -} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > -AppletObject::impl_createInstance( - const ::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext >& xContext ) - throw( ::com::sun::star::uno::Exception ) -{ - return static_cast< ::cppu::OWeakObject * >( new AppletObject( xContext ) ); -} - -::rtl::OUString AppletObject::impl_getStaticImplementationName() -{ - return ::rtl::OUString::createFromAscii( - "com.sun.star.comp.sfx2.AppletObject" ); -} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > -AppletObject::impl_createFactory() -{ - return uno::Reference< uno::XInterface >( - cppu::createSingleComponentFactory( - impl_createInstance, impl_getStaticImplementationName(), - impl_getStaticSupportedServiceNames() ), - uno::UNO_QUERY_THROW ); -} - -AppletObject::AppletObject( - const uno::Reference < uno::XComponentContext >& rContext ) - : mxContext( rContext ) - , maPropMap( lcl_GetAppletPropertyMap_Impl() ) - , mpApplet( NULL ) - , mbMayScript( FALSE ) -{ -} - -AppletObject::~AppletObject() -{ -} - -void SAL_CALL AppletObject::initialize( const uno::Sequence< uno::Any >& aArguments ) throw ( uno::Exception, uno::RuntimeException ) -{ - if ( aArguments.getLength() ) - aArguments[0] >>= mxObj; -} - -sal_Bool SAL_CALL AppletObject::load( - const uno::Sequence < com::sun::star::beans::PropertyValue >& /*lDescriptor*/, - const uno::Reference < frame::XFrame >& xFrame ) -throw( uno::RuntimeException ) -{ - if ( SvtJavaOptions().IsExecuteApplets() && SvtMiscOptions().IsPluginsEnabled() ) - { - mpApplet = new AppletWrapper_Impl; - - Window* pParent = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - Window* pWin = new AppletWindow_Impl( pParent, mpApplet ); - pWin->SetBackground(); - pWin->Show(); - - // aCmdList.Append( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "width" ) ), String( aPosSize.GetWidth() ) ); - // aCmdList.Append( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "height" ) ), String( aPosSize.GetHeight() ) ); - - if( maName.getLength() ) - maCmdList.Append( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "name" ) ), maName ); - - if( maCodeBase.getLength() ) - { - for ( sal_uInt32 nParams=0; nParams<maCmdList.Count(); nParams++ ) - { - if ( maCmdList[nParams].GetCommand().EqualsAscii("codebase") ) - { - maCmdList.Remove(nParams); - break; - } - } - - maCmdList.Append( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "codebase" ) ), maCodeBase ); - } - - if( maClass.getLength() ) - maCmdList.Append( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "code" ) ), maClass ); - - if( mbMayScript ) - maCmdList.Append( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "mayscript" ) ), String() ); - - INetURLObject aDocBase( maDocBase ); - mpApplet->Init( mxContext, pWin, aDocBase, maCmdList ); - uno::Reference < awt::XWindow > xWindow( pWin->GetComponentInterface(), uno::UNO_QUERY ); - - // we must destroy the applet before the parent is destroyed - xWindow->addEventListener( this ); - - xFrame->setComponent( xWindow, uno::Reference < frame::XController >() ); - return TRUE; - } - - return FALSE; -} - -void SAL_CALL AppletObject::cancel() throw( com::sun::star::uno::RuntimeException ) -{ - if ( mpApplet ) - { - mpApplet->appletClose(); // reparenting window - DELETEZ( mpApplet ); - } -} - -void SAL_CALL AppletObject::close( sal_Bool /*bDeliverOwnership*/ ) throw( com::sun::star::util::CloseVetoException, com::sun::star::uno::RuntimeException ) -{ -} - -void SAL_CALL AppletObject::addCloseListener( const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& ) throw( com::sun::star::uno::RuntimeException ) -{ -} - -void SAL_CALL AppletObject::removeCloseListener( const com::sun::star::uno::Reference < com::sun::star::util::XCloseListener >& ) throw( com::sun::star::uno::RuntimeException ) -{ -} - -void SAL_CALL AppletObject::disposing( const com::sun::star::lang::EventObject& ) throw (com::sun::star::uno::RuntimeException) -{ - cancel(); -} - -uno::Reference< beans::XPropertySetInfo > SAL_CALL AppletObject::getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException ) -{ - static uno::Reference< beans::XPropertySetInfo > xInfo = new SfxItemPropertySetInfo( &maPropMap ); - return xInfo; -} - -void SAL_CALL AppletObject::setPropertyValue(const ::rtl::OUString& aPropertyName, const uno::Any& aAny) - throw ( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) -{ - - const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName ); - if( !pEntry ) - throw beans::UnknownPropertyException(); - switch( pEntry->nWID ) - { - case WID_APPLET_CODE : - aAny >>= maClass; - break; - case WID_APPLET_CODEBASE : - //pImpl->aCodeBase = rURL.GetMainURL( INetURLObject::NO_DECODE ); - //if( rURL.GetProtocol() == INET_PROT_FILE - // && pImpl->aCodeBase.GetChar( 9 ) == INET_ENC_DELIM_TOKEN ) - // // Laufwerksbuchstabe auf ':' patchen - // pImpl->aCodeBase.SetChar( 9, INET_DELIM_TOKEN ); - - aAny >>= maCodeBase; - break; - case WID_APPLET_COMMANDS : - { - maCmdList.Clear(); - uno::Sequence < beans::PropertyValue > aCommandSequence; - if( aAny >>= aCommandSequence ) - maCmdList.FillFromSequence( aCommandSequence ); - } - break; - case WID_APPLET_DOCBASE : - aAny >>= maDocBase; - break; - case WID_APPLET_ISSCRIPT : - aAny >>= mbMayScript; - break; - case WID_APPLET_NAME : - aAny >>= maName; - break; - default:; - - } -} - -uno::Any SAL_CALL AppletObject::getPropertyValue(const ::rtl::OUString& aPropertyName) throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) -{ - uno::Any aAny; - const SfxItemPropertySimpleEntry* pEntry = maPropMap.getByName( aPropertyName ); - if( !pEntry ) - throw beans::UnknownPropertyException(); - switch( pEntry->nWID ) - { - case WID_APPLET_CODE : - aAny <<= maClass; - break; - case WID_APPLET_CODEBASE : - aAny <<= maCodeBase; - break; - case WID_APPLET_COMMANDS : - { - uno::Sequence< beans::PropertyValue > aCommandSequence; - maCmdList.FillSequence( aCommandSequence ); - aAny <<= aCommandSequence; - } - break; - case WID_APPLET_DOCBASE : - break; - case WID_APPLET_ISSCRIPT : - aAny <<= mbMayScript; - break; - case WID_APPLET_NAME : - aAny <<= maName; - break; - default:; - - } - return aAny; -} - -void SAL_CALL AppletObject::addPropertyChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException ) -{ -} - -void SAL_CALL AppletObject::removePropertyChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException ) -{ -} - -void SAL_CALL AppletObject::addVetoableChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException ) -{ -} - -void SAL_CALL AppletObject::removeVetoableChangeListener(const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & ) throw( ::com::sun::star::uno::RuntimeException ) -{ -} - -::sal_Int16 SAL_CALL AppletObject::execute() throw (::com::sun::star::uno::RuntimeException) -{ - SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - uno::Reference < beans::XPropertySet > xSet( this ); - VclAbstractDialog* pDlg = pFact->CreateEditObjectDialog( NULL, SID_INSERT_APPLET, mxObj ); - if ( pDlg ) - pDlg->Execute(); - return 0; -} - -void SAL_CALL AppletObject::setTitle( const ::rtl::OUString& ) throw (::com::sun::star::uno::RuntimeException) -{ -} - -} diff --git a/sfx2/source/doc/commitlistener.cxx b/sfx2/source/doc/commitlistener.cxx deleted file mode 100644 index 9ca08dfe6458..000000000000 --- a/sfx2/source/doc/commitlistener.cxx +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: commitlistener.cxx,v $ - * $Revision: 1.7 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#include "commitlistener.hxx" - -using namespace ::com::sun::star; - -OChildCommitListen_Impl::OChildCommitListen_Impl( SfxBaseModel& aModel ) -: m_pModel( &aModel ) -{} - -OChildCommitListen_Impl::~OChildCommitListen_Impl() -{} - -void OChildCommitListen_Impl::OwnerIsDisposed() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_pModel = NULL; -} - -void SAL_CALL OChildCommitListen_Impl::preCommit( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::commited( const ::com::sun::star::lang::EventObject& /*aEvent*/ ) - throw (::com::sun::star::uno::RuntimeException) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - // StorageIsModified_Impl must not contain any locking! - if ( m_pModel ) - m_pModel->StorageIsModified_Impl(); -} - -void SAL_CALL OChildCommitListen_Impl::preRevert( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - -void SAL_CALL OChildCommitListen_Impl::reverted( const ::com::sun::star::lang::EventObject& ) - throw (::com::sun::star::uno::RuntimeException) -{ - // not interesting -} - - -void SAL_CALL OChildCommitListen_Impl::disposing( const lang::EventObject& ) - throw ( uno::RuntimeException ) -{ - // not interesting -} - diff --git a/sfx2/source/doc/commitlistener.hxx b/sfx2/source/doc/commitlistener.hxx index 1004e4aa27b2..572da034cef1 100644 --- a/sfx2/source/doc/commitlistener.hxx +++ b/sfx2/source/doc/commitlistener.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: commitlistener.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc index ae4ff419565c..838168e64526 100644 --- a/sfx2/source/doc/doc.hrc +++ b/sfx2/source/doc/doc.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doc.hrc,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src index c914d9fe2927..d17b62c9b52a 100644 --- a/sfx2/source/doc/doc.src +++ b/sfx2/source/doc/doc.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doc.src,v $ - * $Revision: 1.94 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docfac.cxx b/sfx2/source/doc/docfac.cxx index b27a98eb9a09..42a57a49bbe9 100644 --- a/sfx2/source/doc/docfac.cxx +++ b/sfx2/source/doc/docfac.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docfac.cxx,v $ - * $Revision: 1.28 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -287,6 +284,14 @@ const SvGlobalName& SfxObjectFactory::GetClassId() const return pImpl->aClassName; } +String SfxObjectFactory::GetFactoryURL() const +{ + ::rtl::OUStringBuffer aURLComposer; + aURLComposer.appendAscii( "private:factory/" ); + aURLComposer.appendAscii( GetShortName() ); + return aURLComposer.makeStringAndClear(); +} + String SfxObjectFactory::GetModuleName() const { static ::rtl::OUString SERVICENAME_MODULEMANAGER = ::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager"); @@ -305,10 +310,36 @@ String SfxObjectFactory::GetModuleName() const ::rtl::OUString sModuleName = aPropSet.getUnpackedValueOrDefault(PROP_MODULEUINAME, ::rtl::OUString()); return String(sModuleName); } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } + catch(const css::uno::RuntimeException&) + { throw; } catch(const css::uno::Exception&) {} return String(); } + + +sal_uInt16 SfxObjectFactory::GetViewNo_Impl( const sal_uInt16 i_nViewId, const sal_uInt16 i_nFallback ) const +{ + for ( sal_uInt16 curViewNo = 0; curViewNo < GetViewFactoryCount(); ++curViewNo ) + { + const sal_uInt16 curViewId = GetViewFactory( curViewNo ).GetOrdinal(); + if ( i_nViewId == curViewId ) + return curViewNo; + } + return i_nFallback; +} + +SfxViewFactory* SfxObjectFactory::GetViewFactoryByViewName( const String& i_rViewName ) const +{ + for ( USHORT nViewNo = 0; + nViewNo < GetViewFactoryCount(); + ++nViewNo + ) + { + SfxViewFactory& rViewFac( GetViewFactory( nViewNo ) ); + if ( rViewFac.GetViewName() == i_rViewName ) + return &rViewFac; + } + return NULL; +} diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index bdb63f622130..7bc679fc94b2 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docfile.cxx,v $ - * $Revision: 1.203.50.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -263,79 +260,6 @@ void SAL_CALL SfxMediumHandler_Impl::handle( const com::sun::star::uno::Referenc } //---------------------------------------------------------------- -class SfxPoolCancelManager_Impl : public SfxCancelManager , - public SfxCancellable , - public SfxListener , - public SvRefBase -{ - SfxCancelManagerWeak wParent; - - ~SfxPoolCancelManager_Impl(); -public: - SfxPoolCancelManager_Impl( SfxCancelManager* pParent, const String& rName ); - - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); - using SfxCancelManager::Cancel; - virtual void Cancel(); -}; - -//---------------------------------------------------------------- -SV_DECL_IMPL_REF( SfxPoolCancelManager_Impl ) - - -//---------------------------------------------------------------- -SfxPoolCancelManager_Impl::SfxPoolCancelManager_Impl( SfxCancelManager* pParent, const String& rName ) - : SfxCancelManager( pParent ), - SfxCancellable( pParent ? pParent : this, rName ), - wParent( pParent ) -{ - if( pParent ) - { - StartListening( *this ); - SetManager( 0 ); - } -} - -//---------------------------------------------------------------- -SfxPoolCancelManager_Impl::~SfxPoolCancelManager_Impl() -{ - for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) - { - // nicht an Parent uebernehmen! - SfxCancellable* pCbl = GetCancellable( nPos ); - if ( pCbl ) - pCbl->SetManager( 0 ); - } -} - - -//---------------------------------------------------------------- -void SfxPoolCancelManager_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/ ) -{ - if( !GetCancellableCount() ) SetManager( 0 ); - else if( !GetManager() ) - { - if( !wParent.Is() ) wParent = SFX_APP()->GetCancelManager(); - SetManager( wParent ); - } -} - -//---------------------------------------------------------------- -void SfxPoolCancelManager_Impl::Cancel() -{ - SfxPoolCancelManager_ImplRef xThis = this; - for( sal_uInt16 nPos = GetCancellableCount(); nPos--; ) - { - SfxCancellable* pCbl = GetCancellable( nPos ); - // Wenn wir nicht im Button stehen - if( pCbl && pCbl != this ) - pCbl->Cancel(); - if( GetCancellableCount() < nPos ) - nPos = GetCancellableCount(); - } -} - -//---------------------------------------------------------------- class SfxMedium_Impl : public SvCompatWeakBase { public: @@ -343,7 +267,6 @@ public: sal_Bool bUpdatePickList : 1; sal_Bool bIsTemp : 1; sal_Bool bForceSynchron : 1; - sal_Bool bDontCreateCancellable : 1; sal_Bool bDownloadDone : 1; sal_Bool bDontCallDoneLinkOnSharingError : 1; sal_Bool bIsStorage: 1; @@ -359,7 +282,6 @@ public: uno::Reference < embed::XStorage > xStorage; - SfxPoolCancelManager_ImplRef xCancelManager; SfxMedium* pAntiImpl; long nFileVersion; @@ -402,8 +324,6 @@ public: uno::Reference< logging::XSimpleLogRing > m_xLogRing; - SfxPoolCancelManager_Impl* GetCancelManager(); - SfxMedium_Impl( SfxMedium* pAntiImplP ); ~SfxMedium_Impl(); }; @@ -419,29 +339,12 @@ void SfxMedium::Cancel_Impl() SetError( ERRCODE_IO_GENERAL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } -SfxPoolCancelManager_Impl* SfxMedium_Impl::GetCancelManager() -{ - if( !xCancelManager.Is() ) - { - if( !bDontCreateCancellable ) - xCancelManager = new SfxPoolCancelManager_Impl( - wLoadTargetFrame ? wLoadTargetFrame->GetCancelManager() : - SFX_APP()->GetCancelManager(), - pAntiImpl->GetURLObject().GetURLNoPass() ); - else - xCancelManager = new SfxPoolCancelManager_Impl( - 0, pAntiImpl->GetURLObject().GetURLNoPass() ); - } - return xCancelManager; -} - //------------------------------------------------------------------ SfxMedium_Impl::SfxMedium_Impl( SfxMedium* pAntiImplP ) : SvCompatWeakBase( pAntiImplP ), bUpdatePickList(sal_True), bIsTemp( sal_False ), bForceSynchron( sal_False ), - bDontCreateCancellable( sal_False ), bDownloadDone( sal_True ), bDontCallDoneLinkOnSharingError( sal_False ), bIsStorage( sal_False ), @@ -2442,25 +2345,7 @@ void SfxMedium::GetMedium_Impl() } } -//------------------------------------------------------------------ -SfxPoolCancelManager_Impl* SfxMedium::GetCancelManager_Impl() const -{ - return pImp->GetCancelManager(); -} - -//------------------------------------------------------------------ -void SfxMedium::SetCancelManager_Impl( SfxPoolCancelManager_Impl* pMgr ) -{ - pImp->xCancelManager = pMgr; -} - //---------------------------------------------------------------- -void SfxMedium::CancelTransfers() -{ - if( pImp->xCancelManager.Is() ) - pImp->xCancelManager->Cancel(); -} - sal_Bool SfxMedium::IsRemote() { return bRemote; @@ -3289,13 +3174,6 @@ sal_Bool SfxMedium::IsDownloadDone_Impl() return pImp->bDownloadDone; } -//---------------------------------------------------------------- - -void SfxMedium::SetDontCreateCancellable( ) -{ - pImp->bDontCreateCancellable = sal_True; -} - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SfxMedium::GetInputStream() { if ( !pImp->xInputStream.is() ) diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx index d8b6d23b8d03..e955c43af705 100644 --- a/sfx2/source/doc/docfilt.cxx +++ b/sfx2/source/doc/docfilt.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docfilt.cxx,v $ - * $Revision: 1.23.142.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx index 0b33dd3fd93d..d0f6678d8641 100644 --- a/sfx2/source/doc/docinf.cxx +++ b/sfx2/source/doc/docinf.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docinf.cxx,v $ - * $Revision: 1.54.174.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 622e7dcf5fa2..360854dc3dbf 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docinsert.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx index 8d96c08a51d4..249ebbaf02ab 100644 --- a/sfx2/source/doc/docmacromode.cxx +++ b/sfx2/source/doc/docmacromode.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docmacromode.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docstoragemodifylistener.cxx b/sfx2/source/doc/docstoragemodifylistener.cxx index c6bb649488ca..625aff0031fc 100644 --- a/sfx2/source/doc/docstoragemodifylistener.cxx +++ b/sfx2/source/doc/docstoragemodifylistener.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docstoragemodifylistener.cxx,v $ - * $Revision: 1.4.28.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctdlg.cxx b/sfx2/source/doc/doctdlg.cxx index d74aaf02d89a..e6726e97e96d 100644 --- a/sfx2/source/doc/doctdlg.cxx +++ b/sfx2/source/doc/doctdlg.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctdlg.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctdlg.hrc b/sfx2/source/doc/doctdlg.hrc index aeee4a06743b..8deed4699f3b 100644 --- a/sfx2/source/doc/doctdlg.hrc +++ b/sfx2/source/doc/doctdlg.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctdlg.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctdlg.src b/sfx2/source/doc/doctdlg.src index e0ac0d9dba6c..91d966fbd2d5 100644 --- a/sfx2/source/doc/doctdlg.src +++ b/sfx2/source/doc/doctdlg.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctdlg.src,v $ - * $Revision: 1.35 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 8773b3745567..f5ea04e5e08d 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctempl.cxx,v $ - * $Revision: 1.76 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -69,7 +66,6 @@ #include <com/sun/star/ucb/TransferInfo.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/ucb/XContent.hpp> -#include <com/sun/star/ucb/XContentCreator.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XAnyCompare.hpp> @@ -794,12 +790,12 @@ String SfxDocumentTemplates::GetDefaultTemplatePath INetURLObject aTemplateObj( pImp->GetRootURL() ); aTemplateObj.insertName( aGroupName, false, - INetURLObject::LAST_SEGMENT, true, - INetURLObject::ENCODE_ALL ); + INetURLObject::LAST_SEGMENT, true, + INetURLObject::ENCODE_ALL ); aTemplateObj.insertName( aTitle, false, - INetURLObject::LAST_SEGMENT, true, - INetURLObject::ENCODE_ALL ); + INetURLObject::LAST_SEGMENT, true, + INetURLObject::ENCODE_ALL ); ::rtl::OUString aResult; diff --git a/sfx2/source/doc/doctempl.src b/sfx2/source/doc/doctempl.src index ce0966eca534..2c91358f845e 100644 --- a/sfx2/source/doc/doctempl.src +++ b/sfx2/source/doc/doctempl.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctempl.src,v $ - * $Revision: 1.35 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 1a4b4e8d0d82..1abf43e4ebd8 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctemplates.cxx,v $ - * $Revision: 1.42.84.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctemplateslocal.cxx b/sfx2/source/doc/doctemplateslocal.cxx index 2ac7e8d17ecd..277199d30051 100644 --- a/sfx2/source/doc/doctemplateslocal.cxx +++ b/sfx2/source/doc/doctemplateslocal.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctemplateslocal.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/doctemplateslocal.hxx b/sfx2/source/doc/doctemplateslocal.hxx index baf947a6e954..84b1a9cc9611 100644 --- a/sfx2/source/doc/doctemplateslocal.hxx +++ b/sfx2/source/doc/doctemplateslocal.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctemplateslocal.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx index 0b840a20792e..6367f2a65d76 100644 --- a/sfx2/source/doc/docvor.cxx +++ b/sfx2/source/doc/docvor.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docvor.cxx,v $ - * $Revision: 1.54 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docvor.hrc b/sfx2/source/doc/docvor.hrc index b79a38ad6a35..842aa73fb8a3 100644 --- a/sfx2/source/doc/docvor.hrc +++ b/sfx2/source/doc/docvor.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docvor.hrc,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/docvor.src b/sfx2/source/doc/docvor.src index 1c91b48bb116..2c9975de9bb8 100644 --- a/sfx2/source/doc/docvor.src +++ b/sfx2/source/doc/docvor.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: docvor.src,v $ - * $Revision: 1.46 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/frmdescr.cxx b/sfx2/source/doc/frmdescr.cxx index 23616edf9279..04c3e78a7e7b 100644 --- a/sfx2/source/doc/frmdescr.cxx +++ b/sfx2/source/doc/frmdescr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frmdescr.cxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx index 5dc3edfdbd76..eff1554526ea 100644 --- a/sfx2/source/doc/graphhelp.cxx +++ b/sfx2/source/doc/graphhelp.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: graphhelp.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/graphhelp.hxx b/sfx2/source/doc/graphhelp.hxx index 9af90b19742c..22f8ad5a115e 100644 --- a/sfx2/source/doc/graphhelp.hxx +++ b/sfx2/source/doc/graphhelp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: graphhelp.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/graphhelp.src b/sfx2/source/doc/graphhelp.src index 86cfa20508ea..1936a8460d25 100644 --- a/sfx2/source/doc/graphhelp.src +++ b/sfx2/source/doc/graphhelp.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: graphhelp.src,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 8966f0e8a651..bb108ba4118d 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: guisaveas.cxx,v $ - * $Revision: 1.37 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -840,8 +837,8 @@ sal_Bool ModelData_Impl::OutputFileDialog( sal_Int8 nStoreMode, ::rtl::OUString aAdjustToType; // bSetStandardName == true means that user agreed to store document in the default (default default ;-)) format - if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) &&
- ( bSetStandardName || GetStorable()->hasLocation() ))
+ if ( !(( nStoreMode & EXPORT_REQUESTED ) && !( nStoreMode & WIDEEXPORT_REQUESTED )) && + ( bSetStandardName || GetStorable()->hasLocation() )) { uno::Sequence< beans::PropertyValue > aOldFilterProps; ::rtl::OUString aOldFilterName = GetDocProps().getUnpackedValueOrDefault( diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 92c28e81cb2e..3ad0cc51a923 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: iframe.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/makefile.mk b/sfx2/source/doc/makefile.mk index 66fd03175a8e..7da456ebaa36 100644 --- a/sfx2/source/doc/makefile.mk +++ b/sfx2/source/doc/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.33 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 05d2cd5e4599..932f6f10ecb0 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: new.cxx,v $ - * $Revision: 1.21 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/new.hrc b/sfx2/source/doc/new.hrc index b80b5f969b3f..dd8878bf0177 100644 --- a/sfx2/source/doc/new.hrc +++ b/sfx2/source/doc/new.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: new.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/new.src b/sfx2/source/doc/new.src index 7df8d711ecc7..146f9f630570 100644 --- a/sfx2/source/doc/new.src +++ b/sfx2/source/doc/new.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: new.src,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 2e56b1b96a8e..890862a4de03 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objcont.cxx,v $ - * $Revision: 1.78 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -50,8 +47,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> @@ -62,6 +59,7 @@ #include <unotools/useroptions.hxx> #include <unotools/localfilehelper.hxx> #include <vcl/virdev.hxx> +#include <vcl/oldprintadaptor.hxx> #include <sfx2/app.hxx> #include "sfx2/sfxresid.hxx" @@ -73,11 +71,11 @@ #include <sfx2/objsh.hxx> #include "objshimp.hxx" #include <sfx2/evntconf.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/dispatch.hxx> #include <sfx2/printer.hxx> -#include <sfx2/topfrm.hxx> #include "sfx2/basmgr.hxx" +#include <sfx2/viewfrm.hxx> #include <sfx2/doctempl.hxx> #include "doc.hrc" #include <sfx2/sfxbasemodel.hxx> @@ -91,9 +89,6 @@ using namespace ::com::sun::star::uno; //==================================================================== -#define SFX_WINDOWS_STREAM "SfxWindows" -#define SFX_PREVIEW_STREAM "SfxPreview" - //==================================================================== static @@ -191,252 +186,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() @@ -481,13 +230,24 @@ void SfxObjectShell::UpdateDocInfoForSave() //-------------------------------------------------------------------- +static void +lcl_add(util::Duration & rDur, Time const& rTime) +{ + // here we don't care about overflow: rDur is converted back to seconds + // anyway, and Time cannot store more than ~4000 hours + rDur.Hours += rTime.GetHour(); + rDur.Minutes += rTime.GetMin(); + rDur.Seconds += rTime.GetSec(); +} + // Bearbeitungszeit aktualisieren void SfxObjectShell::UpdateTime_Impl( const uno::Reference<document::XDocumentProperties> & i_xDocProps) { // Get old time from documentinfo - sal_Int32 secs = i_xDocProps->getEditingDuration(); - Time aOldTime(secs/3600, (secs%3600)/60, secs%60); + const sal_Int32 secs = i_xDocProps->getEditingDuration(); + util::Duration editDuration(sal_False, 0, 0, 0, + secs/3600, (secs%3600)/60, secs%60, 0); // Initialize some local member! Its neccessary for wollow operations! DateTime aNow ; // Date and time at current moment @@ -524,13 +284,14 @@ void SfxObjectShell::UpdateTime_Impl( nAddTime += aNow ; } - aOldTime += nAddTime; + lcl_add(editDuration, nAddTime); } pImp->nTime = aNow; try { - i_xDocProps->setEditingDuration( - aOldTime.GetHour()*3600+aOldTime.GetMin()*60+aOldTime.GetSec()); + const sal_Int32 newSecs( (editDuration.Hours*3600) + + (editDuration.Minutes*60) + editDuration.Seconds); + i_xDocProps->setEditingDuration(newSecs); i_xDocProps->setEditingCycles(i_xDocProps->getEditingCycles() + 1); } catch (lang::IllegalArgumentException &) @@ -961,11 +722,8 @@ BOOL SfxObjectShell::Remove String aName(pMySheet->GetName()); String aEmpty; SfxStyleFamily eFamily = pMySheet->GetFamily(); - if (pMySheet) - { - pMyPool->Remove(pMySheet); - bRet = TRUE; - } + pMyPool->Remove(pMySheet); + bRet = TRUE; SfxStyleSheetBase* pTestSheet = pMyPool->First(); while (pTestSheet) @@ -986,20 +744,10 @@ BOOL SfxObjectShell::Remove pTestSheet = pMyPool->Next(); } - if(bRet) - SetModified( TRUE ); - } -/* - else if (nIdx1 == CONTENT_CONFIG) - { - if (GetConfigManager()->RemoveItem(nIdx2)) - { - SetModified(TRUE); - bRet = TRUE; - SFX_APP()->GetDispatcher_Impl()->Update_Impl(TRUE); - } + + SetModified( TRUE ); } -*/ + return bRet; } @@ -1031,26 +779,18 @@ BOOL SfxObjectShell::Print if ( !pStyle ) return TRUE; - if ( !rPrt.StartJob(String(SfxResId(STR_STYLES))) ) - { - delete pIter; - return FALSE; - } - if ( !rPrt.StartPage() ) - { - delete pIter; - return FALSE; - } - Reference< task::XStatusIndicator > xStatusIndicator; - xStatusIndicator = SFX_APP()->GetStatusIndicator(); - if ( xStatusIndicator.is() ) - xStatusIndicator->start( String(SfxResId(STR_PRINT_STYLES)), nStyles ); + // pepare adaptor for old style StartPage/EndPage printing + boost::shared_ptr< Printer > pPrinter( new Printer( rPrt.GetJobSetup() ) ); + vcl::OldStylePrintAdaptor* pAdaptor = new vcl::OldStylePrintAdaptor( pPrinter ); + boost::shared_ptr< vcl::PrinterController > pController( pAdaptor ); - rPrt.SetMapMode(MapMode(MAP_10TH_MM)); + pAdaptor->StartPage(); + + pPrinter->SetMapMode(MapMode(MAP_10TH_MM)); Font aFont( DEFINE_CONST_UNICODE( "Arial" ), Size(0, 64)); // 18pt aFont.SetWeight(WEIGHT_BOLD); - rPrt.SetFont(aFont); - const Size aPageSize(rPrt.GetOutputSize()); + pPrinter->SetFont(aFont); + const Size aPageSize(pPrinter->GetOutputSize()); const USHORT nXIndent = 200; USHORT nYIndent = 200; Point aOutPos(nXIndent, nYIndent); @@ -1059,68 +799,66 @@ BOOL SfxObjectShell::Print aHeader += *pObjectName; else aHeader += GetTitle(); - long nTextHeight( rPrt.GetTextHeight() ); - rPrt.DrawText(aOutPos, aHeader); + long nTextHeight( pPrinter->GetTextHeight() ); + pPrinter->DrawText(aOutPos, aHeader); aOutPos.Y() += nTextHeight; aOutPos.Y() += nTextHeight/2; aFont.SetSize(Size(0, 35)); // 10pt nStyles = 1; while(pStyle) { - if ( xStatusIndicator.is() ) - xStatusIndicator->setValue( nStyles++ ); - // Ausgabe des Vorlagennamens + // print template name String aStr(pStyle->GetName()); aFont.SetWeight(WEIGHT_BOLD); - rPrt.SetFont(aFont); - nTextHeight = rPrt.GetTextHeight(); - // Seitenwechsel + pPrinter->SetFont(aFont); + nTextHeight = pPrinter->GetTextHeight(); + // check for new page if ( aOutPos.Y() + nTextHeight*2 > aPageSize.Height() - (long) nYIndent ) { - rPrt.EndPage(); - rPrt.StartPage(); + pAdaptor->EndPage(); + pAdaptor->StartPage(); aOutPos.Y() = nYIndent; } - rPrt.DrawText(aOutPos, aStr); + pPrinter->DrawText(aOutPos, aStr); aOutPos.Y() += nTextHeight; - // Ausgabe der Vorlagenbeschreibung + // print template description aFont.SetWeight(WEIGHT_NORMAL); - rPrt.SetFont(aFont); + pPrinter->SetFont(aFont); aStr = pStyle->GetDescription(); const char cDelim = ' '; USHORT nStart = 0, nIdx = 0; - nTextHeight = rPrt.GetTextHeight(); - // wie viele Worte passen auf eine Zeile + nTextHeight = pPrinter->GetTextHeight(); + // break text into lines while(nIdx < aStr.Len()) { USHORT nOld = nIdx; long nTextWidth; nIdx = aStr.Search(cDelim, nStart); - nTextWidth = rPrt.GetTextWidth(aStr, nStart, nIdx-nStart); + nTextWidth = pPrinter->GetTextWidth(aStr, nStart, nIdx-nStart); while(nIdx != STRING_NOTFOUND && aOutPos.X() + nTextWidth < aPageSize.Width() - (long) nXIndent) { nOld = nIdx; nIdx = aStr.Search(cDelim, nIdx+1); - nTextWidth = rPrt.GetTextWidth(aStr, nStart, nIdx-nStart); + nTextWidth = pPrinter->GetTextWidth(aStr, nStart, nIdx-nStart); } String aTmp(aStr, nStart, nIdx == STRING_NOTFOUND? STRING_LEN : nOld-nStart); if ( aTmp.Len() ) { - nStart = nOld+1; // wegen trailing space + nStart = nOld+1; // trailing space } else { USHORT nChar = 1; while( nStart + nChar < aStr.Len() && - aOutPos.X() + rPrt.GetTextWidth( + aOutPos.X() + pPrinter->GetTextWidth( aStr, nStart, nChar) < aPageSize.Width() - nXIndent) ++nChar; @@ -1131,19 +869,19 @@ BOOL SfxObjectShell::Print if ( aOutPos.Y() + nTextHeight*2 > aPageSize.Height() - nYIndent ) { - rPrt.EndPage(); - rPrt.StartPage(); + pAdaptor->EndPage(); + pAdaptor->StartPage(); aOutPos.Y() = nYIndent; } - rPrt.DrawText(aOutPos, aTmp); - aOutPos.Y() += rPrt.GetTextHeight(); + pPrinter->DrawText(aOutPos, aTmp); + aOutPos.Y() += pPrinter->GetTextHeight(); } pStyle = pIter->Next(); } - rPrt.EndPage(); - rPrt.EndJob(); - if ( xStatusIndicator.is() ) - xStatusIndicator->end(); + pAdaptor->EndPage(); + + Printer::PrintJob( pController, rPrt.GetJobSetup() ); + delete pIter; break; } diff --git a/sfx2/source/doc/objembed.cxx b/sfx2/source/doc/objembed.cxx index 7b7a1bea1ea0..1c2105c210b9 100644 --- a/sfx2/source/doc/objembed.cxx +++ b/sfx2/source/doc/objembed.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objembed.cxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -308,7 +305,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, comphelper::EmbeddedObjectContainer& SfxObjectShell::GetEmbeddedObjectContainer() const { if ( !pImp->mpObjectContainer ) - pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), pImp->xModel ); + pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), GetModel() ); return *pImp->mpObjectContainer; } diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx index 6082ce669833..2980d984fd78 100644 --- a/sfx2/source/doc/objitem.cxx +++ b/sfx2/source/doc/objitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objitem.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 2143f9cbd8ad..7e5b69081f1b 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objmisc.cxx,v $ - * $Revision: 1.102.104.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -87,7 +84,7 @@ #include <comphelper/configurationhelper.hxx> #include <com/sun/star/security/XDocumentDigitalSignatures.hpp> -#include <com/sun/star/task/DocumentMacroConfirmationRequest2.hpp> +#include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp> #include <com/sun/star/task/InteractionClassification.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -408,17 +405,11 @@ void SfxObjectShell::ModifyChanged() return; {DBG_CHKTHIS(SfxObjectShell, 0);} - SfxObjectShell *pDoc; - for ( pDoc = SfxObjectShell::GetFirst(); pDoc; - pDoc = SfxObjectShell::GetNext(*pDoc) ) - if( pDoc->IsModified() ) - break; SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if ( pViewFrame ) pViewFrame->GetBindings().Invalidate( SID_SAVEDOCS ); - Invalidate( SID_SIGNATURE ); Invalidate( SID_MACRO_SIGNATURE ); Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); // xmlsec05, signed state might change in title... @@ -1137,7 +1128,7 @@ void SfxObjectShell::SetProgress_Impl void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame* pFrame ) { SfxApplication* pSfxApp = SFX_APP(); - if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame()->IsClosing_Impl() ) + if ( !pSfxApp->IsDowning() && !IsLoading() && pFrame && !pFrame->GetFrame().IsClosing_Impl() ) { SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); if ( !pHiddenItem || !pHiddenItem->GetValue() ) @@ -1168,7 +1159,6 @@ void SfxObjectShell::RegisterTransfer( SfxMedium& rMedium ) laden, muessen an der zugehoerigen SfxObjectShell angemeldet werden. So kann dokumentweise abgebrochen werden. */ { - rMedium.SetCancelManager_Impl( GetMedium()->GetCancelManager_Impl() ); rMedium.SetReferer( GetMedium()->GetName() ); } @@ -1440,8 +1430,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) } } - pImp->bInitialized = sal_True; - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + SetInitialized_Impl( false ); // Title is not available until loading has finished Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); @@ -1560,7 +1549,7 @@ void SfxObjectShell::PositionView_Impl() sal_Bool SfxObjectShell::IsLoading() const /* [Beschreibung ] - Wurde bereits FinishedLoading aufgerufeb? */ + Has FinishedLoading been called? */ { return !( pImp->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ); } @@ -1572,7 +1561,6 @@ void SfxObjectShell::CancelTransfers() Hier koennen Transfers gecanceled werden, die nicht mit RegisterTransfer registiert wurden */ { - GetMedium()->CancelTransfers(); if( ( pImp->nLoadedFlags & SFX_LOADED_ALL ) != SFX_LOADED_ALL ) { AbortImport(); @@ -2031,12 +2019,6 @@ void SfxObjectShell::SetHeaderAttributesForSourceViewHack() ->SetAttributes(); } -void SfxObjectShell::StartLoading_Impl() -{ - pImp->nLoadedFlags = 0; - pImp->bModelInitialized = sal_False; -} - sal_Bool SfxObjectShell::IsPreview() const { if ( !pMedium ) @@ -2112,9 +2094,9 @@ void SfxObjectShell::SetWaitCursor( BOOL bSet ) const for( SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, this ) ) { if ( bSet ) - pFrame->GetFrame()->GetWindow().EnterWait(); + pFrame->GetFrame().GetWindow().EnterWait(); else - pFrame->GetFrame()->GetWindow().LeaveWait(); + pFrame->GetFrame().GetWindow().LeaveWait(); } } @@ -2152,13 +2134,11 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) { Window* pWindow = 0; SfxItemSet* pSet = pLoadingMedium ? pLoadingMedium->GetItemSet() : GetMedium()->GetItemSet(); - SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoAnyItem, SID_FILLFRAME, FALSE ); + SFX_ITEMSET_ARG( pSet, pUnoItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); if ( pUnoItem ) { - uno::Reference < frame::XFrame > xFrame; - pUnoItem->GetValue() >>= xFrame; - if ( xFrame.is() ) - pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + uno::Reference < frame::XFrame > xFrame( pUnoItem->GetFrame() ); + pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); } if ( !pWindow ) @@ -2176,7 +2156,7 @@ Window* SfxObjectShell::GetDialogParent( SfxMedium* pLoadingMedium ) // get any visible frame pView = SfxViewFrame::GetFirst(this); if ( pView ) - pFrame = pView->GetFrame(); + pFrame = &pView->GetFrame(); } if ( pFrame ) @@ -2245,7 +2225,7 @@ BOOL SfxObjectShell::IsInPlaceActive() return FALSE; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - return pFrame && pFrame->GetFrame()->IsInPlace(); + return pFrame && pFrame->GetFrame().IsInPlace(); } BOOL SfxObjectShell::IsUIActive() @@ -2254,7 +2234,7 @@ BOOL SfxObjectShell::IsUIActive() return FALSE; SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); - return pFrame && pFrame->GetFrame()->IsInPlace() && pFrame->GetFrame()->GetWorkWindow_Impl()->IsVisible_Impl(); + return pFrame && pFrame->GetFrame().IsInPlace() && pFrame->GetFrame().GetWorkWindow_Impl()->IsVisible_Impl(); } void SfxObjectShell::UIActivate( BOOL ) @@ -2458,9 +2438,9 @@ sal_Bool SfxObjectShell_Impl::hasTrustedScriptingSignature( sal_Bool bAllowUIToA if ( xInteraction.is() ) { - task::DocumentMacroConfirmationRequest2 aRequest; + task::DocumentMacroConfirmationRequest aRequest; aRequest.DocumentURL = getDocumentLocation(); - aRequest.DocumentZipStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl(); + aRequest.DocumentStorage = rDocShell.GetMedium()->GetZipStorageToSign_Impl(); aRequest.DocumentSignatureInformation = aInfo; aRequest.DocumentVersion = aVersion; aRequest.Classification = task::InteractionClassification_QUERY; diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 83b0f4d19844..962a738e3ea3 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objserv.cxx,v $ - * $Revision: 1.106 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -88,13 +85,13 @@ #include "sfxtypes.hxx" //#include "interno.hxx" #include <sfx2/module.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "versdlg.hxx" #include "doc.hrc" #include <sfx2/docfac.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/filedlghelper.hxx> -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/msgpool.hxx> #include <sfx2/objface.hxx> @@ -140,8 +137,6 @@ public: #define SfxObjectShell #include "sfxslots.hxx" -svtools::AsynchronLink* pPendingCloser = 0; - //========================================================================= @@ -283,7 +278,7 @@ void SfxObjectShell::PrintExec_Impl(SfxRequest &rReq) void SfxObjectShell::PrintState_Impl(SfxItemSet &rSet) { bool bPrinting = false; - SfxViewFrame *pFrame = SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame)); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame ) { SfxPrinter *pPrinter = pFrame->GetViewShell()->GetPrinter(); @@ -391,7 +386,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) if ( !pFrame ) return; - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { pFrame->GetTopViewFrame()->GetObjectShell()->ExecuteSlot( rReq ); return; @@ -430,28 +425,15 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // collect data for dialog String aURL, aTitle; - if ( HasName() && !pImp->aNewName.Len() ) + if ( HasName() ) { aURL = GetMedium()->GetName(); aTitle = GetTitle(); } else { - if ( !pImp->aNewName.Len() ) - { - aURL = DEFINE_CONST_UNICODE( "private:factory/" ); - aURL += String::CreateFromAscii( GetFactory().GetShortName() ); - // aTitle = String( SfxResId( STR_NONAME ) ); - } - else - { - aURL = DEFINE_CONST_UNICODE( "[private:factory/" ); - aURL += String::CreateFromAscii( GetFactory().GetShortName() ); - aURL += DEFINE_CONST_UNICODE( "]" ); - INetURLObject aURLObj( pImp->aNewName ); - aURL += String(aURLObj.GetMainURL( INetURLObject::DECODE_TO_IURI )); - // aTitle = aURLObj.GetBase(); - } + aURL = DEFINE_CONST_UNICODE( "private:factory/" ); + aURL += String::CreateFromAscii( GetFactory().GetShortName() ); aTitle = GetTitle(); } @@ -542,10 +524,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) // get statusindicator uno::Reference< task::XStatusIndicator > xStatusIndicator; SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame() ) + if ( pFrame ) { uno::Reference< task::XStatusIndicatorFactory > xStatFactory( - pFrame->GetFrame()->GetFrameInterface(), + pFrame->GetFrame().GetFrameInterface(), uno::UNO_QUERY ); if( xStatFactory.is() ) xStatusIndicator = xStatFactory->createStatusIndicator(); @@ -665,9 +647,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) && pFilt->GetVersion() >= SOFFICE_FILEFORMAT_60 ) { SfxViewFrame* pDocViewFrame = SfxViewFrame::GetFirst( this ); - SfxFrame* pDocFrame = pDocViewFrame ? pDocViewFrame->GetFrame() : NULL; - if ( pDocFrame ) - SfxHelp::OpenHelpAgent( pDocFrame, HID_DID_SAVE_PACKED_XML ); + if ( pDocViewFrame ) + SfxHelp::OpenHelpAgent( &pDocViewFrame->GetFrame(), HID_DID_SAVE_PACKED_XML ); } // the StoreAsURL/StoreToURL method have called this method with false @@ -731,7 +712,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) case SID_CLOSEDOC: { SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das // aktuelle Dokument aber in einem Frame liegt, soll eigentlich @@ -746,7 +727,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { // Auf dieses Dokument existiert noch eine Sicht, die // in einem FrameSet liegt; diese darf nat"urlich nicht @@ -765,8 +746,8 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) pFrame = SfxViewFrame::GetFirst( this ); while ( pFrame ) { - if ( !pFrame->GetFrame()->GetParentFrame() ) - pFrame->GetFrame()->DoClose(); + if ( !pFrame->GetFrame().GetParentFrame() ) + pFrame->GetFrame().DoClose(); pFrame = SfxViewFrame::GetNext( *pFrame, this ); } } @@ -940,7 +921,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) pFrame = SfxViewFrame::GetFirst( this ); if ( pFrame ) { - if ( pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame->GetFrame().GetParentFrame() ) { pFrame = pFrame->GetTopViewFrame(); pDoc = pFrame->GetObjectShell(); @@ -973,7 +954,7 @@ void SfxObjectShell::GetState_Impl(SfxItemSet &rSet) { SfxObjectShell *pDoc = this; SfxViewFrame *pFrame = GetFrame(); - if ( pFrame && pFrame->GetFrame()->GetParentFrame() ) + if ( pFrame && pFrame->GetFrame().GetParentFrame() ) { // Wenn SID_CLOSEDOC "uber Menue etc. ausgef"uhrt wird, das // aktuelle Dokument aber in einem Frame liegt, soll eigentlich @@ -1193,7 +1174,7 @@ void SfxObjectShell::StateProps_Impl(SfxItemSet &rSet) case SID_CLOSING: { - rSet.Put( SfxBoolItem( SID_CLOSING, Get_Impl()->bInCloseEvent ) ); + rSet.Put( SfxBoolItem( SID_CLOSING, false ) ); break; } @@ -1218,10 +1199,9 @@ void SfxObjectShell::ExecView_Impl(SfxRequest &rReq) { case SID_ACTIVATE: { - SfxViewFrame *pFrame = - SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame), TRUE ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, TRUE ); if ( pFrame ) - pFrame->GetFrame()->Appear(); + pFrame->GetFrame().Appear(); rReq.SetReturnValue( SfxObjectItem( 0, pFrame ) ); rReq.Done(); break; @@ -1262,21 +1242,13 @@ sal_uInt16 SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequence< bool bCompleteSignature = true; if( nInfos ) { - //These errors of certificates are allowed - sal_Int32 nNonErrors = security::CertificateValidity::VALID | - security::CertificateValidity::UNKNOWN_REVOKATION; - //Build a mask to filter out the allowed errors - sal_Int32 nMask = ~nNonErrors; - nResult = SIGNATURESTATE_SIGNATURES_OK; for ( int n = 0; n < nInfos; n++ ) { if ( bCertValid ) { sal_Int32 nCertStat = aInfos[n].CertificateStatus; - // "subtract" the allowed error flags from the result - sal_Int32 nErrors = ( nCertStat & nMask ); - bCertValid = nErrors > 0 ? sal_False : sal_True; + bCertValid = nCertStat == security::CertificateValidity::VALID ? sal_True : sal_False; } if ( !aInfos[n].SignatureIsValid ) diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index b730b0510011..cd27740646a9 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objstor.cxx,v $ - * $Revision: 1.212.44.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -211,31 +208,6 @@ sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd ) } //------------------------------------------------------------------------- -sal_Bool SfxObjectShell::NoDependencyFromManifest_Impl( const uno::Reference< embed::XStorage >& xStorage ) -{ - uno::Sequence< ::rtl::OUString > aElements = xStorage->getElementNames(); - for ( sal_Int32 nInd = 0; nInd < aElements.getLength(); nInd++ ) - { - if ( xStorage->isStorageElement( aElements[nInd] ) ) - { - // if there are other standard elements that do not need manifest.xml the following - // list can be extended - if ( !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Configurations" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Configurations2" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Thumbnails" ) ) ) - && !aElements[nInd].equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ) ) ) - { - // the substorage is not know as one that does not need manifest.xml - return sal_False; - } - } - } - - return sal_True; -} - -//------------------------------------------------------------------------- sal_Bool SfxObjectShell::PutURLContentsToVersionStream_Impl( ::rtl::OUString aURL, const uno::Reference< embed::XStorage >& xDocStorage, @@ -447,23 +419,6 @@ sal_Bool SfxObjectShell::Load( SfxMedium& rMedium ) return GeneralInit_Impl( rMedium.GetStorage(), sal_True ); } -//------------------------------------------------------------------------- -sal_Bool SfxObjectShell::DoInitNew_Impl( const ::rtl::OUString& rName ) - -/* [Beschreibung] -*/ - -{ - if ( rName.getLength() ) - { - DBG_ERROR( "This code is intended to be removed, the caller part must be checked!\n" ); - return DoInitNew(0); - } - else - return DoInitNew(0); -} - - sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) /* [Beschreibung] @@ -518,9 +473,7 @@ sal_Bool SfxObjectShell::DoInitNew( SfxMedium* pMed ) impl_addToModelCollection(xModel); } - pImp->bInitialized = sal_True; - SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); - SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + SetInitialized_Impl( true ); return sal_True; } @@ -869,7 +822,7 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed ) ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest = new ::comphelper::OInteractionRequest( makeAny( aUpdateRequest ) ); pRequest->addContinuation( new ::comphelper::OInteractionApprove ); - pRequest->addContinuation( new ::comphelper::OInteractionDisapprove ); + pRequest->addContinuation( new ::comphelper::OInteractionAbort ); typedef ::comphelper::OInteraction< XInteractionAskLater > OInteractionAskLater; OInteractionAskLater* pLater = new OInteractionAskLater; @@ -952,27 +905,27 @@ sal_uInt32 SfxObjectShell::HandleFilter( SfxMedium* pMedium, SfxObjectShell* pDo if ( !pFORequest->isAbort() ) { - SfxAllItemSet aNewParams( pDoc->GetPool() ); - TransformParameters( SID_OPENDOC, - pFORequest->getFilterOptions(), - aNewParams, - NULL ); - - SFX_ITEMSET_ARG( &aNewParams, - pFilterOptions, - SfxStringItem, - SID_FILE_FILTEROPTIONS, - sal_False ); - if ( pFilterOptions ) - pSet->Put( *pFilterOptions ); - - SFX_ITEMSET_ARG( &aNewParams, - pFilterData, - SfxUnoAnyItem, - SID_FILTER_DATA, - sal_False ); - if ( pFilterData ) - pSet->Put( *pFilterData ); + SfxAllItemSet aNewParams( pDoc->GetPool() ); + TransformParameters( SID_OPENDOC, + pFORequest->getFilterOptions(), + aNewParams, + NULL ); + + SFX_ITEMSET_ARG( &aNewParams, + pFilterOptions, + SfxStringItem, + SID_FILE_FILTEROPTIONS, + sal_False ); + if ( pFilterOptions ) + pSet->Put( *pFilterOptions ); + + SFX_ITEMSET_ARG( &aNewParams, + pFilterData, + SfxUnoAnyItem, + SID_FILTER_DATA, + sal_False ); + if ( pFilterData ) + pSet->Put( *pFilterData ); } else bAbort = TRUE; @@ -1796,14 +1749,14 @@ sal_Bool SfxObjectShell::SaveTo_Impl #define CHAR_POINTER(THE_OUSTRING) ::rtl::OUStringToOString (THE_OUSTRING, RTL_TEXTENCODING_UTF8).pData->buffer // Header for a single-valued ASCII EA data item typedef struct _EA_ASCII_header { - USHORT usAttr; /* value: EAT_ASCII */ - USHORT usLen; /* length of data */ - CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */ + USHORT usAttr; /* value: EAT_ASCII */ + USHORT usLen; /* length of data */ + CHAR szType[_MAX_PATH]; /* ASCII data fits in here ... */ } EA_ASCII_HEADER; - char filePath[_MAX_PATH]; - char fileExt[_MAX_PATH]; - char docType[_MAX_PATH]; - int rc; + char filePath[_MAX_PATH]; + char fileExt[_MAX_PATH]; + char docType[_MAX_PATH]; + int rc; oslFileError eRet; ::rtl::OUString aSystemFileURL; const ::rtl::OUString aFileURL = rMedium.GetName(); @@ -2818,7 +2771,6 @@ sal_Bool SfxObjectShell::CommonSaveAs_Impl pSet->ClearItem( SID_OPTIONS ); //pSet->ClearItem( SID_FILE_FILTEROPTIONS ); pSet->ClearItem( SID_VERSION ); - //pSet->ClearItem( SID_USE_FILTEROPTIONS ); pSet->ClearItem( SID_EDITDOC ); pSet->ClearItem( SID_OVERWRITE ); pSet->ClearItem( SID_DEFAULTFILEPATH ); @@ -3435,7 +3387,7 @@ sal_Bool SfxObjectShell::SaveCompleted( const uno::Reference< embed::XStorage >& sal_Bool StoragesOfUnknownMediaTypeAreCopied_Impl( const uno::Reference< embed::XStorage >& xSource, - const uno::Reference< embed::XStorage >& xTarget ) + const uno::Reference< embed::XStorage >& xTarget ) { OSL_ENSURE( xSource.is() && xTarget.is(), "Source and/or target storages are not available!\n" ); if ( !xSource.is() || !xTarget.is() || xSource == xTarget ) diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx index 27d740bf59c6..32d50de40d51 100644 --- a/sfx2/source/doc/objuno.cxx +++ b/sfx2/source/doc/objuno.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objuno.cxx,v $ - * $Revision: 1.41 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index ec1710ed8d36..a4fa027805a7 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objxtor.cxx,v $ - * $Revision: 1.85 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -57,7 +54,7 @@ #include <svl/eitem.hxx> #include <tools/rtti.hxx> #include <svl/lstner.hxx> -#include <sfxhelp.hxx> +#include <sfx2/sfxhelp.hxx> #include <basic/sbstar.hxx> #include <svl/stritem.hxx> #include <basic/sbx.hxx> @@ -65,6 +62,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/signaturestate.hxx> +#include <sfx2/sfxmodelfactory.hxx> #ifndef _BASIC_SBUNO_HXX #include <basic/sbuno.hxx> @@ -134,7 +132,6 @@ DBG_NAME(SfxObjectShell) #define DocumentInfo #include "sfxslots.hxx" -extern svtools::AsynchronLink* pPendingCloser; static WeakReference< XInterface > s_xCurrentComponent; //========================================================================= @@ -189,9 +186,7 @@ TYPEINIT1(SfxObjectShell, SfxShell); //-------------------------------------------------------------------- SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) -:mpObjectContainer(0) - ,pAccMgr(0) - ,pCfgMgr( 0) + :mpObjectContainer(0) ,pBasicManager( new SfxBasicManagerHolder ) ,rDocShell( _rDocShell ) ,aMacroMode( *this ) @@ -200,10 +195,8 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,nVisualDocumentNumber( USHRT_MAX) ,nDocumentSignatureState( SIGNATURESTATE_UNKNOWN ) ,nScriptingSignatureState( SIGNATURESTATE_UNKNOWN ) - ,bTemplateConfig( sal_False) ,bInList( sal_False) ,bClosing( sal_False) - ,bSetInPlaceObj( sal_False) ,bIsSaving( sal_False) ,bPasswd( sal_False) ,bIsTmp( sal_False) @@ -213,15 +206,9 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bImportDone ( sal_False) ,bInPrepareClose( sal_False ) ,bPreparedForClose( sal_False ) - ,bWaitingForPicklist( sal_False ) - ,bModuleSearched( sal_False ) - ,bIsHelpObjSh( sal_False ) - ,bForbidCaching( sal_False ) + ,bWaitingForPicklist( sal_True ) ,bForbidReload( sal_False ) - ,bSupportsEventMacros( sal_True ) - ,bLoadingWindows( sal_False ) ,bBasicInitialized( sal_False ) -// ,bHidden( sal_False ) ,bIsPrintJobCancelable( sal_True ) ,bOwnsStorage( sal_True ) ,bNoBaseURL( sal_False ) @@ -231,6 +218,7 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,bPreserveVersions( sal_True ) ,m_bMacroSignBroken( sal_False ) ,m_bNoBasicCapabilities( sal_False ) + ,m_bDocRecoverySupport( sal_True ) ,bQueryLoadTemplate( sal_True ) ,bLoadReadonly( sal_False ) ,bUseUserData( sal_True ) @@ -239,46 +227,62 @@ SfxObjectShell_Impl::SfxObjectShell_Impl( SfxObjectShell& _rDocShell ) ,m_bAllowShareControlFileClean( sal_True ) ,lErr(ERRCODE_NONE) ,nEventId ( 0) - ,bDoNotTouchDocInfo( sal_False ) ,pReloadTimer ( 0) ,pMarkData( 0 ) - ,nLoadedFlags ( SFX_LOADED_MAINDOCUMENT ) + ,nLoadedFlags ( SFX_LOADED_ALL ) ,nFlagsInProgress( 0 ) - ,bInFrame( sal_False ) ,bModalMode( sal_False ) ,bRunningMacro( sal_False ) ,bReloadAvailable( sal_False ) ,nAutoLoadLocks( 0 ) ,pModule( 0 ) - ,pFrame( 0 ) - ,pTbxConfig( 0 ) ,eFlags( SFXOBJECTSHELL_UNDEFINED ) - ,pCloser( 0 ) ,bReadOnlyUI( sal_False ) ,bHiddenLockedByAPI( sal_False ) - ,bInCloseEvent( sal_False ) ,nStyleFilter( 0 ) ,bDisposing( sal_False ) ,m_bEnableSetModified( sal_True ) ,m_bIsModified( sal_False ) ,m_nMapUnit( MAP_100TH_MM ) ,m_bCreateTempStor( sal_False ) - ,m_xDocInfoListener() ,m_bIsInit( sal_False ) ,m_bIncomplEncrWarnShown( sal_False ) { + SfxObjectShell* pDoc = &_rDocShell; + SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); + rArr.C40_INSERT( SfxObjectShell, pDoc, rArr.Count() ); + bInList = sal_True; } //-------------------------------------------------------------------- SfxObjectShell_Impl::~SfxObjectShell_Impl() { - if ( pPendingCloser == pCloser ) - pPendingCloser = 0; - delete pCloser; delete pBasicManager; } +//-------------------------------------------------------------------- + +SfxObjectShell::SfxObjectShell( const sal_uInt64 i_nCreationFlags ) + : pImp( new SfxObjectShell_Impl( *this ) ) + , pMedium(0) + , pStyleSheetPool(0) + , eCreateMode( ( i_nCreationFlags & SFXMODEL_EMBEDDED_OBJECT ) ? SFX_CREATE_MODE_EMBEDDED : SFX_CREATE_MODE_STANDARD ) + , bHasName( sal_False ) +{ + DBG_CTOR(SfxObjectShell, 0); + + const bool bScriptSupport = ( i_nCreationFlags & SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) == 0; + if ( !bScriptSupport ) + SetHasNoBasic(); + + const bool bDocRecovery = ( i_nCreationFlags & SFXMODEL_DISABLE_DOCUMENT_RECOVERY ) == 0; + if ( !bDocRecovery ) + pImp->m_bDocRecoverySupport = sal_False; +} + +//-------------------------------------------------------------------- + // initializes a document from a file-description SfxObjectShell::SfxObjectShell @@ -312,24 +316,10 @@ SfxObjectShell::SfxObjectShell : pImp( new SfxObjectShell_Impl( *this ) ), pMedium(0), pStyleSheetPool(0), - eCreateMode(eMode) + eCreateMode(eMode), + bHasName( sal_False ) { DBG_CTOR(SfxObjectShell, 0); - - bHasName = sal_False; - nViewNo = 0; - - pImp->bWaitingForPicklist = sal_True; - - // Aggregation InPlaceObject+Automation -//(mba) AddInterface( SvDispatch::ClassFactory() ); - - SfxObjectShell *pThis = this; - SfxObjectShellArr_Impl &rArr = SFX_APP()->GetObjectShells_Impl(); - rArr.C40_INSERT( SfxObjectShell, pThis, rArr.Count() ); - pImp->bInList = sal_True; - pImp->nLoadedFlags = SFX_LOADED_ALL; -//REMOVE SetObjectShell( TRUE ); } //-------------------------------------------------------------------- @@ -347,12 +337,8 @@ SfxObjectShell::~SfxObjectShell() // Ableitungszweig SfxInternObject ist wegen eines Compiler Bugs nicht // erlaubt SfxObjectShell::Close(); - pImp->xModel = NULL; + pImp->pBaseModel.set( NULL ); -// DELETEX(pImp->pEventConfig); -// DELETEX(pImp->pTbxConfig); -// DELETEX(pImp->pAccMgr); -// DELETEX(pImp->pCfgMgr); DELETEX(pImp->pReloadTimer ); SfxApplication *pSfxApp = SFX_APP(); @@ -365,8 +351,7 @@ SfxObjectShell::~SfxObjectShell() if ( pSfxApp->GetDdeService() ) pSfxApp->RemoveDdeTopic( this ); - if ( pImp->xModel.is() ) - pImp->xModel = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > (); + pImp->pBaseModel.set( NULL ); // don't call GetStorage() here, in case of Load Failure it's possible that a storage was never assigned! if ( pMedium && pMedium->HasStorage_Impl() && pMedium->GetStorage( sal_False ) == pImp->m_xDocStorage ) @@ -492,7 +477,7 @@ SfxObjectShell* SfxObjectShell::GetFirst continue; if ( ( !pType || pSh->IsA(*pType) ) && - ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, 0, sal_True ))) + ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, sal_True ))) return pSh; } @@ -525,7 +510,7 @@ SfxObjectShell* SfxObjectShell::GetNext continue; if ( ( !pType || pSh->IsA(*pType) ) && - ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, 0, sal_True ))) + ( !bOnlyVisible || SfxViewFrame::GetFirst( pSh, sal_True ))) return pSh; } return 0; @@ -565,12 +550,11 @@ sal_uInt16 SfxObjectShell::PrepareClose return sal_False; SfxViewFrame* pFirst = SfxViewFrame::GetFirst( this ); - if( pFirst && !pFirst->GetFrame()->PrepareClose_Impl( bUI, bForBrowsing ) ) + if( pFirst && !pFirst->GetFrame().PrepareClose_Impl( bUI, bForBrowsing ) ) return sal_False; // prepare views for closing - for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( - this, TYPE(SfxViewFrame)); + for ( SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this ); pFrm; pFrm = SfxViewFrame::GetNext( *pFrm, this ) ) { DBG_ASSERT(pFrm->GetViewShell(),"KeineShell"); @@ -595,83 +579,69 @@ sal_uInt16 SfxObjectShell::PrepareClose // nur fuer in sichtbaren Fenstern dargestellte Dokumente fragen SfxViewFrame *pFrame = SfxObjectShell::Current() == this ? SfxViewFrame::Current() : SfxViewFrame::GetFirst( this ); - while ( pFrame && (pFrame->GetFrameType() & SFXFRAME_SERVER ) ) - pFrame = SfxViewFrame::GetNext( *pFrame, this ); sal_Bool bClose = sal_False; - if ( bUI && IsModified() ) + if ( bUI && IsModified() && pFrame ) { - if ( pFrame ) + // minimierte restoren + SfxFrame& rTop = pFrame->GetTopFrame(); + SfxViewFrame::SetViewFrame( rTop.GetCurrentViewFrame() ); + pFrame->GetFrame().Appear(); + + // fragen, ob gespeichert werden soll + short nRet = RET_YES; + //TODO/CLEANUP + //brauchen wir UI=2 noch? + //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) { - // minimierte restoren - SfxFrame* pTop = pFrame->GetTopFrame(); - SfxViewFrame::SetViewFrame( pTop->GetCurrentViewFrame() ); - pFrame->GetFrame()->Appear(); - - // fragen, ob gespeichert werden soll - short nRet = RET_YES; - //TODO/CLEANUP - //brauchen wir UI=2 noch? - //if( SfxApplication::IsPlugin() == sal_False || bUI == 2 ) + //initiate help agent to inform about "print modifies the document" + SvtPrintWarningOptions aPrintOptions; + if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && + HasName() && getDocProperties()->getPrintDate().Month > 0) { - //initiate help agent to inform about "print modifies the document" - SvtPrintWarningOptions aPrintOptions; - if (aPrintOptions.IsModifyDocumentOnPrintingAllowed() && - HasName() && getDocProperties()->getPrintDate().Month > 0) - { - SfxHelp::OpenHelpAgent(pFirst->GetFrame(), HID_CLOSE_WARNING); - } - const Reference< XTitle > xTitle(pImp->xModel, UNO_QUERY_THROW); - const ::rtl::OUString sTitle = xTitle->getTitle (); - nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + SfxHelp::OpenHelpAgent( &pFirst->GetFrame(), HID_CLOSE_WARNING ); } - /*HACK for plugin::destroy()*/ + const Reference< XTitle > xTitle( *pImp->pBaseModel.get(), UNO_QUERY_THROW ); + const ::rtl::OUString sTitle = xTitle->getTitle (); + nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle); + } + /*HACK for plugin::destroy()*/ - if ( RET_YES == nRet ) + if ( RET_YES == nRet ) + { + // per Dispatcher speichern + const SfxPoolItem *pPoolItem; + if ( IsSaveVersionOnClose() ) { - // per Dispatcher speichern - const SfxPoolItem *pPoolItem; - if ( IsSaveVersionOnClose() ) - { - SfxStringItem aItem( SID_DOCINFO_COMMENTS, String( SfxResId( STR_AUTOMATICVERSION ) ) ); - SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); - const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, 0 }; - pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); - } - else - { - SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); - const SfxPoolItem* ppArgs[] = { &aWarnItem, 0 }; - pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); - } - - if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) - return sal_False; - else - bClose = sal_True; + SfxStringItem aItem( SID_DOCINFO_COMMENTS, String( SfxResId( STR_AUTOMATICVERSION ) ) ); + SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); + const SfxPoolItem* ppArgs[] = { &aItem, &aWarnItem, 0 }; + pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } - else if ( RET_CANCEL == nRet ) - // abgebrochen - return sal_False; - else if ( RET_NEWTASK == nRet ) + else { - return RET_NEWTASK; + SfxBoolItem aWarnItem( SID_FAIL_ON_WARNING, bUI ); + const SfxPoolItem* ppArgs[] = { &aWarnItem, 0 }; + pPoolItem = pFrame->GetBindings().ExecuteSynchron( SID_SAVEDOC, ppArgs ); } + + if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) + return sal_False; else - { - // Bei Nein nicht noch Informationlost bClose = sal_True; - } } - } - - // ggf. hinweisen, da\s unter Fremdformat gespeichert - if( pMedium ) - { - SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIgnoreInformationLost, - SfxBoolItem, SID_DOC_IGNOREINFORMATIONLOST, sal_False); - if( pIgnoreInformationLost && pIgnoreInformationLost->GetValue() ) - bUI = sal_False; + else if ( RET_CANCEL == nRet ) + // abgebrochen + return sal_False; + else if ( RET_NEWTASK == nRet ) + { + return RET_NEWTASK; + } + else + { + // Bei Nein nicht noch Informationlost + bClose = sal_True; + } } pImp->bPreparedForClose = sal_True; @@ -865,20 +835,6 @@ sal_Bool SfxObjectShell::DoClose() //-------------------------------------------------------------------- -void SfxObjectShell::SetLastMark_Impl( const String &rMark ) -{ - pImp->aMark = rMark; -} - -//-------------------------------------------------------------------- - -const String& SfxObjectShell::GetLastMark_Impl() const -{ - return pImp->aMark; -} - -//-------------------------------------------------------------------- - SfxObjectShell* SfxObjectShell::GetObjectShell() { return this; @@ -903,45 +859,28 @@ SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames() return *pEventNameContainer; } -SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames_Impl() -{ - if (!pImp->xEventNames.getLength()) - pImp->xEventNames = GetEventNames(); - return pImp->xEventNames; -} - //-------------------------------------------------------------------- -void SfxObjectShell::SetModel( SfxBaseModel* pModel ) +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetModel() const { - OSL_ENSURE( !pImp->xModel.is() || pModel == NULL, "Model already set!" ); - pImp->xModel = pModel; - if ( pModel ) { - pModel->addCloseListener( new SfxModelListener_Impl(this) ); - //pImp->m_xDocInfoListener = new SfxDocInfoListener_Impl(*this); - //uno::Reference<util::XModifyBroadcaster> xMB( - // pModel->getDocumentProperties(), uno::UNO_QUERY_THROW); - //xMB->addModifyListener(pImp->m_xDocInfoListener); - } -} - -//-------------------------------------------------------------------- - -const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& SfxObjectShell::GetModel() const -{ - return pImp->xModel; + return GetBaseModel(); } void SfxObjectShell::SetBaseModel( SfxBaseModel* pModel ) { - SetModel(pModel); + OSL_ENSURE( !pImp->pBaseModel.is() || pModel == NULL, "Model already set!" ); + pImp->pBaseModel.set( pModel ); + if ( pImp->pBaseModel.is() ) + { + pImp->pBaseModel->addCloseListener( new SfxModelListener_Impl(this) ); + } } //-------------------------------------------------------------------- -::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SfxObjectShell::GetBaseModel() const { - return pImp->xModel; + return pImp->pBaseModel.get(); } /* -----------------------------10.09.2001 15:56------------------------------ @@ -1122,3 +1061,16 @@ SfxObjectShell* SfxObjectShell::CreateAndLoadObject( const SfxItemSet& rSet, Sfx return NULL; } +void SfxObjectShell::SetInitialized_Impl( const bool i_fromInitNew ) +{ + pImp->bInitialized = sal_True; + if ( i_fromInitNew ) + { + SetActivateEvent_Impl( SFX_EVENT_CREATEDOC ); + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_DOCCREATED, GlobalEventConfig::GetEventName(STR_EVENT_DOCCREATED), this ) ); + } + else + { + SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_LOADFINISHED, GlobalEventConfig::GetEventName(STR_EVENT_LOADFINISHED), this ) ); + } +} diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index d2146a5e2d68..d6192542d1a1 100755 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: oleprops.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx index 4219a52a3730..5bd586576ac8 100755 --- a/sfx2/source/doc/oleprops.hxx +++ b/sfx2/source/doc/oleprops.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: oleprops.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/opostponedtruncationstream.cxx b/sfx2/source/doc/opostponedtruncationstream.cxx index ddcf38d50483..84b1d6a3906a 100644 --- a/sfx2/source/doc/opostponedtruncationstream.cxx +++ b/sfx2/source/doc/opostponedtruncationstream.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: opostponedtruncationstream.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/opostponedtruncationstream.hxx b/sfx2/source/doc/opostponedtruncationstream.hxx index 6a43d6dcd48a..fe67319fbbe0 100644 --- a/sfx2/source/doc/opostponedtruncationstream.hxx +++ b/sfx2/source/doc/opostponedtruncationstream.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: opostponedtruncationstream.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/ownsubfilterservice.cxx b/sfx2/source/doc/ownsubfilterservice.cxx index 4f31df6c4e4f..9cab42889b6e 100644 --- a/sfx2/source/doc/ownsubfilterservice.cxx +++ b/sfx2/source/doc/ownsubfilterservice.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ownsubfilterservice.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/plugin.cxx b/sfx2/source/doc/plugin.cxx index 0ab29e39b829..9ff8c73acbf6 100644 --- a/sfx2/source/doc/plugin.cxx +++ b/sfx2/source/doc/plugin.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: plugin.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index d61bd4701e1b..459a142b9129 100755 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printhelper.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,6 +39,7 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/view/DuplexMode.hpp> #include <svl/lstner.hxx> #include <svl/stritem.hxx> @@ -148,8 +146,9 @@ Reference< ::com::sun::star::view::XPrintable > SAL_CALL SfxPrintJob_Impl::getPr void SAL_CALL SfxPrintJob_Impl::cancelJob() throw (RuntimeException) { + // FIXME: how to cancel PrintJob via API?! if( m_pData->m_pObjectShell.Is() ) - m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2, NULL, NULL ) ); + m_pData->m_pObjectShell->Broadcast( SfxPrintingHint( -2 ) ); } SfxPrintHelper::SfxPrintHelper() @@ -269,7 +268,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro // Printer beschaffen SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return uno::Sequence< beans::PropertyValue >(); @@ -320,7 +319,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue > { // alten Printer beschaffen SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return; @@ -583,14 +582,14 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // get view for sfx printing capabilities SfxViewFrame *pViewFrm = m_pData->m_pObjectShell.Is() ? - SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ) : 0; + SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ) : 0; if ( !pViewFrm ) return; SfxViewShell* pView = pViewFrm->GetViewShell(); if ( !pView ) return; - SfxAllItemSet aArgs( pView->GetPool() ); +// SfxAllItemSet aArgs( pView->GetPool() ); sal_Bool bMonitor = sal_False; // We need this information at the end of this method, if we start the vcl printer // by executing the slot. Because if it is a ucb relevant URL we must wait for @@ -601,7 +600,10 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& String sUcbUrl; ::utl::TempFile* pUCBPrintTempFile = NULL; - sal_Bool bWaitUntilEnd = sal_False; + uno::Sequence < beans::PropertyValue > aCheckedArgs( rOptions.getLength() ); + sal_Int32 nProps = 0; + sal_Bool bWaitUntilEnd = sal_False; + sal_Int16 nDuplexMode = ::com::sun::star::view::DuplexMode::UNKNOWN; for ( int n = 0; n < rOptions.getLength(); ++n ) { // get Property-Value from options @@ -634,10 +636,15 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // converted its not an URL nor a system path. Then we can't accept // this parameter and have to throw an exception. ::rtl::OUString sSystemPath(sTemp); - ::rtl::OUString sFileURL ; + ::rtl::OUString sFileURL; if (::osl::FileBase::getFileURLFromSystemPath(sSystemPath,sFileURL)!=::osl::FileBase::E_None) throw ::com::sun::star::lang::IllegalArgumentException(); - aArgs.Put( SfxStringItem(SID_FILE_NAME,sTemp) ); + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= sFileURL; + // and append the local filename + aCheckedArgs.realloc( aCheckedArgs.getLength()+1 ); + aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName"); + aCheckedArgs[nProps++].Value <<= ::rtl::OUString( sTemp ); } else // It's a valid URL. but now we must know, if it is a local one or not. @@ -648,7 +655,12 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // And we have to use the system notation of the incoming URL. // But it into the descriptor and let the slot be executed at // the end of this method. - aArgs.Put( SfxStringItem(SID_FILE_NAME,sPath) ); + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= sTemp; + // and append the local filename + aCheckedArgs.realloc( aCheckedArgs.getLength()+1 ); + aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName"); + aCheckedArgs[nProps++].Value <<= ::rtl::OUString( sPath ); } else { @@ -663,7 +675,10 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // a slot ... pUCBPrintTempFile = new ::utl::TempFile(); pUCBPrintTempFile->EnableKillingFile(); - aArgs.Put( SfxStringItem(SID_FILE_NAME,pUCBPrintTempFile->GetFileName()) ); + + //FIXME: does it work? + aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("LocalFileName"); + aCheckedArgs[nProps++].Value <<= ::rtl::OUString( pUCBPrintTempFile->GetFileName() ); sUcbUrl = sURL; } } @@ -674,25 +689,22 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& sal_Int32 nCopies = 0; if ( ( rProp.Value >>= nCopies ) == sal_False ) throw ::com::sun::star::lang::IllegalArgumentException(); - aArgs.Put( SfxInt16Item( SID_PRINT_COPIES, (USHORT) nCopies ) ); + + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= nCopies; } // Collate-Property - else if ( rProp.Name.compareToAscii( "Collate" ) == 0 ) + // Sort-Property (deprecated) + else if ( rProp.Name.compareToAscii( "Collate" ) == 0 || + ( rProp.Name.compareToAscii( "Sort" ) == 0 ) ) { sal_Bool bTemp = sal_Bool(); if ( rProp.Value >>= bTemp ) - aArgs.Put( SfxBoolItem( SID_PRINT_COLLATE, bTemp ) ); - else - throw ::com::sun::star::lang::IllegalArgumentException(); - } - - // Sort-Property - else if ( rProp.Name.compareToAscii( "Sort" ) == 0 ) - { - sal_Bool bTemp = sal_Bool(); - if( rProp.Value >>= bTemp ) - aArgs.Put( SfxBoolItem( SID_PRINT_SORT, bTemp ) ); + { + aCheckedArgs[nProps].Name = rtl::OUString::createFromAscii("Collate"); + aCheckedArgs[nProps++].Value <<= bTemp; + } else throw ::com::sun::star::lang::IllegalArgumentException(); } @@ -702,7 +714,10 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& { OUSTRING sTemp; if( rProp.Value >>= sTemp ) - aArgs.Put( SfxStringItem( SID_PRINT_PAGES, String( sTemp ) ) ); + { + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= sTemp; + } else throw ::com::sun::star::lang::IllegalArgumentException(); } @@ -712,26 +727,36 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& { if( !(rProp.Value >>= bMonitor) ) throw ::com::sun::star::lang::IllegalArgumentException(); + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= bMonitor; } - // MonitorVisible + // Wait else if ( rProp.Name.compareToAscii( "Wait" ) == 0 ) { if ( !(rProp.Value >>= bWaitUntilEnd) ) throw ::com::sun::star::lang::IllegalArgumentException(); + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= bWaitUntilEnd; + } + + else if ( rProp.Name.compareToAscii( "DuplexMode" ) == 0 ) + { + if ( !(rProp.Value >>= nDuplexMode ) ) + throw ::com::sun::star::lang::IllegalArgumentException(); + aCheckedArgs[nProps].Name = rProp.Name; + aCheckedArgs[nProps++].Value <<= nDuplexMode; } } + if ( nProps != aCheckedArgs.getLength() ) + aCheckedArgs.realloc(nProps); + // Execute the print request every time. // It doesn'tmatter if it is a real printer used or we print to a local file // nor if we print to a temp file and move it afterwards by using the ucb. // That will be handled later. see pUCBPrintFile below! - aArgs.Put( SfxBoolItem( SID_SILENT, !bMonitor ) ); - if ( bWaitUntilEnd ) - aArgs.Put( SfxBoolItem( SID_ASYNCHRON, sal_False ) ); - SfxRequest aReq( SID_PRINTDOC, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_API, pView->GetPool() ); - aReq.SetArgs( aArgs ); - pView->ExecuteSlot( aReq ); + pView->ExecPrint( aCheckedArgs, sal_True, sal_False ); // Ok - may be execution before has finished (or started!) printing. // And may it was a printing to a file. @@ -764,11 +789,11 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); if ( pPrintHint ) { - if ( pPrintHint->GetWhich() == -1 ) // -1 : Initialisation of PrintOptions + if ( pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_STARTED ) { if ( !m_xPrintJob.is() ) m_xPrintJob = new SfxPrintJob_Impl( this ); - +/* PrintDialog* pDlg = pPrintHint->GetPrintDialog(); Printer* pPrinter = pPrintHint->GetPrinter(); ::rtl::OUString aPrintFile ( ( pPrinter && pPrinter->IsPrintFileEnabled() ) ? pPrinter->GetPrintFile() : String() ); @@ -805,7 +830,10 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin m_aPrintOptions[nArgs-1].Name = DEFINE_CONST_UNICODE("FileName"); m_aPrintOptions[nArgs-1].Value <<= aPrintFile; } +*/ + m_aPrintOptions = pPrintHint->GetOptions(); } +/* else if ( pPrintHint->GetWhich() == -3 ) // -3 : AdditionalPrintOptions { uno::Sequence < beans::PropertyValue >& lOldOpts = m_aPrintOptions; @@ -839,6 +867,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin // at least one new options has overwritten an old one, so we allocated too much lOldOpts.realloc( nTotal ); } +*/ else if ( pPrintHint->GetWhich() != -2 ) // -2 : CancelPrintJob { view::PrintJobEvent aEvent; diff --git a/sfx2/source/doc/printhelper.hxx b/sfx2/source/doc/printhelper.hxx index 8c562995f4e1..9ba05fc20cee 100755 --- a/sfx2/source/doc/printhelper.hxx +++ b/sfx2/source/doc/printhelper.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printhelper.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/querytemplate.cxx b/sfx2/source/doc/querytemplate.cxx index c07457bc074a..d3a669e999c3 100644 --- a/sfx2/source/doc/querytemplate.cxx +++ b/sfx2/source/doc/querytemplate.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: openlocked.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/querytemplate.hxx b/sfx2/source/doc/querytemplate.hxx index 71f709db06dd..92e9f26da0a7 100644 --- a/sfx2/source/doc/querytemplate.hxx +++ b/sfx2/source/doc/querytemplate.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: openlocked.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/sfxacldetect.cxx b/sfx2/source/doc/sfxacldetect.cxx index b156d409c9be..de6528794e20 100755 --- a/sfx2/source/doc/sfxacldetect.cxx +++ b/sfx2/source/doc/sfxacldetect.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: shutdowniconw32.cxx,v $ - * $Revision: 1.48 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index e0adbc9c5b2a..38cd688b96f1 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxbasemodel.cxx,v $ - * $Revision: 1.139.2.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -73,6 +70,7 @@ #include <cppuhelper/exc_hlp.hxx> #include <comphelper/processfactory.hxx> // can be removed when this is a "real" service #include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <svl/itemset.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> @@ -101,6 +99,9 @@ // includes of my own project //________________________________________________________________________________________________________ +#include <sfx2/sfxbasecontroller.hxx> +#include "sfx2/viewfac.hxx" +#include "workwin.hxx" #include <sfx2/signaturestate.hxx> #include <sfx2/sfxuno.hxx> #include <objshimp.hxx> @@ -117,7 +118,7 @@ #include <sfx2/evntconf.hxx> #include <sfx2/sfx.hrc> #include <sfx2/app.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "appdata.hxx" #include <sfx2/docfac.hxx> #include <sfx2/fcontnr.hxx> @@ -140,11 +141,19 @@ static const ::rtl::OUString SERVICENAME_DESKTOP = ::rtl::OUString::createFromAs namespace css = ::com::sun::star; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::lang::IllegalArgumentException; +using ::com::sun::star::io::IOException; +using ::com::sun::star::lang::WrappedTargetException; +using ::com::sun::star::uno::Type; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::document::XDocumentRecovery; /** This Listener is used to get notified when the XDocumentProperties of the XModel change. - If several changes are done the "bQuiet" member can be used to - temporarily suppress notifications. */ class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::util::XModifyListener > @@ -152,12 +161,9 @@ class SfxDocInfoListener_Impl : public ::cppu::WeakImplHelper1< public: SfxObjectShell& m_rShell; - bool bQuiet; - bool bGotModified; SfxDocInfoListener_Impl( SfxObjectShell& i_rDoc ) : m_rShell(i_rDoc) - , bQuiet(false) { }; ~SfxDocInfoListener_Impl(); @@ -174,12 +180,9 @@ void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& ) throw ( uno::RuntimeException ) { ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); - bGotModified = true; // notify changes to the SfxObjectShell - if ( !bQuiet ) { - m_rShell.FlushDocInfo(); - } + m_rShell.FlushDocInfo(); } void SAL_CALL SfxDocInfoListener_Impl::disposing( const lang::EventObject& ) @@ -215,6 +218,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument sal_Bool m_bClosing ; sal_Bool m_bSaving ; sal_Bool m_bSuicide ; + sal_Bool m_bInitialized ; + sal_Bool m_bModifiedSinceLastSave; uno::Reference< com::sun::star::view::XPrintable> m_xPrintable ; uno::Reference< script::provider::XScriptProvider > m_xScriptProvider; uno::Reference< ui::XUIConfigurationManager > m_xUIConfigurationManager; @@ -233,6 +238,8 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument , m_bClosing ( sal_False ) , m_bSaving ( sal_False ) , m_bSuicide ( sal_False ) + , m_bInitialized ( sal_False ) + , m_bModifiedSinceLastSave( sal_False ) , m_pStorageModifyListen ( NULL ) , m_xTitleHelper () , m_xNumberedControllers () @@ -360,41 +367,40 @@ SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell* pObjectShell ) if ( !pObjectShell ) return; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pObjectShell, TYPE(SfxTopViewFrame) ); pFrame; - pFrame = SfxViewFrame::GetNext(*pFrame, pObjectShell, TYPE(SfxTopViewFrame) ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pObjectShell ); + pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pObjectShell ) + ) { - SfxFrame* pSfxFrame = pFrame->GetFrame(); - if ( pSfxFrame ) + SfxFrame& rSfxFrame = pFrame->GetFrame(); + try { - try + // get vcl window related to the frame and lock it if it is still not locked + uno::Reference< frame::XFrame > xFrame = rSfxFrame.GetFrameInterface(); + Window* pWindow = GetVCLWindow( xFrame ); + if ( !pWindow ) + throw uno::RuntimeException(); + + if ( pWindow->IsEnabled() ) { - // get vcl window related to the frame and lock it if it is still not locked - uno::Reference< frame::XFrame > xFrame = pSfxFrame->GetFrameInterface(); - Window* pWindow = GetVCLWindow( xFrame ); - if ( !pWindow ) - throw uno::RuntimeException(); + pWindow->Disable(); - if ( pWindow->IsEnabled() ) + try { - pWindow->Disable(); - - try - { - sal_Int32 nLen = m_aLockedFrames.getLength(); - m_aLockedFrames.realloc( nLen + 1 ); - m_aLockedFrames[nLen] = xFrame; - } - catch( uno::Exception& ) - { - pWindow->Enable(); - throw; - } + sal_Int32 nLen = m_aLockedFrames.getLength(); + m_aLockedFrames.realloc( nLen + 1 ); + m_aLockedFrames[nLen] = xFrame; + } + catch( uno::Exception& ) + { + pWindow->Enable(); + throw; } } - catch( uno::Exception& ) - { - OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); - } + } + catch( uno::Exception& ) + { + OSL_ENSURE( sal_False, "Not possible to lock the frame window!\n" ); } } } @@ -525,6 +531,7 @@ SfxBaseModel::SfxBaseModel( SfxObjectShell *pObjectShell ) : BaseMutex() , m_pData( new IMPL_SfxBaseModel_DataContainer( m_aMutex, pObjectShell ) ) , m_bSupportEmbeddedScripts( pObjectShell && pObjectShell->Get_Impl() ? !pObjectShell->Get_Impl()->m_bNoBasicCapabilities : false ) +, m_bSupportDocRecovery( pObjectShell && pObjectShell->Get_Impl() ? pObjectShell->Get_Impl()->m_bDocRecoverySupport : false ) { DBG_CTOR(sfx2_SfxBaseModel,NULL); if ( pObjectShell != NULL ) @@ -548,7 +555,9 @@ SfxBaseModel::~SfxBaseModel() uno::Any SAL_CALL SfxBaseModel::queryInterface( const UNOTYPE& rType ) throw( uno::RuntimeException ) { - if ( !m_bSupportEmbeddedScripts && rType.equals( XEMBEDDEDSCRIPTS::static_type() ) ) + if ( ( !m_bSupportEmbeddedScripts && rType.equals( XEMBEDDEDSCRIPTS::static_type() ) ) + || ( !m_bSupportDocRecovery && rType.equals( XDocumentRecovery::static_type() ) ) + ) return Any(); return SfxBaseModel_Base::queryInterface( rType ); @@ -584,21 +593,31 @@ void SAL_CALL SfxBaseModel::release() throw( ) // XTypeProvider //________________________________________________________________________________________________________ -uno::Sequence< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( uno::RuntimeException ) +namespace { - uno::Sequence< UNOTYPE > aTypes( SfxBaseModel_Base::getTypes() ); - if ( !m_bSupportEmbeddedScripts ) + void lcl_stripType( Sequence< Type >& io_rTypes, const Type& i_rTypeToStrip ) { - // remove XEmbeddedScripts type from the sequence - Sequence< UNOTYPE > aStrippedTypes( aTypes.getLength() - 1 ); + Sequence< UNOTYPE > aStrippedTypes( io_rTypes.getLength() - 1 ); ::std::remove_copy_if( - aTypes.getConstArray(), - aTypes.getConstArray() + aTypes.getLength(), + io_rTypes.getConstArray(), + io_rTypes.getConstArray() + io_rTypes.getLength(), aStrippedTypes.getArray(), - ::std::bind2nd( ::std::equal_to< UNOTYPE >(), XEMBEDDEDSCRIPTS::static_type() ) + ::std::bind2nd( ::std::equal_to< Type >(), i_rTypeToStrip ) ); - aTypes = aStrippedTypes; + io_rTypes = aStrippedTypes; } +} + +uno::Sequence< UNOTYPE > SAL_CALL SfxBaseModel::getTypes() throw( uno::RuntimeException ) +{ + uno::Sequence< UNOTYPE > aTypes( SfxBaseModel_Base::getTypes() ); + + if ( !m_bSupportEmbeddedScripts ) + lcl_stripType( aTypes, XEMBEDDEDSCRIPTS::static_type() ); + + if ( !m_bSupportDocRecovery ) + lcl_stripType( aTypes, XDocumentRecovery::static_type() ); + return aTypes; } @@ -651,9 +670,7 @@ uno::Reference< script::XStarBasicAccess > implGetStarBasicAccess( SfxObjectShel uno::Reference< XNAMECONTAINER > SAL_CALL SfxBaseModel::getLibraryContainer() throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -672,9 +689,7 @@ void SAL_CALL SfxBaseModel::createLibrary( const ::rtl::OUString& LibName, const const ::rtl::OUString& ExternalSourceURL, const ::rtl::OUString& LinkTargetURL ) throw(ELEMENTEXISTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -691,9 +706,7 @@ void SAL_CALL SfxBaseModel::addModule( const ::rtl::OUString& LibraryName, const const ::rtl::OUString& Language, const ::rtl::OUString& Source ) throw( NOSUCHELEMENTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -710,9 +723,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const const ::com::sun::star::uno::Sequence< sal_Int8 >& Data ) throw(NOSUCHELEMENTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStarBasicAccess >& rxAccess = m_pData->m_xStarBasicAccess; if( !rxAccess.is() && m_pData->m_pObjectShell.Is() ) @@ -729,9 +740,7 @@ void SAL_CALL SfxBaseModel::addDialog( const ::rtl::OUString& LibraryName, const uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_xParent; } @@ -742,7 +751,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getParent() throw( uno: void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& Parent) throw(NOSUPPORTEXCEPTION, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_xParent = Parent; } @@ -752,11 +761,7 @@ void SAL_CALL SfxBaseModel::setParent(const uno::Reference< uno::XInterface >& P void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - // object already disposed? - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_bClosed ) { @@ -815,11 +820,7 @@ void SAL_CALL SfxBaseModel::dispose() throw(::com::sun::star::uno::RuntimeExcept void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -830,11 +831,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XEVENTLISTEN void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLISTENER >& aListener ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XEVENTLISTENER >*)0), aListener ); } @@ -844,11 +841,7 @@ void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XEVENTLIS uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_xDocumentInfo.is() ) { // WARNING: this will only work if (when loading a document) the @@ -894,11 +887,7 @@ uno::Reference< document::XDocumentProperties > SAL_CALL SfxBaseModel::getDocumentProperties() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( !m_pData->m_xDocumentProperties.is() ) { uno::Reference< lang::XInitialization > xDocProps( @@ -946,10 +935,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& const uno::Sequence< beans::PropertyValue >& rArgs ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( rURL.getLength() == 0 && rArgs.getLength() == 1 && rArgs[0].Name.equalsAscii( "SetEmbedded" ) ) { // allows to set a windowless document to EMBEDDED state @@ -967,53 +953,50 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& if ( m_pData->m_pObjectShell.Is() ) { m_pData->m_sURL = rURL; - uno::Sequence< beans::PropertyValue > aNewSeqArgs( rArgs.getLength() ); - sal_Int32 nNewLen = 0; - for ( sal_Int32 nInd = 0; nInd < rArgs.getLength(); nInd++ ) + SfxObjectShell* pObjectShell = m_pData->m_pObjectShell; + + ::comphelper::NamedValueCollection aArgs( rArgs ); + + Sequence< sal_Int32 > aWinExtent; + if ( ( aArgs.get( "WinExtent" ) >>= aWinExtent )&& ( aWinExtent.getLength() == 4 ) ) { - if ( rArgs[nInd].Name.equalsAscii( "WinExtent" ) ) - { - Sequence< sal_Int32 > aSize; - if ( ( rArgs[nInd].Value >>= aSize ) && aSize.getLength() == 4 ) - { - Rectangle aTmpRect( aSize[0], aSize[1], aSize[2], aSize[3] ); - aTmpRect = OutputDevice::LogicToLogic( aTmpRect, MAP_100TH_MM, m_pData->m_pObjectShell->GetMapUnit() ); - m_pData->m_pObjectShell->SetVisArea( aTmpRect ); - } - } - else if ( rArgs[nInd].Name.equalsAscii( "BreakMacroSignature" ) ) - { - sal_Bool bBreakMacroSign = sal_False; - rArgs[nInd].Value >>= bBreakMacroSign; - m_pData->m_pObjectShell->BreakMacroSign_Impl( bBreakMacroSign ); - } - else if ( !rArgs[nInd].Name.equalsAscii( "Stream" ) && !rArgs[nInd].Name.equalsAscii( "InputStream" ) ) - { - // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be ignored here - aNewSeqArgs[nNewLen++] = rArgs[nInd]; - } + Rectangle aVisArea( aWinExtent[0], aWinExtent[1], aWinExtent[2], aWinExtent[3] ); + aVisArea = OutputDevice::LogicToLogic( aVisArea, MAP_100TH_MM, pObjectShell->GetMapUnit() ); + pObjectShell->SetVisArea( aVisArea ); + } + + sal_Bool bBreakMacroSign = sal_False; + if ( aArgs.get( "BreakMacroSignature" ) >>= bBreakMacroSign ) + { + pObjectShell->BreakMacroSign_Impl( bBreakMacroSign ); } - aNewSeqArgs.realloc( nNewLen ); + aArgs.remove( "WinExtent" ); + aArgs.remove( "BreakMacroSignature" ); + aArgs.remove( "Stream" ); + aArgs.remove( "InputStream" ); - m_pData->m_seqArguments = aNewSeqArgs; + // TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here - if( m_pData->m_pObjectShell->GetMedium() ) + m_pData->m_seqArguments = aArgs.getPropertyValues(); + + SfxMedium* pMedium = pObjectShell->GetMedium(); + if ( pMedium ) { - SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); + SfxAllItemSet aSet( pObjectShell->GetPool() ); TransformParameters( SID_OPENDOC, rArgs, aSet ); - m_pData->m_pObjectShell->GetMedium()->GetItemSet()->Put( aSet ); + pMedium->GetItemSet()->Put( aSet ); SFX_ITEMSET_ARG( &aSet, pItem, SfxStringItem, SID_FILTER_NAME, sal_False ); if ( pItem ) - m_pData->m_pObjectShell->GetMedium()->SetFilter( - m_pData->m_pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); + pMedium->SetFilter( + pObjectShell->GetFactory().GetFilterContainer()->GetFilter4FilterName( pItem->GetValue() ) ); SFX_ITEMSET_ARG( &aSet, pTitleItem, SfxStringItem, SID_DOCINFO_TITLE, sal_False ); if ( pTitleItem ) { - SfxViewFrame* pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); + SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pObjectShell ); if ( pFrame ) pFrame->UpdateTitle(); } @@ -1029,10 +1012,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& ::rtl::OUString SAL_CALL SfxBaseModel::getURL() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); return m_pData->m_sURL ; } @@ -1042,10 +1022,7 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString& uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); - + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { uno::Sequence< beans::PropertyValue > seqArgsNew; @@ -1145,9 +1122,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getArgs() throw(::c void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + OSL_PRECOND( xController.is(), "SfxBaseModel::connectController: invalid controller!" ); + if ( !xController.is() ) + return; sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); uno::Sequence< uno::Reference< frame::XController > > aNewSeq( nOldCount + 1 ); @@ -1155,6 +1133,16 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon aNewSeq.getArray()[n] = m_pData->m_seqControllers.getConstArray()[n]; aNewSeq.getArray()[nOldCount] = xController; m_pData->m_seqControllers = aNewSeq; + + if ( m_pData->m_seqControllers.getLength() == 1 ) + { + SfxViewFrame* pViewFrame = SfxViewFrame::Get( xController, GetObjectShell() ); + ENSURE_OR_THROW( pViewFrame, "SFX document without SFX view!?" ); + pViewFrame->UpdateDocument_Impl(); + const String sDocumentURL = GetObjectShell()->GetMedium()->GetName(); + if ( sDocumentURL.Len() ) + SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, sDocumentURL ) ); + } } //________________________________________________________________________________________________________ @@ -1163,9 +1151,7 @@ void SAL_CALL SfxBaseModel::connectController( const uno::Reference< frame::XCon void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::XController >& xController ) throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); sal_uInt32 nOldCount = m_pData->m_seqControllers.getLength(); if ( !nOldCount ) @@ -1193,9 +1179,8 @@ void SAL_CALL SfxBaseModel::disconnectController( const uno::Reference< frame::X void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + ++m_pData->m_nControllerLockCount ; } @@ -1205,9 +1190,8 @@ void SAL_CALL SfxBaseModel::lockControllers() throw(::com::sun::star::uno::Runti void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); + --m_pData->m_nControllerLockCount ; } @@ -1217,9 +1201,7 @@ void SAL_CALL SfxBaseModel::unlockControllers() throw(::com::sun::star::uno::Run sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return ( m_pData->m_nControllerLockCount != 0 ) ; } @@ -1229,10 +1211,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasControllersLocked() throw(::com::sun::star::u uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); // get the last active controller of this model if ( m_pData->m_xCurrent.is() ) @@ -1249,10 +1228,7 @@ uno::Reference< frame::XController > SAL_CALL SfxBaseModel::getCurrentController void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::XController >& xCurrentController ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); m_pData->m_xCurrent = xCurrentController; } @@ -1263,10 +1239,7 @@ void SAL_CALL SfxBaseModel::setCurrentController( const uno::Reference< frame::X uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< uno::XInterface > xReturn; uno::Reference< frame::XController > xController = getCurrentController() ; @@ -1290,9 +1263,7 @@ uno::Reference< uno::XInterface > SAL_CALL SfxBaseModel::getCurrentSelection() t sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1305,9 +1276,7 @@ sal_Bool SAL_CALL SfxBaseModel::disableSetModified() throw (::com::sun::star::un sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1320,9 +1289,7 @@ sal_Bool SAL_CALL SfxBaseModel::enableSetModified() throw (::com::sun::star::uno sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw DISPOSEDEXCEPTION(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::RuntimeException(); @@ -1336,10 +1303,7 @@ sal_Bool SAL_CALL SfxBaseModel::isSetModifiedEnabled() throw (::com::sun::star:: sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsModified() : sal_False; } @@ -1351,10 +1315,7 @@ sal_Bool SAL_CALL SfxBaseModel::isModified() throw(::com::sun::star::uno::Runtim void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) m_pData->m_pObjectShell->SetModified(bModified); @@ -1366,10 +1327,7 @@ void SAL_CALL SfxBaseModel::setModified( sal_Bool bModified ) void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0),xListener ); } @@ -1380,10 +1338,7 @@ void SAL_CALL SfxBaseModel::addModifyListener(const uno::Reference< XMODIFYLISTE void SAL_CALL SfxBaseModel::removeModifyListener(const uno::Reference< XMODIFYLISTENER >& xListener) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0), xListener ); } @@ -1397,7 +1352,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo static ::rtl::OUString MSG_1 = ::rtl::OUString::createFromAscii("Cant close while saving."); ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !m_pData || m_pData->m_bClosed || m_pData->m_bClosing ) + if ( impl_isDisposed() || m_pData->m_bClosed || m_pData->m_bClosing ) return; uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); @@ -1459,10 +1414,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener ); } @@ -1473,10 +1425,7 @@ void SAL_CALL SfxBaseModel::addCloseListener( const uno::Reference< XCLOSELISTEN void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELISTENER >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XCLOSELISTENER >*)0), xListener ); } @@ -1487,10 +1436,7 @@ void SAL_CALL SfxBaseModel::removeCloseListener( const uno::Reference< XCLOSELIS uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) return m_pData->m_xPrintable->getPrinter(); @@ -1501,10 +1447,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxBaseModel::getPrinter() throw( void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) m_pData->m_xPrintable->setPrinter( rPrinter ); @@ -1513,10 +1456,7 @@ void SAL_CALL SfxBaseModel::setPrinter(const uno::Sequence< beans::PropertyValue void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& rOptions) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) m_pData->m_xPrintable->print( rOptions ); @@ -1528,10 +1468,7 @@ void SAL_CALL SfxBaseModel::print(const uno::Sequence< beans::PropertyValue >& r sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->HasName() : sal_False; } @@ -1542,10 +1479,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti ::rtl::OUString SAL_CALL SfxBaseModel::getLocation() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1565,10 +1499,7 @@ sal_Bool SAL_CALL SfxBaseModel::hasLocation() throw(::com::sun::star::uno::Runti sal_Bool SAL_CALL SfxBaseModel::isReadonly() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); return m_pData->m_pObjectShell.Is() ? m_pData->m_pObjectShell->IsReadOnly() : sal_True; } @@ -1584,10 +1515,7 @@ void SAL_CALL SfxBaseModel::storeSelf( const uno::Sequence< beans::PropertyVa { RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeSelf" ); - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1685,10 +1613,7 @@ void SAL_CALL SfxBaseModel::storeAsURL( const ::rtl::OUString& { RTL_LOGFILE_PRODUCT_CONTEXT( aPerfLog, "PERFORMANCE - SfxBaseModel::storeAsURL" ); - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1711,10 +1636,7 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& const uno::Sequence< beans::PropertyValue >& rArgs ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() ) { @@ -1724,6 +1646,51 @@ void SAL_CALL SfxBaseModel::storeToURL( const ::rtl::OUString& } } +::sal_Bool SAL_CALL SfxBaseModel::wasModifiedSinceLastSave() throw ( RuntimeException ) +{ + SfxModelGuard aGuard( *this ); + return m_pData->m_bModifiedSinceLastSave; +} + +void SAL_CALL SfxBaseModel::storeToRecoveryFile( const ::rtl::OUString& i_TargetLocation, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + SfxModelGuard aGuard( *this ); + + // delegate + SfxSaveGuard aSaveGuard( this, m_pData, sal_False ); + impl_store( i_TargetLocation, i_MediaDescriptor, sal_True ); + + // no need for subsequent calls to storeToRecoveryFile, unless we're modified, again + m_pData->m_bModifiedSinceLastSave = sal_False; +} + +void SAL_CALL SfxBaseModel::recoverFromFile( const ::rtl::OUString& i_SourceLocation, const ::rtl::OUString& i_SalvagedFile, const Sequence< PropertyValue >& i_MediaDescriptor ) throw ( RuntimeException, IOException, WrappedTargetException ) +{ + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + + // delegate to our "load" method + ::comphelper::NamedValueCollection aMediaDescriptor( i_MediaDescriptor ); + + // our load implementation expects the SalvagedFile to be in the media descriptor + OSL_ENSURE( !aMediaDescriptor.has( "SalvagedFile" ) || ( aMediaDescriptor.getOrDefault( "SalvagedFile", ::rtl::OUString() ) == i_SalvagedFile ), + "SfxBaseModel::recoverFromFile: inconsistent information!" ); + aMediaDescriptor.put( "SalvagedFile", i_SalvagedFile ); + + // similar for the to-be-loaded file + OSL_ENSURE( !aMediaDescriptor.has( "URL" ) || ( aMediaDescriptor.getOrDefault( "URL", ::rtl::OUString() ) == i_SourceLocation ), + "SfxBaseModel::recoverFromFile: inconsistent information!" ); + aMediaDescriptor.put( "URL", i_SourceLocation ); + + load( aMediaDescriptor.getPropertyValues() ); + + // Note: The XDocumentRecovery interface specification requires us to do an attachResource after loading. + // However, we will not do this here, as we know that our load implementation (respectively some method + // called from there) already did so. + // In particular, the load process might already have modified some elements of the media + // descriptor, for instance the MacroExecMode (in case the user was involved to decide about it), and we do + // not want to overwrite it with the "old" elements passed to this method here. +} + //________________________________________________________________________________________________________ // XLoadable //________________________________________________________________________________________________________ @@ -1734,10 +1701,9 @@ void SAL_CALL SfxBaseModel::initNew() ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); // the object shell should exist always DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); @@ -1766,10 +1732,9 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& ::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); // the object shell should exist always DBG_ASSERT( m_pData->m_pObjectShell.Is(), "Model is useless without an ObjectShell" ); @@ -1913,6 +1878,13 @@ void SAL_CALL SfxBaseModel::load( const uno::Sequence< beans::PropertyValue >& nError ? nError : ERRCODE_IO_CANTREAD ); } } + + BOOL bHidden = FALSE; + SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); + if ( pHidItem ) + bHidden = pHidItem->GetValue(); + // !TODO: will be done by Framework! + pMedium->SetUpdatePickList( !bHidden ); } } @@ -1925,10 +1897,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Any aAny; @@ -2167,10 +2136,7 @@ uno::Any SAL_CALL SfxBaseModel::getTransferData( const DATAFLAVOR& aFlavor ) uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() throw (::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); sal_Int32 nSuppFlavors = GraphicHelper::supportsMetaFileHandle_Impl() ? 10 : 8; uno::Sequence< DATAFLAVOR > aFlavorSeq( nSuppFlavors ); @@ -2239,10 +2205,7 @@ uno::Sequence< DATAFLAVOR > SAL_CALL SfxBaseModel::getTransferDataFlavors() sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor ) throw (::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( aFlavor.MimeType.equalsAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ) ) { @@ -2301,10 +2264,7 @@ sal_Bool SAL_CALL SfxBaseModel::isDataFlavorSupported( const DATAFLAVOR& aFlavor uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xEvents.is() ) { @@ -2320,9 +2280,7 @@ uno::Reference< container::XNameReplace > SAL_CALL SfxBaseModel::getEvents() thr uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getBasicLibraries() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStorageBasedLibraryContainer > xBasicLibraries; if ( m_pData->m_pObjectShell ) @@ -2332,9 +2290,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::getDialogLibraries() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::XStorageBasedLibraryContainer > xDialogLibraries; if ( m_pData->m_pObjectShell ) @@ -2344,9 +2300,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g ::sal_Bool SAL_CALL SfxBaseModel::getAllowMacroExecution() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell ) return m_pData->m_pObjectShell->AdjustMacroMode( String(), false ); @@ -2359,9 +2313,7 @@ uno::Reference< script::XStorageBasedLibraryContainer > SAL_CALL SfxBaseModel::g Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContainer() throw (RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); Reference< document::XEmbeddedScripts > xDocumentScripts; @@ -2397,10 +2349,7 @@ Reference< document::XEmbeddedScripts > SAL_CALL SfxBaseModel::getScriptContaine void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener ); } @@ -2411,10 +2360,7 @@ void SAL_CALL SfxBaseModel::addEventListener( const uno::Reference< XDOCEVENTLIS void SAL_CALL SfxBaseModel::removeEventListener( const uno::Reference< XDOCEVENTLISTENER >& aListener ) throw( uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< XDOCEVENTLISTENER >*)0), aListener ); } @@ -2492,7 +2438,9 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , if ( pNamedHint ) { - if ( SFX_EVENT_STORAGECHANGED == pNamedHint->GetEventId() ) + switch ( pNamedHint->GetEventId() ) + { + case SFX_EVENT_STORAGECHANGED: { // for now this event is sent only on creation of a new storage for new document // and in case of reload of medium without document reload @@ -2523,12 +2471,17 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); } - else if ( SFX_EVENT_LOADFINISHED == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_LOADFINISHED: { impl_getPrintHelper(); ListenForStorage_Impl( m_pData->m_pObjectShell->GetStorage() ); + m_pData->m_bModifiedSinceLastSave = sal_False; } - else if ( SFX_EVENT_SAVEASDOCDONE == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_SAVEASDOCDONE: { m_pData->m_sURL = m_pData->m_pObjectShell->GetMedium()->GetName(); @@ -2539,9 +2492,20 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , addTitle_Impl( aArgs, aTitle ); attachResource( m_pData->m_pObjectShell->GetMedium()->GetName(), aArgs ); } - else if ( SFX_EVENT_DOCCREATED == pNamedHint->GetEventId() ) + break; + + case SFX_EVENT_DOCCREATED: { impl_getPrintHelper(); + m_pData->m_bModifiedSinceLastSave = sal_False; + } + break; + + case SFX_EVENT_MODIFYCHANGED: + { + m_pData->m_bModifiedSinceLastSave = isModified(); + } + break; } postEvent_Impl( pNamedHint->GetEventName() ); @@ -2575,36 +2539,29 @@ void SfxBaseModel::Notify( SfxBroadcaster& rBC , // public impl. //________________________________________________________________________________________________________ +void SfxBaseModel::NotifyModifyListeners_Impl() const +{ + ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); + if ( pIC ) + { + lang::EventObject aEvent( (frame::XModel *)this ); + pIC->notifyEach( &util::XModifyListener::modified, aEvent ); + } + + // this notification here is done too generously, we cannot simply assume that we're really modified + // now, but we need to check it ... + m_pData->m_bModifiedSinceLastSave = const_cast< SfxBaseModel* >( this )->isModified(); +} + void SfxBaseModel::changing() { - // object already disposed? - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); // the notification should not be sent if the document can not be modified if ( !m_pData->m_pObjectShell.Is() || !m_pData->m_pObjectShell->IsEnableSetModified() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); - if( pIC ) - - { - lang::EventObject aEvent( (frame::XModel *)this ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - try - { - ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); - } - catch( uno::RuntimeException& ) - { - aIt.remove(); - } - } - } + NotifyModifyListeners_Impl(); } void SfxBaseModel::impl_change() @@ -2613,24 +2570,7 @@ void SfxBaseModel::impl_change() if ( impl_isDisposed() ) return; - ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( ::getCppuType((const uno::Reference< XMODIFYLISTENER >*)0) ); - if( pIC ) - - { - lang::EventObject aEvent( (frame::XModel *)this ); - ::cppu::OInterfaceIteratorHelper aIt( *pIC ); - while( aIt.hasMoreElements() ) - { - try - { - ((XMODIFYLISTENER *)aIt.next())->modified( aEvent ); - } - catch( uno::RuntimeException& ) - { - aIt.remove(); - } - } - } + NotifyModifyListeners_Impl(); } //________________________________________________________________________________________________________ @@ -2656,6 +2596,17 @@ sal_Bool SfxBaseModel::IsDisposed() const return ( m_pData == NULL ) ; } +sal_Bool SfxBaseModel::IsInitialized() const +{ + if ( !m_pData || !m_pData->m_pObjectShell ) + { + OSL_ENSURE( false, "SfxBaseModel::IsInitialized: this should have been caught earlier!" ); + return sal_False; + } + + return m_pData->m_pObjectShell->GetMedium() != NULL; +} + sal_Bool SfxBaseModel::impl_isDisposed() const { return ( m_pData == NULL ) ; @@ -2923,16 +2874,13 @@ void SfxBaseModel::postEvent_Impl( ::rtl::OUString aName ) uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( m_pData->m_pObjectShell.Is() && !m_pData->m_contViewData.is() ) { SfxViewFrame *pActFrame = SfxViewFrame::Current(); if ( !pActFrame || pActFrame->GetObjectShell() != m_pData->m_pObjectShell ) - pActFrame = SfxViewFrame::GetFirst(m_pData->m_pObjectShell, TYPE(SfxTopViewFrame)); + pActFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); if ( !pActFrame || !pActFrame->GetViewShell() ) // currently no frame for this document at all or View is under construction @@ -2953,8 +2901,8 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() sal_Int32 nCount = 0; uno::Sequence < beans::PropertyValue > aSeq; ::com::sun::star::uno::Any aAny; - for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(m_pData->m_pObjectShell, TYPE(SfxTopViewFrame) ); pFrame; - pFrame = SfxViewFrame::GetNext(*pFrame, m_pData->m_pObjectShell, TYPE(SfxTopViewFrame) ) ) + for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst( m_pData->m_pObjectShell ); pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, m_pData->m_pObjectShell ) ) { BOOL bIsActive = ( pFrame == pActFrame ); pFrame->GetViewShell()->WriteUserDataSequence( aSeq ); @@ -2969,10 +2917,7 @@ uno::Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData() void SAL_CALL SfxBaseModel::setViewData( const uno::Reference < container::XIndexAccess >& aData ) throw(::com::sun::star::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); m_pData->m_contViewData = aData; } @@ -3012,10 +2957,7 @@ sal_Bool SfxBaseModel::hasEventListeners() const void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); if ( impl_getPrintHelper() ) { @@ -3029,10 +2971,7 @@ void SAL_CALL SfxBaseModel::addPrintJobListener( const uno::Reference< view::XPr void SAL_CALL SfxBaseModel::removePrintJobListener( const uno::Reference< view::XPrintJobListener >& xListener ) throw (uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); if ( impl_getPrintHelper() ) { @@ -3051,7 +2990,7 @@ class SvObject; sal_Int64 SAL_CALL SfxBaseModel::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !impl_isDisposed() && GetObjectShell() ) + if ( GetObjectShell() ) { SvGlobalName aName( aIdentifier ); if ( aName == SvGlobalName( SO3_GLOBAL_CLASSID ) ) @@ -3085,9 +3024,7 @@ void SfxBaseModel::ListenForStorage_Impl( const uno::Reference< embed::XStorage uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentSubStorage( const ::rtl::OUString& aStorageName, sal_Int32 nMode ) throw ( uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( m_pData->m_pObjectShell.Is() ) @@ -3112,9 +3049,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() throw ( io::IOException, RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); Sequence< ::rtl::OUString > aResult; sal_Int32 nResultSize = 0; @@ -3153,9 +3088,7 @@ Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames() uno::Reference< script::provider::XScriptProvider > SAL_CALL SfxBaseModel::getScriptProvider() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< script::provider::XScriptProvider > xScriptProvider; @@ -3261,9 +3194,7 @@ static void ConvertSlotsToCommands( SfxObjectShell* pDoc, uno::Reference< contai uno::Reference< ui::XUIConfigurationManager > SAL_CALL SfxBaseModel::getUIConfigurationManager() throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_xUIConfigurationManager.is() ) { @@ -3379,17 +3310,15 @@ void SAL_CALL SfxBaseModel::setVisualAreaSize( sal_Int64 nAspect, const awt::Siz uno::Exception, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling - SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, 0, sal_False ); - if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame()->IsInPlace() ) + SfxViewFrame* pViewFrm = SfxViewFrame::GetFirst( m_pData->m_pObjectShell, sal_False ); + if ( pViewFrm && m_pData->m_pObjectShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED && !pViewFrm->GetFrame().IsInPlace() ) { - Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame()->GetFrameInterface()->getContainerWindow() ); + Window* pWindow = VCLUnoHelper::GetWindow( pViewFrm->GetFrame().GetFrameInterface()->getContainerWindow() ); Size aWinSize = pWindow->GetSizePixel(); awt::Size aCurrent = getVisualAreaSize( nAspect ); Size aDiff( aSize.Width-aCurrent.Width, aSize.Height-aCurrent.Height ); @@ -3413,9 +3342,7 @@ awt::Size SAL_CALL SfxBaseModel::getVisualAreaSize( sal_Int64 /*nAspect*/ ) uno::Exception, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3444,9 +3371,7 @@ sal_Int32 SAL_CALL SfxBaseModel::getMapUnit( sal_Int64 /*nAspect*/ ) throw ( uno::Exception, uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); if ( !m_pData->m_pObjectShell.Is() ) throw uno::Exception(); // TODO: error handling @@ -3460,9 +3385,7 @@ embed::VisualRepresentation SAL_CALL SfxBaseModel::getPreferredVisualRepresentat uno::Exception, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); datatransfer::DataFlavor aDataFlavor( ::rtl::OUString::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ), @@ -3488,44 +3411,34 @@ void SAL_CALL SfxBaseModel::loadFromStorage( const uno::Reference< XSTORAGE >& x EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); + if ( IsInitialized() ) + throw ::com::sun::star::frame::DoubleInitializationException( ::rtl::OUString(), *this ); - if ( !m_pData->m_pObjectShell.Is() ) - throw IOEXCEPTION(); // TODO: + // after i36090 is fixed the pool from object shell can be used + // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); + SfxAllItemSet aSet( SFX_APP()->GetPool() ); - if ( m_pData->m_pObjectShell.Is() ) - { - if( m_pData->m_pObjectShell->GetMedium() ) - // if a Medium is present, the document is already initialized - throw DOUBLEINITIALIZATIONEXCEPTION(); + // the BaseURL is part of the ItemSet + SfxMedium* pMedium = new SfxMedium( xStorage, String() ); + TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet ); + pMedium->GetItemSet()->Put( aSet ); - // after i36090 is fixed the pool from object shell can be used - // SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() ); - SfxAllItemSet aSet( SFX_APP()->GetPool() ); + // allow to use an interactionhandler (if there is one) + pMedium->UseInteractionHandler( TRUE ); - // the BaseURL is part of the ItemSet - SfxMedium* pMedium = new SfxMedium( xStorage, String() ); - TransformParameters( SID_OPENDOC, aMediaDescriptor, aSet ); - pMedium->GetItemSet()->Put( aSet ); - - // allow to use an interactionhandler (if there is one) - pMedium->UseInteractionHandler( TRUE ); - - SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); - BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); - m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); - m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; + SFX_ITEMSET_ARG( &aSet, pTemplateItem, SfxBoolItem, SID_TEMPLATE, sal_False); + BOOL bTemplate = pTemplateItem && pTemplateItem->GetValue(); + m_pData->m_pObjectShell->SetActivateEvent_Impl( bTemplate ? SFX_EVENT_CREATEDOC : SFX_EVENT_OPENDOC ); + m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE; - // load document - if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) - { - sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); - throw task::ErrorCodeIOException( ::rtl::OUString(), - uno::Reference< uno::XInterface >(), - nError ? nError : ERRCODE_IO_CANTREAD ); - } + // load document + if ( !m_pData->m_pObjectShell->DoLoad(pMedium) ) + { + sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode(); + throw task::ErrorCodeIOException( ::rtl::OUString(), + uno::Reference< uno::XInterface >(), + nError ? nError : ERRCODE_IO_CANTREAD ); } } @@ -3536,9 +3449,7 @@ void SAL_CALL SfxBaseModel::storeToStorage( const uno::Reference< XSTORAGE >& xS EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3599,9 +3510,7 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3625,9 +3534,7 @@ uno::Reference< XSTORAGE > SAL_CALL SfxBaseModel::getDocumentStorage() EXCEPTION, uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); uno::Reference< XSTORAGE > xResult; if ( !m_pData->m_pObjectShell.Is() ) @@ -3640,9 +3547,7 @@ void SAL_CALL SfxBaseModel::addStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); m_pData->m_aInterfaceContainer.addInterface( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener ); @@ -3652,9 +3557,7 @@ void SAL_CALL SfxBaseModel::removeStorageChangeListener( const uno::Reference< document::XStorageChangeListener >& xListener ) throw ( uno::RuntimeException ) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_aInterfaceContainer.removeInterface( ::getCppuType((const uno::Reference< document::XStorageChangeListener >*)0), xListener ); @@ -3680,9 +3583,7 @@ bool SfxBaseModel::impl_getPrintHelper() void SAL_CALL SfxBaseModel::setIdentifier(const ::rtl::OUString& Identifier) throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); m_pData->m_sModuleIdentifier = Identifier; } @@ -3691,9 +3592,7 @@ bool SfxBaseModel::impl_getPrintHelper() ::rtl::OUString SAL_CALL SfxBaseModel::getIdentifier() throw (css::uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return ::rtl::OUString(); + SfxModelGuard aGuard( *this ); if (m_pData->m_sModuleIdentifier.getLength() > 0) return m_pData->m_sModuleIdentifier; if (m_pData->m_pObjectShell) @@ -3704,10 +3603,7 @@ bool SfxBaseModel::impl_getPrintHelper() //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return css::uno::Reference< css::frame::XTitle >(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xTitleHelper.is ()) { @@ -3727,10 +3623,7 @@ css::uno::Reference< css::frame::XTitle > SfxBaseModel::impl_getTitleHelper () //============================================================================= css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitledHelper () { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return css::uno::Reference< css::frame::XUntitledNumbers >(); + SfxModelGuard aGuard( *this ); if ( ! m_pData->m_xNumberedControllers.is ()) { @@ -3752,10 +3645,7 @@ css::uno::Reference< css::frame::XUntitledNumbers > SfxBaseModel::impl_getUntitl throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return ::rtl::OUString(); + SfxModelGuard aGuard( *this ); ::rtl::OUString aResult = impl_getTitleHelper()->getTitle (); if ( m_pData->m_pObjectShell ) @@ -3786,10 +3676,7 @@ void SAL_CALL SfxBaseModel::setTitle( const ::rtl::OUString& sTitle ) throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); impl_getTitleHelper()->setTitle (sTitle); } @@ -3800,10 +3687,7 @@ void SAL_CALL SfxBaseModel::addTitleChangeListener( const css::uno::Reference< c throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this, SfxModelGuard::E_INITIALIZING ); css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY); if (xBroadcaster.is ()) @@ -3816,10 +3700,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference throw (css::uno::RuntimeException) { // SYNCHRONIZED -> - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - - if ( impl_isDisposed() ) - return; + SfxModelGuard aGuard( *this ); css::uno::Reference< css::frame::XTitleChangeBroadcaster > xBroadcaster(impl_getTitleHelper(), css::uno::UNO_QUERY); if (xBroadcaster.is ()) @@ -3832,10 +3713,7 @@ void SAL_CALL SfxBaseModel::removeTitleChangeListener( const css::uno::Reference throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return css::frame::UntitledNumbersConst::INVALID_NUMBER; + SfxModelGuard aGuard( *this ); return impl_getUntitledHelper ()->leaseNumber (xComponent); } @@ -3846,11 +3724,7 @@ void SAL_CALL SfxBaseModel::releaseNumber( ::sal_Int32 nNumber ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); impl_getUntitledHelper ()->releaseNumber (nNumber); } @@ -3860,11 +3734,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference throw (css::lang::IllegalArgumentException, css::uno::RuntimeException ) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return; - + SfxModelGuard aGuard( *this ); impl_getUntitledHelper ()->releaseNumberForComponent (xComponent); } @@ -3873,11 +3743,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference ::rtl::OUString SAL_CALL SfxBaseModel::getUntitledPrefix() throw (css::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return ::rtl::OUString (); - + SfxModelGuard aGuard( *this ); return impl_getUntitledHelper ()->getUntitledPrefix (); } @@ -3886,10 +3752,7 @@ void SAL_CALL SfxBaseModel::releaseNumberForComponent( const css::uno::Reference css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getControllers() throw (css::uno::RuntimeException) { - // object already disposed? - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - return css::uno::Reference< css::container::XEnumeration >(); + SfxModelGuard aGuard( *this ); sal_Int32 c = m_pData->m_seqControllers.getLength(); sal_Int32 i = 0; @@ -3907,29 +3770,217 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL SfxBaseModel::getCo css::uno::Sequence< ::rtl::OUString > SAL_CALL SfxBaseModel::getAvailableViewControllerNames() throw (css::uno::RuntimeException) { - return css::uno::Sequence< ::rtl::OUString >(); + SfxModelGuard aGuard( *this ); + + const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const sal_Int32 nViewFactoryCount = rDocumentFactory.GetViewFactoryCount(); + + Sequence< ::rtl::OUString > aViewNames( nViewFactoryCount ); + for ( sal_Int32 nViewNo = 0; nViewNo < nViewFactoryCount; ++nViewNo ) + aViewNames[nViewNo] = rDocumentFactory.GetViewFactory( nViewNo ).GetViewName(); + return aViewNames; } //============================================================================= // css::frame::XModel2 -css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDefaultViewController(const css::uno::Reference< css::frame::XFrame >& /*Frame*/) +css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createDefaultViewController( const css::uno::Reference< css::frame::XFrame >& i_rFrame ) throw (css::uno::RuntimeException , css::lang::IllegalArgumentException, css::uno::Exception ) { - return css::uno::Reference< css::frame::XController2 >(); + SfxModelGuard aGuard( *this ); + + const SfxObjectFactory& rDocumentFactory = GetObjectShell()->GetFactory(); + const ::rtl::OUString sDefaultViewName = rDocumentFactory.GetViewFactory( 0 ).GetViewName(); + + aGuard.clear(); + + return createViewController( sDefaultViewName, Sequence< PropertyValue >(), i_rFrame ); +} + +//============================================================================= +namespace sfx { namespace intern { + + /** a class which, in its dtor, cleans up variuos objects (well, at the moment only the frame) collected during + the creation of a document view, unless the creation was successful. + */ + class SAL_DLLPRIVATE ViewCreationGuard + { + public: + ViewCreationGuard() + :m_bSuccess( false ) + { + } + + ~ViewCreationGuard() + { + if ( !m_bSuccess ) + impl_closeAll(); + } + + void takeFrameOwnership( SfxFrame* i_pFrame ) + { + OSL_PRECOND( !m_aWeakFrame, "ViewCreationGuard::takeFrameOwnership: already have a frame!" ); + OSL_PRECOND( i_pFrame != NULL, "ViewCreationGuard::takeFrameOwnership: invalid frame!" ); + m_aWeakFrame = i_pFrame; + } + + void releaseAll() + { + m_bSuccess = true; + } + + private: + void impl_closeAll() + { + if ( m_aWeakFrame && !m_aWeakFrame->GetCurrentDocument() ) + { + m_aWeakFrame->SetFrameInterface_Impl( NULL ); + m_aWeakFrame->DoClose(); + } + } + + private: + bool m_bSuccess; + SfxFrameWeak m_aWeakFrame; + }; +} } + +//============================================================================= +SfxViewFrame* SfxBaseModel::FindOrCreateViewFrame_Impl( const Reference< XFrame >& i_rFrame, ::sfx::intern::ViewCreationGuard& i_rGuard ) const +{ + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( GetObjectShell(), FALSE ); + pViewFrame; + pViewFrame= SfxViewFrame::GetNext( *pViewFrame, GetObjectShell(), FALSE ) + ) + { + if ( pViewFrame->GetFrame().GetFrameInterface() == i_rFrame ) + break; + } + if ( !pViewFrame ) + { + #if OSL_DEBUG_LEVEL > 0 + for ( SfxFrame* pCheckFrame = SfxFrame::GetFirst(); + pCheckFrame; + pCheckFrame = SfxFrame::GetNext( *pCheckFrame ) + ) + { + if ( pCheckFrame->GetFrameInterface() == i_rFrame ) + { + if ( ( pCheckFrame->GetCurrentViewFrame() != NULL ) + || ( pCheckFrame->GetCurrentDocument() != NULL ) + ) + // Note that it is perfectly letgitimate that during loading into an XFrame which already contains + // a document, there exist two SfxFrame instances bound to this XFrame - the old one, which will be + // destroyed later, and the new one, which we're going to create + continue; + + OSL_ENSURE( false, "SfxBaseModel::FindOrCreateViewFrame_Impl: there already is an SfxFrame for the given XFrame, but no view in it!" ); + // nowadays, we're the only instance allowed to create an SfxFrame for an XFrame, so this case here should not happen + break; + } + } + #endif + + SfxFrame* pTargetFrame = SfxFrame::Create( i_rFrame ); + ENSURE_OR_THROW( pTargetFrame, "could not create an SfxFrame" ); + i_rGuard.takeFrameOwnership( pTargetFrame ); + + // prepare it + pTargetFrame->PrepareForDoc_Impl( *GetObjectShell() ); + + // create view frame + pViewFrame = new SfxViewFrame( *pTargetFrame, GetObjectShell() ); + } + return pViewFrame; } //============================================================================= // css::frame::XModel2 -css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createViewController(const ::rtl::OUString& /*ViewName*/, - const css::uno::Sequence< css::beans::PropertyValue >& /*Arguments*/, - const css::uno::Reference< css::frame::XFrame >& /*Frame */) +css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createViewController( + const ::rtl::OUString& i_rViewName, const Sequence< PropertyValue >& i_rArguments, const Reference< XFrame >& i_rFrame ) throw (css::uno::RuntimeException , css::lang::IllegalArgumentException, css::uno::Exception ) { - return css::uno::Reference< css::frame::XController2 >(); + SfxModelGuard aGuard( *this ); + + if ( !i_rFrame.is() ) + throw css::lang::IllegalArgumentException( ::rtl::OUString(), *this, 3 ); + + // find the proper SFX view factory + SfxViewFactory* pViewFactory = GetObjectShell()->GetFactory().GetViewFactoryByViewName( i_rViewName ); + if ( !pViewFactory ) + throw IllegalArgumentException( ::rtl::OUString(), *this, 1 ); + + // determine previous shell (used in some special cases) + Reference< XController > xPreviousController( i_rFrame->getController() ); + const Reference< XModel > xMe( this ); + if ( ( xPreviousController.is() ) + && ( xMe != xPreviousController->getModel() ) + ) + { + xPreviousController.clear(); + } + SfxViewShell* pOldViewShell = SfxViewShell::Get( xPreviousController ); + OSL_ENSURE( !xPreviousController.is() || ( pOldViewShell != NULL ), + "SfxBaseModel::createViewController: invalid old controller!" ); + + // a guard which will clean up in case of failure + ::sfx::intern::ViewCreationGuard aViewCreationGuard; + + // determine the ViewFrame belonging to the given XFrame + SfxViewFrame* pViewFrame = FindOrCreateViewFrame_Impl( i_rFrame, aViewCreationGuard ); + OSL_POSTCOND( pViewFrame, "SfxBaseModel::createViewController: no frame?" ); + + // delegate to SFX' view factory + pViewFrame->GetBindings().ENTERREGISTRATIONS(); + SfxViewShell* pViewShell = pViewFactory->CreateInstance( pViewFrame, pOldViewShell ); + pViewFrame->GetBindings().LEAVEREGISTRATIONS(); + ENSURE_OR_THROW( pViewShell, "invalid view shell provided by factory" ); + + // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also + pViewFrame->GetDispatcher()->SetDisableFlags( 0 ); + pViewFrame->SetViewShell_Impl( pViewShell ); + + // remember ViewID + pViewFrame->SetCurViewId_Impl( pViewFactory->GetOrdinal() ); + + // ensure a default controller, if the view shell did not provide an own implementation + if ( !pViewShell->GetController().is() ) + pViewShell->SetController( new SfxBaseController( pViewShell ) ); + + // pass the creation arguments to the controller + SfxBaseController* pBaseController = pViewShell->GetBaseController_Impl(); + ENSURE_OR_THROW( pBaseController, "invalid controller implementation!" ); + pBaseController->SetCreationArguments_Impl( i_rArguments ); + + // some initial view settings, coming from our most recent attachResource call + ::comphelper::NamedValueCollection aDocumentLoadArgs( getArgs() ); + if ( aDocumentLoadArgs.getOrDefault( "ViewOnly", false ) ) + pViewFrame->GetFrame().SetMenuBarOn_Impl( FALSE ); + + const sal_Int16 nPluginMode = aDocumentLoadArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + if ( nPluginMode == 1 ) + { + pViewFrame->ForceOuterResize_Impl( FALSE ); + pViewFrame->GetBindings().HidePopups( TRUE ); + + SfxFrame& rFrame = pViewFrame->GetFrame(); + // MBA: layoutmanager of inplace frame starts locked and invisible + rFrame.GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); + rFrame.GetWorkWindow_Impl()->Lock_Impl( TRUE ); + + rFrame.GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + pViewFrame->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + + // tell the guard we were successful + aViewCreationGuard.releaseAll(); + + // outta gere + return pBaseController; } //============================================================================= @@ -3939,9 +3990,7 @@ css::uno::Reference< css::frame::XController2 > SAL_CALL SfxBaseModel::createVie uno::Reference< rdf::XRepository > SAL_CALL SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -3956,9 +4005,7 @@ SfxBaseModel::getRDFRepository() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getStringValue() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -3973,9 +4020,7 @@ SfxBaseModel::getStringValue() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getNamespace() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -3989,9 +4034,7 @@ SfxBaseModel::getNamespace() throw (uno::RuntimeException) ::rtl::OUString SAL_CALL SfxBaseModel::getLocalName() throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4008,9 +4051,7 @@ SfxBaseModel::getElementByMetadataReference( const ::com::sun::star::beans::StringPair & i_rReference) throw (uno::RuntimeException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4025,9 +4066,7 @@ uno::Reference< rdf::XMetadatable > SAL_CALL SfxBaseModel::getElementByURI(const uno::Reference< rdf::XURI > & i_xURI) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4043,9 +4082,7 @@ SfxBaseModel::getMetadataGraphsWithType( const uno::Reference<rdf::XURI> & i_xType) throw (uno::RuntimeException, lang::IllegalArgumentException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4062,9 +4099,7 @@ SfxBaseModel::addMetadataFile(const ::rtl::OUString & i_rFileName, throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4085,9 +4120,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, datatransfer::UnsupportedFlavorException, container::ElementExistException, rdf::ParseException, io::IOException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4105,9 +4138,7 @@ SfxBaseModel::removeMetadataFile( throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4123,9 +4154,7 @@ SfxBaseModel::addContentOrStylesFile(const ::rtl::OUString & i_rFileName) throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4141,9 +4170,7 @@ SfxBaseModel::removeContentOrStylesFile(const ::rtl::OUString & i_rFileName) throw (uno::RuntimeException, lang::IllegalArgumentException, container::NoSuchElementException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4162,9 +4189,7 @@ SfxBaseModel::loadMetadataFromStorage( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA( m_pData->CreateDMAUninitialized()); @@ -4192,9 +4217,7 @@ SfxBaseModel::storeMetadataToStorage( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { @@ -4211,9 +4234,7 @@ SfxBaseModel::loadMetadataFromMedium( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA( m_pData->CreateDMAUninitialized()); @@ -4240,9 +4261,7 @@ SfxBaseModel::storeMetadataToMedium( throw (uno::RuntimeException, lang::IllegalArgumentException, lang::WrappedTargetException) { - ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( impl_isDisposed() ) - throw lang::DisposedException(); + SfxModelGuard aGuard( *this ); const uno::Reference<rdf::XDocumentMetadataAccess> xDMA(m_pData->GetDMA()); if (!xDMA.is()) { diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index e35bc41000c9..714dfc2ea824 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxmodelfactory.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -152,7 +149,8 @@ namespace sfx2 static bool isSpecialArgumentName( const ::rtl::OUString& _rValueName ) { return _rValueName.equalsAscii( "EmbeddedObject" ) - || _rValueName.equalsAscii( "EmbeddedScriptSupport" ); + || _rValueName.equalsAscii( "EmbeddedScriptSupport" ) + || _rValueName.equalsAscii( "DocumentRecoverySupport" ); } bool operator()( const Any& _rArgument ) const @@ -174,15 +172,17 @@ namespace sfx2 ::comphelper::NamedValueCollection aArgs( _rArguments ); const sal_Bool bEmbeddedObject = aArgs.getOrDefault( "EmbeddedObject", sal_False ); const sal_Bool bScriptSupport = aArgs.getOrDefault( "EmbeddedScriptSupport", sal_True ); + const sal_Bool bDocRecoverySupport = aArgs.getOrDefault( "DocumentRecoverySupport", sal_True ); sal_uInt64 nCreationFlags = ( bEmbeddedObject ? SFXMODEL_EMBEDDED_OBJECT : 0 ) - | ( bScriptSupport ? 0 : SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ); + | ( bScriptSupport ? 0 : SFXMODEL_DISABLE_EMBEDDED_SCRIPTS ) + | ( bDocRecoverySupport ? 0 : SFXMODEL_DISABLE_DOCUMENT_RECOVERY ); Reference< XInterface > xInstance( impl_createInstance( nCreationFlags ) ); // to mimic the bahaviour of the default factory's createInstanceWithArguments, we initialize - // the object with the given arguments, stripped by the two special ones + // the object with the given arguments, stripped by the three special ones Sequence< Any > aStrippedArguments( _rArguments.getLength() ); Any* pStrippedArgs = aStrippedArguments.getArray(); Any* pStrippedArgsEnd = ::std::remove_copy_if( diff --git a/sfx2/source/explorer/makefile.mk b/sfx2/source/explorer/makefile.mk index dd70d7a60b71..75a15ebdb862 100644 --- a/sfx2/source/explorer/makefile.mk +++ b/sfx2/source/explorer/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.13 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/explorer/nochaos.cxx b/sfx2/source/explorer/nochaos.cxx index 4c7a1fcbe102..63c165bea7eb 100644 --- a/sfx2/source/explorer/nochaos.cxx +++ b/sfx2/source/explorer/nochaos.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: nochaos.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/SfxDocumentMetaData.hxx b/sfx2/source/inc/SfxDocumentMetaData.hxx index f6ecc41b6da3..ec573cf007a7 100644 --- a/sfx2/source/inc/SfxDocumentMetaData.hxx +++ b/sfx2/source/inc/SfxDocumentMetaData.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: SfxDocumentMetaData.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index 20dd3e5cc300..f7c38173fceb 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: alienwarn.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/appbas.hxx b/sfx2/source/inc/appbas.hxx index c46f71d0e0c5..8b10fcb843de 100644 --- a/sfx2/source/inc/appbas.hxx +++ b/sfx2/source/inc/appbas.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appbas.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/appbaslib.hxx b/sfx2/source/inc/appbaslib.hxx index 278a221c234f..5bc7662e8f9b 100644 --- a/sfx2/source/inc/appbaslib.hxx +++ b/sfx2/source/inc/appbaslib.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appbaslib.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx index 8b0420ef1e97..91305eb95cce 100644 --- a/sfx2/source/inc/appdata.hxx +++ b/sfx2/source/inc/appdata.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: appdata.hxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -55,7 +52,6 @@ class SfxFilterMatcher; class SvUShorts; class ISfxTemplateCommon; class SfxFilterMatcher; -class SfxCancelManager; class SfxStatusDispatcher; class SfxDdeTriggerTopic_Impl; class SfxDocumentTemplates; @@ -111,7 +107,6 @@ public: // application members SfxFilterMatcher* pMatcher; - SfxCancelManager* pCancelMgr; ResMgr* pLabelResMgr; SfxStatusDispatcher* pAppDispatch; SfxDocumentTemplates* pTemplates; diff --git a/sfx2/source/inc/applet.hxx b/sfx2/source/inc/applet.hxx index f8906a7670dd..5b7d61ebe314 100644 --- a/sfx2/source/inc/applet.hxx +++ b/sfx2/source/inc/applet.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: applet.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/doctemplates.hxx b/sfx2/source/inc/doctemplates.hxx index f10c95edb86d..5e962b93a117 100644 --- a/sfx2/source/inc/doctemplates.hxx +++ b/sfx2/source/inc/doctemplates.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: doctemplates.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/eventsupplier.hxx b/sfx2/source/inc/eventsupplier.hxx index a720c2369cf5..e012eea39c2d 100644 --- a/sfx2/source/inc/eventsupplier.hxx +++ b/sfx2/source/inc/eventsupplier.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: eventsupplier.hxx,v $ - * $Revision: 1.14.28.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/fltfnc.hxx b/sfx2/source/inc/fltfnc.hxx index e5cd41eff809..0a078a33c5be 100644 --- a/sfx2/source/inc/fltfnc.hxx +++ b/sfx2/source/inc/fltfnc.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fltfnc.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/fltoptint.hxx b/sfx2/source/inc/fltoptint.hxx index 9ea1f77bf083..b4aed7ccdd99 100644 --- a/sfx2/source/inc/fltoptint.hxx +++ b/sfx2/source/inc/fltoptint.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: fltoptint.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/helper.hxx b/sfx2/source/inc/helper.hxx index 16eabab43a7e..45aed74b154a 100644 --- a/sfx2/source/inc/helper.hxx +++ b/sfx2/source/inc/helper.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helper.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/helpid.hrc b/sfx2/source/inc/helpid.hrc index b8beacafee3a..29ad461d18da 100644 --- a/sfx2/source/inc/helpid.hrc +++ b/sfx2/source/inc/helpid.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: helpid.hrc,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/hexplwnd.hxx b/sfx2/source/inc/hexplwnd.hxx index d3c90813ba1f..228ce78949b9 100644 --- a/sfx2/source/inc/hexplwnd.hxx +++ b/sfx2/source/inc/hexplwnd.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hexplwnd.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/iframe.hxx b/sfx2/source/inc/iframe.hxx index 9abfd70ab663..041ffac822b7 100644 --- a/sfx2/source/inc/iframe.hxx +++ b/sfx2/source/inc/iframe.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: iframe.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/intro.hxx b/sfx2/source/inc/intro.hxx index 007e0473bc13..1b09008c0778 100644 --- a/sfx2/source/inc/intro.hxx +++ b/sfx2/source/inc/intro.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: intro.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/mailmodel.hxx b/sfx2/source/inc/mailmodel.hxx index 20e47a7c471c..43e938d46800 100644 --- a/sfx2/source/inc/mailmodel.hxx +++ b/sfx2/source/inc/mailmodel.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mailmodel.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/mnucfga.hxx b/sfx2/source/inc/mnucfga.hxx index 76fbb4386898..bbc3c1cd63ac 100644 --- a/sfx2/source/inc/mnucfga.hxx +++ b/sfx2/source/inc/mnucfga.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mnucfga.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/nfltdlg.hxx b/sfx2/source/inc/nfltdlg.hxx index 9d0fa68e0cbd..371fa96c57a2 100644 --- a/sfx2/source/inc/nfltdlg.hxx +++ b/sfx2/source/inc/nfltdlg.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: nfltdlg.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/nochaos.hxx b/sfx2/source/inc/nochaos.hxx index 17cb5fd9e045..4b5d7fb1f40e 100644 --- a/sfx2/source/inc/nochaos.hxx +++ b/sfx2/source/inc/nochaos.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: nochaos.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/objmnctl.hxx b/sfx2/source/inc/objmnctl.hxx index 7d1768b7689c..e58c6cd5592d 100644 --- a/sfx2/source/inc/objmnctl.hxx +++ b/sfx2/source/inc/objmnctl.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objmnctl.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index fed465c69986..a882cfedd821 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objshimp.hxx,v $ - * $Revision: 1.46 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,6 +32,7 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustring.hxx> +#include <rtl/ref.hxx> #include <com/sun/star/logging/XSimpleLogRing.hpp> #include <tools/datetime.hxx> @@ -59,14 +57,11 @@ struct MarkData_Impl class SfxFrame; class SfxToolBoxConfig; -class SfxAcceleratorManager; class SfxBasicManagerHolder; struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess { ::comphelper::EmbeddedObjectContainer* mpObjectContainer; - SfxAcceleratorManager* pAccMgr; - SfxConfigManager* pCfgMgr; SfxBasicManagerHolder* pBasicManager; SfxObjectShell& rDocShell; @@ -84,10 +79,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_uInt16 nVisualDocumentNumber; sal_Int16 nDocumentSignatureState; sal_Int16 nScriptingSignatureState; - sal_Bool bTemplateConfig:1, - bInList:1, // ob per First/Next erreichbar + sal_Bool bInList:1, // ob per First/Next erreichbar bClosing:1, // sal_True w"aehrend Close(), um Benachrichtigungs-Rekursionen zu verhindern - bSetInPlaceObj:1, // sal_True, falls bereits versucht wurde pInPlaceObject zu casten bIsSaving:1, bPasswd:1, bIsTmp:1, @@ -98,14 +91,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bInPrepareClose : 1, bPreparedForClose : 1, bWaitingForPicklist : 1,// Muss noch in die Pickliste - bModuleSearched : 1, - bIsHelpObjSh : 1, - bForbidCaching : 1, bForbidReload : 1, - bSupportsEventMacros: 1, - bLoadingWindows: 1, bBasicInitialized :1, - //bHidden :1, // indicates a hidden view shell bIsPrintJobCancelable :1, // Stampit disable/enable cancel button for print jobs ... default = true = enable! bOwnsStorage:1, bNoBaseURL:1, @@ -115,6 +102,7 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess bPreserveVersions:1, m_bMacroSignBroken:1, // whether the macro signature was explicitly broken m_bNoBasicCapabilities:1, + m_bDocRecoverySupport:1, bQueryLoadTemplate:1, bLoadReadonly:1, bUseUserData:1, @@ -122,36 +110,25 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess m_bSharedXMLFlag:1, // whether the flag should be stored in xml file m_bAllowShareControlFileClean:1; // whether the flag should be stored in xml file - String aNewName; // Der Name, unter dem das Doc gespeichert - // werden soll IndexBitSet aBitSet; sal_uInt32 lErr; sal_uInt16 nEventId; // falls vor Activate noch ein // Open/Create gesendet werden mu/s - sal_Bool bDoNotTouchDocInfo; - AutoReloadTimer_Impl *pReloadTimer; MarkData_Impl* pMarkData; sal_uInt16 nLoadedFlags; sal_uInt16 nFlagsInProgress; - String aMark; - Size aViewSize; // wird leider vom Writer beim - sal_Bool bInFrame; // HTML-Import gebraucht sal_Bool bModalMode; sal_Bool bRunningMacro; sal_Bool bReloadAvailable; sal_uInt16 nAutoLoadLocks; SfxModule* pModule; - SfxFrame* pFrame; - SfxToolBoxConfig* pTbxConfig; SfxObjectShellFlags eFlags; - svtools::AsynchronLink* pCloser; - String aBaseURL; sal_Bool bReadOnlyUI; SvRefBaseRef xHeaderAttributes; sal_Bool bHiddenLockedByAPI; - sal_Bool bInCloseEvent; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xModel; + ::rtl::Reference< SfxBaseModel > + pBaseModel; sal_uInt16 nStyleFilter; sal_Bool bDisposing; @@ -164,9 +141,6 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess sal_Bool m_bCreateTempStor; ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xDocStorage; - ::com::sun::star::uno::Reference< - ::com::sun::star::util::XModifyListener > m_xDocInfoListener; - sal_Bool m_bIsInit; ::rtl::OUString m_aSharedFileURL; diff --git a/sfx2/source/inc/openflag.hxx b/sfx2/source/inc/openflag.hxx index d6abac5f4079..5b719095eae8 100644 --- a/sfx2/source/inc/openflag.hxx +++ b/sfx2/source/inc/openflag.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: openflag.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/ownsubfilterservice.hxx b/sfx2/source/inc/ownsubfilterservice.hxx index f038ff26a9e1..f800e1e253ae 100644 --- a/sfx2/source/inc/ownsubfilterservice.hxx +++ b/sfx2/source/inc/ownsubfilterservice.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ownsubfilterservice.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/partwnd.hxx b/sfx2/source/inc/partwnd.hxx index 122e6ce91341..4a485e3cc91f 100644 --- a/sfx2/source/inc/partwnd.hxx +++ b/sfx2/source/inc/partwnd.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: partwnd.hxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/plugin.hxx b/sfx2/source/inc/plugin.hxx index f258ca720b15..a9d3ce2f1e72 100644 --- a/sfx2/source/inc/plugin.hxx +++ b/sfx2/source/inc/plugin.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: plugin.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/preview.hxx b/sfx2/source/inc/preview.hxx index d608639ee4ac..f247a2570cf9 100644 --- a/sfx2/source/inc/preview.hxx +++ b/sfx2/source/inc/preview.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: preview.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/recfloat.hxx b/sfx2/source/inc/recfloat.hxx index a70b6fd4b40a..5667a6c1e67a 100644 --- a/sfx2/source/inc/recfloat.hxx +++ b/sfx2/source/inc/recfloat.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: recfloat.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/referers.hxx b/sfx2/source/inc/referers.hxx index 897e58592baf..6c938861d013 100644 --- a/sfx2/source/inc/referers.hxx +++ b/sfx2/source/inc/referers.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: referers.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/sfxlocal.hrc b/sfx2/source/inc/sfxlocal.hrc index bc7d267d75d8..fb21cb0ab13c 100644 --- a/sfx2/source/inc/sfxlocal.hrc +++ b/sfx2/source/inc/sfxlocal.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxlocal.hrc,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/sfxpicklist.hxx b/sfx2/source/inc/sfxpicklist.hxx index 6e502bd9d7ad..8b5069f20296 100644 --- a/sfx2/source/inc/sfxpicklist.hxx +++ b/sfx2/source/inc/sfxpicklist.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxpicklist.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/sfxtypes.hxx b/sfx2/source/inc/sfxtypes.hxx index 200795f3f374..73014121541e 100644 --- a/sfx2/source/inc/sfxtypes.hxx +++ b/sfx2/source/inc/sfxtypes.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxtypes.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/sfxurlrelocator.hxx b/sfx2/source/inc/sfxurlrelocator.hxx index 1ef45bca59b8..8acc674b3568 100644 --- a/sfx2/source/inc/sfxurlrelocator.hxx +++ b/sfx2/source/inc/sfxurlrelocator.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxurlrelocator.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/slotserv.hxx b/sfx2/source/inc/slotserv.hxx index e53bde55c96d..9b0a8e94733c 100644 --- a/sfx2/source/inc/slotserv.hxx +++ b/sfx2/source/inc/slotserv.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: slotserv.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/speakerdlg.hxx b/sfx2/source/inc/speakerdlg.hxx deleted file mode 100644 index b3d16cd578cf..000000000000 --- a/sfx2/source/inc/speakerdlg.hxx +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: speakerdlg.hxx,v $ - * $Revision: 1.3 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SPEAKERDLG_HXX -#define _SPEAKERDLG_HXX - -#ifndef _GOODIES_RECOGNIZER_HXX_ -#include <goodies/recognizer.hxx> -#endif - -#ifndef _DIALOG_HXX -#include <vcl/dialog.hxx> -#endif -#ifndef _BUTTON_HXX -#include <vcl/button.hxx> -#endif -#ifndef _LSTBOX_HXX -#include <vcl/lstbox.hxx> -#endif - -// --------------- -// - SfxSpeakerDlg - -// --------------- - -class SfxSpeakerDlg: public ModalDialog -{ - OKButton aBtnOK; - CancelButton aBtnCancel; - ListBox aListBox; - CharSet aCharSet; - - OSpeakerManagerRef m_aSpeakerMgr; - -public: - - SfxSpeakerDlg(Window *pParent, OSpeakerManagerRef& aSpeakerMgr); - ~SfxSpeakerDlg(); - - virtual short Execute(); -}; - - -#endif // _SPEAKER_HXX diff --git a/sfx2/source/inc/splitwin.hxx b/sfx2/source/inc/splitwin.hxx index 2d6404371912..5105d27dd536 100644 --- a/sfx2/source/inc/splitwin.hxx +++ b/sfx2/source/inc/splitwin.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: splitwin.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/statcach.hxx b/sfx2/source/inc/statcach.hxx index 84d045d2a14b..03b0d72dac61 100644 --- a/sfx2/source/inc/statcach.hxx +++ b/sfx2/source/inc/statcach.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: statcach.hxx,v $ - * $Revision: 1.10.180.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index b4ea96c1ed4e..116f56163681 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: templdgi.hxx,v $ - * $Revision: 1.18.46.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/tplcitem.hxx b/sfx2/source/inc/tplcitem.hxx index aad0738214f7..f97d7f89868c 100644 --- a/sfx2/source/inc/tplcitem.hxx +++ b/sfx2/source/inc/tplcitem.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tplcitem.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/tplcomp.hxx b/sfx2/source/inc/tplcomp.hxx index 1dceb6bba39b..c172efb15d87 100644 --- a/sfx2/source/inc/tplcomp.hxx +++ b/sfx2/source/inc/tplcomp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tplcomp.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx index a5b637918e14..73b686d91252 100644 --- a/sfx2/source/inc/versdlg.hxx +++ b/sfx2/source/inc/versdlg.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: versdlg.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/virtmenu.hxx b/sfx2/source/inc/virtmenu.hxx index aecb2c0cf4cb..4b000133d11c 100644 --- a/sfx2/source/inc/virtmenu.hxx +++ b/sfx2/source/inc/virtmenu.hxx @@ -2,14 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: virtmenu.hxx,v $ - * - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inc/workwin.hxx b/sfx2/source/inc/workwin.hxx index 59b9d29c479d..ae005d1bad88 100644 --- a/sfx2/source/inc/workwin.hxx +++ b/sfx2/source/inc/workwin.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: workwin.hxx,v $ - * $Revision: 1.31 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index de399eaaa956..4ac85a7c98fe 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: inettbc.cxx,v $ - * $Revision: 1.37 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -42,7 +39,6 @@ #include <com/sun/star/task/XInteractionHandler.hpp> #include <svl/eitem.hxx> #include <svl/stritem.hxx> -#include <svl/cancel.hxx> #include <unotools/historyoptions.hxx> #include <svl/folderrestriction.hxx> #include <vcl/toolbox.hxx> @@ -305,102 +301,3 @@ void SfxURLToolBoxControl_Impl::StateChanged } } -//*************************************************************************** -// SfxCancelToolBoxControl_Impl -//*************************************************************************** - -SFX_IMPL_TOOLBOX_CONTROL(SfxCancelToolBoxControl_Impl,SfxBoolItem) - -//*************************************************************************** - -SfxCancelToolBoxControl_Impl::SfxCancelToolBoxControl_Impl( USHORT nSlotId, USHORT nId, ToolBox& rBox ) : - SfxToolBoxControl( nSlotId, nId, rBox ) -{ -} - -//*************************************************************************** - -SfxPopupWindowType SfxCancelToolBoxControl_Impl::GetPopupWindowType() const -{ - return SFX_POPUPWINDOW_ONTIMEOUT; -} - -//*************************************************************************** - -SfxPopupWindow* SfxCancelToolBoxControl_Impl::CreatePopupWindow() -{ - PopupMenu aMenu; - BOOL bExecute = FALSE, bSeparator = FALSE; - USHORT nIndex = 1; - for ( SfxCancelManager *pCancelMgr = SfxViewFrame::Current()->GetTopViewFrame()->GetCancelManager(); - pCancelMgr; - pCancelMgr = pCancelMgr->GetParent() ) - { - for ( USHORT n=0; n<pCancelMgr->GetCancellableCount(); ++n ) - { - if ( !n && bSeparator ) - { - aMenu.InsertSeparator(); - bSeparator = FALSE; - } - String aItemText = pCancelMgr->GetCancellable(n)->GetTitle(); - if ( aItemText.Len() > 50 ) - { - aItemText.Erase( 48 ); - aItemText += DEFINE_CONST_UNICODE("..."); - } - aMenu.InsertItem( nIndex++, aItemText ); - bExecute = TRUE; - bSeparator = TRUE; - } - } - - ToolBox& rToolBox = GetToolBox(); - USHORT nId = bExecute ? aMenu.Execute( &rToolBox, rToolBox.GetPointerPosPixel() ) : 0; - GetToolBox().EndSelection(); -// ClearCache(); -// UpdateSlot(); - if ( nId ) - { - String aSearchText = aMenu.GetItemText(nId); - for ( SfxCancelManager *pCancelMgr = SfxViewFrame::Current()->GetTopViewFrame()->GetCancelManager(); - pCancelMgr; - pCancelMgr = pCancelMgr->GetParent() ) - { - for ( USHORT n = 0; n < pCancelMgr->GetCancellableCount(); ++n ) - { - SfxCancellable *pCancel = pCancelMgr->GetCancellable(n); - String aItemText = pCancel->GetTitle(); - if ( aItemText.Len() > 50 ) - { - aItemText.Erase( 48 ); - aItemText += DEFINE_CONST_UNICODE("..."); - } - - if ( aItemText == aSearchText ) - { - pCancel->Cancel(); - return 0; - } - } - } - - } - - return 0; -} - -//*************************************************************************** - -void SfxCancelToolBoxControl_Impl::StateChanged -( - USHORT nSID, - SfxItemState eState, - const SfxPoolItem* pState -) -{ - SfxVoidItem aVoidItem( nSID ); - //SfxToolBoxControl::StateChanged( nSID, eState, pState ? &aVoidItem : 0 ); - SfxToolBoxControl::StateChanged( nSID, eState, pState ); -} - diff --git a/sfx2/source/inet/makefile.mk b/sfx2/source/inet/makefile.mk index 0460834fdd16..9347e68a2cdb 100644 --- a/sfx2/source/inet/makefile.mk +++ b/sfx2/source/inet/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/layout/factory.cxx b/sfx2/source/layout/factory.cxx index 697970f7e34c..e572ffb2b76e 100644 --- a/sfx2/source/layout/factory.cxx +++ b/sfx2/source/layout/factory.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tabdlg.cxx,v $ - * $Revision: 1.38 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/layout/makefile.mk b/sfx2/source/layout/makefile.mk index 24caa81ac643..a11ba76a15bd 100644 --- a/sfx2/source/layout/makefile.mk +++ b/sfx2/source/layout/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/layout/sfxdialog.cxx b/sfx2/source/layout/sfxdialog.cxx index 739f67180cc2..f3a76c489b7e 100644 --- a/sfx2/source/layout/sfxdialog.cxx +++ b/sfx2/source/layout/sfxdialog.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tabdlg.cxx,v $ - * $Revision: 1.38 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/layout/sfxtabdialog.cxx b/sfx2/source/layout/sfxtabdialog.cxx index c2a1b48f0271..7909d404b524 100644 --- a/sfx2/source/layout/sfxtabdialog.cxx +++ b/sfx2/source/layout/sfxtabdialog.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tabdlg.cxx,v $ - * $Revision: 1.38 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -46,7 +43,7 @@ #include <sfx2/viewfrm.hxx> #include <sfx2/app.hxx> #include "sfx2/sfxresid.hxx" -#include "sfxhelp.hxx" +#include "sfx2/sfxhelp.hxx" #include <sfx2/ctrlitem.hxx> #include <sfx2/bindings.hxx> #include <sfx2/sfxdlg.hxx> diff --git a/sfx2/source/layout/sfxtabpage.cxx b/sfx2/source/layout/sfxtabpage.cxx index 767cb14dfa28..7df739a38bb3 100644 --- a/sfx2/source/layout/sfxtabpage.cxx +++ b/sfx2/source/layout/sfxtabpage.cxx @@ -1,31 +1,29 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2008 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* $RCSfile: code,v $ -* -* $Revision: 1.3 $ -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -************************************************************************/ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ***********************************************************************/ #include <sfx2/layout.hxx> diff --git a/sfx2/source/menu/makefile.mk b/sfx2/source/menu/makefile.mk index 57a02ceef9f9..d3b209fc4a45 100644 --- a/sfx2/source/menu/makefile.mk +++ b/sfx2/source/menu/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/menu/menu.hrc b/sfx2/source/menu/menu.hrc index f339f07f247a..5017f980872b 100644 --- a/sfx2/source/menu/menu.hrc +++ b/sfx2/source/menu/menu.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: menu.hrc,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/menu/menu.src b/sfx2/source/menu/menu.src index a2ca838cd722..97c9c7f640fa 100644 --- a/sfx2/source/menu/menu.src +++ b/sfx2/source/menu/menu.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: menu.src,v $ - * $Revision: 1.31 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index e194a718bbb3..f101b0d426b9 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mnuitem.cxx,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -456,7 +453,7 @@ SfxAppMenuControl_Impl::SfxAppMenuControl_Impl( Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); ::framework::MenuConfiguration aConf( aXMultiServiceFactory ); - Reference<com::sun::star::frame::XFrame> aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> aXFrame( GetBindings().GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); pMenu = aConf.CreateBookmarkMenu( aXFrame, GetId() == SID_NEWDOCDIRECT ? BOOKMARK_NEWMENU : BOOKMARK_WIZARDMENU ); if( pMenu ) { diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 01d94dc141cf..a7fa737ecd18 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: mnumgr.cxx,v $ - * $Revision: 1.43 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/menu/objmnctl.cxx b/sfx2/source/menu/objmnctl.cxx index 3d88009e7c0e..e9d609151504 100644 --- a/sfx2/source/menu/objmnctl.cxx +++ b/sfx2/source/menu/objmnctl.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: objmnctl.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 04eaba861b94..0428d015dcea 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: virtmenu.cxx,v $ - * $Revision: 1.48 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -343,7 +340,7 @@ void SfxVirtualMenu::CreateFromSVMenu() DBG_CHKTHIS(SfxVirtualMenu, 0); // Merge Addon popup menus into the SV Menu - Reference< com::sun::star::frame::XFrame > xFrame( pBindings->GetDispatcher()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference< com::sun::star::frame::XFrame > xFrame( pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface() ); if ( pSVMenu->IsMenuBar() ) { @@ -608,7 +605,7 @@ IMPL_LINK( SfxVirtualMenu, SettingsChanged, void*, EMPTYARG ) SfxViewFrame *pViewFrame = pBindings->GetDispatcher()->GetFrame(); BOOL bIcons = Application::GetSettings().GetStyleSettings().GetUseImagesInMenus(); BOOL bIsHiContrastMode = IsHiContrastMode(); - Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); if ( !bIsAddonPopupMenu ) { @@ -680,7 +677,7 @@ void SfxVirtualMenu::UpdateImages() BOOL bIsHiContrastMode = IsHiContrastMode(); USHORT nItemCount = pSVMenu->GetItemCount(); SfxViewFrame * pViewFrame = pBindings->GetDispatcher()->GetFrame(); - Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> xFrame( pViewFrame->GetFrame().GetFrameInterface() ); for ( USHORT nSVPos=0; nSVPos < nItemCount; ++nSVPos ) { @@ -729,7 +726,7 @@ void SfxVirtualMenu::UpdateImages( Menu* pMenu ) { BOOL bIsHiContrastMode = IsHiContrastMode(); USHORT nItemCount = pMenu->GetItemCount(); - Reference<com::sun::star::frame::XFrame> aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> aXFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); for ( USHORT nPos=0; nPos < nItemCount; ++nPos ) { @@ -898,7 +895,7 @@ void SfxVirtualMenu::InsertAddOnsMenuItem( Menu* pMenu ) // Create special popup menu that is filled with the 3rd party components popup menu items Reference<com::sun::star::lang::XMultiServiceFactory> aXMultiServiceFactory(::comphelper::getProcessServiceFactory()); ::framework::MenuConfiguration aConf( aXMultiServiceFactory ); - Reference<com::sun::star::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame()->GetFrameInterface() ); + Reference<com::sun::star::frame::XFrame> xFrame( pBindings->GetDispatcher_Impl()->GetFrame()->GetFrame().GetFrameInterface() ); PopupMenu* pAddonMenu = NULL; try @@ -1251,36 +1248,6 @@ String SfxVirtualMenu::GetItemHelpText( USHORT nSlotId ) const } //-------------------------------------------------------------------- -/* -void SfxVirtualMenu::InvalidateKeyCodes() -{ - DBG_ASSERT( pSVMenu, "invalidating key of incomplete menu" ); - - SfxApplication* pSfxApp = SFX_APP(); - SfxViewFrame *pViewFrame = pBindings->GetDispatcher()->GetFrame(); - SfxAcceleratorManager* pAccMgr = pViewFrame->GetViewShell()->GetAccMgr_Impl(); - SfxAcceleratorManager* pAppAccel = pSfxApp->GetAppAccel_Impl(); - if ( !pAccMgr ) - pAccMgr = pAppAccel; - - for ( USHORT nPos = 0; nPos < pSVMenu->GetItemCount(); ++nPos ) - { - USHORT nId = pSVMenu->GetItemId(nPos); - SfxVirtualMenu *pPopup = GetPopupMenu(nId); -// if ( pPopup ) -// pPopup->InvalidateKeyCodes(); -// else if ( nId ) - if ( nId && !pSVMenu->GetPopupMenu( nId ) ) - { - KeyCode aCode = pAccMgr->GetKeyCode( nId ); - if ( !aCode.GetCode() && pAccMgr != pAppAccel ) - aCode = pAppAccel->GetKeyCode( nId ); - pSVMenu->SetAccelKey( nId, aCode ); - } - } -} */ - -//-------------------------------------------------------------------- // set the checkmark of the specified item diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index b8cef9dd2074..1ca10c6d9390 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: eventsupplier.cxx,v $ - * $Revision: 1.36.12.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -269,7 +266,7 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg { xProv = ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatchProvider > ( - pView->GetFrame()->GetFrameInterface(), UNO_QUERY ); + pView->GetFrame().GetFrameInterface(), UNO_QUERY ); } else { diff --git a/sfx2/source/notify/hintpost.cxx b/sfx2/source/notify/hintpost.cxx index 64b44d1c5372..d541f5542e3e 100644 --- a/sfx2/source/notify/hintpost.cxx +++ b/sfx2/source/notify/hintpost.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: hintpost.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/notify/makefile.mk b/sfx2/source/notify/makefile.mk index b63d4f16ae98..e2ddde40f936 100644 --- a/sfx2/source/notify/makefile.mk +++ b/sfx2/source/notify/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.9 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/statbar/makefile.mk b/sfx2/source/statbar/makefile.mk index b5c4f1f5fbaf..f99c8fcdaa1e 100644 --- a/sfx2/source/statbar/makefile.mk +++ b/sfx2/source/statbar/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.10 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index df463ac92396..dc5ad5f15d41 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stbitem.cxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -44,7 +41,7 @@ #include <vcl/status.hxx> #include <sfx2/app.hxx> -#include "stbitem.hxx" +#include "sfx2/stbitem.hxx" #include "sfxtypes.hxx" #include <sfx2/msg.hxx> #include "arrdecl.hxx" diff --git a/sfx2/source/toolbox/imgmgr.cxx b/sfx2/source/toolbox/imgmgr.cxx index 00699c6880f9..231baa76fc76 100644 --- a/sfx2/source/toolbox/imgmgr.cxx +++ b/sfx2/source/toolbox/imgmgr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: imgmgr.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/toolbox/makefile.mk b/sfx2/source/toolbox/makefile.mk index bedc92c4249f..ce4f011e6044 100644 --- a/sfx2/source/toolbox/makefile.mk +++ b/sfx2/source/toolbox/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.9 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 6921541ffeda..7cc25c872eb1 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: tbxitem.cxx,v $ - * $Revision: 1.70.80.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index c88297e477f7..090e94ecb63f 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frame.cxx,v $ - * $Revision: 1.55.142.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -80,7 +77,7 @@ #include <sfx2/fcontnr.hxx> #include "impframe.hxx" #include <sfx2/appuno.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "workwin.hxx" #include <sfx2/sfxuno.hxx> #include <sfx2/msgpool.hxx> @@ -103,41 +100,29 @@ using namespace ::com::sun::star::container; TYPEINIT1(SfxFrame, SfxListener); TYPEINIT1_AUTOFACTORY(SfxFrameItem, SfxPoolItem); TYPEINIT1(SfxUsrAnyItem, SfxPoolItem); - -SfxFrame::SfxFrame(SfxFrame* pParent): - pParentFrame( pParent ), - pChildArr(0), - pUnoImp(0) -{ - pImp = new SfxFrame_Impl( this ); - if ( pParent ) - pParent->InsertChildFrame_Impl( this ); - if ( !pFramesArr_Impl ) - pFramesArr_Impl = new SfxFrameArr_Impl; - pFramesArr_Impl->Insert( this, pFramesArr_Impl->Count() ); -} +TYPEINIT1_AUTOFACTORY(SfxUnoFrameItem, SfxPoolItem); SvCompatWeakHdl* SfxFrame::GetHdl() { return pImp->GetHdl(); } -SfxCancelManager* SfxFrame::GetCancelManager() const +//-------------------------------------------------------------------- +void SfxFrame::Construct_Impl() { - SfxFrame *pFrame = GetTopFrame(); - SfxCancelManager*& rpMgr = pFrame->pImp->pCancelMgr; - if ( !rpMgr ) - { - rpMgr = new SfxCancelManager( SFX_APP()->GetCancelManager() ); - pFrame->pImp->StartListening( *rpMgr ); - } - return rpMgr; + pImp = new SfxFrame_Impl( this ); + if ( !pFramesArr_Impl ) + pFramesArr_Impl = new SfxFrameArr_Impl; + pFramesArr_Impl->Insert( this, pFramesArr_Impl->Count() ); } //-------------------------------------------------------------------- SfxFrame::~SfxFrame() { + RemoveTopFrame_Impl( this ); + DELETEZ( pWindow ); + pFramesArr_Impl->Remove( pFramesArr_Impl->GetPos( this ) ); if ( pParentFrame ) @@ -217,53 +202,6 @@ sal_Bool SfxFrame::DoClose_Impl() return bRet; } -void SfxFrame::Clear_Impl() -{ - CancelTransfers(); - - // Bei FrameSets verhindern, da\s das Closen der Childs zu st"andigen - // ReCalcs im SplitWindow f"uhrt; SetUpdateMode am FrameWindow wirkt - // leider nicht auf dem MAC - Window *pWin = NULL; - SfxViewShell *pViewSh; - if ( pImp->pCurrentViewFrame && - 0 != ( pViewSh = pImp->pCurrentViewFrame->GetViewShell() ) ) - { - pWin = pViewSh->GetWindow(); - if ( pWin ) - pWin->Hide(); - } - - sal_Bool bRet = sal_True; - SfxBindings* pBindings = NULL; - if ( pImp->pCurrentViewFrame ) - { - pBindings = &pImp->pCurrentViewFrame->GetBindings(); - pImp->bClosing = sal_True; - bRet = pImp->pCurrentViewFrame->Close(); - pImp->bClosing = sal_False; - } - - if ( bRet ) - { - // Bei internen Tasks m"ussen Controller und Tools abger"aumt werden - if ( pImp->pWorkWin ) - { - pImp->pWorkWin->DeleteControllers_Impl(); - DELETEZ( pImp->pWorkWin ); - } - - if ( pImp->bOwnsBindings ) - delete pBindings; - } - else - { - if ( pWin ) - pWin->Show(); - } -} - - sal_Bool SfxFrame::DocIsModified_Impl() { if ( pImp->pCurrentViewFrame && pImp->pCurrentViewFrame->GetObjectShell() && @@ -293,7 +231,7 @@ sal_uInt16 SfxFrame::PrepareClose_Impl( sal_Bool bUI, sal_Bool bForBrowsing ) for ( const SfxViewFrame *pFrame = SfxViewFrame::GetFirst( pCur ); !bOther && pFrame; pFrame = SfxViewFrame::GetNext( *pFrame, pCur ) ) { - bOther = ( pFrame->GetFrame() != this ); + bOther = ( &pFrame->GetFrame() != this ); } SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_PREPARECLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_PREPARECLOSEVIEW ), pCur) ); @@ -336,164 +274,19 @@ SfxFrame* SfxFrame::GetChildFrame( sal_uInt16 nPos ) const return 0L; } -void SfxFrame::InsertChildFrame_Impl( SfxFrame* pFrame, sal_uInt16 nPos ) -{ - if ( !pChildArr ) - pChildArr = new SfxFrameArr_Impl; - pChildArr->Insert( pFrame, nPos ); - pFrame->pParentFrame = this; -} - -void SfxFrame::RemoveChildFrame_Impl( sal_uInt16 nPos ) -{ - DBG_ASSERT( pChildArr, "Unbekannter Frame!"); - pChildArr->Remove( nPos ); -}; - void SfxFrame::RemoveChildFrame_Impl( SfxFrame* pFrame ) { DBG_ASSERT( pChildArr, "Unbekannter Frame!"); sal_uInt16 nPos = pChildArr->GetPos(pFrame); - RemoveChildFrame_Impl( nPos ); + pChildArr->Remove( nPos ); }; -sal_Bool SfxFrame::CloseChildFrames() -{ - sal_Bool bRet = sal_True; - if ( pChildArr ) - { - // Childs closen - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - // pFrame removed sich selbst - bRet = pFrame->DoClose(); - if ( !bRet ) - break; - } - } - - return bRet; -} - -SfxFrame* SfxFrame::SearchChildrenForName_Impl( const String& rName, sal_Bool bDeep ) const -{ - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=nCount; n>0; n--) - { - SfxFrame* pFrame = (*pChildArr)[n-1]; - if ( rName.CompareIgnoreCaseToAscii( pFrame->GetFrameName() ) == COMPARE_EQUAL ) - return pFrame; - if( bDeep ) - { - pFrame = pFrame->SearchChildrenForName_Impl( rName ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -SfxFrame* SfxFrame::GetTopFrame() const +SfxFrame& SfxFrame::GetTopFrame() const { - SfxFrame *pParent = (SfxFrame*) this; + const SfxFrame* pParent = this; while ( pParent->pParentFrame ) pParent = pParent->pParentFrame; - return pParent; -} - -SfxFrame* SfxFrame::SearchFrame( const String& rName, SfxMedium* /*pMedium*/ ) -{ - // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch - // Sollte besser auch bei den FrameNames gemacht werden! - String aFrameName( rName ); - aFrameName.EraseLeadingChars(); - - SfxFrame *pFrame = this; - if( !aFrameName.Len() || aFrameName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL ) - { - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL ) - { - DBG_ERROR("Not supported!"); - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL) - { - // Eigener Name, kein Name oder Selbstbezug - return pFrame; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL ) - { - // Gesucht ist das Parent Frameset - return pParentFrame ? pParentFrame : this; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL ) - { - return NULL; - } - else if ( aFrameName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL ) - { - while ( pFrame->GetParentFrame() ) - pFrame = pFrame->GetParentFrame(); - return pFrame; - } - else - { - // Zuerst unterhalb dieses Frames absuchen - pFrame = SearchChildrenForName_Impl( aFrameName ); - } - - if ( !pFrame && GetParentFrame() ) - { - // Noch nichts gefunden, nach oben weitergehen - // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus - // Performance-Gr"unden markiert werden - SfxFrame *pParent = GetParentFrame(); - do - { - // Ist es der Parent ? - if ( aFrameName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL ) - return pParent; - - // Weiter nach oben - pParent = pParent->GetParentFrame(); - } - while ( pParent ); - } - - if( !pFrame ) - { - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen - // Toplevel Frames checken. - SfxFrame *pTop = GetTopFrame(); - for( sal_uInt16 nPos = rArr.Count(); nPos--; ) - { - // Unser Topframe wurde bereits durchsucht - SfxFrame* pCurFrame = rArr[ nPos ]; - if( pCurFrame != pTop ) - { - if( aFrameName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == - COMPARE_EQUAL ) - return pCurFrame; - else - { - pFrame = pCurFrame->SearchChildrenForName_Impl( aFrameName ); - if( pFrame ) - return pFrame; - } - } - } - } - - return pFrame; + return *const_cast< SfxFrame* >( pParent ); } sal_Bool SfxFrame::IsClosing_Impl() const @@ -506,21 +299,11 @@ void SfxFrame::SetIsClosing_Impl() pImp->bClosing = TRUE; } -void SfxFrame::DocumentInserted( SfxObjectShell* /*pDoc*/ ) -{ -} - sal_uInt16 SfxFrame::GetChildFrameCount() const { return pChildArr ? pChildArr->Count() : 0; } -sal_Bool SfxFrame::InsertDocument( SfxObjectShell* pDoc ) -{ - DocumentInserted( pDoc ); - return sal_True; -} - void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) { if( !pImp->bInCancelTransfers ) @@ -531,7 +314,7 @@ void SfxFrame::CancelTransfers( sal_Bool /*bCancelLoadEnv*/ ) { SfxViewFrame* pFrm; for( pFrm = SfxViewFrame::GetFirst( pObj ); - pFrm && pFrm->GetFrame() == this; + pFrm && &pFrm->GetFrame() == this; pFrm = SfxViewFrame::GetNext( *pFrm, pObj ) ) ; // Keine anderer Frame mehr auf Doc -> Cancel if( !pFrm ) @@ -569,12 +352,7 @@ SfxObjectShell* SfxFrame::GetCurrentDocument() const { return pImp->pCurrentViewFrame ? pImp->pCurrentViewFrame->GetObjectShell() : - pImp->pCurrentObjectShell; -} - -void SfxFrame::SetCurrentDocument_Impl( SfxObjectShell *pDoc ) -{ - pImp->pCurrentObjectShell = pDoc; + NULL; } void SfxFrame::SetCurrentViewFrame_Impl( SfxViewFrame *pFrame ) @@ -592,56 +370,10 @@ void SfxFrame::SetFrameType_Impl( sal_uInt32 n ) pImp->nType = n; } -void SfxFrame::CopyHistory_Impl( SfxFrame* /*pFrame*/ ) const -{ -} - - -void SfxFrame::ClearHistory() -{ -} - -sal_Bool SfxFrame::ExecuteHistoryMenu_Impl( sal_uInt16 /*nWhich*/, const Rectangle& /*rRect*/, sal_uInt16 /*nFlags*/ ) -{ - return sal_True; -} - -sal_Bool SfxFrame::Browse( sal_Bool /*bForward*/, sal_uInt16 /*nSteps*/, sal_Bool /*bNewFrame*/ ) -{ - return FALSE; -} - -void SfxFrame::UpdatePickEntries() -{ -} - -void SfxFrame::UpdatePickEntries( const ::com::sun::star::uno::Any& /*rValue*/ ) -{ -} - -void SfxFrame::UpdateUndoHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/, const String* /*pTitle*/ ) -{ -} - -void SfxFrame::UpdateCurrentHistory_Impl( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ ) -{ -} - -void SfxFrame::UpdateHistory( SfxObjectShell* /*pDocSh*/, const String* /*pNew*/ ) -{ -} - -void SfxFrame::UpdateHistory( - const ::rtl::OUString& /*aURL*/, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/, - const ::rtl::OUString& /*rTitle*/ ) -{ -} - void SfxFrame::GetViewData_Impl() { // Alle zwischen Laden und Entfernen "anderbaren Daten aktualisieren; die - // festen Daten werden nur einmal ( nach InsertDocument in UpdateDescriptor ) + // festen Daten werden nur einmal ( nach PrepareForDoc_Impl in UpdateDescriptor ) // geholt, um Zeit zu sparen. SfxViewFrame* pViewFrame = GetCurrentViewFrame(); if( pViewFrame && pViewFrame->GetViewShell() ) @@ -650,10 +382,7 @@ void SfxFrame::GetViewData_Impl() sal_Bool bReadOnly = pMed->GetOpenMode() == SFX_STREAM_READONLY; GetDescriptor()->SetReadOnly( bReadOnly ); - String aUserData; - pViewFrame->GetViewShell()->WriteUserData( aUserData, sal_True ); SfxItemSet *pSet = GetDescriptor()->GetArgs(); - pSet->Put( SfxStringItem( SID_USER_DATA, aUserData )); sal_Bool bGetViewData = sal_False; if ( GetController().is() && pSet->GetItemState( SID_VIEW_DATA ) != SFX_ITEM_SET ) { @@ -681,9 +410,9 @@ void SfxFrame::GetViewData_Impl() void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) { - // Beim InsertDocument wird der Descriptor des Frames aktualisiert + // Beim PrepareForDoc_Impl wird der Descriptor des Frames aktualisiert // und sein ItemSet neu initialisiert. Alle Daten, die f"ur ein sp"ateres - // Restaurieren der ::com::sun::star::sdbcx::View n"otig sind, sind damit festgehalten. + // Restaurieren der View n"otig sind, sind damit festgehalten. // Soll das Dokument ersetzt werden, wird durch GetViewData_Impl (s.o.) // die neueste Information hinzugef"ugt. Alles zusammen wird dann in der // Browse-History gesichert. Beim Aktivieren eines solchen FramePickEntry @@ -735,20 +464,6 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell *pDoc ) //------------------------------------------------------------------------- -sal_Bool SfxFrame::CanBrowseBackward() const -{ - return FALSE; -} - -//------------------------------------------------------------------------- - -sal_Bool SfxFrame::CanBrowseForward() const -{ - return FALSE; -} - -//------------------------------------------------------------------------- - void SfxFrame::SetDescriptor( SfxFrameDescriptor *pD ) { DBG_ASSERT( pD, "Kein Descriptor!" ); @@ -796,14 +511,12 @@ void SfxFrame::GetTargetList( TargetList& rList ) const } SfxViewFrame* pView = GetCurrentViewFrame(); - if( pView && pView->GetViewShell() && !pView->GetViewShell()->IsImplementedAsFrameset_Impl() && pChildArr ) + if( pView && pView->GetViewShell() && pChildArr ) { sal_uInt16 nCount = pChildArr->Count(); for ( sal_uInt16 n=0; n<nCount; n++) { SfxFrame* pFrame = (*pChildArr)[n]; - if ( pFrame->GetFrameName().Len() ) - rList.Insert( new String (pFrame->GetFrameName()) ); pFrame->GetTargetList( rList ); } } @@ -811,147 +524,11 @@ void SfxFrame::GetTargetList( TargetList& rList ) const //------------------------------------------------------------------------- -void SfxFrame::SetFrameId_Impl( sal_uInt16 nId ) -{ - pImp->nFrameId = nId; - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->UpdateTitle(); -} - -sal_uInt16 SfxFrame::GetFrameId_Impl() const -{ - return pImp->nFrameId; -} - -void SfxFrame::SetFrameIdName_Impl( const String& rName ) -{ - pImp->aFrameIdName = rName; -} - -//------------------------------------------------------------------------- - -SfxFrame* SfxFrame::SearchFrame_Impl( sal_uInt16 nId, sal_Bool bDeep ) -{ - if ( pImp->nFrameId == nId ) - return this; - - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; n<nCount; n++) - { - SfxFrame* pFrame = (*pChildArr)[n]; - if ( pFrame->pImp->nFrameId == nId ) - return pFrame; - if ( bDeep ) - { - pFrame = pFrame->SearchFrame_Impl( nId, sal_True ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -SfxFrame* SfxFrame::SearchFrame_Impl( const String& rName, sal_Bool bDeep ) -{ - if ( pImp->aFrameIdName == rName ) - return this; - - if ( pChildArr ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; n<nCount; n++) - { - SfxFrame* pFrame = (*pChildArr)[n]; - if ( pFrame->pImp->aFrameIdName == rName ) - return pFrame; - if ( bDeep ) - { - pFrame = pFrame->SearchFrame_Impl( rName ); - if ( pFrame ) - return pFrame; - } - } - } - - return NULL; -} - -//------------------------------------------------------------------------- - -//------------------------------------------------------------------------- - -void SfxFrame::Activate_Impl( sal_Bool bBeamerOn ) - -/* [Description] - - Internal Activate-Handler, called from derived classes which supports - Activate-Handling. -*/ - -{ - if ( GetParentFrame() ) - GetParentFrame()->Activate_Impl( bBeamerOn ); -} - SfxBroadcaster& SfxFrame::GetBroadcaster() const { return *pImp; } -//------------------------------------------------------------------------- - -void SfxFrame::Deactivate_Impl() - -/* [Description] - - Internal Deactivate-Handler, called from derived classes which supports - Activate-Handling. -*/ - -{ - if( GetParentFrame() ) - GetParentFrame()->Deactivate_Impl(); -} - -String SfxFrame::GetContent() const -{ - SfxObjectShell *pObj = GetCurrentDocument(); - if ( !pObj || !pObj->GetMedium() ) - return String(); - else - return pObj->GetMedium()->GetName(); -} - -sal_Bool SfxFrame::CheckContentForLoad_Impl() -{ - if ( GetCurrentDocument() ) - { - SfxMedium* pMedium = GetCurrentDocument()->GetMedium(); -#ifdef DEBUG - SfxItemSet* pSet; - pSet = pMedium->GetItemSet(); -#endif - SfxItemSet* pNew = GetDescriptor()->GetArgs(); - - // Falls URLs nicht uebereinstimmen - if ( INetURLObject( GetDescriptor()->GetActualURL() ) != INetURLObject( pMedium->GetOrigURL() ) ) - return sal_True; - - // Falls die Filter nicht uebereinstimmen - SFX_ITEMSET_ARG( pNew, pFilterItem, SfxStringItem, SID_FILTER_NAME, sal_False ); - if( pMedium->GetOrigFilter() && pFilterItem && pFilterItem->GetValue() != pMedium->GetOrigFilter()->GetFilterName() ) - return sal_True; - - return sal_False; - } - - return (GetDescriptor()->GetActualURL().GetMainURL( INetURLObject::NO_DECODE ).getLength() != 0); -} - sal_Bool SfxFrame::IsParent( SfxFrame *pFrame ) const { SfxFrame *pParent = pParentFrame; @@ -978,7 +555,7 @@ void SfxFrame::RemoveTopFrame_Impl( SfxFrame* pFrame ) } SfxFrameItem::SfxFrameItem( sal_uInt16 nWhichId, SfxViewFrame *p ) - : SfxPoolItem( nWhichId ), pFrame( p ? p->GetFrame() : NULL ) + : SfxPoolItem( nWhichId ), pFrame( p ? &p->GetFrame() : NULL ) { wFrame = pFrame; } @@ -1061,11 +638,6 @@ int SfxUsrAnyItem::operator==( const SfxPoolItem& /*rItem*/ ) const return sal_False; } -String SfxUsrAnyItem::GetValueText() const -{ - return String(); -} - SfxPoolItem* SfxUsrAnyItem::Clone( SfxItemPool *) const { return new SfxUsrAnyItem( Which(), aValue ); @@ -1083,9 +655,37 @@ sal_Bool SfxUsrAnyItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*n return sal_True; } -sal_Bool SfxFrame::BrowseInFrame( int /*nDelta*/ ) +SfxUnoFrameItem::SfxUnoFrameItem() + : SfxPoolItem() + , m_xFrame() { - return sal_False; +} + +SfxUnoFrameItem::SfxUnoFrameItem( sal_uInt16 nWhichId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame ) + : SfxPoolItem( nWhichId ) + , m_xFrame( i_rFrame ) +{ +} + +int SfxUnoFrameItem::operator==( const SfxPoolItem& i_rItem ) const +{ + return i_rItem.ISA( SfxUnoFrameItem ) && static_cast< const SfxUnoFrameItem& >( i_rItem ).m_xFrame == m_xFrame; +} + +SfxPoolItem* SfxUnoFrameItem::Clone( SfxItemPool* ) const +{ + return new SfxUnoFrameItem( Which(), m_xFrame ); +} + +sal_Bool SfxUnoFrameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) const +{ + rVal <<= m_xFrame; + return sal_True; +} + +sal_Bool SfxUnoFrameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE /*nMemberId*/ ) +{ + return ( rVal >>= m_xFrame ); } SfxFrameIterator::SfxFrameIterator( const SfxFrame& rFrame, sal_Bool bRecur ) @@ -1132,116 +732,6 @@ SfxFrame* SfxFrameIterator::NextSibling_Impl( SfxFrame& rPrev ) return pRet; } -void SfxFrame::SetFrameName( const String& rName ) -{ - if ( pImp->pDescr ) - pImp->pDescr->SetName( rName ); - aName = rName; - if ( pImp->pCurrentViewFrame ) - pImp->pCurrentViewFrame->UpdateTitle(); - if ( GetFrameInterface().is() ) - GetFrameInterface()->setName( rName ); -} - -void SfxFrame::LoadFinished_Impl() -{ -} - -SfxFrame* SfxFrame::findFrame(const ::rtl::OUString& aTargetframename, sal_Int32 nSearchFlags) -{ - // Weil Netscape f"uhrende BLANKS "uberliest, m"ussen wir das wohl auch - // Sollte besser auch bei den FrameNames gemacht werden! - String aTargetName( aTargetframename ); - aTargetName.EraseLeadingChars(); - - SfxFrame *pFrame = this; - - if ( !aTargetName.Len() && GetParentFrame() && GetParentFrame()->GetCurrentViewFrame()->GetViewShell()->IsImplementedAsFrameset_Impl() ) - return GetParentFrame(); - - if( !aTargetName.Len() || aTargetName.CompareIgnoreCaseToAscii("_self") == COMPARE_EQUAL ) - return pFrame; - - if ( aTargetName.CompareIgnoreCaseToAscii("_smartself") == COMPARE_EQUAL ) - { - DBG_ERROR("Not supported!"); - return pFrame; - } - - if ( aTargetName.CompareIgnoreCaseToAscii("_parent") == COMPARE_EQUAL ) - { - // Gesucht ist das Parent Frameset - return pFrame->GetParentFrame(); - } - else if ( aTargetName.CompareIgnoreCaseToAscii("_blank") == COMPARE_EQUAL ) - { - return NULL; - - } - else if ( aTargetName.CompareIgnoreCaseToAscii("_top") == COMPARE_EQUAL ) - { - while ( pFrame->GetParentFrame() ) - pFrame = pFrame->GetParentFrame(); - return pFrame; - } - - if ( ( nSearchFlags & FRAME_SEARCH_SELF ) && aTargetName.CompareIgnoreCaseToAscii( GetFrameName() ) == COMPARE_EQUAL ) - { - // Eigener Name - return pFrame; - } - - if ( nSearchFlags & FRAME_SEARCH_CHILDREN ) - { - // Zuerst unterhalb dieses Frames absuchen - pFrame = SearchChildrenForName_Impl( aTargetName ); - } - - if ( ( nSearchFlags & FRAME_SEARCH_CHILDREN ) && !pFrame && GetParentFrame() ) - { - // Noch nichts gefunden, nach oben weitergehen - // Eigentlich m"u\sten Frames, die schon abgesucht wurden, aus - // Performance-Gr"unden markiert werden - SfxFrame *pParent = GetParentFrame(); - do - { - // Ist es der Parent ? - if ( aTargetName.CompareIgnoreCaseToAscii( pParent->GetFrameName() ) == COMPARE_EQUAL ) - return pParent; - - // Weiter nach oben - pParent = pParent->GetParentFrame(); - } - while ( pParent ); - } - - if( !pFrame ) - { - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - // keinen Frame im MDI-Fenster gefunden. Jetzt die anderen - // Toplevel Frames checken. - SfxFrame *pTop = GetTopFrame(); - for( sal_uInt16 nPos = rArr.Count(); nPos--; ) - { - // Unser Topframe wurde bereits durchsucht - SfxFrame* pCurFrame = rArr[ nPos ]; - if( pCurFrame != pTop ) - { - if( aTargetName.CompareIgnoreCaseToAscii( pCurFrame->GetFrameName() ) == COMPARE_EQUAL ) - return pCurFrame; - else - { - pFrame = pCurFrame->SearchChildrenForName_Impl( aTargetName ); - if( pFrame ) - return pFrame; - } - } - } - } - - return pFrame; -} - sal_Bool SfxFrame::IsTop() const { return GetFrameInterface().is() ? GetFrameInterface()->isTop() : sal_False; @@ -1265,7 +755,7 @@ sal_Bool SfxFrame::HasComponent() const return pImp->xFrame; } -void SfxFrame::SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) +void SfxFrame::SetFrameInterface_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) { pImp->xFrame = rFrame; com::sun::star::uno::Reference< com::sun::star::frame::XDispatchRecorder > xRecorder; @@ -1273,16 +763,6 @@ void SfxFrame::SetFrameInterface_Impl( ::com::sun::star::uno::Reference< ::com:: 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() ) @@ -1410,11 +890,6 @@ void SfxFrame::CreateWorkWindow_Impl() pImp->pWorkWin = new SfxFrameWorkWin_Impl( &pFrame->GetWindow(), this, pFrame ); } -const SvBorder& SfxFrame::GetBorder_Impl() const -{ - return pImp->aBorder; -} - void SfxFrame::GrabFocusOnComponent_Impl() { if ( pImp->bReleasingComponent ) @@ -1423,18 +898,12 @@ void SfxFrame::GrabFocusOnComponent_Impl() return; } - Window* pWindow = &GetWindow(); + Window* pFocusWindow = &GetWindow(); if ( GetCurrentViewFrame() && GetCurrentViewFrame()->GetViewShell() && GetCurrentViewFrame()->GetViewShell()->GetWindow() ) - pWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow(); - - if( !pWindow->HasChildPathFocus() ) - pWindow->GrabFocus(); -} + pFocusWindow = GetCurrentViewFrame()->GetViewShell()->GetWindow(); -const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > SfxFrame::GetInterceptor_Impl() -{ -//(mba)/compview: hier fehlt der Zugriff auf den Interceptor !!!!! - return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > (); + if( !pFocusWindow->HasChildPathFocus() ) + pFocusWindow->GrabFocus(); } void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet ) @@ -1442,36 +911,6 @@ void SfxFrame::ReleasingComponent_Impl( sal_Bool bSet ) pImp->bReleasingComponent = bSet; } -sal_Bool SfxFrame::LoadSfxComponent( - const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & /*aFrame*/, - const ::rtl::OUString& /*aURL*/, - const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*aArgs*/, - const SfxObjectFactory* /*pFact*/ ) -{ - // get Implementation of xComponents ... - DBG_ERROR( "Should not be called anymore!" ); - return sal_False; -} - -void SfxFrame::LockFocus_Impl( sal_Bool bLock ) -{ - if ( pChildArr && pChildArr->Count() ) - { - sal_uInt16 nCount = pChildArr->Count(); - for ( sal_uInt16 n=0; n<nCount; n++ ) - { - SfxFrame* pFrame = (*pChildArr)[n]; - pFrame->pImp->bFocusLocked = bLock; - pFrame->LockFocus_Impl( bLock ); - } - } -} - -sal_Bool SfxFrame::IsFocusLocked_Impl() const -{ - return pImp->bFocusLocked; -} - sal_Bool SfxFrame::IsInPlace() const { return pImp->bInPlace; @@ -1506,7 +945,7 @@ void SfxFrame::Resize() if ( nHandle ) { SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); - pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame()->GetWorkWindow_Impl(); + pWork = SfxViewFrame::GetFirst( pDoc )->GetFrame().GetWorkWindow_Impl(); } } @@ -1546,10 +985,10 @@ SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame ) return NULL; } -const SfxPoolItem* SfxFrame::LoadDocumentSynchron( SfxItemSet& aSet ) +const SfxPoolItem* SfxFrame::OpenDocumentSynchron( SfxItemSet& i_rSet, const Reference< XFrame >& i_rTargetFrame ) { - aSet.Put( SfxFrameItem( SID_DOCFRAME, this ) ); - aSet.ClearItem( SID_TARGETNAME ); - return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet ); + i_rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, i_rTargetFrame ) ); + i_rSet.ClearItem( SID_TARGETNAME ); + return SFX_APP()->GetDispatcher_Impl()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, i_rSet ); } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx new file mode 100644 index 000000000000..306523677d66 --- /dev/null +++ b/sfx2/source/view/frame2.cxx @@ -0,0 +1,484 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "impframe.hxx" +#include "objshimp.hxx" +#include "sfx2/sfxhelp.hxx" +#include "workwin.hxx" + +#include "sfx2/app.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/event.hxx" +#include "sfx2/objface.hxx" +#include "sfx2/request.hxx" + +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> + +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/itemset.hxx> +#include <svl/rectitem.hxx> +#include <svl/stritem.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; +using ::com::sun::star::frame::XComponentLoader; + +//------------------------------------------------------------------------ + +class SfxFrameWindow_Impl : public Window +{ +public: + SfxFrame* pFrame; + + SfxFrameWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ); + ~SfxFrameWindow_Impl( ); + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void StateChanged( StateChangedType nStateChange ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual long Notify( NotifyEvent& rEvt ); + virtual void Resize(); + virtual void GetFocus(); + void DoResize(); + DECL_LINK( CloserHdl, void* ); +}; + +SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, Window& i_rContainerWindow ) + : Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) + , pFrame( pF ) +{ +} + +SfxFrameWindow_Impl::~SfxFrameWindow_Impl( ) +{ +} + +void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) +{ + Window::DataChanged( rDCEvt ); + SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); + if ( pWorkWin ) + pWorkWin->DataChanged_Impl( rDCEvt ); +} + +long SfxFrameWindow_Impl::Notify( NotifyEvent& rNEvt ) +{ + if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() ) + return sal_False; + + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + if ( !pView || !pView->GetObjectShell() ) + return Window::Notify( rNEvt ); + + if ( rNEvt.GetType() == EVENT_GETFOCUS ) + { + if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) + { + DBG_TRACE("SfxFrame: GotFocus"); + pView->MakeActive_Impl( FALSE ); + } + + // TODO/LATER: do we still need this code? + Window* pWindow = rNEvt.GetWindow(); + ULONG nHelpId = 0; + while ( !nHelpId && pWindow ) + { + nHelpId = pWindow->GetHelpId(); + pWindow = pWindow->GetParent(); + } + + if ( nHelpId ) + SfxHelp::OpenHelpAgent( pFrame, nHelpId ); + + // if focus was on an external window, the clipboard content might have been changed + pView->GetBindings().Invalidate( SID_PASTE ); + pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); + return sal_True; + } + else if( rNEvt.GetType() == EVENT_KEYINPUT ) + { + if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) ) + return TRUE; + } + else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ ) + { + pView->SetModalMode( sal_True ); + return sal_True; + } + else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) + { + //EnableInput( sal_True, sal_True ); + pView->SetModalMode( sal_False ); + return sal_True; + } + + return Window::Notify( rNEvt ); +} + +long SfxFrameWindow_Impl::PreNotify( NotifyEvent& rNEvt ) +{ + USHORT nType = rNEvt.GetType(); + if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP ) + { + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; + if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) + return sal_True; + } + else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN ) + { + Window* pWindow = rNEvt.GetWindow(); + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; + if ( pShell ) + if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) ) + if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) + return sal_True; + } + + if ( nType == EVENT_MOUSEBUTTONDOWN ) + { + Window* pWindow = rNEvt.GetWindow(); + const MouseEvent* pMEvent = rNEvt.GetMouseEvent(); + Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() ); + SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); + if ( pWorkWin ) + pWorkWin->EndAutoShow_Impl( aPos ); + } + + return Window::PreNotify( rNEvt ); +} + +void SfxFrameWindow_Impl::GetFocus() +{ + if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() ) + pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE ); +} + +void SfxFrameWindow_Impl::Resize() +{ + if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) + DoResize(); +} + +void SfxFrameWindow_Impl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + pFrame->pImp->bHidden = FALSE; + if ( pFrame->IsInPlace() ) + // TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the + // LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that + // the resize event never is sent to the component + SetSizePixel( GetParent()->GetOutputSizePixel() ); + + DoResize(); + SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); + if ( pView ) + pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl(); + } + + Window::StateChanged( nStateChange ); +} + +void SfxFrameWindow_Impl::DoResize() +{ + if ( !pFrame->pImp->bLockResize ) + pFrame->Resize(); +} + +Reference < XFrame > SfxFrame::CreateBlankFrame() +{ + Reference < XFrame > xFrame; + try + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return xFrame; +} + +SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, Window& rWindow, USHORT nViewId, bool bHidden ) +{ + SfxFrame* pFrame = NULL; + try + { + // create and initialize new top level frame for this window + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFramesSupplier > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + Reference < XFrame > xFrame( aContext.createComponent( "com.sun.star.frame.Frame"), UNO_QUERY_THROW ); + + Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( &rWindow ), uno::UNO_QUERY_THROW ); + xFrame->initialize( xWin.get() ); + xDesktop->getFrames()->append( xFrame ); + + if ( xWin->isActive() ) + xFrame->activate(); + + // create load arguments + Sequence< PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *rDoc.GetMedium()->GetItemSet(), aLoadArgs ); + + ::comphelper::NamedValueCollection aArgs( aLoadArgs ); + aArgs.put( "Model", rDoc.GetModel() ); + aArgs.put( "Hidden", bHidden ); + if ( nViewId ) + aArgs.put( "ViewId", nViewId ); + + aLoadArgs = aArgs.getPropertyValues(); + + // load the doc into that frame + ::rtl::OUString sLoaderURL( rDoc.GetModel()->getURL() ); + if ( sLoaderURL.getLength() == 0 ) + sLoaderURL = rDoc.GetFactory().GetFactoryURL(); + + Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( + sLoaderURL, + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), + 0, + aLoadArgs + ); + + for ( pFrame = SfxFrame::GetFirst(); + pFrame; + pFrame = SfxFrame::GetNext( *pFrame ) + ) + { + if ( pFrame->GetFrameInterface() == xFrame ) + break; + } + + OSL_ENSURE( pFrame, "SfxFrame::Create: load succeeded, but no SfxFrame was created during this!" ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + return pFrame; +} + +SfxFrame* SfxFrame::Create( const Reference < XFrame >& i_rFrame ) +{ + // create a new TopFrame to an external XFrame object ( wrap controller ) + ENSURE_OR_THROW( i_rFrame.is(), "NULL frame not allowed" ); + Window* pWindow = VCLUnoHelper::GetWindow( i_rFrame->getContainerWindow() ); + ENSURE_OR_THROW( pWindow, "frame without container window not allowed" ); + + SfxFrame* pFrame = new SfxFrame( *pWindow, false ); + pFrame->SetFrameInterface_Impl( i_rFrame ); + return pFrame; +} + +SfxFrame::SfxFrame( Window& i_rContainerWindow, bool i_bHidden ) + :pParentFrame( NULL ) + ,pChildArr( NULL ) + ,pImp( NULL ) + ,pWindow( NULL ) +{ + Construct_Impl(); + + pImp->bHidden = i_bHidden; + InsertTopFrame_Impl( this ); + pImp->pExternalContainerWindow = &i_rContainerWindow; + + pWindow = new SfxFrameWindow_Impl( this, i_rContainerWindow ); + + // always show pWindow, which is the ComponentWindow of the XFrame we live in + // nowadays, since SfxFrames can be created with an XFrame only, hiding or showing the complete XFrame + // is not done at level of the container window, not at SFX level. Thus, the component window can + // always be visible. + pWindow->Show(); +} + +void SfxFrame::SetPresentationMode( BOOL bSet ) +{ + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); + + Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + + if ( xPropSet.is() ) + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + + if ( xLayoutManager.is() ) + xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode + + SetMenuBarOn_Impl( !bSet ); + if ( GetWorkWindow_Impl() ) + GetWorkWindow_Impl()->SetDockingAllowed( !bSet ); + if ( GetCurrentViewFrame() ) + GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); +} + +SystemWindow* SfxFrame::GetSystemWindow() const +{ + return GetTopWindow_Impl(); +} + +SystemWindow* SfxFrame::GetTopWindow_Impl() const +{ + if ( pImp->pExternalContainerWindow->IsSystemWindow() ) + return (SystemWindow*) pImp->pExternalContainerWindow; + else + return NULL; +} + +Window& SfxFrame::GetWindow() const +{ + return *pWindow; +} + +sal_Bool SfxFrame::Close() +{ + delete this; + return sal_True; +} + +void SfxFrame::LockResize_Impl( BOOL bLock ) +{ + pImp->bLockResize = bLock; +} + +IMPL_LINK( SfxFrameWindow_Impl, CloserHdl, void*, EMPTYARG ) +{ + if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) ) + return 0L; + + if ( pFrame ) + pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON ); + return 0L; +} + +void SfxFrame::SetMenuBarOn_Impl( BOOL bOn ) +{ + pImp->bMenuBarOn = bOn; + + Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); + Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; + + if ( xPropSet.is() ) + { + Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); + aValue >>= xLayoutManager; + } + + if ( xLayoutManager.is() ) + { + rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); + + if ( bOn ) + xLayoutManager->showElement( aMenuBarURL ); + else + xLayoutManager->hideElement( aMenuBarURL ); + } +} + +BOOL SfxFrame::IsMenuBarOn_Impl() const +{ + return pImp->bMenuBarOn; +} + +void SfxFrame::PositionWindow_Impl( const Rectangle& rWinArea ) const +{ + Window *pWin = pImp->pExternalContainerWindow; + + // Groesse setzen + const Size aAppWindow( pImp->pExternalContainerWindow->GetDesktopRectPixel().GetSize() ); + Point aPos( rWinArea.TopLeft() ); + Size aSz( rWinArea.GetSize() ); + if ( aSz.Width() && aSz.Height() ) + { + aPos.X() = Min(aPos.X(), + long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); + aPos.Y() = Min(aPos.Y(), + long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); + if ( aPos.X() + aSz.Width() < + aAppWindow.Width() + aSz.Width() / 2 && + aPos.Y() + aSz.Height() < + aAppWindow.Height() + aSz.Height() / 2 ) + { + pWin->SetPosPixel( aPos ); + pWin->SetOutputSizePixel( aSz ); + } + } +} + +void SfxFrame::PrepareForDoc_Impl( SfxObjectShell& i_rDoc ) +{ + const ::comphelper::NamedValueCollection aDocumentArgs( i_rDoc.GetModel()->getArgs() ); + + // hidden? + OSL_ENSURE( !pImp->bHidden, "when does this happen?" ); + pImp->bHidden = aDocumentArgs.getOrDefault( "Hidden", pImp->bHidden ); + + // update our descriptor + UpdateDescriptor( &i_rDoc ); + + // plugin mode + sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + if ( nPluginMode && ( nPluginMode != 2 ) ) + SetInPlace_Impl( TRUE ); +} + +bool SfxFrame::IsMarkedHidden_Impl() const +{ + return pImp->bHidden; +} diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index 088df6253f21..f30ed34f7846 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: frmload.cxx,v $ - * $Revision: 1.90 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -32,70 +29,85 @@ #include "precompiled_sfx2.hxx" #include "frmload.hxx" - -#include <framework/interaction.hxx> -#include <com/sun/star/frame/XLoadable.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include "objshimp.hxx" +#include "sfx2/app.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/docfilt.hxx" +#include "sfx2/doctempl.hxx" +#include "sfx2/fcontnr.hxx" +#include "sfx2/frame.hxx" +#include "sfx2/request.hxx" +#include "sfx2/sfx.hrc" +#include "sfx2/sfxsids.hrc" +#include "sfx2/sfxuno.hxx" +#include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" +#include "sfx2/viewfac.hxx" + +/** === begin UNO includes === **/ #include <com/sun/star/container/XContainerQuery.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/document/XTypeDetection.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX -#include <comphelper/processfactory.hxx> -#endif -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/io/XInputStream.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> -#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> -#include <com/sun/star/ucb/CommandAbortedException.hpp> -#include <com/sun/star/ucb/InteractiveAppException.hpp> -#include <com/sun/star/document/XTypeDetection.hpp> -#include <framework/interaction.hxx> - -#ifndef _TOOLKIT_UNOHLP_HXX -#include <toolkit/helper/vclunohelper.hxx> -#endif -#include <ucbhelper/simpleinteractionrequest.hxx> +#include <com/sun/star/task/XInteractionHandler2.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +/** === end UNO includes === **/ -#include <rtl/ustring.h> +#include <comphelper/interaction.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/sequenceashashmap.hxx> +#include <cppuhelper/exc_hlp.hxx> +#include <framework/interaction.hxx> #include <rtl/logfile.hxx> -#include <svl/itemset.hxx> -#include <vcl/window.hxx> +#include <rtl/ustring.h> +#include <sot/storinfo.hxx> +#include <svtools/ehdl.hxx> #include <svl/eitem.hxx> +#include <svl/itemset.hxx> +#include <unotools/moduleoptions.hxx> +#include <svtools/sfxecode.hxx> #include <svl/stritem.hxx> -#include <tools/urlobj.hxx> +#include <toolkit/helper/vclunohelper.hxx> +#include <tools/diagnose_ex.h> +#include <ucbhelper/simpleinteractionrequest.hxx> #include <vos/mutex.hxx> -#include <svtools/sfxecode.hxx> -#include <svtools/ehdl.hxx> -#include <sot/storinfo.hxx> -#include <comphelper/sequenceashashmap.hxx> -#include <comphelper/mediadescriptor.hxx> -#include <unotools/moduleoptions.hxx> - -#ifndef css -namespace css = ::com::sun::star; -#endif - -#include <sfx2/doctempl.hxx> -#include <sfx2/app.hxx> -#include <sfx2/request.hxx> -#include <sfx2/sfxsids.hrc> -#include <sfx2/dispatch.hxx> -#include <sfx2/sfxuno.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/topfrm.hxx> -#include <sfx2/frame.hxx> -#include <sfx2/docfac.hxx> -#include <sfx2/fcontnr.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/docfilt.hxx> -#include "sfx2/brokenpackageint.hxx" -#include "objshimp.hxx" -SfxFrameLoader_Impl::SfxFrameLoader_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& /*xFactory*/ ) +/** === begin UNO using === **/ +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::container::XContainerQuery; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::document::XTypeDetection; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XLoadable; +using ::com::sun::star::frame::XModel; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::task::XInteractionHandler; +using ::com::sun::star::task::XInteractionHandler2; +using ::com::sun::star::task::XInteractionRequest; +using ::com::sun::star::task::XStatusIndicator; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::util::XCloseable; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::frame::XController2; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XModel2; +/** === end UNO using === **/ + +SfxFrameLoader_Impl::SfxFrameLoader_Impl( const Reference< XMultiServiceFactory >& _rxFactory ) + :m_aContext( _rxFactory ) { } @@ -103,54 +115,46 @@ SfxFrameLoader_Impl::~SfxFrameLoader_Impl() { } -const SfxFilter* impl_detectFilterForURL(const ::rtl::OUString& sURL , - const css::uno::Sequence< css::beans::PropertyValue >& rArgs , - const SfxFilterMatcher& rMatcher) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_detectFilterForURL( const ::rtl::OUString& sURL, + const ::comphelper::NamedValueCollection& i_rDescriptor, const SfxFilterMatcher& rMatcher ) const { - static ::rtl::OUString SERVICENAME_TYPEDETECTION = ::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection"); - ::rtl::OUString sFilter; try { - if (!sURL.getLength()) + if ( !sURL.getLength() ) return 0; - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - if (!xSMGR.is()) - return 0; + Reference< XTypeDetection > xDetect( + m_aContext.createComponent( "com.sun.star.document.TypeDetection" ), + UNO_QUERY_THROW); - css::uno::Reference< css::document::XTypeDetection > xDetect( - xSMGR->createInstance(SERVICENAME_TYPEDETECTION), - css::uno::UNO_QUERY_THROW); - - ::comphelper::MediaDescriptor lOrgArgs(rArgs); - css::uno::Reference< css::task::XInteractionHandler > xInteraction = lOrgArgs.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER(), - css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::task::XStatusIndicator > xProgress = lOrgArgs.getUnpackedValueOrDefault( - ::comphelper::MediaDescriptor::PROP_STATUSINDICATOR(), - css::uno::Reference< css::task::XStatusIndicator >()); - - ::comphelper::SequenceAsHashMap lNewArgs; - lNewArgs[::comphelper::MediaDescriptor::PROP_URL()] <<= sURL; - if (xInteraction.is()) - lNewArgs[::comphelper::MediaDescriptor::PROP_INTERACTIONHANDLER()] <<= xInteraction; - if (xProgress.is()) - lNewArgs[::comphelper::MediaDescriptor::PROP_STATUSINDICATOR()] <<= xProgress; - - css::uno::Sequence< css::beans::PropertyValue > lDescr = lNewArgs.getAsConstPropertyValueList(); - ::rtl::OUString sType = xDetect->queryTypeByDescriptor(lDescr, sal_True); - if (sType.getLength()) + ::comphelper::NamedValueCollection aNewArgs; + aNewArgs.put( "URL", sURL ); + + if ( i_rDescriptor.has( "InteractionHandler" ) ) + aNewArgs.put( "InteractionHandler", i_rDescriptor.get( "InteractionHandler" ) ); + if ( i_rDescriptor.has( "StatusIndicator" ) ) + aNewArgs.put( "StatusIndicator", i_rDescriptor.get( "StatusIndicator" ) ); + + Sequence< PropertyValue > aQueryArgs( aNewArgs.getPropertyValues() ); + ::rtl::OUString sType = xDetect->queryTypeByDescriptor( aQueryArgs, sal_True ); + if ( sType.getLength() ) { - const SfxFilter* pFilter = rMatcher.GetFilter4EA(sType); - if (pFilter) + const SfxFilter* pFilter = rMatcher.GetFilter4EA( sType ); + if ( pFilter ) sFilter = pFilter->GetName(); } } - catch(const css::uno::RuntimeException& exRun) - { throw exRun; } - catch(const css::uno::Exception&) - { sFilter = ::rtl::OUString(); } + catch ( const RuntimeException& ) + { + throw; + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + sFilter = ::rtl::OUString(); + } const SfxFilter* pFilter = 0; if (sFilter.getLength()) @@ -158,453 +162,548 @@ const SfxFilter* impl_detectFilterForURL(const ::rtl::OUString& return pFilter; } -sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const css::uno::Sequence< css::beans::PropertyValue >& rArgs , - const css::uno::Reference< css::frame::XFrame >& rFrame ) - throw( css::uno::RuntimeException ) +// -------------------------------------------------------------------------------------------------------------------- +const SfxFilter* SfxFrameLoader_Impl::impl_getFilterFromServiceName_nothrow( const ::rtl::OUString& i_rServiceName ) const { - static ::rtl::OUString PROP_URL = ::rtl::OUString::createFromAscii("URL" ); - static ::rtl::OUString PROP_FILENAME = ::rtl::OUString::createFromAscii("FileName" ); - static ::rtl::OUString PROP_TYPENAME = ::rtl::OUString::createFromAscii("TypeName" ); - static ::rtl::OUString PROP_FILTERNAME = ::rtl::OUString::createFromAscii("FilterName" ); - static ::rtl::OUString PROP_MODEL = ::rtl::OUString::createFromAscii("Model" ); - static ::rtl::OUString PROP_DOCUMENTSERVICE = ::rtl::OUString::createFromAscii("DocumentService" ); - static ::rtl::OUString PROP_READONLY = ::rtl::OUString::createFromAscii("ReadOnly" ); - static ::rtl::OUString PROP_ASTEMPLATE = ::rtl::OUString::createFromAscii("AsTemplate" ); - static ::rtl::OUString PROP_INTERACTIONHANDLER = ::rtl::OUString::createFromAscii("InteractionHandler"); - - sal_Bool bLoadState = sal_False; - - // this methods assumes that the filter is detected before, usually by calling the detect() method below - ::vos::OGuard aGuard( Application::GetSolarMutex() ); + try + { + ::comphelper::NamedValueCollection aQuery; + aQuery.put( "DocumentService", i_rServiceName ); - RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); + const Reference< XContainerQuery > xQuery( + m_aContext.createComponent( "com.sun.star.document.FilterFactory" ), + UNO_QUERY_THROW ); - if ( !rFrame.is() ) - return sal_False; + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + const SfxFilterFlags nMust = SFX_FILTER_IMPORT; + const SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED; - ::comphelper::SequenceAsHashMap lDescriptor(rArgs); - String rURL = lDescriptor.getUnpackedValueOrDefault(PROP_URL , ::rtl::OUString() ); - String aTypeName = lDescriptor.getUnpackedValueOrDefault(PROP_TYPENAME , ::rtl::OUString() ); - aFilterName = lDescriptor.getUnpackedValueOrDefault(PROP_FILTERNAME , ::rtl::OUString() ); - String aServiceName = lDescriptor.getUnpackedValueOrDefault(PROP_DOCUMENTSERVICE , ::rtl::OUString() ); - css::uno::Reference< css::task::XInteractionHandler > xInteraction = lDescriptor.getUnpackedValueOrDefault(PROP_INTERACTIONHANDLER, css::uno::Reference< css::task::XInteractionHandler >()); - css::uno::Reference< css::frame::XModel > xModel = lDescriptor.getUnpackedValueOrDefault(PROP_MODEL , css::uno::Reference< css::frame::XModel >() ); + Reference < XEnumeration > xEnum( xQuery->createSubSetEnumerationByProperties( + aQuery.getNamedValues() ), UNO_SET_THROW ); + while ( xEnum->hasMoreElements() ) + { + ::comphelper::NamedValueCollection aType( xEnum->nextElement() ); + ::rtl::OUString sFilterName = aType.getOrDefault( "Name", ::rtl::OUString() ); + if ( !sFilterName.getLength() ) + continue; + + const SfxFilter* pFilter = rMatcher.GetFilter4FilterName( sFilterName ); + if ( !pFilter ) + continue; + + SfxFilterFlags nFlags = pFilter->GetFilterFlags(); + if ( ( ( nFlags & nMust ) == nMust ) + && ( ( nFlags & nDont ) == 0 ) + ) + { + return pFilter; + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + return NULL; +} - const SfxFilter* pFilter = NULL; - const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); +// -------------------------------------------------------------------------------------------------------------------- +::rtl::OUString SfxFrameLoader_Impl::impl_askForFilter_nothrow( const Reference< XInteractionHandler >& i_rxHandler, + const ::rtl::OUString& i_rDocumentURL ) const +{ + ENSURE_OR_THROW( i_rxHandler.is(), "invalid interaction handler" ); - /* special mode: use already loaded model ... - In such case no filter name will be selected and no URL will be given! - Such informations are not neccessary. We have to create a new view only - and call setComponent() at the corresponding frame. */ - if( !xModel.is() ) + ::rtl::OUString sFilterName; + try + { + ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( i_rDocumentURL ); + Reference< XInteractionRequest > xRequest ( pRequest ); + i_rxHandler->handle( xRequest ); + if( !pRequest->isAbort() ) + sFilterName = pRequest->getFilter(); + } + catch( const Exception& ) { + DBG_UNHANDLED_EXCEPTION(); + } - // get filter by its name directly ... - if( aFilterName.Len() ) - pFilter = rMatcher.GetFilter4FilterName( aFilterName ); + return sFilterName; +} - // or search the preferred filter for the detected type ... - if( !pFilter && aTypeName.Len() ) - pFilter = rMatcher.GetFilter4EA(aTypeName); +// -------------------------------------------------------------------------------------------------------------------- +namespace +{ + sal_Bool lcl_getDispatchResult( const SfxPoolItem* _pResult ) + { + if ( !_pResult ) + return sal_False; - // or use given document service for detection too! - if (!pFilter && aServiceName.Len()) - { - ::comphelper::SequenceAsHashMap lQuery; + // default must be set to true, because some return values + // cant be checked, but nonetheless indicate "success"! + sal_Bool bSuccess = sal_True; - if (aServiceName.Len()) - lQuery[::rtl::OUString::createFromAscii("DocumentService")] <<= ::rtl::OUString(aServiceName); + // On the other side some special slots return a boolean state, + // which can be set to FALSE. + SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, _pResult ); + if ( pItem ) + bSuccess = pItem->GetValue(); - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery > xQuery ( xServiceManager->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.document.FilterFactory" ) ), ::com::sun::star::uno::UNO_QUERY ); + return bSuccess; + } +} - SfxFilterFlags nMust = SFX_FILTER_IMPORT; - SfxFilterFlags nDont = SFX_FILTER_NOTINSTALLED; +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlotID, const Reference< XFrame >& i_rxFrame, + const bool i_bHidden ) +{ + SfxRequest aRequest( _nSlotID, SFX_CALLMODE_SYNCHRON, SFX_APP()->GetPool() ); + aRequest.AppendItem( SfxUnoFrameItem( SID_FILLFRAME, i_rxFrame ) ); + if ( i_bHidden ) + aRequest.AppendItem( SfxBoolItem( SID_HIDDEN, TRUE ) ); + return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) ); +} - ::com::sun::star::uno::Reference < com::sun::star::container::XEnumeration > xEnum = xQuery->createSubSetEnumerationByProperties(lQuery.getAsConstNamedValueList()); - while ( xEnum->hasMoreElements() ) - { - ::comphelper::SequenceAsHashMap aType( xEnum->nextElement() ); - aFilterName = aType.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("Name"), ::rtl::OUString()); - if (!aFilterName.Len()) - continue; - pFilter = rMatcher.GetFilter4FilterName(aFilterName); - if (!pFilter) - continue; - SfxFilterFlags nFlags = pFilter->GetFilterFlags(); - if ( - ((nFlags & nMust) == nMust) && - (!(nFlags & nDont )) - ) - { - break; - } - pFilter = 0; //! in case we reach end of enumeration we must have a valid value ... - } - } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const +{ + const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False ); + if ( !bHidden ) + return; + + const SfxViewFrame* pExistingViewFrame = SfxViewFrame::GetFirst( &i_rDocument ); + if ( pExistingViewFrame ) + return; + + // the document is to be loaded hidden, and it is not yet displayed in any other frame + // To prevent it from being closed when the loader returns, increase its OwnerLock + // (the OwnerLock is normally increased by every frame in which the document is displayed, and by this loader) + i_rDocument.RestoreNoDelete(); + i_rDocument.OwnerLock( TRUE ); + i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE; +} - // or use interaction to ask user for right filter. - if ( !pFilter && xInteraction.is() && rURL.Len() ) - { - ::framework::RequestFilterSelect* pRequest = new ::framework::RequestFilterSelect( rURL ); - css::uno::Reference< css::task::XInteractionRequest > xRequest ( pRequest ); - xInteraction->handle( xRequest ); - if( !pRequest->isAbort() ) - { - aFilterName = pRequest->getFilter(); - pFilter = rMatcher.GetFilter4FilterName( aFilterName ); - } - } +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const +{ + const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + const ::rtl::OUString sTypeName = io_rDescriptor.getOrDefault( "TypeName", ::rtl::OUString() ); + const ::rtl::OUString sFilterName = io_rDescriptor.getOrDefault( "FilterName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const Reference< XInteractionHandler > + xInteraction = io_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); - if( !pFilter ) - return sal_False; + const SfxFilterMatcher& rMatcher = SFX_APP()->GetFilterMatcher(); + const SfxFilter* pFilter = NULL; + + // get filter by its name directly ... + if ( sFilterName.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sFilterName ); - aTypeName = pFilter->GetTypeName(); - // use filter names without prefix - aFilterName = pFilter->GetFilterName(); + // or search the preferred filter for the detected type ... + if ( !pFilter && sTypeName.getLength() ) + pFilter = rMatcher.GetFilter4EA( sTypeName ); + + // or use given document service for detection, too + if ( !pFilter && sServiceName.getLength() ) + pFilter = impl_getFilterFromServiceName_nothrow( sServiceName ); + + // or use interaction to ask user for right filter. + if ( !pFilter && xInteraction.is() && sURL.getLength() ) + { + ::rtl::OUString sSelectedFilter = impl_askForFilter_nothrow( xInteraction, sURL ); + if ( sSelectedFilter.getLength() ) + pFilter = rMatcher.GetFilter4FilterName( sSelectedFilter ); + } + + if ( pFilter ) + { + io_rDescriptor.put( "FilterName", ::rtl::OUString( pFilter->GetFilterName() ) ); // If detected filter indicates using of an own template format - // add property "AsTemplate" to descriptor. But supress this step + // add property "AsTemplate" to descriptor. But suppress this step // if such property already exists. - if( pFilter->IsOwnTemplateFormat()) + if ( pFilter->IsOwnTemplateFormat() && !io_rDescriptor.has( "AsTemplate" ) ) + io_rDescriptor.put( "AsTemplate", sal_Bool( sal_True ) ); + + // The DocumentService property will finally be used to determine the document type to create, so + // override it with the service name as indicated by the found filter. + io_rDescriptor.put( "DocumentService", ::rtl::OUString( pFilter->GetServiceName() ) ); + } +} + +// -------------------------------------------------------------------------------------------------------------------- +SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const +{ + for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) + { + if ( i_rxDocument == pDoc->GetModel() ) { - ::comphelper::SequenceAsHashMap::iterator pIt = lDescriptor.find(PROP_ASTEMPLATE); - if (pIt == lDescriptor.end()) - lDescriptor[PROP_ASTEMPLATE] <<= sal_True; + return pDoc; } } - xFrame = rFrame; + DBG_ERROR( "SfxFrameLoader_Impl::impl_findObjectShell: model is not based on SfxObjectShell - wrong frame loader usage!" ); + return NULL; +} - // Achtung: beim Abraeumen der Objekte kann die SfxApp destruiert werden, vorher noch Deinitialize_Impl rufen - SfxApplication* pApp = SFX_APP(); +// -------------------------------------------------------------------------------------------------------------------- +bool SfxFrameLoader_Impl::impl_determineTemplateDocument( ::comphelper::NamedValueCollection& io_rDescriptor ) const +{ + const ::rtl::OUString sTemplateRegioName = io_rDescriptor.getOrDefault( "TemplateRegionName", ::rtl::OUString() ); + const ::rtl::OUString sTemplateName = io_rDescriptor.getOrDefault( "TemplateName", ::rtl::OUString() ); + const ::rtl::OUString sServiceName = io_rDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + const ::rtl::OUString sURL = io_rDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + + // determine the full URL of the template to use, if any + String sTemplateURL; + if ( sTemplateRegioName.getLength() && sTemplateName.getLength() ) + { + SfxDocumentTemplates aTmpFac; + aTmpFac.GetFull( sTemplateRegioName, sTemplateName, sTemplateURL ); + } + else + { + if ( sServiceName.getLength() ) + sTemplateURL = SfxObjectFactory::GetStandardTemplate( sServiceName ); + else + sTemplateURL = SfxObjectFactory::GetStandardTemplate( SfxObjectShell::GetServiceNameFromFactory( sURL ) ); + } - // Attention! Because lDescriptor is a copy of rArgs - // and was might by changed (e.g. for AsTemplate) - // move all changes there back! - SfxAllItemSet aSet( pApp->GetPool() ); - TransformParameters( SID_OPENDOC, lDescriptor.getAsConstPropertyValueList(), aSet ); + if ( sTemplateURL.Len() > 0 ) + { + // detect the filter for the template. Might still be NULL (if the template is broken, or does not + // exist, or some such), but this is handled by our caller the same way as if no template/URL was present. + const SfxFilter* pTemplateFilter = impl_detectFilterForURL( sTemplateURL, io_rDescriptor, SFX_APP()->GetFilterMatcher() ); + if ( pTemplateFilter ) + { + // load the template document, but, well, "as template" + io_rDescriptor.put( "FilterName", ::rtl::OUString( pTemplateFilter->GetName() ) ); + io_rDescriptor.put( "FileName", ::rtl::OUString( sTemplateURL ) ); + io_rDescriptor.put( "AsTemplate", sal_True ); - SFX_ITEMSET_ARG( &aSet, pRefererItem, SfxStringItem, SID_REFERER, FALSE ); - if ( !pRefererItem ) - aSet.Put( SfxStringItem( SID_REFERER, String() ) ); + // #i21583# + // the DocumentService property will finally be used to create the document. Thus, override any possibly + // present value with the document service of the template. + io_rDescriptor.put( "DocumentService", ::rtl::OUString( pTemplateFilter->GetServiceName() ) ); + return true; + } + } + return false; +} - SfxFrame* pFrame=0; - for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) +// -------------------------------------------------------------------------------------------------------------------- +USHORT SfxFrameLoader_Impl::impl_findSlotParam( const ::rtl::OUString& i_rFactoryURL ) const +{ + ::rtl::OUString sSlotParam; + const sal_Int32 nParamPos = i_rFactoryURL.indexOf( '?' ); + if ( nParamPos >= 0 ) { - if ( pFrame->GetFrameInterface() == xFrame ) - break; + // currently only the "slot" parameter is supported + const sal_Int32 nSlotPos = i_rFactoryURL.indexOfAsciiL( RTL_CONSTASCII_STRINGPARAM( "slot=" ), nParamPos ); + if ( nSlotPos > 0 ) + sSlotParam = i_rFactoryURL.copy( nSlotPos + 5 ); } - BOOL bFrameCreated = FALSE; - if ( !pFrame ) + if ( sSlotParam.getLength() ) + return USHORT( sSlotParam.toInt32() ); + + return 0; +} + +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_handleCaughtError_nothrow( const Any& i_rCaughtError, const ::comphelper::NamedValueCollection& i_rDescriptor ) const +{ + try { - pFrame = SfxTopFrame::Create( rFrame ); - bFrameCreated = TRUE; + const Reference< XInteractionHandler > xInteraction = + i_rDescriptor.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ); + if ( !xInteraction.is() ) + return; + ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( i_rCaughtError ) ); + ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove ); + pRequest->addContinuation( pApprove.get() ); + + const Reference< XInteractionHandler2 > xHandler( xInteraction, UNO_QUERY ); + #if OSL_DEBUG_LEVEL > 0 + const sal_Bool bHandled = + #endif + xHandler.is() && xHandler->handleInteractionRequest( pRequest.get() ); + + #if OSL_DEBUG_LEVEL > 0 + if ( !bHandled ) + // the interaction handler couldn't deal with this error + // => report it as assertion, at least (done in the DBG_UNHANDLED_EXCEPTION below) + ::cppu::throwException( i_rCaughtError ); + #endif } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } +} + +// -------------------------------------------------------------------------------------------------------------------- +void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCollection& io_rDescriptor ) +{ + // remove the arguments which are for the loader only, and not for a call to attachResource + io_rDescriptor.remove( "StatusIndicator" ); + io_rDescriptor.remove( "Model" ); +} - if ( xModel.is() ) +// -------------------------------------------------------------------------------------------------------------------- +::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ) +{ + const sal_Char* pKnownViewArgs[] = { + "JumpMark" + }; + + ::comphelper::NamedValueCollection aViewArgs; + for ( size_t i=0; i < sizeof( pKnownViewArgs ) / sizeof( pKnownViewArgs[0] ); ++i ) { - // !TODO: replace by ViewFactory - if ( pFrame->GetFrameInterface()->getController().is() ) + if ( io_rDescriptor.has( pKnownViewArgs[i] ) ) { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - pFrame->GetFrameInterface()->setComponent( 0, 0 ); - if ( !bFrameCreated ) - pFrame = SfxTopFrame::Create( rFrame ); + aViewArgs.put( pKnownViewArgs[i], io_rDescriptor.get( pKnownViewArgs[i] ) ); + io_rDescriptor.remove( pKnownViewArgs[i] ); } + } + return aViewArgs; +} - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - - for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) ) +// -------------------------------------------------------------------------------------------------------------------- +sal_Int16 SfxFrameLoader_Impl::impl_determineEffectiveViewId_nothrow( const SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) +{ + sal_Int16 nViewId = i_rDescriptor.getOrDefault( "ViewId", sal_Int16( 0 ) ); + try + { + if ( nViewId == 0 ) do { - if ( xModel == pDoc->GetModel() ) - { - pFrame->SetItemSet_Impl( &aSet ); - ::comphelper::SequenceAsHashMap lUpdateDescr( lDescriptor ); - lUpdateDescr.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ) ); - lUpdateDescr.erase( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ); - - xModel->attachResource( rURL, lUpdateDescr.getAsConstPropertyValueList() ); - return pFrame->InsertDocument( pDoc ); - } + 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; + + // somewhat weird convention here ... in the view data, the ViewId is a string, effectively describing + // a view name. In the document load descriptor, the ViewId is in fact the numeric ID. + + SfxViewFactory* pViewFactory = i_rDocument.GetFactory().GetViewFactoryByViewName( sViewId ); + if ( pViewFactory ) + nViewId = sal_Int16( pViewFactory->GetOrdinal() ); } - - DBG_ERROR("Model is not based on SfxObjectShell - wrong frame loader use!"); - return sal_False; + while ( false ); } - - // check for the URL pattern of our factory URLs - SfxFrameWeak wFrame = pFrame; - String aPrefix = String::CreateFromAscii( "private:factory/" ); - String aFact( rURL ); - if ( aPrefix.Len() == aFact.Match( aPrefix ) ) + catch( const Exception& ) { - if ( !aServiceName.Len() ) - aServiceName = SfxObjectShell::GetServiceNameFromFactory( rURL ); + DBG_UNHANDLED_EXCEPTION(); + } - // it's a factory URL - aFact.Erase( 0, aPrefix.Len() ); + if ( nViewId == 0 ) + nViewId = i_rDocument.GetFactory().GetViewFactory( 0 ).GetOrdinal(); + return nViewId; +} - // look for parameters - String aParam; - USHORT nPos = aFact.Search( '?' ); - if ( nPos != STRING_NOTFOUND ) - { - // currently only the "slot" parameter is supported - USHORT nParamPos = aFact.Search( String::CreateFromAscii("slot="), nPos ); - if ( nParamPos != STRING_NOTFOUND ) - aParam = aFact.Copy( nParamPos+5, aFact.Len() ); - aFact.Erase( nPos, aFact.Len() ); - } +// -------------------------------------------------------------------------------------------------------------------- +Reference< XController2 > SfxFrameLoader_Impl::impl_createDocumentView( const Reference< XModel2 >& i_rModel, + const Reference< XFrame >& i_rFrame, const ::comphelper::NamedValueCollection& i_rViewFactoryArgs, + const ::rtl::OUString& i_rViewName ) +{ + // let the model create a new controller + const Reference< XController2 > xController( i_rModel->createViewController( + i_rViewName, + i_rViewFactoryArgs.getPropertyValues(), + i_rFrame + ), UNO_SET_THROW ); + + // introduce model/view/controller to each other + xController->attachModel( i_rModel.get() ); + i_rModel->connectController( xController.get() ); + i_rFrame->setComponent( xController->getComponentWindow(), xController.get() ); + xController->attachFrame( i_rFrame ); + i_rModel->setCurrentController( xController.get() ); + + return xController; +} - WildCard aSearchedFac( aFact.EraseAllChars('4').ToUpperAscii() ); - SFX_ITEMSET_ARG( &aSet, pDocumentTitleItem, SfxStringItem, SID_DOCINFO_TITLE, FALSE ); - INetURLObject aObj( rURL ); +// -------------------------------------------------------------------------------------------------------------------- +sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rArgs, + const Reference< XFrame >& _rTargetFrame ) + throw( RuntimeException ) +{ + ENSURE_OR_THROW( _rTargetFrame.is(), "illegal NULL frame" ); - if ( aParam.Len() ) - { - sal_uInt16 nSlotId = (sal_uInt16) aParam.ToInt32(); - SfxRequest aReq( nSlotId, SFX_CALLMODE_SYNCHRON, pApp->GetPool() ); - aReq.AppendItem( SfxFrameItem ( SID_DOCFRAME, pFrame ) ); - const SfxPoolItem* pRet = pApp->ExecuteSlot( aReq ); - if ( pRet ) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; - - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) - { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - } + RTL_LOGFILE_CONTEXT( aLog, "sfx2 (mb93783) ::SfxFrameLoader::load" ); - xFrame.clear(); - xListener.clear(); - return bLoadState; - } + ::comphelper::NamedValueCollection aDescriptor( rArgs ); - String sTemplateURL; - SFX_ITEMSET_ARG( &aSet, pTemplateRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, FALSE ); - SFX_ITEMSET_ARG( &aSet, pTemplateNameItem, SfxStringItem, SID_TEMPLATE_NAME, FALSE ); - if ( pTemplateRegionItem && pTemplateNameItem ) - { - SfxDocumentTemplates aTmpFac; - aTmpFac.GetFull( pTemplateRegionItem->GetValue(), pTemplateNameItem->GetValue(), sTemplateURL ); - } - else + // ensure the descriptor contains a referrer + if ( !aDescriptor.has( "Referer" ) ) + aDescriptor.put( "Referer", ::rtl::OUString() ); + + // TODO: is this needed? finally, when loading is successfull, then there should be no need for this item, + // as the document can always obtain its frame. In particular, there might be situations where this frame + // is accessed, but already disposed: Imagine the user loading a document, opening a second view on it, and + // then closing the first view/frame. + aDescriptor.put( "Frame", _rTargetFrame ); + + // did the caller already pass a model? + Reference< XModel2 > xModel = aDescriptor.getOrDefault( "Model", Reference< XModel2 >() ); + const bool bExternalModel = xModel.is(); + + // check for factory URLs to create a new doc, instead of loading one + const ::rtl::OUString sURL = aDescriptor.getOrDefault( "URL", ::rtl::OUString() ); + const bool bIsFactoryURL = ( sURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( "private:factory/" ) ) == 0 ); + bool bInitNewModel = bIsFactoryURL; + if ( bIsFactoryURL && !bExternalModel ) + { + const ::rtl::OUString sFactory = sURL.copy( sizeof( "private:factory/" ) -1 ); + // special handling for some weird factory URLs a la private:factory/swriter?slot=21053 + const USHORT nSlotParam = impl_findSlotParam( sFactory ); + if ( nSlotParam != 0 ) { - sTemplateURL = SfxObjectFactory::GetStandardTemplate( aServiceName ); + return impl_createNewDocWithSlotParam( nSlotParam, _rTargetFrame, aDescriptor.getOrDefault( "Hidden", false ) ); } - BOOL bUseTemplate = (sTemplateURL.Len()>0); - if( bUseTemplate ) + const bool bDescribesValidTemplate = impl_determineTemplateDocument( aDescriptor ); + if ( bDescribesValidTemplate ) { - // #i21583# - // Forget the filter, which was detected for the corresponding "private:factory/xxx" URL. - // We must use the right filter, matching to this document ... not to the private URL! - const SfxFilter* pTemplateFilter = impl_detectFilterForURL(sTemplateURL, rArgs, rMatcher); - if (pTemplateFilter) - { - pFilter = pTemplateFilter; - aFilterName = pTemplateFilter->GetName(); - // standard template set -> load it "AsTemplate" - aSet.Put( SfxStringItem ( SID_FILE_NAME, sTemplateURL ) ); - aSet.Put( SfxBoolItem( SID_TEMPLATE, sal_True ) ); - } - - // #119268# - // something is wrong with the set default template (e.g. unknown format, missing file etcpp) - // The we have to jump into the following special code, where "private:factory/ URL's are handled. - // We cant "load" such private/factory URL's! - else - bUseTemplate = FALSE; + // if the media descriptor allowed us to determine a template document to create the new document + // from, then do not init a new document model from scratch (below), but instead load the + // template document + bInitNewModel = false; } - - if ( !bUseTemplate ) + else { - // execute "NewDocument" request - /* Attention! - #107913# - Pointers can't be used to check if two objects are equals! - E.g. the memory manager can reuse freed memory ... - and then the holded copy of a pointer will point to another - (and different!) object - may using the same type then before. - In such case we compare one object with itself ... - */ - SfxRequest aReq( SID_NEWDOCDIRECT, SFX_CALLMODE_SYNCHRON, aSet ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aReq.AppendItem( SfxStringItem( SID_NEWDOCDIRECT, aFact ) ); - - if ( pDocumentTitleItem ) - aReq.AppendItem( *pDocumentTitleItem ); - - const SfxPoolItem* pRet = pApp->NewDocDirectExec_ImplOld(aReq); - if (pRet) - { - // default must be set to true, because some return values - // cant be checked ... but indicates "success"! - bLoadState = sal_True; - - // On the other side some special slots return a boolean state, - // which can be set to FALSE. - SfxBoolItem *pItem = PTR_CAST( SfxBoolItem, pRet ); - if (pItem) - bLoadState = pItem->GetValue(); - } - else - bLoadState = sal_False; - - if ( !bLoadState && bFrameCreated && wFrame && !wFrame->GetCurrentDocument() ) - { - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - } - - xFrame.clear(); - xListener.clear(); - return bLoadState; + const ::rtl::OUString sServiceName = SfxObjectShell::GetServiceNameFromFactory( sFactory ); + aDescriptor.put( "DocumentService", sServiceName ); } } else { - // load the desired file - aSet.Put( SfxStringItem ( SID_FILE_NAME, rURL ) ); + // compatibility + aDescriptor.put( "FileName", aDescriptor.get( "URL" ) ); } - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - aSet.Put( SfxUnoAnyItem( SID_FILLFRAME, css::uno::makeAny(xFrame) ) ); - aSet.Put( SfxStringItem( SID_FILTER_NAME, aFilterName ) ); - - // !TODO: replace by direct construction of model (needs view factory) - DBG_ASSERT( pFilter, "No filter set!" ); - if ( !pFilter ) - return sal_False; - - sal_Bool bDisaster = sal_False; - SfxObjectShell* pDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName() ); - if ( pDoc ) + sal_Bool bLoadSuccess = sal_False; + try { - css::uno::Reference< css::frame::XLoadable > xLoadable = css::uno::Reference< css::frame::XLoadable >( pDoc->GetModel(), css::uno::UNO_QUERY ); - css::uno::Sequence < css::beans::PropertyValue > aLoadArgs; - TransformItems( SID_OPENDOC, aSet, aLoadArgs ); - try + // extract view releant arguments from the loader args + ::comphelper::NamedValueCollection aViewCreationArgs( impl_extractViewCreationArgs( aDescriptor ) ); + + // no model passed from outside? => create one from scratch + if ( !xModel.is() ) { - xLoadable->load( aLoadArgs ); - - SfxMedium* pDocMedium = pDoc->GetMedium(); - BOOL bHidden = FALSE; - SFX_ITEMSET_ARG( pDocMedium->GetItemSet(), pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - if ( pHidItem ) - bHidden = pHidItem->GetValue(); - - // !TODO: will be done by Framework! - pDocMedium->SetUpdatePickList( !bHidden ); - - /* - #121119# - We dont know why pFrame can be corrupt here. - But if it was deleted it shouldnt exists inside our global list. - May be we can use the damaged pointer to detect if it was removed from - this global list. - */ - SfxFrame* pTmp=0; - for ( pTmp = SfxFrame::GetFirst(); pTmp; pTmp = SfxFrame::GetNext( *pTmp ) ) + // beforehand, determine the filter to use, and update the descriptor with its information + if ( !bInitNewModel ) { - if ( pFrame == pTmp ) - break; + impl_determineFilter( aDescriptor ); } - if ( pTmp == pFrame ) + // create the new doc + const ::rtl::OUString sServiceName = aDescriptor.getOrDefault( "DocumentService", ::rtl::OUString() ); + xModel.set( m_aContext.createComponent( sServiceName ), UNO_QUERY_THROW ); + + // load resp. init it + const Reference< XLoadable > xLoadable( xModel, UNO_QUERY_THROW ); + if ( bInitNewModel ) { - // !TODO: replace by ViewFactory - if ( pFrame->GetFrameInterface()->getController().is() ) - { - // remove old component - // if a frame was created already, it can't be an SfxComponent! - // pFrame->GetFrameInterface()->setComponent( 0, 0 ); - if ( !bFrameCreated ) - pFrame = SfxTopFrame::Create( rFrame ); - } - - wFrame = pFrame; - aSet.Put( SfxFrameItem( SID_DOCFRAME, pFrame ) ); - if( pFrame->InsertDocument( pDoc ) ) - { - pFrame->GetCurrentViewFrame()->UpdateDocument_Impl(); - String aURL = pDoc->GetMedium()->GetName(); - SFX_APP()->Broadcast( SfxStringHint( SID_OPENURL, aURL ) ); - bLoadState = sal_True; - } - else - bDisaster = sal_True; + xLoadable->initNew(); + + impl_removeLoaderArguments( aDescriptor ); + xModel->attachResource( ::rtl::OUString(), aDescriptor.getPropertyValues() ); } else { - DBG_ERROR("#121119# You found the reason for a stacktrace! Frame destroyed while loading document."); - bLoadState = sal_False; + xLoadable->load( aDescriptor.getPropertyValues() ); } } - catch ( css::uno::Exception& ) + else { - bDisaster = sal_True; + // tell the doc its (current) load args. + impl_removeLoaderArguments( aDescriptor ); + xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() ); + // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could + // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs) + // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document + // might have a mode other than the one passed to the loader, and we always overwrite the former with + // the latter. } - if ( bDisaster ) - { - if ( wFrame && !wFrame->GetCurrentDocument() ) - { - // document loading was not successful; close SfxFrame (but not XFrame!) - css::uno::Reference< css::frame::XFrame > axFrame; - wFrame->SetFrameInterface_Impl( axFrame ); - wFrame->DoClose(); - aSet.ClearItem( SID_DOCFRAME ); - } + // get the SfxObjectShell (still needed at the moment) + const SfxObjectShellLock xDoc = impl_findObjectShell( xModel ); + ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" ); + + // ensure the ID of the to-be-created view is in the descriptor, if possible + const sal_Int16 nViewId = impl_determineEffectiveViewId_nothrow( *xDoc, aDescriptor ); + const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 ); + const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetViewName() ); + + // if the document is created hidden, prevent it from being deleted until it is shown or disposed + impl_lockHiddenDocument( *xDoc, aDescriptor ); + // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef, + // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter + // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the + // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature + // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the + // code at the very end of this method cares for closing the XModel, which should also close the + // ObjectShell. + + // plug the document into the frame + impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName ); + bLoadSuccess = sal_True; + } + catch ( Exception& ) + { + const Any aError( ::cppu::getCaughtException() ); + if ( !aDescriptor.getOrDefault( "Silent", sal_False ) ) + impl_handleCaughtError_nothrow( aError, aDescriptor ); + } - css::uno::Reference< css::util::XCloseable > xCloseable( xLoadable, css::uno::UNO_QUERY ); - if ( xCloseable.is() ) - { - try { - xCloseable->close( sal_True ); - } catch ( css::uno::Exception& ) - {} - } + // if loading was not successful, close the document + if ( !bLoadSuccess && !bExternalModel ) + { + try + { + const Reference< XCloseable > xCloseable( xModel, UNO_QUERY_THROW ); + xCloseable->close( sal_True ); + } + catch ( Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); } } - xFrame.clear(); - xListener.clear(); - return bLoadState; + return bLoadSuccess; } -void SfxFrameLoader_Impl::cancel() throw( RUNTIME_EXCEPTION ) +void SfxFrameLoader_Impl::cancel() throw( RuntimeException ) { } SFX_IMPL_SINGLEFACTORY( SfxFrameLoader_Impl ) /* XServiceInfo */ -UNOOUSTRING SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( UNORUNTIMEEXCEPTION ) +UNOOUSTRING SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( RuntimeException ) { return impl_getStaticImplementationName(); } \ /* XServiceInfo */ -sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServiceName ) throw( UNORUNTIMEEXCEPTION ) +sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServiceName ) throw( RuntimeException ) { UNOSEQUENCE< UNOOUSTRING > seqServiceNames = getSupportedServiceNames(); const UNOOUSTRING* pArray = seqServiceNames.getConstArray(); @@ -619,7 +718,7 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const UNOOUSTRING& sServ } /* XServiceInfo */ -UNOSEQUENCE< UNOOUSTRING > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( UNORUNTIMEEXCEPTION ) +UNOSEQUENCE< UNOOUSTRING > SAL_CALL SfxFrameLoader_Impl::getSupportedServiceNames() throw( RuntimeException ) { return impl_getStaticSupportedServiceNames(); } diff --git a/sfx2/source/view/impframe.cxx b/sfx2/source/view/impframe.cxx deleted file mode 100644 index c81b48b20aa2..000000000000 --- a/sfx2/source/view/impframe.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: impframe.cxx,v $ - * $Revision: 1.9 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" - -#ifndef GCC -#endif - -#include "impframe.hxx" - -#include <svl/smplhint.hxx> - -#include <sfx2/frame.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/viewfrm.hxx> - -void SfxFrame_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) -{ - SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint ); - if( pHint && pHint->GetId() == SFX_HINT_CANCELLABLE && pCurrentViewFrame ) - { - // vom Cancel-Manager - SfxBindings &rBind = pCurrentViewFrame->GetBindings(); - rBind.Invalidate( SID_BROWSE_STOP ); - if ( !rBind.IsInRegistrations() ) - rBind.Update( SID_BROWSE_STOP ); - rBind.Invalidate( SID_BROWSE_STOP ); - } -} - diff --git a/sfx2/source/view/impframe.hxx b/sfx2/source/view/impframe.hxx index d0b83ad619af..72f322036efb 100644 --- a/sfx2/source/view/impframe.hxx +++ b/sfx2/source/view/impframe.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: impframe.hxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,8 +28,6 @@ #ifndef _SFX_IMPFRAME_HXX #define _SFX_IMPFRAME_HXX -#include <svl/cancel.hxx> - #include <sfx2/frame.hxx> #include <sfx2/viewfrm.hxx> // SvBorder @@ -54,60 +49,51 @@ class SfxObjectShell; #define FRAME_SEARCH_CREATE 0x00000008 #endif -class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase, public SfxListener +class SfxFrame_Impl : public SfxBroadcaster, public SvCompatWeakBase { -friend class SfxFrame; - +public: ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame; - String aFrameIdName; sal_uInt32 nType; - sal_uInt32 nHistoryPos; SfxViewFrame* pCurrentViewFrame; - SfxObjectShell* pCurrentObjectShell; SfxFrameDescriptor* pDescr; - sal_uInt16 nFrameId; sal_uInt16 nLocks; - sal_Bool bCloseOnUnlock : 1; sal_Bool bClosing : 1; sal_Bool bPrepClosing : 1; sal_Bool bInCancelTransfers : 1; sal_Bool bOwnsBindings : 1; sal_Bool bReleasingComponent : 1; - sal_Bool bFocusLocked : 1; sal_Bool bInPlace : 1; - SfxCancelManager* pCancelMgr; - SfxCancellable* pLoadCancellable; SfxFrame* pFrame; - const SfxItemSet* pSet; SfxWorkWindow* pWorkWin; SvBorder aBorder; + // formerly SfxTopFrame + Window* pExternalContainerWindow; + bool bHidden; + bool bLockResize; + bool bMenuBarOn; - SfxFrame_Impl( SfxFrame* pAntiImplP ) : - SvCompatWeakBase( pAntiImplP ), - nType( 0L ), - nHistoryPos( 0 ), - pCurrentViewFrame( NULL ), - pCurrentObjectShell( NULL ), - pDescr( NULL ), - nFrameId( 0 ), - nLocks( 0 ), - bCloseOnUnlock( sal_False ), - bClosing(sal_False), - bPrepClosing(sal_False), - bInCancelTransfers( sal_False ), - bOwnsBindings( sal_False ), - bReleasingComponent( sal_False ), - bFocusLocked( sal_False ), - bInPlace( sal_False ), - pCancelMgr( 0 ), - pLoadCancellable( 0 ), - pFrame( pAntiImplP ), - pSet( 0 ), - pWorkWin( 0 ) - {} + SfxFrame_Impl( SfxFrame* pAntiImplP ) + :SvCompatWeakBase( pAntiImplP ) + ,nType( 0L ) + ,pCurrentViewFrame( NULL ) + ,pDescr( NULL ) + ,nLocks( 0 ) + ,bClosing(sal_False) + ,bPrepClosing(sal_False) + ,bInCancelTransfers( sal_False ) + ,bOwnsBindings( sal_False ) + ,bReleasingComponent( sal_False ) + ,bInPlace( sal_False ) + ,pFrame( pAntiImplP ) + ,pWorkWin( 0 ) + ,pExternalContainerWindow( NULL ) + ,bHidden( false ) + ,bLockResize( false ) + ,bMenuBarOn( true ) + { + } - virtual ~SfxFrame_Impl() { delete pCancelMgr; delete pLoadCancellable; } - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual ~SfxFrame_Impl() { } }; #endif diff --git a/sfx2/source/view/impviewframe.hxx b/sfx2/source/view/impviewframe.hxx new file mode 100644 index 000000000000..5460d613c7e8 --- /dev/null +++ b/sfx2/source/view/impviewframe.hxx @@ -0,0 +1,94 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2009 by Sun Microsystems, Inc. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +************************************************************************/ + +#ifndef SFX2_IMPVIEWFRAME_HXX +#define SFX2_IMPVIEWFRAME_HXX + +#include "sfx2/viewfrm.hxx" + +#include <svtools/asynclink.hxx> +#include <vcl/window.hxx> + +struct SfxViewFrame_Impl +{ + SvBorder aBorder; + Size aMargin; + Size aSize; + String aFrameTitle; + TypeId aLastType; + String aActualURL; + SfxFrame& rFrame; + svtools::AsynchronLink* pReloader; + Window* pWindow; + SfxViewFrame* pActiveChild; + Window* pFocusWin; + sal_uInt16 nDocViewNo; + sal_uInt16 nCurViewId; + sal_Bool bResizeInToOut:1; + sal_Bool bDontOverwriteResizeInToOut:1; + sal_Bool bObjLocked:1; + sal_Bool bReloading:1; + sal_Bool bIsDowning:1; + sal_Bool bModal:1; + sal_Bool bEnabled:1; + sal_Bool bWindowWasEnabled:1; + sal_Bool bActive; + String aFactoryName; + + SfxViewFrame_Impl( SfxFrame& i_rFrame ) + : rFrame( i_rFrame ) + , pReloader(0 ) + , pWindow( 0 ) + , bWindowWasEnabled(sal_True) + , bActive( sal_False ) + { + } + + ~SfxViewFrame_Impl() + { + delete pReloader; + } +}; + +class SfxFrameViewWindow_Impl : public Window +{ + BOOL bActive; + SfxViewFrame* pFrame; + +public: + SfxFrameViewWindow_Impl( SfxViewFrame* p, Window& rParent, WinBits nBits=0 ) : + Window( &rParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), + bActive( FALSE ), + pFrame( p ) + { + p->GetFrame().GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); + } + + virtual void Resize(); + virtual void StateChanged( StateChangedType nStateChange ); +}; + +#endif // SFX2_IMPVIEWFRAME_HXX + diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 3e9989760b11..6d61f4182bbb 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: ipclient.cxx,v $ - * $Revision: 1.34 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -60,7 +57,7 @@ #include <sfx2/dispatch.hxx> #include "workwin.hxx" #include "guisaveas.hxx" -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include <cppuhelper/implbase5.hxx> #include <vcl/salbtype.hxx> #include <svtools/ehdl.hxx> @@ -204,7 +201,7 @@ throw (::com::sun::star::uno::RuntimeException) // currently needs SFX code SfxObjectShell* pDoc = reinterpret_cast< SfxObjectShell* >( sal::static_int_cast< sal_IntPtr >( nHandle )); SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDoc ); - SfxWorkWindow *pWorkWin = pFrame->GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow *pWorkWin = pFrame->GetFrame().GetWorkWindow_Impl(); pWorkWin->UpdateObjectBars_Impl(); } */ @@ -234,7 +231,7 @@ uno::Reference < frame::XFrame > SfxInPlaceClient_Impl::GetFrame() const { if ( !m_pClient ) throw uno::RuntimeException(); - return m_pClient->GetViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(); + return m_pClient->GetViewShell()->GetViewFrame()->GetFrame().GetFrameInterface(); } void SAL_CALL SfxInPlaceClient_Impl::saveObject() @@ -736,7 +733,7 @@ void SfxInPlaceClient::SetObject( const uno::Reference < embed::XEmbeddedObject } } - if ( !m_pViewSh || m_pViewSh->GetViewFrame()->GetFrame()->IsClosing_Impl() ) + if ( !m_pViewSh || m_pViewSh->GetViewFrame()->GetFrame().IsClosing_Impl() ) // sometimes applications reconnect clients on shutting down because it happens in their Paint methods return; @@ -986,7 +983,7 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) { if ( m_pViewSh ) - ((SfxTopFrame*)m_pViewSh->GetViewFrame()->GetTopFrame())->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(TRUE); try { m_pImp->m_xObject->setClientSite( m_pImp->m_xClient ); @@ -1036,8 +1033,8 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) if ( m_pViewSh ) { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); - ((SfxTopFrame*)pFrame->GetTopFrame())->LockResize_Impl(FALSE); - pFrame->GetTopFrame()->Resize(); + pFrame->GetTopFrame().LockResize_Impl(FALSE); + pFrame->GetTopFrame().Resize(); } } } @@ -1097,7 +1094,7 @@ void SfxInPlaceClient::DeactivateObject() } if ( m_pViewSh ) - ((SfxTopFrame*)m_pViewSh->GetViewFrame()->GetTopFrame())->LockResize_Impl(TRUE); + m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(TRUE); if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) { @@ -1119,8 +1116,8 @@ void SfxInPlaceClient::DeactivateObject() { SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); SfxViewFrame::SetViewFrame( pFrame ); - ((SfxTopFrame*)pFrame->GetTopFrame())->LockResize_Impl(FALSE); - pFrame->GetTopFrame()->Resize(); + pFrame->GetTopFrame().LockResize_Impl(FALSE); + pFrame->GetTopFrame().Resize(); } } catch (com::sun::star::uno::Exception& ) diff --git a/sfx2/source/view/makefile.mk b/sfx2/source/view/makefile.mk index 98d34215e097..9c257f4c9f75 100644 --- a/sfx2/source/view/makefile.mk +++ b/sfx2/source/view/makefile.mk @@ -2,14 +2,10 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2008 by Sun Microsystems, Inc. +# Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # -# $RCSfile: makefile.mk,v $ -# -# $Revision: 1.20 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,18 +45,17 @@ SRC1FILES = \ view.src SLOFILES = \ - $(SLO)$/ipclient.obj \ + $(SLO)$/ipclient.obj \ $(SLO)$/viewsh.obj \ $(SLO)$/frmload.obj \ $(SLO)$/frame.obj \ + $(SLO)$/frame2.obj \ $(SLO)$/printer.obj \ - $(SLO)$/prnmon.obj \ $(SLO)$/viewprn.obj \ $(SLO)$/viewfac.obj \ $(SLO)$/orgmgr.obj \ $(SLO)$/viewfrm.obj \ - $(SLO)$/impframe.obj \ - $(SLO)$/topfrm.obj \ + $(SLO)$/viewfrm2.obj \ $(SLO)$/sfxbasecontroller.obj \ $(SLO)$/userinputinterception.obj diff --git a/sfx2/source/view/orgmgr.cxx b/sfx2/source/view/orgmgr.cxx index 00568c394d23..6c92cd448adf 100644 --- a/sfx2/source/view/orgmgr.cxx +++ b/sfx2/source/view/orgmgr.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: orgmgr.cxx,v $ - * $Revision: 1.26 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx index 5944b7c0e9fd..310c1a58a578 100644 --- a/sfx2/source/view/printer.cxx +++ b/sfx2/source/view/printer.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: printer.cxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -546,14 +543,17 @@ SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent, // TabPage einh"angen pPage = pViewSh->CreatePrintOptionsPage( this, *pOptions ); DBG_ASSERT( pPage, "CreatePrintOptions != SFX_VIEW_HAS_PRINTOPTIONS" ); - pPage->Reset( *pOptions ); - SetHelpId( pPage->GetHelpId() ); - pPage->Show(); + if( pPage ) + { + pPage->Reset( *pOptions ); + SetHelpId( pPage->GetHelpId() ); + pPage->Show(); + } // Dialoggr"o\se bestimmen Size a6Sz = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); Size aBtnSz = LogicToPixel( Size( 50, 14 ), MAP_APPFONT ); - Size aOutSz( pPage->GetSizePixel() ); + Size aOutSz( pPage ? pPage->GetSizePixel() : Size() ); aOutSz.Height() += 6; long nWidth = aBtnSz.Width(); nWidth += a6Sz.Width(); @@ -589,6 +589,9 @@ SfxPrintOptionsDialog::~SfxPrintOptionsDialog() short SfxPrintOptionsDialog::Execute() { + if( ! pPage ) + return RET_CANCEL; + short nRet = ModalDialog::Execute(); if ( nRet == RET_OK ) pPage->FillItemSet( *pOptions ); diff --git a/sfx2/source/view/prnmon.cxx b/sfx2/source/view/prnmon.cxx deleted file mode 100644 index 3377fceff67f..000000000000 --- a/sfx2/source/view/prnmon.cxx +++ /dev/null @@ -1,496 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: prnmon.cxx,v $ - * $Revision: 1.25.46.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#include <com/sun/star/view/PrintableState.hpp> -#include <com/sun/star/util/XCloseable.hpp> -#include <com/sun/star/util/XCloseBroadcaster.hpp> -#include <com/sun/star/util/XCloseListener.hpp> -#include <com/sun/star/util/CloseVetoException.hpp> -#include <vcl/fixed.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/asynclink.hxx> - -#include <unotools/printwarningoptions.hxx> -#include <svl/eitem.hxx> - -#ifndef GCC -#endif - -#include <sfx2/prnmon.hxx> -#include <sfx2/viewsh.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/objsh.hxx> -#include <sfx2/docfile.hxx> -#include "sfxtypes.hxx" -#include <sfx2/progress.hxx> -#include <sfx2/bindings.hxx> -#include "sfx2/sfxresid.hxx" -#include <sfx2/event.hxx> -#include <sfx2/request.hxx> -#include <sfx2/app.hxx> - -#include "view.hrc" - -//------------------------------------------------------------------------ - -#define SFX_TITLE_MAXLEN_PRINTMONITOR 22 - -//------------------------------------------------------------------------ - -struct SfxPrintMonitor_Impl: public ModelessDialog -{ - - SfxPrintMonitor_Impl( Window *pParent, SfxViewShell *rpViewShell ); - virtual BOOL Close(); - - SfxViewShell* pViewShell; - FixedText aDocName; - FixedText aPrinting; - FixedText aPrinter; - FixedText aPrintInfo; - CancelButton aCancel; -}; - -//------------------------------------------------------------------------- - -struct SfxPrintProgress_Impl : public SfxListener -{ - SfxPrintMonitor_Impl* pMonitor; - SfxViewShell* pViewShell; - SfxPrinter* pPrinter; - SfxPrinter* pOldPrinter; - USHORT nLastPage; - BOOL bRunning; - BOOL bCancel; - BOOL bDeleteOnEndPrint; - BOOL bShow; - BOOL bCallbacks; - BOOL bOldEnablePrintFile; - BOOL bOldFlag; - BOOL bRestoreFlag; - BOOL bAborted; - svtools::AsynchronLink aDeleteLink; - Link aCancelHdl; - -private: - DECL_LINK( CancelHdl, Button * ); - DECL_STATIC_LINK( SfxPrintProgress_Impl, DeleteHdl, SfxPrintProgress * ); - -public: - SfxPrintProgress_Impl( SfxViewShell* pTheViewShell, SfxPrinter* pThePrinter ); - ~SfxPrintProgress_Impl(); - - void Delete( SfxPrintProgress* pAntiImpl ) { aDeleteLink.Call( pAntiImpl ); } - SfxViewShell* GetViewShell() const { return pViewShell; } - BOOL SetPage( USHORT nPage, const String &rPage ); - void CreateMonitor(); - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); -}; - -void SfxPrintProgress_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) -{ - SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); - if ( pPrintHint ) - { - if ( pPrintHint->GetWhich() == -2 ) - CancelHdl(0); - } -} - -//------------------------------------------------------------------------ - -SfxPrintMonitor_Impl::SfxPrintMonitor_Impl( Window* pParent, SfxViewShell* rpViewShell ) : - ModelessDialog( pParent, SfxResId( DLG_PRINTMONITOR ) ), - pViewShell ( rpViewShell ), - aDocName ( this, SfxResId( FT_DOCNAME ) ), - aPrinting ( this, SfxResId( FT_PRINTING ) ), - aPrinter ( this, SfxResId( FT_PRINTER ) ), - aPrintInfo ( this, SfxResId( FT_PRINTINFO ) ), - aCancel ( this, SfxResId( PB_CANCELPRNMON ) ) -{ - if( rpViewShell->GetPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) != 0 ) - { - String aPrep( SfxResId( STR_FT_PREPARATION ) ); - aPrinting.SetText( aPrep ); - aPrinter.Show( FALSE ); - } - FreeResource(); -} - -//------------------------------------------------------------------------ - -IMPL_STATIC_LINK_NOINSTANCE( SfxPrintProgress_Impl, DeleteHdl, SfxPrintProgress*, pAntiImpl ) -{ - delete pAntiImpl; - return 0; -} - -void actualizePrintCancelState(CancelButton& rButton, const SfxObjectShell* pShell) -{ - sal_Bool bEnableCancelButton = sal_True; - if (pShell) - bEnableCancelButton = pShell->Stamp_GetPrintCancelState(); - - if (!bEnableCancelButton) - rButton.Disable(); - else - rButton.Enable(); -} - -//------------------------------------------------------------------------ - -SfxPrintProgress_Impl::SfxPrintProgress_Impl( SfxViewShell* pTheViewShell, - SfxPrinter* pThePrinter ) : - - pMonitor ( 0 ), - pViewShell ( pTheViewShell ), - pPrinter ( pThePrinter ), - pOldPrinter ( NULL ), - nLastPage ( 0 ), - bRunning ( TRUE ), - bCancel ( FALSE ), - bDeleteOnEndPrint ( FALSE ), - bShow ( FALSE ), - bCallbacks ( FALSE ), - bOldEnablePrintFile ( FALSE ), - bOldFlag ( TRUE ), - bRestoreFlag ( FALSE ), - bAborted ( FALSE ), - aDeleteLink ( STATIC_LINK( this, SfxPrintProgress_Impl, DeleteHdl ) ) -{ - StartListening( *pViewShell->GetObjectShell() ); -} - -void SfxPrintProgress_Impl::CreateMonitor() -{ - // mark monitor to been shown in first status indication - bShow = TRUE; - - if ( !pMonitor ) - { - Window* pParent = pViewShell->GetWindow(); - pMonitor = new SfxPrintMonitor_Impl( pParent, pViewShell ); - pMonitor->aDocName.SetText( pViewShell->GetObjectShell()->GetTitle( SFX_TITLE_MAXLEN_PRINTMONITOR ) ); - pMonitor->aPrinter.SetText( pViewShell->GetPrinter()->GetName() ); - - // Stampit enable/dsiable cancel button - actualizePrintCancelState( pMonitor->aCancel, pViewShell->GetObjectShell() ); - pMonitor->aCancel.SetClickHdl( LINK( this, SfxPrintProgress_Impl, CancelHdl ) ); - } -} - -//------------------------------------------------------------------------ - -SfxPrintProgress_Impl::~SfxPrintProgress_Impl() -{ -} - -//------------------------------------------------------------------------ - -BOOL SfxPrintProgress_Impl::SetPage( USHORT nPage, const String &rPage ) -{ - // wurde der Druckauftrag abgebrochen? - if ( bCancel || !pMonitor ) - return FALSE; - - // Stampit enable/dsiable cancel button - actualizePrintCancelState(pMonitor->aCancel, pViewShell->GetObjectShell()); - - nLastPage = nPage; - String aStrPrintInfo = String( SfxResId( STR_PAGE ) ); - if ( !rPage.Len() ) - aStrPrintInfo += String::CreateFromInt32( nLastPage ); - else - aStrPrintInfo += rPage; - pMonitor->aPrintInfo.SetText( aStrPrintInfo ); - pMonitor->Update(); - return TRUE; -} - -//------------------------------------------------------------------------ - -IMPL_LINK( SfxPrintProgress_Impl, CancelHdl, Button *, EMPTYARG ) -{ - if ( !pViewShell->GetPrinter()->IsJobActive() && pViewShell->GetPrinter()->IsPrinting() ) - // we are still in StartJob, cancelling now might lead to a crash - return 0; - - if ( pMonitor ) - pMonitor->Hide(); - - pViewShell->GetObjectShell()->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_ABORTED, NULL, NULL ) ); - pViewShell->GetPrinter()->AbortJob(); - bCancel = TRUE; - - if ( aCancelHdl.IsSet() ) - aCancelHdl.Call( this ); - - bAborted = TRUE; - return 0; -} - -BOOL SfxPrintMonitor_Impl::Close() -{ - BOOL bAgree = pViewShell ? pViewShell->GetObjectShell()->Stamp_GetPrintCancelState() : TRUE; - if (!bAgree) - return FALSE; - else - return ModelessDialog::Close(); -} - -//-------------------------------------------------------------------- - -SfxPrintProgress::SfxPrintProgress( SfxViewShell* pViewSh, FASTBOOL bShow ) -: SfxProgress( pViewSh->GetViewFrame()->GetObjectShell(), - String(SfxResId(STR_PRINTING)), 1, FALSE ), - pImp( new SfxPrintProgress_Impl( pViewSh, pViewSh->GetPrinter() ) ) -{ - pImp->pPrinter->SetEndPrintHdl( LINK( this, SfxPrintProgress, EndPrintNotify ) ); - pImp->pPrinter->SetErrorHdl( LINK( this, SfxPrintProgress, PrintErrorNotify ) ); - pImp->pPrinter->SetStartPrintHdl( LINK( this, SfxPrintProgress, StartPrintNotify ) ); - pImp->bCallbacks = TRUE; - - SfxObjectShell* pDoc = pViewSh->GetObjectShell(); - SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_HIDDEN, FALSE ); - if ( pItem && pItem->GetValue() ) - bShow = FALSE; - - if ( bShow ) - pImp->CreateMonitor(); - - Lock(); - if ( !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) - { - pImp->bRestoreFlag = TRUE; - pImp->bOldFlag = pDoc->IsEnableSetModified(); - if ( pImp->bOldFlag ) - pDoc->EnableSetModified( FALSE ); - } -} - -//-------------------------------------------------------------------- - -SfxPrintProgress::~SfxPrintProgress() -{ - // k"onnte auch schon weg sein (in EndPrintNotify) - DELETEZ(pImp->pMonitor); - - // ggf. Callbacks entfermen - if ( pImp->bCallbacks ) - { - pImp->pPrinter->SetEndPrintHdl( Link() ); - pImp->pPrinter->SetErrorHdl( Link() ); - pImp->bCallbacks = FALSE; - } - - // ggf. vorherigen Drucker wieder einsetzen - if ( pImp->pOldPrinter ) - pImp->pViewShell->SetPrinter( pImp->pOldPrinter, SFX_PRINTER_PRINTER ); - else - // ggf. vorherigen Print-To-File-Status zuruecksetzen - pImp->pViewShell->GetPrinter()->EnablePrintFile( pImp->bOldEnablePrintFile ); - - // EndPrint-Notification an Frame - //pImp->pViewShell->GetViewFrame()->GetFrame()->Lock_Impl(FALSE); - pImp->EndListening( *(pImp->pViewShell->GetObjectShell()) ); - - // the following call might destroy the view or even the document - pImp->pViewShell->CheckOwnerShip_Impl(); - delete pImp; -} - -//-------------------------------------------------------------------- - -BOOL SfxPrintProgress::SetState( ULONG nValue, ULONG nNewRange ) -{ - if ( pImp->bShow ) - { - pImp->bShow = FALSE; - if ( pImp->pMonitor ) - { - pImp->pMonitor->Show(); - pImp->pMonitor->Update(); - } - } - - return pImp->SetPage( (USHORT)nValue, GetStateText_Impl() ) && - SfxProgress::SetState( nValue, nNewRange ); -} - -//-------------------------------------------------------------------- - -void SfxPrintProgress::SetText( const String& rText ) -{ - if ( pImp->pMonitor ) - { - pImp->pMonitor->SetText( rText ); - pImp->pMonitor->Update(); - } - SfxProgress::SetText( rText ); -} - -//------------------------------------------------------------------------ - -IMPL_LINK_INLINE_START( SfxPrintProgress, PrintErrorNotify, void *, EMPTYARG ) -{ - if ( pImp->pMonitor ) - pImp->pMonitor->Hide(); - // AbortJob calls EndPrint hdl, so do not delete pImp just now - BOOL bWasDeleteOnEndPrint = pImp->bDeleteOnEndPrint; - pImp->bDeleteOnEndPrint = FALSE; - pImp->pPrinter->AbortJob(); - InfoBox( pImp->GetViewShell()->GetWindow(), - String( SfxResId(STR_ERROR_PRINT) ) ).Execute(); - if ( pImp->bRestoreFlag && pImp->pViewShell->GetObjectShell()->IsEnableSetModified() != pImp->bOldFlag ) - pImp->pViewShell->GetObjectShell()->EnableSetModified( pImp->bOldFlag ); - pImp->GetViewShell()->GetObjectShell()->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_FAILED, NULL, NULL ) ); - // now we can clean up like normally EndPrint hdl does - if( bWasDeleteOnEndPrint ) - { - DELETEZ(pImp->pMonitor); - delete this; - } - return 0; -} -IMPL_LINK_INLINE_END( SfxPrintProgress, PrintErrorNotify, void *, EMPTYARG ) - -//------------------------------------------------------------------------ - -IMPL_LINK( SfxPrintProgress, StartPrintNotify, void *, EMPTYARG ) -{ - SfxObjectShell *pObjShell = pImp->pViewShell->GetObjectShell(); - SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_PRINTDOC, GlobalEventConfig::GetEventName( STR_EVENT_PRINTDOC ), pObjShell)); - pObjShell->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_STARTED, NULL, NULL ) ); - return 0; -} - -IMPL_LINK( SfxPrintProgress, EndPrintNotify, void *, EMPTYARG ) -{ - if ( pImp->pMonitor ) - pImp->pMonitor->Hide(); - - SfxViewShell* pViewShell = pImp->pViewShell; - - // Slots enablen - pViewShell->Invalidate( SID_PRINTDOC ); - pViewShell->Invalidate( SID_PRINTDOCDIRECT ); - pViewShell->Invalidate( SID_SETUPPRINTER ); - - // . . . falls der Printer im System umgestellt wurde, hier Aenderung - // nachziehen. - //! if( pMDI->IsPrinterChanged() ) pMDI->Changed( 0L ); - - // Callbacks rausnehmen - pImp->pPrinter->SetEndPrintHdl( Link() ); - pImp->pPrinter->SetErrorHdl( Link() ); - pImp->bCallbacks = FALSE; - - // ggf. alten Printer wieder einsetzen - if ( pImp->pOldPrinter ) - { - // Fix #59613#: niemals den aktuellen Printer synchron abschiessen ! - // Da sowieso immer bDeleteOnEndPrint gesetzt wird, wird der der Drucker im - // dtor vom Printprogress ( dann aber asynchron !! ) zur"uckgesetzt. -/* - pImp->pViewShell->SetPrinter( pImp->pOldPrinter, SFX_PRINTER_PRINTER ); - pImp->pOldPrinter = 0; - pImp->pPrinter = 0; - */ - } - else - // ggf. vorherigen Print-To-File-Status zuruecksetzen - pViewShell->GetPrinter()->EnablePrintFile( pImp->bOldEnablePrintFile ); - - // it is possible that after printing the document or view is deleted (because the VieShell got the ownership) - // so first clean up - if ( pImp->bRestoreFlag && pViewShell->GetObjectShell()->IsEnableSetModified() != pImp->bOldFlag ) - pViewShell->GetObjectShell()->EnableSetModified( TRUE ); - - pViewShell->GetObjectShell()->Broadcast( SfxPrintingHint( com::sun::star::view::PrintableState_JOB_COMPLETED, NULL, NULL ) ); - if ( pImp->bDeleteOnEndPrint ) - { - DELETEZ(pImp->pMonitor); - delete this; - } - else - { - DBG_ASSERT( !pImp->pOldPrinter, "Unable to restore printer!" ); - pImp->bRunning = FALSE; - } - - return 0; -} - -//------------------------------------------------------------------------ - -void SfxPrintProgress::DeleteOnEndPrint() -{ - UnLock(); // jetzt schon, wg. Drucken im Thread -#ifndef WNT - // da das Drucken im 'Thread' unter Windows zu undefiniert ist bleibt der - // Print-Monitor dort stehen, auf den anderen Plattformen kann man dann - // weiterarbeiten, also kommt das Teil weg - DELETEZ( pImp->pMonitor ); -#endif - - pImp->bDeleteOnEndPrint = TRUE; - if ( !pImp->bRunning ) - delete this; -} - -//------------------------------------------------------------------------ - -void SfxPrintProgress::RestoreOnEndPrint( SfxPrinter *pOldPrinter, - BOOL bOldEnablePrintFile ) -{ - pImp->pOldPrinter = pOldPrinter; - pImp->bOldEnablePrintFile = bOldEnablePrintFile; -} - -//------------------------------------------------------------------------ - -void SfxPrintProgress::RestoreOnEndPrint( SfxPrinter *pOldPrinter ) -{ - RestoreOnEndPrint( pOldPrinter, FALSE ); -} - -//------------------------------------------------------------------------ - -void SfxPrintProgress::SetCancelHdl( const Link& aCancelHdl ) -{ - pImp->aCancelHdl = aCancelHdl; -} - -BOOL SfxPrintProgress::IsAborted() const -{ - return pImp->bAborted; -} diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 2951ac3ef4a3..dc61cb293a26 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: sfxbasecontroller.cxx,v $ - * $Revision: 1.76 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -49,6 +46,7 @@ #include <com/sun/star/util/XCloseBroadcaster.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <com/sun/star/util/CloseVetoException.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> #include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase2.hxx> #include <com/sun/star/frame/FrameActionEvent.hpp> @@ -56,15 +54,18 @@ #include <com/sun/star/frame/CommandGroup.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XBorderResizeListener.hpp> +#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/EventObject.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> #include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/implbase1.hxx> #include <basic/sbstar.hxx> #include <uno/mapping.hxx> #include <sfx2/viewsh.hxx> +#include <sfx2/docfac.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/objsh.hxx> #include <sfx2/app.hxx> @@ -87,10 +88,12 @@ #include <toolkit/helper/convert.hxx> #include <framework/titlehelper.hxx> #include <comphelper/processfactory.hxx> +#include <tools/diagnose_ex.h> #include <hash_map> #include <sfx2/event.hxx> +#include "sfx2/viewfac.hxx" #define OMULTITYPEINTERFACECONTAINERHELPER ::cppu::OMultiTypeInterfaceContainerHelper #define OINTERFACECONTAINERHELPER ::cppu::OInterfaceContainerHelper @@ -112,6 +115,24 @@ #define TIMEOUT_START_RESCHEDULE 10L /* 10th s */ using namespace ::com::sun::star; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::UNO_QUERY_THROW; +using ::com::sun::star::lang::DisposedException; +using ::com::sun::star::awt::XWindow; +using ::com::sun::star::frame::XController; +using ::com::sun::star::frame::XDispatchProvider; +using ::com::sun::star::document::XViewDataSupplier; +using ::com::sun::star::container::XIndexAccess; +using ::com::sun::star::beans::PropertyValue; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::frame::XFrame; +using ::com::sun::star::frame::XFrameActionListener; +using ::com::sun::star::util::XCloseListener; +using ::com::sun::star::task::XStatusIndicator; +using ::com::sun::star::frame::XTitle; namespace css = ::com::sun::star; struct GroupIDToCommandGroup @@ -223,7 +244,7 @@ void reschedule() class SfxStatusIndicator : public ::cppu::WeakImplHelper2< ::com::sun::star::task::XStatusIndicator, ::com::sun::star::lang::XEventListener > { friend class SfxBaseController; - ::com::sun::star::uno::Reference < XCONTROLLER > xOwner; + ::com::sun::star::uno::Reference < XController > xOwner; ::com::sun::star::uno::Reference < ::com::sun::star::task::XStatusIndicator > xProgress; SfxWorkWindow* pWorkWindow; sal_Int32 _nRange; @@ -430,29 +451,19 @@ void SAL_CALL IMPL_SfxBaseController_CloseListenerHelper::notifyClosing( const E struct IMPL_SfxBaseController_DataContainer { - REFERENCE < XFRAME > m_xFrame; - REFERENCE < XFRAMEACTIONLISTENER > m_xListener ; - REFERENCE < XCLOSELISTENER > m_xCloseListener ; + Reference< XFrame > m_xFrame ; + Reference< XFrameActionListener > m_xListener ; + Reference< XCloseListener > m_xCloseListener ; ::sfx2::UserInputInterception m_aUserInputInterception; OMULTITYPEINTERFACECONTAINERHELPER m_aListenerContainer ; - OINTERFACECONTAINERHELPER m_aInterceptorContainer ; - REFERENCE < ::com::sun::star::task::XStatusIndicator > m_xIndicator; + OINTERFACECONTAINERHELPER m_aInterceptorContainer ; + Reference< XStatusIndicator > m_xIndicator ; SfxViewShell* m_pViewShell ; SfxBaseController* m_pController ; sal_Bool m_bDisposing ; - sal_Bool m_bSuspendState; - /** When this flag is <true/> (the default) then in dispose() the frame - and with it the view shell are released together with the - controller. - A derived class can set the flag to <false/> when it wants to - exchange controllers that work on the same view shell. One - application is the Impress Multi Pane GUI that changes shells that - are stacked on one view shell. Controllers are associated with the - stacked shells and thus must not destroy the view shell which is not - affected by the switching. - */ - sal_Bool m_bIsFrameReleasedWithController; - css::uno::Reference< css::frame::XTitle > m_xTitleHelper; + sal_Bool m_bSuspendState ; + Reference< XTitle > m_xTitleHelper ; + Sequence< PropertyValue > m_aCreationArgs ; IMPL_SfxBaseController_DataContainer( MUTEX& aMutex , SfxViewShell* pViewShell , @@ -466,7 +477,6 @@ struct IMPL_SfxBaseController_DataContainer , m_pController ( pController ) , m_bDisposing ( sal_False ) , m_bSuspendState ( sal_False ) - , m_bIsFrameReleasedWithController( sal_True ) { } @@ -528,8 +538,7 @@ void SAL_CALL IMPL_SfxBaseController_ListenerHelper::disposing( const EVENTOBJEC //________________________________________________________________________________________________________ DBG_NAME(sfx2_SfxBaseController) SfxBaseController::SfxBaseController( SfxViewShell* pViewShell ) - : IMPL_SfxBaseController_MutexContainer ( ) - , m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this )) + : m_pData ( new IMPL_SfxBaseController_DataContainer( m_aMutex, pViewShell, this )) { DBG_CTOR(sfx2_SfxBaseController,NULL); m_pData->m_pViewShell->SetController( this ); @@ -546,138 +555,60 @@ SfxBaseController::~SfxBaseController() } //________________________________________________________________________________________________________ -// SfxBaseController -> XInterface -//________________________________________________________________________________________________________ -ANY SAL_CALL SfxBaseController::queryInterface( const UNOTYPE& rType ) throw( RUNTIMEEXCEPTION ) -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Ask for my own supported interfaces ... - ANY aReturn( ::cppu::queryInterface( rType , - static_cast< XTYPEPROVIDER* > ( this ) , - static_cast< XCOMPONENT* > ( this ) , - static_cast< XCONTROLLER* > ( this ) , - static_cast< XCONTROLLERBORDER* > ( this ) , - static_cast< XUSERINPUTINTERCEPTION* > ( this ) , - static_cast< XSTATUSINDICATORSUPPLIER* > ( this ) , - static_cast< XCONTEXTMENUINTERCEPTION* > ( this ) , - static_cast< XDISPATCHPROVIDER* > ( this ), - static_cast< XTITLE* > ( this ), - static_cast< XTITLECHANGEBROADCASTER* > ( this ), - static_cast< XDISPATCHINFORMATIONPROVIDER* > ( this ) ) ) ; - - // If searched interface supported by this class ... - if ( aReturn.hasValue() == sal_True ) - { - // ... return this information. - return aReturn ; - } - else - { - // Else; ... ask baseclass for interfaces! - return OWeakObject::queryInterface( rType ) ; - } -} - -//________________________________________________________________________________________________________ -// SfxBaseController -> XInterface -//________________________________________________________________________________________________________ - -void SAL_CALL SfxBaseController::acquire() throw() -{ - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. - - // Forward to baseclass - OWeakObject::acquire() ; -} - -//________________________________________________________________________________________________________ -// SfxBaseController -> XInterface +// SfxBaseController -> XController2 //________________________________________________________________________________________________________ -void SAL_CALL SfxBaseController::release() throw() +Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() throw (RuntimeException) { - // Attention: - // Don't use mutex or guard in this method!!! Is a method of XInterface. + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell ) + throw DisposedException(); - // Forward to baseclass - OWeakObject::release() ; + return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); } -//________________________________________________________________________________________________________ -// SfxBaseController -> XTypeProvider -//________________________________________________________________________________________________________ - -SEQUENCE< UNOTYPE > SAL_CALL SfxBaseController::getTypes() throw( RUNTIMEEXCEPTION ) +::rtl::OUString SAL_CALL SfxBaseController::getViewControllerName() throw (RuntimeException) { - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL! - static OTYPECOLLECTION* pTypeCollection = NULL ; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) + throw DisposedException(); - if ( pTypeCollection == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; + const SfxObjectFactory& rDocFac( m_pData->m_pViewShell->GetObjectShell()->GetFactory() ); + sal_uInt16 nViewNo = rDocFac.GetViewNo_Impl( GetViewFrame_Impl().GetCurViewId(), rDocFac.GetViewFactoryCount() ); + OSL_ENSURE( nViewNo < rDocFac.GetViewFactoryCount(), "SfxBaseController::getViewControllerName: view ID not found in view factories!" ); - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pTypeCollection == NULL ) - { - // Create a static typecollection ... - static OTYPECOLLECTION aTypeCollection( ::getCppuType(( const REFERENCE< XTYPEPROVIDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTROLLER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTROLLERBORDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XDISPATCHPROVIDER >*)NULL ) , - ::getCppuType(( const REFERENCE< XSTATUSINDICATORSUPPLIER >*)NULL ) , - ::getCppuType(( const REFERENCE< XCONTEXTMENUINTERCEPTION >*)NULL ) , - ::getCppuType(( const REFERENCE< XUSERINPUTINTERCEPTION >*)NULL ) , - ::getCppuType(( const REFERENCE< XTITLE >*)NULL ) , - ::getCppuType(( const REFERENCE< XTITLECHANGEBROADCASTER >*)NULL ) , - ::getCppuType(( const REFERENCE< XDISPATCHINFORMATIONPROVIDER >*)NULL ) ); - // ... and set his address to static pointer! - pTypeCollection = &aTypeCollection ; - } - } + ::rtl::OUString sViewName; + if ( nViewNo < rDocFac.GetViewFactoryCount() ) + sViewName = rDocFac.GetViewFactory( nViewNo ).GetViewName(); - return pTypeCollection->getTypes() ; + return sViewName; } -//________________________________________________________________________________________________________ -// SfxBaseController -> XTypeProvider -//________________________________________________________________________________________________________ - -SEQUENCE< sal_Int8 > SAL_CALL SfxBaseController::getImplementationId() throw( RUNTIMEEXCEPTION ) +Sequence< PropertyValue > SAL_CALL SfxBaseController::getCreationArguments() throw (RuntimeException) { - // Create one Id for all instances of this class. - // Use ethernet address to do this! (sal_True) - - // Optimize this method - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pID is NULL - for the second call pID is different from NULL! - static OIMPLEMENTATIONID* pID = NULL ; + ::vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !m_pData->m_pViewShell || !m_pData->m_pViewShell->GetObjectShell() ) + throw DisposedException(); - if ( pID == NULL ) - { - // Ready for multithreading; get global mutex for first call of this method only! see before - MUTEXGUARD aGuard( MUTEX::getGlobalMutex() ) ; + return m_pData->m_aCreationArgs; +} - // Control these pointer again ... it can be, that another instance will be faster then these! - if ( pID == NULL ) - { - // Create a new static ID ... - static OIMPLEMENTATIONID aID( sal_False ) ; - // ... and set his address to static pointer! - pID = &aID ; - } - } +void SfxBaseController::SetCreationArguments_Impl( const Sequence< PropertyValue >& i_rCreationArgs ) +{ + OSL_ENSURE( m_pData->m_aCreationArgs.getLength() == 0, "SfxBaseController::SetCreationArguments_Impl: not intended to be called twice!" ); + m_pData->m_aCreationArgs = i_rCreationArgs; +} - return pID->getImplementationId() ; +SfxViewFrame& SfxBaseController::GetViewFrame_Impl() const +{ + ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); + SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pActFrame, "a view shell without a view frame is pretty pathological" ); + return *pActFrame; } //________________________________________________________________________________________________________ -// SfxBaseController -> XController +// SfxBaseController -> XController2 -> XController //________________________________________________________________________________________________________ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame ) throw( ::com::sun::star::uno::RuntimeException ) @@ -704,32 +635,11 @@ void SAL_CALL SfxBaseController::attachFrame( const REFERENCE< XFRAME >& xFrame if ( m_pData->m_pViewShell ) { - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - pActFrame->Enable( TRUE ); - pActFrame->GetDispatcher()->Lock( FALSE ); + ConnectSfxFrame_Impl( E_CONNECT ); - if ( ( m_pData->m_pViewShell->GetObjectShell() != NULL ) - && ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - ) - { - SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame(); - if ( !pViewFrm->GetFrame()->IsInPlace() ) - { - // for outplace embedded objects, we want the layout manager to keep the content window - // size constant, if possible - try - { - uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xLayouterProps( - xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW ); - xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - } - } - } + // attaching the frame to the controller is the last step in the creation of a new view, so notify this + SfxEventHint aHint( SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), m_pData->m_pViewShell->GetObjectShell() ); + SFX_APP()->NotifyEvent( aHint ); } } } @@ -790,9 +700,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: BOOL bRet = bOther || pDocShell->PrepareClose(); if ( bRet ) { - // disable window and dispatcher until suspend call is withdrawn - pActFrame->Enable( FALSE ); - pActFrame->GetDispatcher()->Lock( TRUE ); + ConnectSfxFrame_Impl( E_DISCONNECT ); m_pData->m_bSuspendState = sal_True; } @@ -805,9 +713,7 @@ sal_Bool SAL_CALL SfxBaseController::suspend( sal_Bool bSuspend ) throw( ::com:: if ( m_pData->m_pViewShell ) { - SfxViewFrame* pActFrame = m_pData->m_pViewShell->GetFrame() ; - pActFrame->Enable( TRUE ); - pActFrame->GetDispatcher()->Lock( FALSE ); + ConnectSfxFrame_Impl( E_RECONNECT ); } m_pData->m_bSuspendState = sal_False; @@ -896,7 +802,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU if ( xFrame.is() ) xFrame->setName( sTargetFrameName ); - REFERENCE < XDISPATCHPROVIDER > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); + Reference< XDispatchProvider > xProv( xFrame, ::com::sun::star::uno::UNO_QUERY ); if ( xProv.is() ) return xProv->queryDispatch( aURL, sTargetFrameName, ::com::sun::star::frame::FrameSearchFlag::SELF ); } @@ -914,13 +820,13 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pSlot = rSlotPool.GetUnoSlot( aMasterCommand ); else pSlot = rSlotPool.GetUnoSlot( aURL.Path ); - if ( pSlot && ( !pAct->GetFrame()->IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) + if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) return pAct->GetBindings().GetDispatch( pSlot, aURL, bMasterCommand ); else { // try to find parent SfxViewFrame uno::Reference< frame::XFrame > xParentFrame; - uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface(); if ( xOwnFrame.is() ) xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY ); @@ -935,7 +841,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) { - if ( pFrame->GetFrame()->GetFrameInterface() == xParentFrame ) + if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame ) { pParentFrame = pFrame; break; @@ -971,13 +877,13 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool( pAct ); const SfxSlot* pSlot = rSlotPool.GetSlot( nId ); - if ( pSlot && ( !pAct->GetFrame()->IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) + if ( pSlot && ( !pAct->GetFrame().IsInPlace() || !pSlot->IsMode( SFX_SLOT_CONTAINER ) ) ) return pAct->GetBindings().GetDispatch( pSlot, aURL, sal_False ); else { // try to find parent SfxViewFrame uno::Reference< frame::XFrame > xParentFrame; - uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame()->GetFrameInterface(); + uno::Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface(); if ( xOwnFrame.is() ) xParentFrame = uno::Reference< frame::XFrame >( xOwnFrame->getCreator(), uno::UNO_QUERY ); @@ -992,7 +898,7 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch( const UNOU pFrame; pFrame = SfxViewFrame::GetNext( *pFrame ) ) { - if ( pFrame->GetFrame()->GetFrameInterface() == xParentFrame ) + if ( pFrame->GetFrame().GetFrameInterface() == xParentFrame ) { pParentFrame = pFrame; break; @@ -1126,19 +1032,14 @@ void SfxBaseController::BorderWidthsChanged_Impl() // SfxBaseController -> XComponent //________________________________________________________________________________________________________ -void SfxBaseController::FrameIsReleasedWithController (sal_Bool bFlag) -{ - m_pData->m_bIsFrameReleasedWithController = bFlag; -} - void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::RuntimeException ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); - REFERENCE < XCONTROLLER > xTmp( this ); + Reference< XController > xTmp( this ); m_pData->m_bDisposing = sal_True ; EVENTOBJECT aEventObject; - aEventObject.Source = (XCONTROLLER*)this ; + aEventObject.Source = *this ; m_pData->m_aListenerContainer.disposeAndClear( aEventObject ) ; if ( m_pData->m_pController && m_pData->m_pController->getFrame().is() ) @@ -1147,18 +1048,15 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime if ( m_pData->m_pViewShell ) { SfxViewFrame* pFrame = m_pData->m_pViewShell->GetViewFrame() ; - if (m_pData->m_bIsFrameReleasedWithController) - { - if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) - pFrame->GetFrame()->SetIsClosing_Impl(); - m_pData->m_pViewShell->DiscardClients_Impl(); - m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; - } + if ( pFrame && pFrame->GetViewShell() == m_pData->m_pViewShell ) + pFrame->GetFrame().SetIsClosing_Impl(); + m_pData->m_pViewShell->DiscardClients_Impl(); + m_pData->m_pViewShell->pImp->bControllerSet = sal_False ; if ( pFrame ) { EVENTOBJECT aObject; - aObject.Source = (OWEAKOBJECT*)this ; + aObject.Source = *this ; SfxObjectShell* pDoc = pFrame->GetObjectShell() ; SfxViewFrame *pView = SfxViewFrame::GetFirst(pDoc); @@ -1170,12 +1068,9 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime pView = SfxViewFrame::GetNext( *pView, pDoc ); } - if ( m_pData->m_bIsFrameReleasedWithController ) - { - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); - if ( !pView ) - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); - } + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEVIEW, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEVIEW ), pDoc ) ); + if ( !pView ) + SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), pDoc) ); REFERENCE< XMODEL > xModel = pDoc->GetModel(); REFERENCE < ::com::sun::star::util::XCloseable > xCloseable( xModel, com::sun::star::uno::UNO_QUERY ); @@ -1192,14 +1087,13 @@ void SAL_CALL SfxBaseController::dispose() throw( ::com::sun::star::uno::Runtime m_pData->m_xListener->disposing( aObject ); SfxViewShell *pShell = m_pData->m_pViewShell; m_pData->m_pViewShell = NULL; - if ( pFrame->GetViewShell() == pShell - && m_pData->m_bIsFrameReleasedWithController) + if ( pFrame->GetViewShell() == pShell ) { // Enter registrations only allowed if we are the owner! - if ( pFrame->GetFrame()->OwnsBindings_Impl() ) + if ( pFrame->GetFrame().OwnsBindings_Impl() ) pFrame->GetBindings().ENTERREGISTRATIONS(); - pFrame->GetFrame()->SetFrameInterface_Impl( aXFrame ); - pFrame->GetFrame()->DoClose_Impl(); + pFrame->GetFrame().SetFrameInterface_Impl( aXFrame ); + pFrame->GetFrame().DoClose_Impl(); } } } @@ -1253,7 +1147,7 @@ SfxViewShell* SfxBaseController::GetViewShell_Impl() const { ::vos::OGuard aGuard( Application::GetSolarMutex() ); if ( m_pData->m_pViewShell && !m_pData->m_xIndicator.is() ) - m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame()->GetWorkWindow_Impl() ); + m_pData->m_xIndicator = new SfxStatusIndicator( this, m_pData->m_pViewShell->GetViewFrame()->GetFrame().GetWorkWindow_Impl() ); return m_pData->m_xIndicator; } @@ -1398,6 +1292,165 @@ BOOL SfxBaseController::HasMouseClickListeners_Impl() return m_pData->m_aUserInputInterception.hasMouseClickListeners(); } +void SfxBaseController::ConnectSfxFrame_Impl( const ConnectSfxFrame i_eConnect ) +{ + ENSURE_OR_THROW( m_pData->m_pViewShell, "not to be called without a view shell" ); + SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); + ENSURE_OR_THROW( pViewFrame, "a view shell without a view frame is pretty pathological" ); + + const bool bConnect = ( i_eConnect != E_DISCONNECT ); + + // disable window and dispatcher + pViewFrame->Enable( bConnect ); + pViewFrame->GetDispatcher()->Lock( !bConnect ); + + if ( bConnect ) + { + if ( i_eConnect == E_CONNECT ) + { + if ( ( m_pData->m_pViewShell->GetObjectShell() != NULL ) + && ( m_pData->m_pViewShell->GetObjectShell()->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) + ) + { + SfxViewFrame* pViewFrm = m_pData->m_pViewShell->GetViewFrame(); + if ( !pViewFrm->GetFrame().IsInPlace() ) + { + // for outplace embedded objects, we want the layout manager to keep the content window + // size constant, if possible + try + { + uno::Reference< beans::XPropertySet > xFrameProps( m_pData->m_xFrame, uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xLayouterProps( + xFrameProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ), uno::UNO_QUERY_THROW ); + xLayouterProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PreserveContentSize" ) ), uno::makeAny( sal_True ) ); + } + catch( const uno::Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + + // upon DISCONNECT, we did *not* pop the shells from the stack (this is done elsewhere), so upon + // RECONNECT, we're not allowed to push them + if ( i_eConnect != E_RECONNECT ) + { + pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell ); + if ( m_pData->m_pViewShell->GetSubShell() ) + pViewFrame->GetDispatcher()->Push( *m_pData->m_pViewShell->GetSubShell() ); + m_pData->m_pViewShell->PushSubShells_Impl(); + pViewFrame->GetDispatcher()->Flush(); + } + + Window* pEditWin = m_pData->m_pViewShell->GetWindow(); + if ( pEditWin && m_pData->m_pViewShell->IsShowView_Impl() ) + pEditWin->Show(); + + if ( SfxViewFrame::Current() == pViewFrame ) + pViewFrame->GetDispatcher()->Update_Impl( sal_True ); + + Window* pFrameWin = &pViewFrame->GetWindow(); + if ( pFrameWin != &pViewFrame->GetFrame().GetWindow() ) + pFrameWin->Show(); + + if ( i_eConnect == E_CONNECT ) + { + ::comphelper::NamedValueCollection aDocumentArgs( getModel()->getArgs() ); + + const sal_Int16 nPluginMode = aDocumentArgs.getOrDefault( "PluginMode", sal_Int16( 0 ) ); + const bool bHasPluginMode = ( nPluginMode != 0 ); + + SfxFrame& rFrame = pViewFrame->GetFrame(); + SfxObjectShell& rDoc = *m_pData->m_pViewShell->GetObjectShell(); + if ( !rFrame.IsMarkedHidden_Impl() ) + { + if ( rDoc.IsHelpDocument() || ( nPluginMode == 2 ) ) + pViewFrame->GetDispatcher()->HideUI( TRUE ); + else + pViewFrame->GetDispatcher()->HideUI( FALSE ); + + if ( rFrame.IsInPlace() ) + pViewFrame->LockAdjustPosSizePixel(); + + if ( nPluginMode == 3 ) + rFrame.GetWorkWindow_Impl()->SetInternalDockingAllowed( FALSE ); + + if ( !rFrame.IsInPlace() ) + pViewFrame->GetDispatcher()->Update_Impl(); + pViewFrame->Show(); + rFrame.GetWindow().Show(); + if ( !rFrame.IsInPlace() || ( nPluginMode == 3 ) ) + pViewFrame->MakeActive_Impl( rFrame.GetFrameInterface()->isActive() ); + + if ( rFrame.IsInPlace() ) + { + pViewFrame->UnlockAdjustPosSizePixel(); + // force resize for OLE server to fix layout problems of writer and math + // see i53651 + if ( nPluginMode == 3 ) + pViewFrame->Resize( TRUE ); + } + } + else + { + DBG_ASSERT( !rFrame.IsInPlace() && !bHasPluginMode, "Special modes not compatible with hidden mode!" ); + rFrame.GetWindow().Show(); + } + + // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! + pViewFrame->UpdateTitle(); + + if ( !rFrame.IsInPlace() ) + pViewFrame->Resize( TRUE ); + + // if there's a JumpMark given, then, well, jump to it + ::comphelper::NamedValueCollection aViewArgs( getCreationArguments() ); + const ::rtl::OUString sJumpMark = aViewArgs.getOrDefault( "JumpMark", ::rtl::OUString() ); + const bool bHasJumpMark = ( sJumpMark.getLength() > 0 ); + OSL_ENSURE( ( !m_pData->m_pViewShell->GetObjectShell()->IsLoading() ) + || ( !sJumpMark.getLength() ), + "SfxBaseController::ConnectSfxFrame_Impl: so this code wasn't dead?" ); + // Before CWS autorecovery, there was code which postponed jumping to the Mark to a later time + // (SfxObjectShell::PositionView_Impl), but it seems this branch was never used, since this method + // here is never called before the load process finished. At least not with a non-empty jump mark + if ( sJumpMark.getLength() ) + m_pData->m_pViewShell->JumpToMark( sJumpMark ); + + // if no plugin mode and no jump mark was supplied, check whether the document itself can provide view data, and + // if so, forward it to the view/shell. + if ( !bHasPluginMode && !bHasJumpMark ) + { + try + { + Reference< XViewDataSupplier > xViewDataSupplier( getModel(), UNO_QUERY ); + Reference< XIndexAccess > xViewData; + if ( xViewDataSupplier.is() ) + xViewData = xViewDataSupplier->getViewData(); + if ( xViewData.is() && xViewData->getCount() > 0 ) + { + Sequence< PropertyValue > aViewData; + if ( ( xViewData->getByIndex( 0 ) >>= aViewData ) && ( aViewData.getLength() ) ) + { + m_pData->m_pViewShell->ReadUserDataSequence( aViewData, TRUE ); + } + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + } + } + + // invalidate slot corresponding to the view shell + const sal_uInt16 nViewNo = m_pData->m_pViewShell->GetObjectShell()->GetFactory().GetViewNo_Impl( pViewFrame->GetCurViewId(), USHRT_MAX ); + DBG_ASSERT( nViewNo != USHRT_MAX, "view shell id not found" ); + if ( nViewNo != USHRT_MAX ) + pViewFrame->GetBindings().Invalidate( nViewNo + SID_VIEWSHELL0 ); +} + //============================================================================= css::uno::Reference< css::frame::XTitle > SfxBaseController::impl_getTitleHelper () { diff --git a/sfx2/source/view/topfrm.cxx b/sfx2/source/view/topfrm.cxx deleted file mode 100644 index cc2aa178d6f1..000000000000 --- a/sfx2/source/view/topfrm.cxx +++ /dev/null @@ -1,1646 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: topfrm.cxx,v $ - * $Revision: 1.97 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sfx2.hxx" -#ifndef GCC -#endif - -#include <sfx2/topfrm.hxx> -#include <sfx2/signaturestate.hxx> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/frame/XFrame.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX -#include <comphelper/processfactory.hxx> -#endif -#include <com/sun/star/frame/XFramesSupplier.hpp> -#include <com/sun/star/util/XCloseable.hpp> -#include <com/sun/star/util/CloseVetoException.hpp> -#ifndef _TOOLKIT_UNOHLP_HXX -#include <toolkit/helper/vclunohelper.hxx> -#endif -#ifndef _UNO_COM_SUN_STAR_AWT_POSSIZE_HPP_ -#include <com/sun/star/awt/PosSize.hpp> -#endif -#include <com/sun/star/container/XIndexAccess.hpp> -#ifndef _COM_SUN_STAR_CONTAINER_XPROPERTYSET_HPP_ -#include <com/sun/star/beans/XPropertySet.hpp> -#endif -#include <com/sun/star/frame/XLayoutManager.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/beans/XMaterialHolder.hpp> -#include <com/sun/star/awt/XWindow2.hpp> -#include <vcl/menu.hxx> -#include <svl/rectitem.hxx> -#include <svl/intitem.hxx> -#include <svl/eitem.hxx> -#include <svl/stritem.hxx> -#include <svtools/asynclink.hxx> -#include <svtools/sfxecode.hxx> -#include <vcl/dialog.hxx> -#include <svl/urihelper.hxx> -#include <unotools/moduleoptions.hxx> -#include <unotools/configmgr.hxx> -#include <unotools/bootstrap.hxx> - -#include <sfx2/sfxresid.hxx> - -// wg. pTopFrames -#include "appdata.hxx" -#include <sfx2/app.hxx> -#include <sfx2/sfx.hrc> -#include <sfx2/objsh.hxx> -#include <sfx2/docfile.hxx> -#include <sfx2/viewsh.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/dispatch.hxx> -#include <sfx2/request.hxx> -#include <sfx2/objitem.hxx> -#include <sfx2/objface.hxx> -#include <sfx2/msg.hxx> -#include "objshimp.hxx" -#include "workwin.hxx" -#include "sfxtypes.hxx" -#include "splitwin.hxx" -#include "arrdecl.hxx" -#include "sfxhelp.hxx" -#include <sfx2/fcontnr.hxx> -#include <sfx2/docfac.hxx> -#include "statcach.hxx" -#include <sfx2/event.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::beans; - -//------------------------------------------------------------------------ - -#define SfxTopViewFrame -#include "sfxslots.hxx" - -DBG_NAME(SfxTopViewFrame) - -#include <comphelper/sequenceashashmap.hxx> -static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) -{ - uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); - ::rtl::OUString sVar; - if ( !xMM.is() ) - return sVar; - - try - { - ::comphelper::SequenceAsHashMap aAnalyzer( xMM->getByName(sDocService) ); - sVar = aAnalyzer.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("ooSetupFactoryUIName"), ::rtl::OUString() ); - } - catch( uno::Exception& ) - { - sVar = ::rtl::OUString(); - } - - return sVar; -} - -class SfxTopFrame_Impl -{ -public: - Window* pWindow; // maybe external - BOOL bHidden; - BOOL bLockResize; - BOOL bMenuBarOn; -}; - -class SfxTopWindow_Impl : public Window -{ -public: - SfxTopFrame* pFrame; - - SfxTopWindow_Impl( SfxTopFrame* pF ); -// : Window( pF->pImp->pWindow, WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) -// , pFrame( pF ) -// { SetBackground(); } - ~SfxTopWindow_Impl( ); - - virtual void DataChanged( const DataChangedEvent& rDCEvt ); - virtual void StateChanged( StateChangedType nStateChange ); - virtual long PreNotify( NotifyEvent& rNEvt ); - virtual long Notify( NotifyEvent& rEvt ); - virtual void Resize(); - virtual void GetFocus(); - void DoResize(); - DECL_LINK( CloserHdl, void* ); -}; - -SfxTopWindow_Impl::SfxTopWindow_Impl( SfxTopFrame* pF ) - : Window( pF->pImp->pWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK ) - , pFrame( pF ) -{ -} - -SfxTopWindow_Impl::~SfxTopWindow_Impl( ) -{ -} - -void SfxTopWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); - if ( pWorkWin ) - pWorkWin->DataChanged_Impl( rDCEvt ); -} - -long SfxTopWindow_Impl::Notify( NotifyEvent& rNEvt ) -{ - if ( pFrame->IsClosing_Impl() || !pFrame->GetFrameInterface().is() ) - return sal_False; - - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - if ( !pView || !pView->GetObjectShell() ) - return Window::Notify( rNEvt ); - - if ( rNEvt.GetType() == EVENT_GETFOCUS ) - { - if ( pView->GetViewShell() && !pView->GetViewShell()->GetUIActiveIPClient_Impl() && !pFrame->IsInPlace() ) - { - DBG_TRACE("SfxTopFrame: GotFocus"); - pView->MakeActive_Impl( FALSE ); - } - - // TODO/LATER: do we still need this code? - Window* pWindow = rNEvt.GetWindow(); - ULONG nHelpId = 0; - while ( !nHelpId && pWindow ) - { - nHelpId = pWindow->GetHelpId(); - pWindow = pWindow->GetParent(); - } - - if ( nHelpId ) - SfxHelp::OpenHelpAgent( pFrame, nHelpId ); - - // if focus was on an external window, the clipboard content might have been changed - pView->GetBindings().Invalidate( SID_PASTE ); - pView->GetBindings().Invalidate( SID_PASTE_SPECIAL ); - return sal_True; - } - else if( rNEvt.GetType() == EVENT_KEYINPUT ) - { - if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) ) - return TRUE; - } - else if ( rNEvt.GetType() == EVENT_EXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTDISABLE*/ ) - { - pView->SetModalMode( sal_True ); - return sal_True; - } - else if ( rNEvt.GetType() == EVENT_ENDEXECUTEDIALOG /*|| rNEvt.GetType() == EVENT_INPUTENABLE*/ ) - { - //EnableInput( sal_True, sal_True ); - pView->SetModalMode( sal_False ); - return sal_True; - } - - return Window::Notify( rNEvt ); -} - -long SfxTopWindow_Impl::PreNotify( NotifyEvent& rNEvt ) -{ - USHORT nType = rNEvt.GetType(); - if ( nType == EVENT_KEYINPUT || nType == EVENT_KEYUP ) - { - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; - if ( pShell && pShell->HasKeyListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) - return sal_True; - } - else if ( nType == EVENT_MOUSEBUTTONUP || nType == EVENT_MOUSEBUTTONDOWN ) - { - Window* pWindow = rNEvt.GetWindow(); - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - SfxViewShell* pShell = pView ? pView->GetViewShell() : NULL; - if ( pShell ) - if ( pWindow == pShell->GetWindow() || pShell->GetWindow()->IsChild( pWindow ) ) - if ( pShell->HasMouseClickListeners_Impl() && pShell->HandleNotifyEvent_Impl( rNEvt ) ) - return sal_True; - } - - if ( nType == EVENT_MOUSEBUTTONDOWN ) - { - Window* pWindow = rNEvt.GetWindow(); - const MouseEvent* pMEvent = rNEvt.GetMouseEvent(); - Point aPos = pWindow->OutputToScreenPixel( pMEvent->GetPosPixel() ); - SfxWorkWindow *pWorkWin = pFrame->GetWorkWindow_Impl(); - if ( pWorkWin ) - pWorkWin->EndAutoShow_Impl( aPos ); - } - - return Window::PreNotify( rNEvt ); -} - -void SfxTopWindow_Impl::GetFocus() -{ - if ( pFrame && !pFrame->IsClosing_Impl() && pFrame->GetCurrentViewFrame() && pFrame->GetFrameInterface().is() ) - pFrame->GetCurrentViewFrame()->MakeActive_Impl( TRUE ); -} - -void SfxTopWindow_Impl::Resize() -{ - if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) - DoResize(); -} - -void SfxTopWindow_Impl::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - pFrame->pImp->bHidden = FALSE; - if ( pFrame->IsInPlace() ) - // TODO/MBA: workaround for bug in LayoutManager: the final resize does not get through because the - // LayoutManager works asynchronously and between resize and time execution the DockingAcceptor was exchanged so that - // the resize event never is sent to the component - SetSizePixel( GetParent()->GetOutputSizePixel() ); - - DoResize(); - SfxViewFrame* pView = pFrame->GetCurrentViewFrame(); - if ( pView ) - pView->GetBindings().GetWorkWindow_Impl()->ShowChilds_Impl(); - } - - Window::StateChanged( nStateChange ); -} - -void SfxTopWindow_Impl::DoResize() -{ - if ( !pFrame->pImp->bLockResize ) - pFrame->Resize(); -} - -class StopButtonTimer_Impl : public Timer -{ - BOOL bState; - SfxViewFrame* pFrame; -protected: - virtual void Timeout(); -public: - StopButtonTimer_Impl( SfxViewFrame*); - void SetButtonState( BOOL bStateP ); - BOOL GetButtonState() const { return bState; } -}; - -StopButtonTimer_Impl::StopButtonTimer_Impl( SfxViewFrame*p) - : bState( FALSE ) - , pFrame( p ) -{ - SetTimeout( 200 ); -} - -void StopButtonTimer_Impl::SetButtonState( BOOL bStateP ) -{ - if( bStateP ) - { - bState = TRUE; - Stop(); - } - else if( bState ) - Start(); -} - -void StopButtonTimer_Impl::Timeout() -{ - bState = FALSE; - pFrame->GetBindings().Invalidate( SID_BROWSE_STOP ); -} - -class SfxTopViewWin_Impl : public Window -{ -friend class SfxInternalFrame; - - BOOL bActive; - SfxTopViewFrame* pFrame; - -public: - SfxTopViewWin_Impl( SfxTopViewFrame* p, - Window *pParent, WinBits nBits=0 ) : - Window( pParent, nBits | WB_BORDER | WB_CLIPCHILDREN ), - bActive( FALSE ), - pFrame( p ) - { - p->GetFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - - virtual void Resize(); - virtual void StateChanged( StateChangedType nStateChange ); -}; - -//-------------------------------------------------------------------- -void SfxTopViewWin_Impl::StateChanged( StateChangedType nStateChange ) -{ - if ( nStateChange == STATE_CHANGE_INITSHOW ) - { - SfxObjectShell* pDoc = pFrame->GetObjectShell(); - if ( pDoc && !pFrame->IsVisible_Impl() ) - pFrame->Show(); - - pFrame->Resize(); - } - else - Window::StateChanged( nStateChange ); -} - -void SfxTopViewWin_Impl::Resize() -{ - if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) - pFrame->Resize(); -} - -class SfxTopViewFrame_Impl -{ -public: - sal_Bool bActive; - Window* pWindow; - String aFactoryName; - StopButtonTimer_Impl* pStopButtonTimer; - - SfxTopViewFrame_Impl() - : bActive( sal_False ) - , pWindow( 0 ) - , pStopButtonTimer( 0 ) - {} -}; - -static svtools::AsynchronLink* pPendingCloser = 0; - -static String _getTabString() -{ - String result; - - Reference < XMaterialHolder > xHolder( - ::comphelper::getProcessServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY ); - if (xHolder.is()) - { - rtl::OUString aTabString; - Sequence< NamedValue > sMaterial; - if (xHolder->getMaterial() >>= sMaterial) { - for (int i=0; i < sMaterial.getLength(); i++) { - if ((sMaterial[i].Name.equalsAscii("title")) && - (sMaterial[i].Value >>= aTabString)) - { - result += ' '; - result += String(aTabString); - } - } - } - } - return result; -} - -SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet ) -{ - Reference < XFrame > xDesktop ( ::comphelper::getProcessServiceFactory()->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - SfxTopFrame *pFrame = NULL; - BOOL bNewView = FALSE; - if ( pSet ) - { - SFX_ITEMSET_ARG( pSet, pItem, SfxBoolItem, SID_OPEN_NEW_VIEW, sal_False ); - bNewView = pItem && pItem->GetValue(); - } - - if ( pDoc && !bHidden && !bNewView ) - { - URL aTargetURL; - aTargetURL.Complete = pDoc->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ); - - BOOL bIsBasic = FALSE; - if ( !aTargetURL.Complete.getLength() ) - { - String sFactory = String::CreateFromAscii(pDoc->GetFactory().GetShortName()); - bIsBasic = (sFactory.CompareIgnoreCaseToAscii("sbasic")==COMPARE_EQUAL); - - if (!bIsBasic) - { - String aURL = String::CreateFromAscii("private:factory/"); - aURL += sFactory; - aTargetURL.Complete = aURL; - } - } - - if (bIsBasic) - { - Reference < XFramesSupplier > xSupplier( xDesktop, UNO_QUERY ); - if (xSupplier.is()) - { - Reference < XIndexAccess > xContainer(xSupplier->getFrames(), UNO_QUERY); - if (xContainer.is()) - { - Reference< ::com::sun::star::frame::XModuleManager > xCheck(::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager" )), UNO_QUERY); - sal_Int32 nCount = xContainer->getCount(); - for (sal_Int32 i=0; i<nCount; ++i) - { - try - { - Reference < XFrame > xFrame; - if (!(xContainer->getByIndex(i) >>= xFrame) || !xFrame.is()) - continue; - ::rtl::OUString sModule = xCheck->identify(xFrame); - if (sModule.equalsAscii("com.sun.star.frame.StartModule")) - { - pFrame = Create(xFrame); - break; - } - } - catch(const Exception&) {} - } - } - } - } - else - { - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )), UNO_QUERY ); - xTrans->parseStrict( aTargetURL ); - - Reference < ::com::sun::star::frame::XDispatchProvider > xProv( xDesktop, UNO_QUERY ); - Reference < ::com::sun::star::frame::XDispatch > xDisp; - if ( xProv.is() ) - { - Sequence < ::com::sun::star::beans::PropertyValue > aSeq(1); - aSeq[0].Name = ::rtl::OUString::createFromAscii("Model"); - aSeq[0].Value <<= pDoc->GetModel(); - ::rtl::OUString aTargetFrame( ::rtl::OUString::createFromAscii("_default") ); - xDisp = xProv->queryDispatch( aTargetURL, aTargetFrame , 0 ); - if ( xDisp.is() ) - xDisp->dispatch( aTargetURL, aSeq ); - } - - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - for( USHORT nPos = rArr.Count(); nPos--; ) - { - SfxTopFrame *pF = (SfxTopFrame*) rArr[ nPos ]; - if ( pF->GetCurrentDocument() == pDoc ) - { - pFrame = pF; - break; - } - } - } - } - - if ( !pFrame ) - { - Reference < XFrame > xFrame = xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ); - pFrame = Create( xFrame ); - } - - pFrame->pImp->bHidden = bHidden; - Window* pWindow = pFrame->GetTopWindow_Impl(); - if ( pWindow && pDoc ) - { - ::rtl::OUString aDocServiceName( pDoc->GetFactory().GetDocumentServiceName() ); - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - String aTitle = pDoc->GetTitle( SFX_TITLE_DETECT ); - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); - aTitle += ' '; - aTitle += String( GetModuleName_Impl( aDocServiceName ) ); -#ifdef DBG_UTIL - ::rtl::OUString aDefault; - aTitle += DEFINE_CONST_UNICODE(" ["); - String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); - aTitle += aVerId; - aTitle += ']'; -#endif - - // append TAB string if available - aTitle += _getTabString(); - - /* AS_TITLE - pWindow->SetText( aTitle ); - */ - - /* AS_ICON - if( pWindow->GetType() == WINDOW_WORKWINDOW ) - { - SvtModuleOptions::EFactory eFactory; - if( SvtModuleOptions::ClassifyFactoryByName( aDocServiceName, eFactory ) ) - { - WorkWindow* pWorkWindow = (WorkWindow*)pWindow; - pWorkWindow->SetIcon( (sal_uInt16) SvtModuleOptions().GetFactoryIcon( eFactory ) ); - } - } - */ - } - - pFrame->SetItemSet_Impl( pSet ); - if ( pDoc && pDoc != pFrame->GetCurrentDocument() ) - { - if ( nViewId ) - pDoc->GetMedium()->GetItemSet()->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - pFrame->InsertDocument( pDoc ); - if ( pWindow && !bHidden ) - pWindow->Show(); - } - - return pFrame; -} - -SfxTopFrame* SfxTopFrame::Create( SfxObjectShell* pDoc, Window* pWindow, USHORT nViewId, BOOL bHidden, const SfxItemSet* pSet ) -{ - Reference < ::com::sun::star::lang::XMultiServiceFactory > xFact( ::comphelper::getProcessServiceFactory() ); - Reference < XFramesSupplier > xDesktop ( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); - Reference < XFrame > xFrame( xFact->createInstance( DEFINE_CONST_UNICODE("com.sun.star.frame.Frame") ), UNO_QUERY ); - - xFrame->initialize( VCLUnoHelper::GetInterface ( pWindow ) ); - if ( xDesktop.is() ) - xDesktop->getFrames()->append( xFrame ); - - uno::Reference< awt::XWindow2 > xWin( VCLUnoHelper::GetInterface ( pWindow ), uno::UNO_QUERY ); - if ( xWin.is() && xWin->isActive() ) - xFrame->activate(); - - SfxTopFrame* pFrame = new SfxTopFrame( pWindow ); - 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( pDoc ); - } - - return pFrame; -} - -SfxTopFrame* SfxTopFrame::Create( Reference < XFrame > xFrame ) -{ - // create a new TopFrame to an external XFrame object ( wrap controller ) - DBG_ASSERT( xFrame.is(), "Wrong parameter!" ); - - Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - SfxTopFrame* pFrame = new SfxTopFrame( pWindow ); - pFrame->SetFrameInterface_Impl( xFrame ); - return pFrame; -} - -SfxTopFrame::SfxTopFrame( Window* pExternal, sal_Bool bHidden ) - : SfxFrame( NULL ) - , pWindow( NULL ) -{ - pImp = new SfxTopFrame_Impl; - pImp->bHidden = bHidden; - pImp->bLockResize = FALSE; - pImp->bMenuBarOn = TRUE; - InsertTopFrame_Impl( this ); - if ( pExternal ) - { - pImp->pWindow = pExternal; - } - else - { - DBG_ERROR( "TopFrame without window created!" ); -/* - pImp->pWindow = new SfxTopFrameWindow_Impl( this ); - pImp->pWindow->SetActivateMode( ACTIVATE_MODE_GRABFOCUS ); - pImp->pWindow->SetPosSizePixel( Point( 20,20 ), Size( 800,600 ) ); - if ( GetFrameInterface().is() ) - GetFrameInterface()->initialize( VCLUnoHelper::GetInterface( pImp->pWindow ) ); - pImp->pWindow->Show(); - */ - } - - pWindow = new SfxTopWindow_Impl( this ); -/** AS: - Hide this window till the component was realy loaded. Otherwhise it overpaint e.g. the old component hardly - and produce repaint errors. - pWindow->Show(); - */ -} - -SfxTopFrame::~SfxTopFrame() -{ - RemoveTopFrame_Impl( this ); - DELETEZ( pWindow ); - delete pImp; -} - -void SfxTopFrame::SetPresentationMode( BOOL bSet ) -{ - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( bSet ? WINDOW_BORDER_NOBORDER : WINDOW_BORDER_NORMAL ); - - Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - - if ( xPropSet.is() ) - { - Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - aValue >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - xLayoutManager->setVisible( !bSet ); // we don't want to have ui in presentation mode - - SetMenuBarOn_Impl( !bSet ); - if ( GetWorkWindow_Impl() ) - GetWorkWindow_Impl()->SetDockingAllowed( !bSet ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetDispatcher()->Update_Impl( TRUE ); -} - -SystemWindow* -SfxTopFrame::GetSystemWindow() const -{ - return GetTopWindow_Impl(); -} - -SystemWindow* SfxTopFrame::GetTopWindow_Impl() const -{ - if ( pImp->pWindow->IsSystemWindow() ) - return (SystemWindow*) pImp->pWindow; - else - return NULL; -} - -Window& SfxTopFrame::GetWindow() const -{ - return *pWindow; -} - -sal_Bool SfxTopFrame::Close() -{ - delete this; - return sal_True; -} - -void SfxTopFrame::LockResize_Impl( BOOL bLock ) -{ - pImp->bLockResize = bLock; -} - -IMPL_LINK( SfxTopWindow_Impl, CloserHdl, void*, EMPTYARG ) -{ - if ( pFrame && !pFrame->PrepareClose_Impl( TRUE ) ) - return 0L; - - if ( pFrame ) - pFrame->GetCurrentViewFrame()->GetBindings().Execute( SID_CLOSEWIN, 0, 0, SFX_CALLMODE_ASYNCHRON ); - return 0L; -} - -void SfxTopFrame::SetMenuBarOn_Impl( BOOL bOn ) -{ - pImp->bMenuBarOn = bOn; - - Reference< com::sun::star::beans::XPropertySet > xPropSet( GetFrameInterface(), UNO_QUERY ); - Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; - - if ( xPropSet.is() ) - { - Any aValue = xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))); - aValue >>= xLayoutManager; - } - - if ( xLayoutManager.is() ) - { - rtl::OUString aMenuBarURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" )); - - if ( bOn ) - xLayoutManager->showElement( aMenuBarURL ); - else - xLayoutManager->hideElement( aMenuBarURL ); - } -} - -BOOL SfxTopFrame::IsMenuBarOn_Impl() const -{ - return pImp->bMenuBarOn; -} - -String SfxTopFrame::GetWindowData() -{ - String aActWinData; - char cToken = ','; - - SfxViewFrame *pActFrame = SfxViewFrame::Current(); - SfxViewFrame *pFrame = GetCurrentViewFrame(); - const sal_Bool bActWin = ( pActFrame->GetTopViewFrame() == pFrame ); - - // ::com::sun::star::sdbcx::User-Daten der ViewShell - String aUserData; - pFrame->GetViewShell()->WriteUserData(aUserData); - - // assemble ini-data - String aWinData; - aWinData += String::CreateFromInt32( pFrame->GetCurViewId() ); - aWinData += cToken; - - aWinData += '1'; // former attribute "isfloating" - aWinData += cToken; - - // aktives kennzeichnen - aWinData += cToken; - aWinData += bActWin ? '1' : '0'; - - aWinData += cToken; - aWinData += aUserData; - - return aWinData; -} - -sal_Bool SfxTopFrame::InsertDocument( SfxObjectShell* pDoc ) -/* [Beschreibung] - */ -{ - // Spezielle Bedingungen testen: nicht im ModalMode! - if ( !SfxFrame::InsertDocument( pDoc ) ) - return sal_False; - - SfxObjectShell *pOld = GetCurrentDocument(); - - // Position und Groesse testen - // Wenn diese schon gesetzt sind, soll offensichtlich nicht noch - // LoadWindows_Impl aufgerufen werden ( z.B. weil dieses ein CreateFrame() - // an einer Task aufgerufen hat! ) - const SfxItemSet* pSet = GetItemSet_Impl(); - if ( !pSet ) - pSet = pDoc->GetMedium()->GetItemSet(); - SetItemSet_Impl(0); - - // Position und Gr"o\se - SFX_ITEMSET_ARG( - pSet, pAreaItem, SfxRectangleItem, SID_VIEW_POS_SIZE, sal_False ); - // View-Id - SFX_ITEMSET_ARG( - pSet, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); - // Zoom - SFX_ITEMSET_ARG( - pSet, pModeItem, SfxUInt16Item, SID_VIEW_ZOOM_MODE, sal_False ); - // Hidden - SFX_ITEMSET_ARG( - pSet, pHidItem, SfxBoolItem, SID_HIDDEN, sal_False); - // ViewDaten - SFX_ITEMSET_ARG( - pSet, pViewDataItem, SfxStringItem, SID_USER_DATA, sal_False ); - // ViewOnly - SFX_ITEMSET_ARG( - pSet, pEditItem, SfxBoolItem, SID_VIEWONLY, sal_False); - // InPlace (Hack) - SFX_ITEMSET_ARG( - pSet, pPluginItem, SfxUInt16Item, SID_PLUGIN_MODE, sal_False ); - - // Plugin (external InPlace) - SFX_ITEMSET_ARG( - pSet, pPluginMode, SfxUInt16Item, SID_PLUGIN_MODE, sal_False); - // Jump (GotoBookmark) - SFX_ITEMSET_ARG( - pSet, pJumpItem, SfxStringItem, SID_JUMPMARK, sal_False); - - if ( pEditItem && pEditItem->GetValue() ) - SetMenuBarOn_Impl( FALSE ); - - if ( pHidItem ) - pImp->bHidden = pHidItem->GetValue(); - - if( !pImp->bHidden ) - pDoc->OwnerLock( sal_True ); - - // Wenn z.B. eine Fenstergr"o\se gesetzt wurde, soll keine Fensterinformation - // aus den Dokument geladen werden, z.B. weil InsertDocument seinerseits - // aus LoadWindows_Impl aufgerufen wurde! - if ( !pJumpItem && !pPluginMode && pDoc && !pAreaItem && !pViewIdItem && !pModeItem && - pDoc->LoadWindows_Impl( this ) ) - { - if ( GetCurrentDocument() != pDoc ) - // something went wrong during insertion - return sal_False; - pDoc->OwnerLock( sal_False ); - return sal_True; - } - - if ( pDoc ) - { - UpdateHistory( pDoc ); - UpdateDescriptor( pDoc ); - } - - SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); - sal_Bool bBrowsing = sal_True; - SfxViewFrame *pFrame = GetCurrentViewFrame(); - if ( pFrame ) - { - sal_Bool bChildActivated = sal_False; - if ( pFrame->GetActiveChildFrame_Impl() && pFrame->GetActiveChildFrame_Impl() == SfxViewFrame::Current() ) - { -// ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier > xFrames( GetFrameInterface(), ::com::sun::star::uno::UNO_QUERY ); -// if ( xFrames.is() ) -// xFrames->setActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () ); - pFrame->SetActiveChildFrame_Impl(0); - SfxViewFrame::SetViewFrame( pFrame ); - bChildActivated = sal_True; - } - - if ( pFrame->GetObjectShell() ) - { - pFrame->ReleaseObjectShell_Impl( sal_False ); - } - - if ( pViewIdItem ) - pFrame->SetViewData_Impl( pViewIdItem->GetValue(), String() ); - if ( pDoc ) - pFrame->SetObjectShell_Impl( *pDoc ); - } - else - { - // 1: internal embedded object - // 2: external embedded object - // 3: OLE server - if ( pPluginItem && pPluginItem->GetValue() != 2 ) - SetInPlace_Impl( TRUE ); - - bBrowsing = sal_False; - pFrame = new SfxTopViewFrame( this, pDoc, pViewIdItem ? pViewIdItem->GetValue() : 0 ); - if ( !pFrame->GetViewShell() ) - return sal_False; - - if ( pPluginItem && pPluginItem->GetValue() == 1 ) - { - pFrame->ForceOuterResize_Impl( FALSE ); - pFrame->GetBindings().HidePopups(TRUE); - - // MBA: layoutmanager of inplace frame starts locked and invisible - GetWorkWindow_Impl()->MakeVisible_Impl( FALSE ); - GetWorkWindow_Impl()->Lock_Impl( TRUE ); - - GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - if ( GetCurrentViewFrame() ) - GetCurrentViewFrame()->GetWindow().SetBorderStyle( WINDOW_BORDER_NOBORDER ); - } - } - - String aMark; - SFX_ITEMSET_ARG( pSet, pMarkItem, SfxStringItem, SID_JUMPMARK, FALSE ); - if ( pMarkItem ) - aMark = pMarkItem->GetValue(); - - if ( pDoc->Get_Impl()->nLoadedFlags & SFX_LOADED_MAINDOCUMENT ) - { - if ( pViewDataItem ) - pFrame->GetViewShell()->ReadUserData( pViewDataItem->GetValue(), sal_True ); - else if( aMark.Len() ) - GetCurrentViewFrame()->GetViewShell()->JumpToMark( aMark ); - } - else - { - // Daten setzen, die in FinishedLoading ausgewertet werden - MarkData_Impl*& rpMark = pDoc->Get_Impl()->pMarkData; - if (!rpMark) - rpMark = new MarkData_Impl; - rpMark->pFrame = GetCurrentViewFrame(); - if ( pViewDataItem ) - rpMark->aUserData = pViewDataItem->GetValue(); - else - rpMark->aMark = aMark; - } - - // Position und Groesse setzen - //sal_uInt16 nWinMode = pModeItem ? pModeItem->GetValue() : 1; - if ( pAreaItem && !pOld ) - { - Window *pWin = pImp->pWindow; - - // Groesse setzen - const Rectangle aWinRect( pAreaItem->GetValue() ); - const Size aAppWindow( pImp->pWindow->GetDesktopRectPixel().GetSize() ); - Point aPos( aWinRect.TopLeft() ); - Size aSz(aWinRect.GetSize()); - if ( aSz.Width() && aSz.Height() ) - { - aPos.X() = Min(aPos.X(), - long(aAppWindow.Width() - aSz.Width() + aSz.Width() / 2) ); - aPos.Y() = Min(aPos.Y(), - long( aAppWindow.Height() - aSz.Height() + aSz.Height() / 2) ); - if ( aPos.X() + aSz.Width() < - aAppWindow.Width() + aSz.Width() / 2 && - aPos.Y() + aSz.Height() < - aAppWindow.Height() + aSz.Height() / 2 ) - { - pWin->SetPosPixel( aPos ); - pWin->SetOutputSizePixel( aSz ); - } - } - } - - if ( !pImp->bHidden ) - { - if ( pDoc->IsHelpDocument() || (pPluginItem && pPluginItem->GetValue() == 2) ) - pFrame->GetDispatcher()->HideUI( TRUE ); - else - pFrame->GetDispatcher()->HideUI( FALSE ); - - if ( IsInPlace() ) - pFrame->LockAdjustPosSizePixel(); - - if ( pPluginMode && pPluginMode->GetValue() == 3) - GetWorkWindow_Impl()->SetInternalDockingAllowed(FALSE); - - if ( !IsInPlace() ) - pFrame->GetDispatcher()->Update_Impl(); - pFrame->Show(); - GetWindow().Show(); - if ( !IsInPlace() || (pPluginItem && pPluginItem->GetValue() == 3) ) - pFrame->MakeActive_Impl( GetFrameInterface()->isActive() ); - pDoc->OwnerLock( sal_False ); - - // Dont show container window! Its done by framework or directly - // by SfxTopFrame::Create() or SfxViewFrame::ExecView_Impl() ... - - if ( IsInPlace() ) - { - pFrame->UnlockAdjustPosSizePixel(); - // force resize for OLE server to fix layout problems of writer and math - // see i53651 - if ( pPluginItem && pPluginItem->GetValue() == 3 ) - pFrame->Resize(TRUE); - } - } - else - { - DBG_ASSERT( !IsInPlace() && !pPluginMode && !pPluginItem, "Special modes not compatible with hidden mode!" ); - GetWindow().Show(); - } - - // Jetzt UpdateTitle, hidden TopFrames haben sonst keinen Namen! - pFrame->UpdateTitle(); - - if ( !IsInPlace() ) - { - if ( pFrame->GetViewShell()->UseObjectSize() ) - { - GetCurrentViewFrame()->UnlockAdjustPosSizePixel(); - GetCurrentViewFrame()->Resize(TRUE); - GetCurrentViewFrame()->ForceInnerResize_Impl( FALSE ); - GetCurrentViewFrame()->Resize(TRUE); - } - else - GetCurrentViewFrame()->Resize(TRUE); - } - - SFX_APP()->NotifyEvent( SfxEventHint(SFX_EVENT_VIEWCREATED, GlobalEventConfig::GetEventName( STR_EVENT_VIEWCREATED ), pDoc ) ); - return sal_True; -} - - -//======================================================================== - -long SfxViewFrameClose_Impl( void* /*pObj*/, void* pArg ) -{ - ((SfxViewFrame*)pArg)->GetFrame()->DoClose(); - return 0; -} - -TYPEINIT1(SfxTopFrame, SfxFrame); -TYPEINIT1(SfxTopViewFrame, SfxViewFrame); - -//-------------------------------------------------------------------- -SFX_IMPL_INTERFACE(SfxTopViewFrame,SfxViewFrame,SfxResId(0)) -{ -} - -//-------------------------------------------------------------------- -String SfxTopViewFrame::UpdateTitle() - -/* [Beschreibung] - - Mit dieser Methode kann der SfxTopViewFrame gezwungen werden, sich sofort - den neuen Titel vom der <SfxObjectShell> zu besorgen. - - [Anmerkung] - - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. - - - [Beispiel] - - void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) - { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_TITLECHANGED: - for ( SfxTopViewFrame *pTop = (SfxTopViewFrame*) - SfxViewFrame::GetFirst(this, TYPE(SfxTopViewFrame)); - pTop; - pTop = (SfxTopViewFrame*) - SfxViewFrame::GetNext(this, TYPE(SfxTopViewFrame)); - { - pTop->UpdateTitle(); - ... pTop->GetName() ... - } - break; - ... - } - } - } -*/ - -{ - DBG_CHKTHIS(SfxTopViewFrame, 0); - - const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); - pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); - - String aTitle = SfxViewFrame::UpdateTitle(); - - ::rtl::OUString aProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; - - aTitle += String::CreateFromAscii( " - " ); - aTitle += String(aProductName); - aTitle += ' '; - ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); - aTitle += String( GetModuleName_Impl( aDocServiceName ) ); -#ifdef DBG_UTIL - ::rtl::OUString aDefault; - aTitle += DEFINE_CONST_UNICODE(" ["); - String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); - aTitle += aVerId; - aTitle += ']'; -#endif - - // append TAB string if available - aTitle += _getTabString(); - - GetBindings().Invalidate( SID_NEWDOCDIRECT ); - - /* AS_TITLE - Window* pWindow = GetTopFrame_Impl()->GetTopWindow_Impl(); - if ( pWindow && pWindow->GetText() != aTitle ) - pWindow->SetText( aTitle ); - */ - return aTitle; -} - -//-------------------------------------------------------------------- -void SfxTopViewFrame::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) -{ - {DBG_CHKTHIS(SfxTopViewFrame, 0);} - - if( IsDowning_Impl()) - return; - - // we know only SimpleHints - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_MODECHANGED: - case SFX_HINT_TITLECHANGED: - // when the document changes its title, change views too - UpdateTitle(); - break; - - case SFX_HINT_DEINITIALIZING: - // on all other changes force repaint - GetFrame()->DoClose(); - return; - } - } - - SfxViewFrame::Notify( rBC, rHint ); -} - -//-------------------------------------------------------------------- -sal_Bool SfxTopViewFrame::Close() -{ - {DBG_CHKTHIS(SfxTopViewFrame, 0);} - - // Modaler Dialog oben ?? -// if ( pImp->GetModalDialog() ) -// return sal_False; - - // eigentliches Schlie\sen - if ( SfxViewFrame::Close() ) - { - if (SfxViewFrame::Current() == this) - SfxViewFrame::SetViewFrame(0); - - // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr - // vern"unftig verwenden - also besser still legen - GetDispatcher()->Lock(sal_True); - delete this; - - return sal_True; - } - - return sal_False; -} - -SfxTopViewFrame::SfxTopViewFrame -( - SfxFrame* pFrame, - SfxObjectShell* pObjShell, - sal_uInt16 nViewId -) - -/* [Beschreibung] - - Ctor des SfxTopViewFrame f"ur eine <SfxObjectShell> aus der Ressource. - Die 'nViewId' der zu erzeugenden <SfxViewShell> kann angegeben werden - (default ist die zuerst registrierte SfxViewShell-Subklasse). -*/ - - : SfxViewFrame( *(new SfxBindings), pFrame, pObjShell, SFXFRAME_HASTITLE ) -{ - DBG_CTOR(SfxTopViewFrame, 0); - - pCloser = 0; - pImp = new SfxTopViewFrame_Impl; - pImp->pStopButtonTimer = new StopButtonTimer_Impl(this); - -//(mba)/task if ( !pFrame->GetTask() ) - { - pImp->pWindow = new SfxTopViewWin_Impl( this, &pFrame->GetWindow() ); - pImp->pWindow->SetSizePixel( pFrame->GetWindow().GetOutputSizePixel() ); - SetWindow_Impl( pImp->pWindow ); - pFrame->SetOwnsBindings_Impl( sal_True ); - pFrame->CreateWorkWindow_Impl(); - } - - sal_uInt32 nType = SFXFRAME_OWNSDOCUMENT | SFXFRAME_HASTITLE; - if ( pObjShell && pObjShell->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) - nType |= SFXFRAME_EXTERNAL; - GetFrame()->SetFrameType_Impl( GetFrame()->GetFrameType() | nType ); - - if ( GetFrame()->IsInPlace() ) - { - LockAdjustPosSizePixel(); - } - - try - { - if ( pObjShell ) - SwitchToViewShell_Impl( nViewId ); - } - catch (com::sun::star::uno::Exception& ) - { - // make sure that the ctor is left regularly - ReleaseObjectShell_Impl(); - return; - } - - if ( GetFrame()->IsInPlace() ) - { - UnlockAdjustPosSizePixel(); - } - else if ( GetViewShell() && GetViewShell()->UseObjectSize() ) - { - // initiale Gr"o\se festlegen - // Zuerst die logischen Koordinaten von IP-Objekt und EditWindow - // ber"ucksichtigen - LockAdjustPosSizePixel(); - ForceInnerResize_Impl( TRUE ); - - Window *pWindow = GetViewShell()->GetWindow(); - - // Da in den Applikationen bei der R"ucktransformation immer die - // Eckpunkte tranformiert werden und nicht die Size (um die Ecken - // alignen zu k"onnen), transformieren wir hier auch die Punkte, um - // m"oglichst wenig Rundungsfehler zu erhalten. -/* - Rectangle aRect = pWindow->LogicToLogic( GetObjectShell()->GetVisArea(), - GetObjectShell()->GetMapUnit(), - pWindow->GetMapMode() ); -*/ - Rectangle aRect = pWindow->LogicToPixel( GetObjectShell()->GetVisArea() ); - Size aSize = aRect.GetSize(); - GetViewShell()->GetWindow()->SetSizePixel( aSize ); - DoAdjustPosSizePixel(GetViewShell(), Point(), aSize ); - } -} - -//------------------------------------------------------------------------ -SfxTopViewFrame::~SfxTopViewFrame() -{ - DBG_DTOR(SfxTopViewFrame, 0); - - SetDowning_Impl(); - - if ( SfxViewFrame::Current() == this ) - SfxViewFrame::SetViewFrame(NULL); - - ReleaseObjectShell_Impl(); - if ( pPendingCloser == pCloser ) - pPendingCloser = 0; - delete pCloser; - if ( GetFrame()->OwnsBindings_Impl() ) - // Die Bindings l"oscht der Frame! - KillDispatcher_Impl(); - - delete pImp->pWindow; - delete pImp->pStopButtonTimer; - delete pImp; -} - -//------------------------------------------------------------------------ -sal_Bool SfxTopViewFrame::SetBorderPixelImpl( const SfxViewShell *pVSh, const SvBorder &rBorder ) -{ - if( SfxViewFrame::SetBorderPixelImpl( GetViewShell(), rBorder ) ) - { - if ( IsResizeInToOut_Impl() && !GetFrame()->IsInPlace() ) - { - Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); - if ( aSize.Width() && aSize.Height() ) - { - aSize.Width() += rBorder.Left() + rBorder.Right(); - aSize.Height() += rBorder.Top() + rBorder.Bottom(); - - Size aOldSize = GetWindow().GetOutputSizePixel(); - GetWindow().SetOutputSizePixel( aSize ); - Window* pParent = &GetWindow(); - while ( pParent->GetParent() ) - pParent = pParent->GetParent(); - Size aOuterSize = pParent->GetOutputSizePixel(); - aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() ); - aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() ); - pParent->SetOutputSizePixel( aOuterSize ); - } - } - else - { - Point aPoint; - Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() ); - aEditArea.Left() += rBorder.Left(); - aEditArea.Right() -= rBorder.Right(); - aEditArea.Top() += rBorder.Top(); - aEditArea.Bottom() -= rBorder.Bottom(); - pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() ); - } - return sal_True; - - } - return sal_False; -} - -void SfxTopViewFrame::Exec_Impl(SfxRequest &rReq ) -{ - // Wenn gerade die Shells ausgetauscht werden... - if ( !GetObjectShell() || !GetViewShell() ) - return; - - switch ( rReq.GetSlot() ) - { - case SID_SHOWPOPUPS : - { - SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE); - BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE; - SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE); - USHORT nId = pIdItem ? pIdItem->GetValue() : 0; - - // ausfuehren - SfxWorkWindow *pWorkWin = GetFrame()->GetWorkWindow_Impl(); - if ( bShow ) - { - // Zuerst die Floats auch anzeigbar machen - pWorkWin->MakeChildsVisible_Impl( bShow ); - GetDispatcher()->Update_Impl( TRUE ); - - // Dann anzeigen - GetBindings().HidePopups( !bShow ); - } - else - { - // Alles hiden - SfxBindings *pBind = &GetBindings(); - while ( pBind ) - { - pBind->HidePopupCtrls_Impl( !bShow ); - pBind = pBind->GetSubBindings_Impl(); - } - - pWorkWin->HidePopups_Impl( !bShow, TRUE, nId ); - pWorkWin->MakeChildsVisible_Impl( bShow ); - } - - Invalidate( rReq.GetSlot() ); - rReq.Done(); - break; - } - - case SID_ACTIVATE: - { - MakeActive_Impl( TRUE ); - rReq.SetReturnValue( SfxObjectItem( 0, this ) ); - break; - } - - case SID_WIN_POSSIZE: - break; - - case SID_NEWDOCDIRECT : - { - SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); - String aFactName; - if ( pFactoryItem ) - aFactName = pFactoryItem->GetValue(); - else if ( pImp->aFactoryName.Len() ) - aFactName = pImp->aFactoryName; - else - { - DBG_ERROR("Missing argument!"); - break; - } - - SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() ); - String aFact = String::CreateFromAscii("private:factory/"); - aFact += aFactName; - aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); - aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, GetFrame() ) ); - aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_blank" ) ) ); - SFX_APP()->ExecuteSlot( aReq ); - const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); - if ( pItem ) - rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); - break; - } - - case SID_CLOSEWIN: - { - // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); - if ( !xTask.is() ) - break; - - if ( GetViewShell()->PrepareClose() ) - { - // weitere Views auf dasselbe Doc? - SfxObjectShell *pDocSh = GetObjectShell(); - int bOther = sal_False; - for ( const SfxTopViewFrame *pFrame = - (SfxTopViewFrame *)SfxViewFrame::GetFirst( pDocSh, TYPE(SfxTopViewFrame) ); - !bOther && pFrame; - pFrame = (SfxTopViewFrame *)SfxViewFrame::GetNext( *pFrame, pDocSh, TYPE(SfxTopViewFrame) ) ) - bOther = (pFrame != this); - - // Doc braucht nur gefragt zu werden, wenn keine weitere View - sal_Bool bClosed = sal_False; - sal_Bool bUI = TRUE; - if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) - { - if ( !bOther ) - pDocSh->SetModified( FALSE ); - rReq.Done(); // unbedingt vor Close() rufen! - bClosed = sal_False; - try - { - xTask->close(sal_True); - bClosed = sal_True; - } - catch( CloseVetoException& ) - { - bClosed = sal_False; - } - } - - rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed )); - } - return; - } - } - - rReq.Done(); -} - -void SfxTopViewFrame::GetState_Impl( SfxItemSet &rSet ) -{ - SfxObjectShell *pDocSh = GetObjectShell(); - - if ( !pDocSh ) - return; - - const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges, "Set ohne Bereich"); - while ( *pRanges ) - { - for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) - { - switch(nWhich) - { - case SID_NEWDOCDIRECT : - { - if ( pImp->aFactoryName.Len() ) - { - String aFact = String::CreateFromAscii("private:factory/"); - aFact += pImp->aFactoryName; - rSet.Put( SfxStringItem( nWhich, aFact ) ); - } - break; - } - - case SID_NEWWINDOW: - rSet.DisableItem(nWhich); - break; - - case SID_CLOSEWIN: - { - // disable CloseWin, if frame is not a task - Reference < XCloseable > xTask( GetFrame()->GetFrameInterface(), UNO_QUERY ); - if ( !xTask.is() ) - rSet.DisableItem(nWhich); - break; - } - - case SID_SHOWPOPUPS : - break; - - case SID_WIN_POSSIZE: - { - rSet.Put( SfxRectangleItem( nWhich, Rectangle( - GetWindow().GetPosPixel(), GetWindow().GetSizePixel() ) ) ); - break; - } - - default: - DBG_ERROR( "invalid message-id" ); - } - } - ++pRanges; - } -} - -void SfxTopViewFrame::INetExecute_Impl( SfxRequest &rRequest ) -{ - sal_uInt16 nSlotId = rRequest.GetSlot(); - switch( nSlotId ) - { - case SID_BROWSE_FORWARD: - case SID_BROWSE_BACKWARD: - { - // Anzeige der n"achsten oder vorherigen Seite aus der History - SFX_REQUEST_ARG( rRequest, pSteps, SfxUInt16Item, nSlotId, sal_False ); - GetFrame()->Browse( nSlotId == SID_BROWSE_FORWARD, pSteps ? pSteps->GetValue() : 1, - (rRequest.GetModifier() & KEY_MOD1) != 0 ); - break; - } - case SID_CREATELINK: - { -/*! (pb) we need new implementation to create a link -*/ - break; - } - case SID_BROWSE_STOP: - { - if ( GetCancelManager() ) - GetCancelManager()->Cancel( TRUE ); - - // cancel jobs in hidden tasks - SfxFrameArr_Impl& rArr = *SFX_APP()->Get_Impl()->pTopFrames; - for( USHORT nPos = rArr.Count(); nPos--; ) - { - SfxFrame *pFrame = rArr[ nPos ]; - if ( !pFrame->GetCurrentViewFrame() ) - pFrame->GetCancelManager()->Cancel( TRUE ); - } - - break; - } - case SID_FOCUSURLBOX: - { - SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); - if( pCache ) - { - SfxControllerItem* pCtrl = pCache->GetItemLink(); - while( pCtrl ) - { - pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 ); - pCtrl = pCtrl->GetItemLink(); - } - } - } - } - - // Recording - rRequest.Done(); -} - -void SfxTopViewFrame::INetState_Impl( SfxItemSet &rItemSet ) -{ - if ( !GetFrame()->CanBrowseForward() ) - rItemSet.DisableItem( SID_BROWSE_FORWARD ); - - if ( !GetFrame()->CanBrowseBackward() ) - rItemSet.DisableItem( SID_BROWSE_BACKWARD ); - - // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen - SfxObjectShell *pDocSh = GetObjectShell(); - sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); - sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; - if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) - rItemSet.DisableItem( SID_CREATELINK ); - - pImp->pStopButtonTimer->SetButtonState( GetCancelManager()->CanCancel() ); - if ( !pImp->pStopButtonTimer->GetButtonState() ) - rItemSet.DisableItem( SID_BROWSE_STOP ); -} - -void SfxTopViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) -{ - GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); -} - -void SfxTopViewFrame::Activate( sal_Bool bMDI ) -{ - DBG_ASSERT(GetViewShell(), "Keine Shell"); - if ( bMDI ) - pImp->bActive = sal_True; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! -} - -void SfxTopViewFrame::Deactivate( sal_Bool bMDI ) -{ - DBG_ASSERT(GetViewShell(), "Keine Shell"); - if ( bMDI ) - pImp->bActive = sal_False; -//(mba): hier evtl. wie in Beanframe NotifyEvent ?! -} - -void SfxTopFrame::CheckMenuCloser_Impl( MenuBar* pMenuBar ) -{ - Reference < ::com::sun::star::frame::XFrame > xFrame = GetFrameInterface(); - - // checks if there is more than one "real" (not help) task window - // in this case a close button is inserted into the menubar - - DBG_ASSERT( xFrame.is(), "Attention: this bug is very hard to reproduce. Please try to remember how you triggered it!"); - if ( !xFrame.is() || !xFrame->getController().is() ) - // dummy component - return; - - Reference < ::com::sun::star::frame::XFramesSupplier > xDesktop( xFrame->getCreator(), UNO_QUERY ); - if ( !xDesktop.is() ) - // test only for task windows - return; - - sal_Bool bLastTask = sal_False; - Reference < ::com::sun::star::container::XIndexAccess > - xList ( xDesktop->getFrames(), ::com::sun::star::uno::UNO_QUERY ); - sal_Int32 nCount = xList->getCount(); - if ( nCount<=1 ) - // only one task - bLastTask = sal_True; - else if ( nCount==2 ) - { - // if we have to tasks, one can be the help task, that should be ignored - for( sal_Int32 i=0; i<nCount; ++i ) - { - Reference < ::com::sun::star::frame::XFrame > xTask; - ::com::sun::star::uno::Any aVal = xList->getByIndex(i); - if ( (aVal>>=xTask) && xTask.is() && xTask->getName().compareToAscii("OFFICE_HELP_TASK") == COMPARE_EQUAL ) - { - // one of the two open tasks was the help task -> ignored - bLastTask = sal_True; - break; - } - } - } - - pMenuBar->ShowCloser(bLastTask); -} diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx index 932b698c753e..e716e604b649 100644 --- a/sfx2/source/view/userinputinterception.cxx +++ b/sfx2/source/view/userinputinterception.cxx @@ -1,31 +1,29 @@ /************************************************************************* -* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -* -* Copyright 2008 by Sun Microsystems, Inc. -* -* OpenOffice.org - a multi-platform office productivity suite -* -* $RCSfile: userinputinterception.cxx,v $ -* -* $Revision: 1.2 $ -* -* This file is part of OpenOffice.org. -* -* OpenOffice.org is free software: you can redistribute it and/or modify -* it under the terms of the GNU Lesser General Public License version 3 -* only, as published by the Free Software Foundation. -* -* OpenOffice.org is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU Lesser General Public License version 3 for more details -* (a copy is included in the LICENSE file that accompanied this code). -* -* You should have received a copy of the GNU Lesser General Public License -* version 3 along with OpenOffice.org. If not, see -* <http://www.openoffice.org/license.html> -* for a copy of the LGPLv3 License. -************************************************************************/ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ***********************************************************************/ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sfx2.hxx" diff --git a/sfx2/source/view/view.hrc b/sfx2/source/view/view.hrc index 39c94d21b8e7..3dce1ec795bb 100644 --- a/sfx2/source/view/view.hrc +++ b/sfx2/source/view/view.hrc @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: view.hrc,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/view/view.hxx b/sfx2/source/view/view.hxx index 6781bfd1d9c9..20e542d90bc7 100644 --- a/sfx2/source/view/view.hxx +++ b/sfx2/source/view/view.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: view.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/view/view.src b/sfx2/source/view/view.src index b0e4cb29fbea..b4c09a0677ed 100644 --- a/sfx2/source/view/view.src +++ b/sfx2/source/view/view.src @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: view.src,v $ - * $Revision: 1.55 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/sfx2/source/view/viewfac.cxx b/sfx2/source/view/viewfac.cxx index 1114b5864641..a633403a2bb1 100644 --- a/sfx2/source/view/viewfac.cxx +++ b/sfx2/source/view/viewfac.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: viewfac.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -34,6 +31,7 @@ #include <sfx2/app.hxx> #include "sfx2/viewfac.hxx" +#include <rtl/ustrbuf.hxx> // STATIC DATA ----------------------------------------------------------- @@ -51,6 +49,14 @@ void SfxViewFactory::InitFactory() (*fnInit)(); } +String SfxViewFactory::GetViewName() const +{ + ::rtl::OUStringBuffer aViewName; + aViewName.appendAscii( "view" ); + aViewName.append( sal_Int32( GetOrdinal() ) ); + return aViewName.makeStringAndClear(); +} + // CTOR / DTOR ----------------------------------------------------------- SfxViewFactory::SfxViewFactory( SfxViewCtor fnC, SfxViewInit fnI, USHORT nOrdinal ): diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index ba2bcc7615c7..1cd34d41ed8b 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: viewfrm.cxx,v $ - * $Revision: 1.136.8.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -37,6 +34,7 @@ #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> #include <toolkit/unohlp.hxx> #include <vcl/splitwin.hxx> @@ -50,6 +48,7 @@ #include <vcl/msgbox.hxx> #include <svtools/sfxecode.hxx> #include <svtools/ehdl.hxx> +#include <tools/diagnose_ex.h> #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> @@ -58,8 +57,9 @@ #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XModel2.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> @@ -73,6 +73,8 @@ #include <unotools/localfilehelper.hxx> #include <unotools/ucbhelper.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <comphelper/configurationhelper.hxx> #include <com/sun/star/uno/Reference.h> @@ -93,6 +95,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; +using ::com::sun::star::awt::XWindow; +using ::com::sun::star::beans::PropertyValue; namespace css = ::com::sun::star; #ifndef GCC @@ -122,7 +126,7 @@ namespace css = ::com::sun::star; #include <sfx2/docfile.hxx> #include <sfx2/module.hxx> #include <sfx2/msgpool.hxx> -#include <sfx2/topfrm.hxx> +#include <sfx2/viewfrm.hxx> #include "viewimp.hxx" #include <sfx2/sfxbasecontroller.hxx> #include <sfx2/sfx.hrc> @@ -135,11 +139,14 @@ namespace css = ::com::sun::star; #include "macro.hxx" #include "sfx2/minfitem.hxx" #include "../appl/app.hrc" +#include "impviewframe.hxx" + //------------------------------------------------------------------------- DBG_NAME(SfxViewFrame) #define SfxViewFrame #include "sfxslots.hxx" +#undef SfxViewFrame //------------------------------------------------------------------------- @@ -157,54 +164,6 @@ TYPEINIT1(SfxViewFrameItem, SfxPoolItem); //========================================================================= -struct SfxViewFrame_Impl -{ - SvBorder aBorder; - Size aMargin; - Size aSize; - String aViewData; - String aFrameTitle; - TypeId aLastType; - String aActualURL; - String aActualPresentationURL; - SfxFrame* pFrame; - SfxCancelManager* pCancelMgr; - svtools::AsynchronLink* pReloader; - //SfxInPlaceFrame* pIPFrame; - Window* pWindow; - SfxViewFrame* pActiveChild; - SfxViewFrame* pParentViewFrame; - SfxObjectShell* pImportShell; - Window* pFocusWin; - SfxMacro* pMacro; - sal_uInt16 nDocViewNo; - sal_uInt16 nCurViewId; - sal_Bool bResizeInToOut:1; - sal_Bool bDontOverwriteResizeInToOut:1; - sal_Bool bObjLocked:1; - sal_Bool bRestoreView:1; - sal_Bool bSetViewFrameLocked:1; - sal_Bool bReloading:1; - sal_Bool bIsDowning:1; - sal_Bool bInCtor:1; - sal_Bool bModal:1; - sal_Bool bEnabled:1; - sal_Bool bEventFlag:1; - sal_Bool bWindowWasEnabled:1; - - SfxViewFrame_Impl() - : pReloader(0 ) - , pMacro( 0 ) - , bWindowWasEnabled(sal_True) - {} - - ~SfxViewFrame_Impl() - { - delete pReloader; - delete pCancelMgr; - } -}; - //------------------------------------------------------------------------- void SfxViewFrame::SetDowning_Impl() { @@ -218,31 +177,7 @@ sal_Bool SfxViewFrame::IsDowning_Impl() const } -//------------------------------------------------------------------------- -void SfxViewFrame::SetSetViewFrameAllowed_Impl( sal_Bool bSet ) -{ - pImp->bSetViewFrameLocked = !bSet; -}; - -//------------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsSetViewFrameAllowed_Impl() const -{ - return !pImp->bSetViewFrameLocked; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetImportingObjectShell_Impl( SfxObjectShell* pSh ) -{ - pImp->pImportShell = pSh; -} - //-------------------------------------------------------------------- -SfxObjectShell* SfxViewFrame::GetImportingObjectShell_Impl() const -{ - return pImp->pImportShell; -} - - class SfxViewNotificatedFrameList_Impl : public SfxListener, public SfxViewFrameArr_Impl { @@ -298,7 +233,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq, sal_Bool bAsync ) void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { - SfxFrame *pParent = GetFrame()->GetParentFrame(); + SfxFrame *pParent = GetFrame().GetParentFrame(); if ( rReq.GetSlot() == SID_RELOAD ) { // Bei CTRL-Reload den aktiven Frame reloaden @@ -318,11 +253,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // Wenn nur ein Reload der Graphiken eines oder mehrerer ChildFrames // gemacht werden soll - SfxFrame *pFrame = GetFrame(); - if ( pParent == pFrame && pFrame->GetChildFrameCount() ) + SfxFrame& rFrame = GetFrame(); + if ( pParent == &rFrame && rFrame.GetChildFrameCount() ) { sal_Bool bReloadAvailable = sal_False; - SfxFrameIterator aIter( *pFrame, sal_False ); + SfxFrameIterator aIter( rFrame, sal_False ); SfxFrame *pChild = aIter.FirstFrame(); while ( pChild ) { @@ -355,13 +290,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } SfxObjectShell* pSh = GetObjectShell(); - sal_Bool bWasReadonly = pSh->IsReadOnly(); - switch ( rReq.GetSlot() ) { case SID_EDITDOC: { - if ( GetFrame()->HasComponent() ) + if ( GetFrame().HasComponent() ) break; // Wg. Doppeltbelegung in Toolboxen (mit/ohne Ctrl) ist es auch @@ -497,12 +430,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // r/o-Doc kann nicht in Editmode geschaltet werden? rReq.Done( sal_False ); - SFX_REQUEST_ARG( rReq, pFSetItem, SfxBoolItem, SID_EDIT_FRAMESET, sal_False); if ( nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI() ) { // dem ::com::sun::star::sdbcx::User anbieten, als Vorlage zu oeffnen QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_OPENASTEMPLATE) ); - if ( !pFSetItem && RET_YES == aBox.Execute() ) + if ( RET_YES == aBox.Execute() ) { SfxApplication* pApp = SFX_APP(); SfxAllItemSet aSet( pApp->GetPool() ); @@ -543,16 +475,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) rReq.Done( sal_True ); // if( nOpenMode == SFX_STREAM_READONLY ) // pMed->Close(); - - // ReloadForEdit bei Framesets schaltet auch FramesetEditmode - sal_Bool bIsReadonly = GetObjectShell()->IsReadOnly(); - if ( bIsReadonly != bWasReadonly && !GetFrame()->GetParentFrame() ) - { - SfxBoolItem aItem( SID_EDIT_FRAMESET, !bIsReadonly ); - GetDispatcher()->Execute( SID_EDIT_FRAMESET, - SFX_CALLMODE_RECORD, &aItem, 0L ); - pSh->Broadcast( SfxSimpleHint( SFX_HINT_TITLECHANGED ) ); - } return; } } @@ -595,7 +517,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // AutoLoad ist ggf. verboten SFX_REQUEST_ARG(rReq, pAutoLoadItem, SfxBoolItem, SID_AUTOLOAD, sal_False); if ( pAutoLoadItem && pAutoLoadItem->GetValue() && - GetFrame()->IsAutoLoadLocked_Impl() ) + GetFrame().IsAutoLoadLocked_Impl() ) return; SfxObjectShellLock xOldObj( pSh ); @@ -610,7 +532,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // ggf. beim User nachfragen sal_Bool bDo = ( GetViewShell()->PrepareClose() != FALSE ); SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, sal_False); - if ( bDo && GetFrame()->DocIsModified_Impl() && + if ( bDo && GetFrame().DocIsModified_Impl() && !rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) ) { QueryBox aBox( &GetWindow(), SfxResId(MSG_QUERY_LASTVERSION) ); @@ -630,25 +552,21 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // bestehende SfxMDIFrames f"ur dieses Doc leeren // eigenes Format oder R/O jetzt editierbar "offnen? - SfxViewNotificatedFrameList_Impl aFrames; SfxObjectShellLock xNewObj; - sal_Bool bRestoreView = ( pURLItem == NULL ); - TypeId aOldType = xOldObj->Type(); - SfxViewFrame *pView = GetFirst(xOldObj); - while(pView) + // collect the views of the document + // TODO: when UNO ViewFactories are available for SFX-based documents, the below code should + // be UNOized, too + typedef ::std::pair< Reference< XFrame >, USHORT > ViewDescriptor; + ::std::list< ViewDescriptor > aViewFrames; + SfxViewFrame *pView = GetFirst( xOldObj ); + while ( pView ) { - if( bHandsOff ) - pView->GetDispatcher()->LockUI_Impl(sal_True); - aFrames.InsertViewFrame( pView ); - pView->GetBindings().ENTERREGISTRATIONS(); - - // RestoreView nur wenn keine neue Datei geladen - // (Client-Pull-Reloading) - pView = /*bHandsOff ? (SfxTopViewFrame*) GetFirst( - xOldObj, TYPE(SfxTopViewFrame) ) :*/ - (SfxTopViewFrame*)GetNext( *pView, xOldObj, - TYPE( SfxTopViewFrame ) ); + Reference< XFrame > xFrame( pView->GetFrame().GetFrameInterface() ); + OSL_ENSURE( xFrame.is(), "SfxViewFrame::ExecReload_Impl: no XFrame?!" ); + aViewFrames.push_back( ViewDescriptor( xFrame, pView->GetCurViewId() ) ); + + pView = GetNext( *pView, xOldObj ); } DELETEZ( xOldObj->Get_Impl()->pReloadTimer ); @@ -671,7 +589,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { pNewSet = new SfxAllItemSet( *pMedium->GetItemSet() ); pNewSet->ClearItem( SID_VIEW_ID ); - pNewSet->ClearItem( SID_USER_DATA ); pNewSet->ClearItem( SID_STREAM ); pNewSet->ClearItem( SID_INPUTSTREAM ); pNewSet->Put( SfxStringItem( SID_FILTER_NAME, pMedium->GetFilter()->GetName() ) ); @@ -740,9 +657,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedOptions, SfxStringItem, SID_FILE_FILTEROPTIONS, sal_False); SFX_ITEMSET_ARG( pMedium->GetItemSet(), pSavedReferer, SfxStringItem, SID_REFERER, sal_False); - if( !pURLItem || pURLItem->GetValue() == xOldObj->GetMedium()->GetName() ) - xOldObj->Get_Impl()->bForbidCaching = sal_True; - sal_Bool bHasStorage = pMedium->HasStorage_Impl(); if( bHandsOff ) { @@ -757,12 +671,12 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) } xNewObj = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_STANDARD ); + uno::Sequence < beans::PropertyValue > aLoadArgs; + TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs ); try { - uno::Sequence < beans::PropertyValue > aProps; - TransformItems( SID_OPENDOC, *pNewSet, aProps ); uno::Reference < frame::XLoadable > xLoad( xNewObj->GetModel(), uno::UNO_QUERY ); - xLoad->load( aProps ); + xLoad->load( aLoadArgs ); } catch ( uno::Exception& ) { @@ -814,54 +728,41 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) { if ( xNewObj->IsDocShared() ) { - // the file is shared but the closing can chang the sharing control file + // the file is shared but the closing can change the sharing control file xOldObj->DoNotCleanShareControlFile(); } + // the Reload and Silent items were only temporary, remove them xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_RELOAD ); xNewObj->GetMedium()->GetItemSet()->ClearItem( SID_SILENT ); - UpdateDocument_Impl(); - } - - SfxViewFrame* pThis = (SfxViewFrame*)this; - sal_Bool bDeleted = aFrames.C40_GETPOS( SfxViewFrame, pThis ) == USHRT_MAX; + TransformItems( SID_OPENDOC, *xNewObj->GetMedium()->GetItemSet(), aLoadArgs ); - if( !bDeleted ) - { - GetBindings().Invalidate( SID_RELOAD ); - pImp->bReloading = sal_False; + UpdateDocument_Impl(); } - // neues Doc in die bestehenden SfxMDIFrames einsetzen; wenn - // das Reload geklappt hat, mu\s in diesem Frame kein Dokument - // eingesetzt werden, weil das schon vom LoadEnvironment - // gemacht wurde - if ( xNewObj.Is() && xNewObj->Type() != aOldType ) - // RestoreView nur, wenn gleicher Dokumenttyp - bRestoreView = sal_False; - - const sal_uInt16 nCount = aFrames.Count(); - for(sal_uInt16 i = 0; i < nCount; ++i) + if ( xNewObj.Is() ) { - SfxViewFrame *pCurrView = aFrames.GetObject( i ); - if ( xNewObj.Is() ) + try { - //if( /*!bHandsOff &&*/ this != pView ) - pCurrView->ReleaseObjectShell_Impl( bRestoreView ); - pCurrView->SetRestoreView_Impl( bRestoreView ); - //if( pView != this || !xNewObj.Is() ) + while ( !aViewFrames.empty() ) { - SfxFrame *pFrame = pCurrView->GetFrame(); - pFrame->InsertDocument(xNewObj.Is() ? xNewObj : xOldObj ); + LoadViewIntoFrame_Impl( *xNewObj, aViewFrames.front().first, aLoadArgs, aViewFrames.front().second, false ); + aViewFrames.pop_front(); + } + } + catch( const Exception& ) + { + // close the remaining frames + // Don't catch exceptions herein, if this fails, then we're left in an indetermined state, and + // crashing is better than trying to proceed + while ( !aViewFrames.empty() ) + { + Reference< util::XCloseable > xClose( aViewFrames.front().first, UNO_QUERY_THROW ); + xClose->close( sal_True ); + aViewFrames.pop_front(); } } - pCurrView->GetBindings().LEAVEREGISTRATIONS(); - pCurrView->GetDispatcher()->LockUI_Impl( sal_False ); - } - - if ( xNewObj.Is() ) - { // Propagate document closure. SFX_APP()->NotifyEvent( SfxEventHint( SFX_EVENT_CLOSEDOC, GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ), xOldObj ) ); } @@ -869,11 +770,6 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) // als erledigt recorden rReq.Done( sal_True ); rReq.SetReturnValue(SfxBoolItem(rReq.GetSlot(), sal_True)); - if( !bDeleted ) - { - Notify( *GetObjectShell(), SfxSimpleHint( - SFX_HINT_TITLECHANGED )); - } return; } else @@ -896,11 +792,11 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) // Ich bin gerade am Reloaden und Yielde so vor mich hin ... return; - GetFrame()->GetParentFrame(); + GetFrame().GetParentFrame(); SfxWhichIter aIter( rSet ); for ( sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich() ) { - if ( GetFrame()->HasComponent() ) + if ( GetFrame().HasComponent() ) { // Wenn die Komponente es nicht selbst dispatched, dann // macht es auch keinen Sinn! @@ -928,16 +824,7 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) case SID_RELOAD: { - SfxFrame* pFrame = GetTopFrame(); - SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); - if ( pView && pView->GetViewShell() && - pView->GetViewShell()->IsImplementedAsFrameset_Impl() && - pView->GetViewShell()->GetInterface()->GetSlot( nWhich ) ) - { - // Hack f"ur Explorer: Reload wird an der ViewShell ausgef"uhrt - pView->GetViewShell()->GetSlotState( nWhich, 0, &rSet ); - break; - } + SfxFrame* pFrame = &GetTopFrame(); if ( !pSh || !pSh->CanReload_Impl() || pSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) rSet.DisableItem(nWhich); @@ -1008,7 +895,7 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) } else if ( GetViewShell() ) { - // der SW hat eigenes Undo an der ::com::sun::star::sdbcx::View + // der SW hat eigenes Undo an der View const SfxPoolItem *pRet = GetViewShell()->ExecuteSlot( rReq ); if ( pRet ) bOK = ((SfxBoolItem*)pRet)->GetValue(); @@ -1030,7 +917,7 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) SfxUndoManager *pShUndoMgr = pSh->GetUndoManager(); if ( !pShUndoMgr ) { - // der SW hat eigenes Undo an der ::com::sun::star::sdbcx::View + // der SW hat eigenes Undo an der View SfxWhichIter aIter( rSet ); SfxViewShell *pViewSh = GetViewShell(); if( !pViewSh ) return; @@ -1074,86 +961,30 @@ void SfxViewFrame::StateHistory_Impl( SfxItemSet &rSet ) } //-------------------------------------------------------------------- -void SfxViewFrame::SetObjectShell_Impl -( - SfxObjectShell& rObjSh, // eine initialisierte SfxObjectShell, - FASTBOOL bDefaultView // sal_True: nicht restaurieren -) - -/* [Beschreibung] - - Diese Methode setzt eine <SfxObjectShell> in den SfxViewFrame ein. - - Zuvor mu\s die vorherige SfxObjectShell, insofern schein eine gesetzt - wurde, mit der Methode ReleaseObjectShell() entfernt worden sein. Somit - kann durch Aufruf von ReleaseObjectShell() und SetObjectShell() die - SfxObjectShell ausgetauscht werden. - - - [Querverweise] - - <SfxViewFrame::ReleaseObjectShell()> -*/ - +void SfxViewFrame::PopShellAndSubShells_Impl( SfxViewShell& i_rViewShell ) { - DBG_CHKTHIS(SfxViewFrame, 0); - DBG_ASSERT( !xObjSh.Is(), "old feature used: only one Object per View!" ); - - GetFrame()->ReleasingComponent_Impl( sal_False ); - - // Doc einsetzen - xObjSh = &rObjSh; - if ( xObjSh.Is() && xObjSh->IsPreview() ) - SetQuietMode_Impl( sal_True ); - - GetFrame()->SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); - - // Modulshell einf"ugen - SfxModule* pModule = xObjSh->GetModule(); - if( pModule ) - pDispatcher->InsertShell_Impl( *pModule, 1 ); - - pDispatcher->Push( rObjSh ); - pDispatcher->Flush(); - StartListening( rObjSh ); - - rObjSh.ViewAssigned(); - pDispatcher->SetReadOnly_Impl( rObjSh.IsReadOnly() ); - - const SfxMedium *pMedium = GetObjectShell()->GetMedium(); - SFX_ITEMSET_ARG( - pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( !pHiddenItem || !pHiddenItem->GetValue() ) + i_rViewShell.PopSubShells_Impl(); + sal_uInt16 nLevel = pDispatcher->GetShellLevel( i_rViewShell ); + if ( nLevel != USHRT_MAX ) { - LockObjectShell_Impl(sal_True); - GetDocNumber_Impl(); + if ( nLevel ) + { + // more sub shells on the stack, which were not affected by PopSubShells_Impl + SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); + if ( pSubShell == i_rViewShell.GetSubShell() ) + // "real" sub shells will be deleted elsewhere + pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); + else + pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); + } + pDispatcher->Pop( i_rViewShell ); + pDispatcher->Flush(); } - // ::com::sun::star::sdbcx::View erzeugen - if ( bDefaultView ) - SetRestoreView_Impl( sal_False ); - -// So darf man es nicht machen, da LaodWindows hierueber laeuft. Kann meiner Meinung nach -// auch nur beim Reload mit Dokumenttypwechsel passieren. -/* if ( xObjSh->Type() != pImp->aLastType ) - SetRestoreView_Impl( sal_False ); */ - - SwitchToViewShell_Impl( !IsRestoreView_Impl() ? (sal_uInt16) 0 : GetCurViewId() ); - rObjSh.PostActivateEvent_Impl( this ); - if ( Current() == this ) - SFX_APP()->NotifyEvent(SfxEventHint(SFX_EVENT_ACTIVATEDOC, GlobalEventConfig::GetEventName( STR_EVENT_ACTIVATEDOC ), &rObjSh ) ); - - Notify( rObjSh, SfxSimpleHint(SFX_HINT_TITLECHANGED) ); - Notify( rObjSh, SfxSimpleHint(SFX_HINT_DOCCHANGED) ); - - // Zur Sicherheit, aber eigentlich sollte jetzt nichts mehr passieren - // ( kein erzwungenes Update ) - if ( SfxViewFrame::Current() == this ) - GetDispatcher()->Update_Impl(); } //-------------------------------------------------------------------- -void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) +void SfxViewFrame::ReleaseObjectShell_Impl() /* [Beschreibung] @@ -1165,7 +996,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) die SfxObjectShell ausgetauscht werden. Zwischen RealeaseObjectShell() und SetObjectShell() darf die Kontrolle - nicht an das ::com::sun::star::chaos::System abgegeben werden. + nicht an das System abgegeben werden. [Querverweise] @@ -1176,7 +1007,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) DBG_CHKTHIS(SfxViewFrame, 0); DBG_ASSERT( xObjSh.Is(), "no SfxObjectShell to release!" ); - GetFrame()->ReleasingComponent_Impl( sal_True ); + GetFrame().ReleasingComponent_Impl( sal_True ); if ( GetWindow().HasChildPathFocus( sal_True ) ) { DBG_ASSERT( !GetActiveChildFrame_Impl(), "Wrong active child frame!" ); @@ -1186,25 +1017,7 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) SfxViewShell *pDyingViewSh = GetViewShell(); if ( pDyingViewSh ) { - SetRestoreView_Impl( bStoreView ); - if ( bStoreView ) - pDyingViewSh->WriteUserData( GetViewData_Impl(), sal_True ); - - // Jetzt alle SubShells wechhauen - pDyingViewSh->PushSubShells_Impl( sal_False ); - sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pDyingViewSh ); - if ( nLevel && nLevel != USHRT_MAX ) - { - // Es gibt immer nocht SubShells - SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); - if ( pSubShell == pDyingViewSh->GetSubShell() ) - //"Echte" Subshells nicht deleten - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); - else - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); - } - pDispatcher->Pop( *pDyingViewSh ); - pDispatcher->Flush(); + PopShellAndSubShells_Impl( *pDyingViewSh ); pDyingViewSh->DisconnectAllClients(); SetViewShell_Impl(0); delete pDyingViewSh; @@ -1243,116 +1056,26 @@ void SfxViewFrame::ReleaseObjectShell_Impl( sal_Bool bStoreView ) GetDispatcher()->SetDisableFlags( 0 ); } -//------------------------------------------------------------------------- - -String SfxViewFrame::UpdateTitle() - -/* [Beschreibung] - - Mit dieser Methode kann der SfxMDIFrame gezwungen werden, sich sofort - den neuen Titel vom der <SfxObjectShell> zu besorgen. - - [Anmerkung] - - Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener - zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren - m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxMDIFrames) - jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung - nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. - - - [Beispiel] - - void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) - { - if ( rHint.IsA(TYPE(SfxSimpleHint)) ) - { - switch( ( (SfxSimpleHint&) rHint ).GetId() ) - { - case SFX_HINT_TITLECHANGED: - for ( SfxMDIFrame *pMDI = (SfxMDIFrame*) - SfxViewFrame::GetFirst(this, TYPE(SfxMDIFrame)); - pMDI; - pMDI = (SfxMDIFrame*) - SfxViewFrame::GetNext(this, TYPE(SfxMDIFrame)); - { - pMDI->UpdateTitle(); - ... pMDI->GetName() ... - } - break; - ... - } - } - } -*/ - -{ - SfxObjectShell *pObjSh = GetObjectShell(); - if ( !pObjSh ) - return String(); - -// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) -// // kein UpdateTitle mit Embedded-ObjectShell -// return String(); - - const SfxMedium *pMedium = pObjSh->GetMedium(); - String aURL; - GetFrame(); // -Wall required?? - if ( pObjSh->HasName() ) - { - INetURLObject aTmp( pMedium->GetName() ); - aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); - } - - if ( aURL != pImp->aActualURL ) - // URL hat sich ge"andert - pImp->aActualURL = aURL; - - // gibt es noch eine weitere View? - sal_uInt16 nViews=0; - for ( SfxViewFrame *pView= GetFirst(pObjSh); - pView && nViews<2; - pView = GetNext(*pView,pObjSh) ) - if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && - !IsDowning_Impl()) - nViews++; - - // Titel des Fensters - String aTitle; - if ( nViews == 2 || pImp->nDocViewNo > 1 ) - // dann die Nummer dranh"angen - aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); - else - aTitle = pObjSh->UpdateTitle(); - - // Name des SbxObjects - String aSbxName = pObjSh->SfxShell::GetName(); - if ( IsVisible_Impl() ) - { - aSbxName += ':'; - aSbxName += String::CreateFromInt32(pImp->nDocViewNo); - } - - SetName( aSbxName ); - pImp->aFrameTitle = aTitle; - GetBindings().Invalidate( SID_FRAMETITLE ); - GetBindings().Invalidate( SID_CURRENT_URL ); - return aTitle; -} - - //-------------------------------------------------------------------- sal_Bool SfxViewFrame::Close() { DBG_CHKTHIS(SfxViewFrame, 0); - DBG_ASSERT( GetFrame()->IsClosing_Impl() || !GetFrame()->GetFrameInterface().is(), "ViewFrame closed too early!" ); + DBG_ASSERT( GetFrame().IsClosing_Impl() || !GetFrame().GetFrameInterface().is(), "ViewFrame closed too early!" ); // Wenn bis jetzt noch nicht gespeichert wurde, sollen eingebettete Objekte // auch nicht mehr automatisch gespeichert werden! if ( GetViewShell() ) GetViewShell()->DiscardClients_Impl(); - Broadcast( SfxSimpleHint(SFX_HINT_DYING) ); + Broadcast( SfxSimpleHint( SFX_HINT_DYING ) ); + + if (SfxViewFrame::Current() == this) + SfxViewFrame::SetViewFrame( NULL ); + + // Da der Dispatcher leer ger"aumt wird, kann man ihn auch nicht mehr + // vern"unftig verwenden - also besser still legen + GetDispatcher()->Lock(sal_True); + delete this; return sal_True; } @@ -1393,7 +1116,7 @@ void SfxViewFrame::DoActivate( sal_Bool bUI, SfxViewFrame* pOldFrame ) SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { - if ( !pOldFrame || !pOldFrame->GetFrame()->IsParent( pFrame->GetFrame() ) ) + if ( !pOldFrame || !pOldFrame->GetFrame().IsParent( &pFrame->GetFrame() ) ) pFrame->pDispatcher->DoParentActivate_Impl(); pFrame = pFrame->GetParentViewFrame(); } @@ -1411,8 +1134,8 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) // ViewFrames, erh"alt er ein ParentDeactivate if ( bUI ) { -// if ( GetFrame()->GetWorkWindow_Impl() ) -// GetFrame()->GetWorkWindow_Impl()->SaveStatus_Impl(); +// if ( GetFrame().GetWorkWindow_Impl() ) +// GetFrame().GetWorkWindow_Impl()->SaveStatus_Impl(); /* SfxMedium* pMed = GetObjectShell() ? GetObjectShell()->GetMedium() : NULL; if( pMed ) @@ -1427,7 +1150,7 @@ void SfxViewFrame::DoDeactivate(sal_Bool bUI, SfxViewFrame* pNewFrame ) SfxViewFrame *pFrame = GetParentViewFrame(); while ( pFrame ) { - if ( !pNewFrame || !pNewFrame->GetFrame()->IsParent( pFrame->GetFrame() ) ) + if ( !pNewFrame || !pNewFrame->GetFrame().IsParent( &pFrame->GetFrame() ) ) pFrame->pDispatcher->DoParentDeactivate_Impl(); pFrame = pFrame->GetParentViewFrame(); } @@ -1444,7 +1167,7 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) { if ( GetViewShell() && GetWindow().IsVisible() ) { - if ( GetFrame()->IsInPlace() ) + if ( GetFrame().IsInPlace() ) { /* Size aSize( GetViewShell()->GetWindow()->GetSizePixel() ); @@ -1456,24 +1179,8 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) return; } - if ( GetViewShell()->UseObjectSize() ) - { - // Zun"achst die Gr"o\se des MDI-Fensters berechnen - - DoAdjustPosSizePixel( GetViewShell(), Point(), - GetViewShell()->GetWindow()->GetSizePixel() ); - - // Da nach einem InnerResize die Position des EditFensters und - // damit auch der Tools nocht stimmt, mu\s nun noch einmal von - // au\sen resized werden ! - - ForceOuterResize_Impl(sal_True); - } - DoAdjustPosSizePixel( (SfxViewShell *) GetViewShell(), Point(), GetWindow().GetOutputSizePixel() ); - if ( GetViewShell()->UseObjectSize() ) - ForceOuterResize_Impl(sal_False); } } } @@ -1481,12 +1188,43 @@ void SfxViewFrame::InvalidateBorderImpl( const SfxViewShell* pSh ) //------------------------------------------------------------------------ sal_Bool SfxViewFrame::SetBorderPixelImpl ( - const SfxViewShell* /*pSh*/, + const SfxViewShell* pVSh, const SvBorder& rBorder ) { pImp->aBorder = rBorder; + + if ( IsResizeInToOut_Impl() && !GetFrame().IsInPlace() ) + { + Size aSize = pVSh->GetWindow()->GetOutputSizePixel(); + if ( aSize.Width() && aSize.Height() ) + { + aSize.Width() += rBorder.Left() + rBorder.Right(); + aSize.Height() += rBorder.Top() + rBorder.Bottom(); + + Size aOldSize = GetWindow().GetOutputSizePixel(); + GetWindow().SetOutputSizePixel( aSize ); + Window* pParent = &GetWindow(); + while ( pParent->GetParent() ) + pParent = pParent->GetParent(); + Size aOuterSize = pParent->GetOutputSizePixel(); + aOuterSize.Width() += ( aSize.Width() - aOldSize.Width() ); + aOuterSize.Height() += ( aSize.Height() - aOldSize.Height() ); + pParent->SetOutputSizePixel( aOuterSize ); + } + } + else + { + Point aPoint; + Rectangle aEditArea( aPoint, GetWindow().GetOutputSizePixel() ); + aEditArea.Left() += rBorder.Left(); + aEditArea.Right() -= rBorder.Right(); + aEditArea.Top() += rBorder.Top(); + aEditArea.Bottom() -= rBorder.Bottom(); + pVSh->GetWindow()->SetPosSizePixel( aEditArea.TopLeft(), aEditArea.GetSize() ); + } + return sal_True; } @@ -1504,15 +1242,22 @@ const SvBorder& SfxViewFrame::GetBorderPixelImpl void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { {DBG_CHKTHIS(SfxViewFrame, 0);} - if ( !xObjSh.Is() ) + + if( IsDowning_Impl()) return; + // we know only SimpleHints if ( rHint.IsA(TYPE(SfxSimpleHint)) ) { switch( ( (SfxSimpleHint&) rHint ).GetId() ) { case SFX_HINT_MODECHANGED: { + UpdateTitle(); + + if ( !xObjSh.Is() ) + break; + // r/o Umschaltung? SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); @@ -1554,13 +1299,15 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) break; } - case SFX_HINT_DYING: case SFX_HINT_DEINITIALIZING: + GetFrame().DoClose(); + break; + case SFX_HINT_DYING: // when the Object is being deleted, destroy the view too if ( xObjSh.Is() ) ReleaseObjectShell_Impl(); else - GetFrame()->DoClose(); + GetFrame().DoClose(); break; } @@ -1585,6 +1332,9 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_EVENT_OPENDOC: case SFX_EVENT_CREATEDOC: { + if ( !xObjSh.Is() ) + break; + SfxBindings& rBind = GetBindings(); rBind.Invalidate( SID_RELOAD ); rBind.Invalidate( SID_EDITDOC ); @@ -1608,7 +1358,7 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) case SFX_EVENT_TOGGLEFULLSCREENMODE: { - if ( GetFrame()->OwnsBindings_Impl() ) + if ( GetFrame().OwnsBindings_Impl() ) GetBindings().GetDispatcher_Impl()->Update_Impl( sal_True ); break; } @@ -1619,26 +1369,18 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) //------------------------------------------------------------------------ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { - pImp->pFrame->DocumentInserted( pObjSh ); - pImp->bInCtor = sal_True; - pImp->pParentViewFrame = 0; pImp->bResizeInToOut = sal_True; pImp->bDontOverwriteResizeInToOut = sal_False; - pImp->pImportShell = 0; pImp->bObjLocked = sal_False; - pImp->bEventFlag = sal_True; pImp->pFocusWin = 0; pImp->pActiveChild = NULL; - pImp->bRestoreView = sal_False; pImp->nCurViewId = 0; - pImp->bSetViewFrameLocked = sal_False; pImp->bReloading = sal_False; pImp->bIsDowning = sal_False; pImp->bModal = sal_False; pImp->bEnabled = sal_True; pImp->nDocViewNo = 0; pImp->aMargin = Size( -1, -1 ); - pImp->pCancelMgr = 0; pImp->pWindow = 0; SetPool( &SFX_APP()->GetPool() ); @@ -1650,7 +1392,6 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) if ( xObjSh.Is() && xObjSh->IsPreview() ) SetQuietMode_Impl( sal_True ); - GetFrame()->SetFrameType_Impl( GetFrameType() & ~SFXFRAME_FRAMESET ); if ( pObjSh ) { pDispatcher->Push( *SFX_APP() ); @@ -1676,56 +1417,36 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) SfxViewFrame *pThis = this; // wegen der kranken Array-Syntax SfxViewFrameArr_Impl &rViewArr = SFX_APP()->GetViewFrames_Impl(); rViewArr.C40_INSERT(SfxViewFrame, pThis, rViewArr.Count() ); - pImp->bInCtor = sal_False; } -//------------------------------------------------------------------------ -SfxViewFrame::SfxViewFrame( SfxObjectShell &rObjShell, SfxBindings &rBindings, - SfxFrame* pParent, sal_uInt32 nType ) -: - pImp( new SfxViewFrame_Impl ), - pDispatcher(0), - pBindings(&rBindings), - nAdjustPosPixelLock( 0 ) -{ - DBG_CTOR(SfxViewFrame, 0); - - SetFrame_Impl( pParent ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | nType ); - Construct_Impl( &rObjShell ); -} +SfxViewFrame::SfxViewFrame +( + SfxFrame& rFrame, + SfxObjectShell* pObjShell +) -//------------------------------------------------------------------------ -SfxViewFrame::SfxViewFrame(const SfxViewFrame &rCopy, SfxBindings &rBindings, - SfxFrame *pFrame ) -: - pImp( new SfxViewFrame_Impl ), - pDispatcher(0), - pBindings(&rBindings), - nAdjustPosPixelLock( 0 ) -{ - DBG_CTOR(SfxViewFrame, 0); +/* [Beschreibung] - SetFrame_Impl( pFrame ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( rCopy.GetFrameType() ); - Construct_Impl( rCopy.GetObjectShell() ); -} + Ctor des SfxViewFrame f"ur eine <SfxObjectShell> aus der Ressource. + Die 'nViewId' der zu erzeugenden <SfxViewShell> kann angegeben werden + (default ist die zuerst registrierte SfxViewShell-Subklasse). +*/ -SfxViewFrame::SfxViewFrame( SfxBindings& rBindings, SfxFrame *pFrame, - SfxObjectShell *pDoc, sal_uInt32 nType ) - : pImp( new SfxViewFrame_Impl ) + : pImp( new SfxViewFrame_Impl( rFrame ) ) , pDispatcher(0) - , pBindings(&rBindings) + , pBindings( new SfxBindings ) , nAdjustPosPixelLock( 0 ) { - DBG_CTOR(SfxViewFrame, 0); + DBG_CTOR( SfxViewFrame, NULL ); - SetFrame_Impl( pFrame ); - pImp->pFrame->SetCurrentViewFrame_Impl( this ); - GetFrame()->SetFrameType_Impl( GetFrameType() | nType ); - Construct_Impl( pDoc); + rFrame.SetCurrentViewFrame_Impl( this ); + rFrame.SetFrameType_Impl( GetFrameType() | SFXFRAME_HASTITLE ); + Construct_Impl( pObjShell ); + + pImp->pWindow = new SfxFrameViewWindow_Impl( this, rFrame.GetWindow() ); + pImp->pWindow->SetSizePixel( rFrame.GetWindow().GetOutputSizePixel() ); + rFrame.SetOwnsBindings_Impl( sal_True ); + rFrame.CreateWorkWindow_Impl(); } //------------------------------------------------------------------------ @@ -1733,12 +1454,21 @@ SfxViewFrame::~SfxViewFrame() { DBG_DTOR(SfxViewFrame, 0); - if ( GetFrame() && GetFrame()->GetCurrentViewFrame() == this ) - GetFrame()->SetCurrentViewFrame_Impl( NULL ); + SetDowning_Impl(); + + if ( SfxViewFrame::Current() == this ) + SfxViewFrame::SetViewFrame( NULL ); + + ReleaseObjectShell_Impl(); - SfxObjectShell* pSh = pImp->pImportShell; - if( pSh ) - pSh->AbortImport(); + if ( GetFrame().OwnsBindings_Impl() ) + // Die Bindings l"oscht der Frame! + KillDispatcher_Impl(); + + delete pImp->pWindow; + + if ( GetFrame().GetCurrentViewFrame() == this ) + GetFrame().SetCurrentViewFrame_Impl( NULL ); // von Frame-Liste abmelden SfxApplication *pSfxApp = SFX_APP(); @@ -1780,12 +1510,11 @@ SfxViewFrame* SfxViewFrame::Current() } //-------------------------------------------------------------------- -sal_uInt16 SfxViewFrame::Count(TypeId aType) +sal_uInt16 SfxViewFrame::Count() /* [Beschreibung] - Liefert die Anzahl der sichtbaren <SfxViewFrame>-Instanzen vom Typ - 'aType' bzw. aller sichtbaren, falls 'aType==0' (default). + Liefert die Anzahl der sichtbaren <SfxViewFrame>-Instanzen. */ { @@ -1796,8 +1525,7 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType) for ( sal_uInt16 i = 0; i < nCount; ++i ) { SfxViewFrame *pFrame = rFrames[i]; - if ( ( !aType || pFrame->IsA(aType) ) && - pFrame->IsVisible_Impl() ) + if ( pFrame->IsVisible() ) ++nFound; } return nFound; @@ -1808,7 +1536,6 @@ sal_uInt16 SfxViewFrame::Count(TypeId aType) SfxViewFrame* SfxViewFrame::GetFirst ( const SfxObjectShell* pDoc, - TypeId aType, sal_Bool bOnlyIfVisible ) { @@ -1819,9 +1546,9 @@ SfxViewFrame* SfxViewFrame::GetFirst for ( sal_uInt16 nPos = 0; nPos < rFrames.Count(); ++nPos ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) && - ( !aType || pFrame->IsA(aType) ) && - ( !bOnlyIfVisible || pFrame->IsVisible_Impl()) ) + if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) + && ( !bOnlyIfVisible || pFrame->IsVisible() ) + ) return pFrame; } @@ -1834,7 +1561,6 @@ SfxViewFrame* SfxViewFrame::GetNext ( const SfxViewFrame& rPrev, const SfxObjectShell* pDoc, - TypeId aType, sal_Bool bOnlyIfVisible ) { @@ -1851,9 +1577,9 @@ SfxViewFrame* SfxViewFrame::GetNext for ( ++nPos; nPos < rFrames.Count(); ++nPos ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) && - ( !aType || pFrame->IsA(aType) ) && - ( !bOnlyIfVisible || pFrame->IsVisible_Impl()) ) + if ( ( !pDoc || pDoc == pFrame->GetObjectShell() ) + && ( !bOnlyIfVisible || pFrame->IsVisible() ) + ) return pFrame; } return 0; @@ -1866,7 +1592,7 @@ void SfxViewFrame::CloseHiddenFrames_Impl() for ( sal_uInt16 nPos=0; nPos<rFrames.Count(); ) { SfxViewFrame *pFrame = rFrames.GetObject(nPos); - if ( !pFrame->IsVisible_Impl() ) + if ( !pFrame->IsVisible() ) pFrame->DoClose(); else nPos++; @@ -1886,7 +1612,7 @@ void SfxViewFrame::ShowStatusText( const String& /*rText*/) /* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); if ( pMgr ) { @@ -1902,7 +1628,7 @@ void SfxViewFrame::HideStatusText() /* OBSOLETE: If this is used, framework/uielement/progressbarwrapper.[h|c]xx & framework/uielement/statusindicatorinterfacewrapper.[h|c]xx must be extended to support a new interface to support ShowStatusText/HideStatusText - SfxWorkWindow* pWorkWin = GetFrame()->GetWorkWindow_Impl(); + SfxWorkWindow* pWorkWin = GetFrame().GetWorkWindow_Impl(); SfxStatusBarManager *pMgr = pWorkWin->GetStatusBarManager_Impl(); if ( pMgr ) pMgr->GetStatusBar()->ShowItems(); @@ -1977,7 +1703,7 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) SfxShell::SetViewShell_Impl( pVSh ); // Hack: InPlaceMode - if ( pVSh && !pVSh->UseObjectSize() ) + if ( pVSh ) pImp->bResizeInToOut = sal_False; } @@ -1987,21 +1713,10 @@ void SfxViewFrame::SetViewShell_Impl( SfxViewShell *pVSh ) Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace */ -void SfxViewFrame::SetParentViewFrame_Impl(SfxViewFrame *pFrame) -{ - pImp->pParentViewFrame = pFrame; -} - -//-------------------------------------------------------------------- -/* - Beschreibung: - Der ParentViewFrame ist der ViewFrame des Containers bei internem InPlace -*/ - //TODO/LATER: is it still necessary? is there a replacement for GetParentViewFrame_Impl? SfxViewFrame* SfxViewFrame::GetParentViewFrame_Impl() const { - return pImp->pParentViewFrame; + return NULL; } //-------------------------------------------------------------------- @@ -2026,7 +1741,7 @@ void SfxViewFrame::DoAdjustPosSize( SfxViewShell *pSh, const Point rPos, const Size &rSize ) { DBG_CHKTHIS(SfxViewFrame, 0); - if( pSh && !nAdjustPosPixelLock && pSh->UseObjectSize()) + if( pSh && !nAdjustPosPixelLock ) { Window *pWindow = pSh->GetWindow(); Point aPos = pWindow->LogicToPixel(rPos); @@ -2059,7 +1774,7 @@ void SfxViewFrame::Enable( sal_Bool bEnable ) } else { - Window *pWindow = &GetFrame()->GetTopFrame()->GetWindow(); + Window *pWindow = &GetFrame().GetTopFrame().GetWindow(); if ( !bEnable ) pImp->bWindowWasEnabled = pWindow->IsInputEnabled(); if ( !bEnable || pImp->bWindowWasEnabled ) @@ -2109,7 +1824,7 @@ void SfxViewFrame::Show() LockObjectShell_Impl( sal_True ); // Doc-Shell Titel-Nummer anpassen, get unique view-no - if ( 0 == pImp->nDocViewNo && !(GetFrameType() & SFXFRAME_PLUGIN ) ) + if ( 0 == pImp->nDocViewNo ) { GetDocNumber_Impl(); UpdateTitle(); @@ -2120,12 +1835,12 @@ void SfxViewFrame::Show() // Frame-Window anzeigen, aber nur wenn der ViewFrame kein eigenes Window // hat oder wenn er keine Component enth"alt - if ( &GetWindow() == &GetFrame()->GetWindow() || !GetFrame()->HasComponent() ) + if ( &GetWindow() == &GetFrame().GetWindow() || !GetFrame().HasComponent() ) GetWindow().Show(); - GetFrame()->GetWindow().Show(); + GetFrame().GetWindow().Show(); /* SfxViewFrame* pCurrent = SfxViewFrame::Current(); - if ( GetFrame()->GetFrameInterface()->isActive() && + if ( GetFrame().GetFrameInterface()->isActive() && pCurrent != this && ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) && !GetActiveChildFrame_Impl() ) @@ -2138,10 +1853,8 @@ void SfxViewFrame::Show() } //-------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsVisible_Impl() const +sal_Bool SfxViewFrame::IsVisible() const { - //Window *pWin = pImp->bInCtor ? 0 : &GetWindow(); - //return GetFrame()->HasComponent() || pImp->bObjLocked || ( pWin && pWin->IsVisible() ); return pImp->bObjLocked; } @@ -2166,9 +1879,9 @@ void SfxViewFrame::LockObjectShell_Impl( sal_Bool bLock ) //-------------------------------------------------------------------- void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) { - if ( GetViewShell() && !GetFrame()->IsClosing_Impl() ) + if ( GetViewShell() && !GetFrame().IsClosing_Impl() ) { - if ( IsVisible_Impl() ) + if ( IsVisible() ) { if ( GetViewShell() ) { @@ -2185,7 +1898,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) } SfxViewFrame* pCurrent = SfxViewFrame::Current(); - css::uno::Reference< css::frame::XFrame > xFrame = GetFrame()->GetFrameInterface(); + css::uno::Reference< css::frame::XFrame > xFrame = GetFrame().GetFrameInterface(); if ( !bPreview ) { SetViewFrame( this ); @@ -2201,7 +1914,7 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) SfxInPlaceClient *pCli = GetViewShell()->GetUIActiveClient(); if ( ( !pCli || !pCli->IsObjectUIActive() ) && ( !pCurrent || pCurrent->GetParentViewFrame_Impl() != this ) ) - GetFrame()->GrabFocusOnComponent_Impl(); + GetFrame().GrabFocusOnComponent_Impl(); } } else @@ -2215,89 +1928,6 @@ void SfxViewFrame::MakeActive_Impl( BOOL bGrabFocus ) } } -//-------------------------------------------------------------------- - -SfxViewShell* SfxViewFrame::CreateView_Impl( sal_uInt16 nViewId ) - -/* [Beschreibung] - - Erzeugt eine SfxViewShell f"ur diesen SfxViewFrame. Wird auch aus - <SfxObjectShell::LoadWindows_Impl()> - gerufen. -*/ - -{ - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); - - LockAdjustPosSizePixel(); - - // passende ::com::sun::star::sdbcx::View-Factory suchen - SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); - sal_uInt16 nNewNo = nViewId ? USHRT_MAX : 0; - for ( sal_uInt16 nNo = 0; - nNo < rDocFact.GetViewFactoryCount(); - ++nNo ) - { - sal_uInt16 nFoundId = rDocFact.GetViewFactory(nNo).GetOrdinal(); - if ( nNewNo == USHRT_MAX ) - { - if ( nViewId == nFoundId ) - nNewNo = nNo; - } - } - - // per Factory erzeugen - GetBindings().ENTERREGISTRATIONS(); - SfxViewFactory &rViewFactory = rDocFact.GetViewFactory( nNewNo ); - SfxViewShell *pViewShell = rViewFactory.CreateInstance(this, 0); - SetViewShell_Impl(pViewShell); - UnlockAdjustPosSizePixel(); - - if ( GetWindow().IsReallyVisible() ) - DoAdjustPosSizePixel(pViewShell, Point(), GetWindow().GetOutputSizePixel()); - - // erste jetzt anzeigen (ausser wenn MTs BASIC-IDE mal wieder keins hat) - Window *pViewWin = pViewShell->GetWindow(); - if ( pViewWin && pViewShell->IsShowView_Impl() ) - pViewWin->Show(); - - // Dispatcher - GetDispatcher()->Push( *pViewShell ); - if ( pViewShell->GetSubShell() ) - GetDispatcher()->Push( *pViewShell->GetSubShell() ); - pViewShell->PushSubShells_Impl(); - -#if defined SFX_HINT_VIEWCREATED - GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_VIEWCREATED ) ); -#endif - - GetBindings().LEAVEREGISTRATIONS(); - - DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); - return pViewShell; -} - -//------------------------------------------------------------------------- -SfxViewFrame* SfxViewFrame::SearchViewFrame( SfxViewFrame *pViewFrame, - const String& rName ) -{ - if ( !pViewFrame ) - pViewFrame = SfxViewFrame::Current(); - if ( !pViewFrame ) - return NULL; - SfxFrame *pFrame = pViewFrame->GetFrame()->SearchFrame( rName ); - if ( !pFrame ) - return NULL; - - // Der Frame ist selbst ein ViewFrame oder enth"alt einen -/* - pViewFrame = PTR_CAST( SfxViewFrame, pFrame ); - if ( !pViewFrame && pFrame->GetChildFrameCount() ) - pViewFrame = PTR_CAST( SfxViewFrame, pFrame->GetChildFrame(0) ); -*/ - return pFrame->GetCurrentViewFrame(); -} - //------------------------------------------------------------------------- void SfxViewFrame::SetQuietMode_Impl( sal_Bool bOn ) @@ -2312,11 +1942,6 @@ SfxObjectShell* SfxViewFrame::GetObjectShell() return xObjSh; } -void SfxViewFrame::SetMargin_Impl( const Size& rMargin ) -{ - pImp->aMargin = rMargin; -} - const Size& SfxViewFrame::GetMargin_Impl() const { return pImp->aMargin; @@ -2331,10 +1956,10 @@ void SfxViewFrame::SetActiveChildFrame_Impl( SfxViewFrame *pViewFrame ) pImp->pActiveChild = pViewFrame; - Reference< XFramesSupplier > xFrame( GetFrame()->GetFrameInterface(), UNO_QUERY ); + Reference< XFramesSupplier > xFrame( GetFrame().GetFrameInterface(), UNO_QUERY ); Reference< XFrame > xActive; if ( pViewFrame ) - xActive = pViewFrame->GetFrame()->GetFrameInterface(); + xActive = pViewFrame->GetFrame().GetFrameInterface(); if ( xFrame.is() ) // PB: #74432# xFrame cann be NULL xFrame->setActiveFrame( xActive ); @@ -2363,20 +1988,181 @@ SfxViewFrame* SfxViewFrame::GetActiveChildFrame_Impl() const } //-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::LoadViewIntoFrame_Impl_NoThrow( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, + const USHORT i_nViewId, const bool i_bHidden ) +{ + Reference< XFrame > xFrame( i_rFrame ); + bool bOwnFrame = false; + SfxViewShell* pSuccessView = NULL; + try + { + if ( !xFrame.is() ) + { + ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); + Reference < XFrame > xDesktop( aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW ); + xFrame.set( xDesktop->findFrame( DEFINE_CONST_UNICODE("_blank"), 0 ), UNO_SET_THROW ); + bOwnFrame = true; + } + + pSuccessView = LoadViewIntoFrame_Impl( + i_rDoc, + xFrame, + Sequence< PropertyValue >(), // means "reuse existing model's args" + i_nViewId, + i_bHidden + ); + + if ( bOwnFrame && !i_bHidden ) + { + // ensure the frame/window is visible + Reference< XWindow > xContainerWindow( xFrame->getContainerWindow(), UNO_SET_THROW ); + xContainerWindow->setVisible( sal_True ); + } + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( pSuccessView ) + return pSuccessView->GetViewFrame(); + + if ( bOwnFrame ) + { + try + { + xFrame->dispose(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + + return NULL; +} + +//-------------------------------------------------------------------- +SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rFrame, + const Sequence< PropertyValue >& i_rLoadArgs, const USHORT i_nViewId, + const bool i_bHidden ) +{ + Reference< XModel > xDocument( i_rDoc.GetModel(), UNO_SET_THROW ); + + ::comphelper::NamedValueCollection aTransformLoadArgs( i_rLoadArgs.getLength() ? i_rLoadArgs : xDocument->getArgs() ); + aTransformLoadArgs.put( "Model", xDocument ); + if ( i_nViewId ) + aTransformLoadArgs.put( "ViewId", sal_Int16( i_nViewId ) ); + if ( i_bHidden ) + aTransformLoadArgs.put( "Hidden", i_bHidden ); + else + aTransformLoadArgs.remove( "Hidden" ); + + ::rtl::OUString sURL( xDocument->getURL() ); + if ( !sURL.getLength() ) + sURL = i_rDoc.GetFactory().GetFactoryURL(); + + Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW ); + xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0, + aTransformLoadArgs.getPropertyValues() ); + + SfxViewShell* pViewShell = SfxViewShell::Get( i_rFrame->getController() ); + ENSURE_OR_THROW( pViewShell, + "SfxViewFrame::LoadViewIntoFrame_Impl: loading an SFX doc into a frame resulted in a non-SFX view - quite impossible" ); + return pViewShell; +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadHiddenDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, true ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocument( SfxObjectShell& i_rDoc, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, Reference< XFrame >(), i_nViewId, false ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const Reference< XFrame >& i_rTargetFrame, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_rTargetFrame, i_nViewId, false ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::LoadDocumentIntoFrame( SfxObjectShell& i_rDoc, const SfxFrameItem* i_pFrameItem, const USHORT i_nViewId ) +{ + return LoadViewIntoFrame_Impl_NoThrow( i_rDoc, i_pFrameItem && i_pFrameItem->GetFrame() ? i_pFrameItem->GetFrame()->GetFrameInterface() : NULL, i_nViewId, false ); +} + +//-------------------------------------------------------------------- +SfxViewFrame* SfxViewFrame::DisplayNewDocument( SfxObjectShell& i_rDoc, const SfxRequest& i_rCreateDocRequest, const USHORT i_nViewId ) +{ + SFX_REQUEST_ARG( i_rCreateDocRequest, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, FALSE ); + SFX_REQUEST_ARG( i_rCreateDocRequest, pHiddenItem, SfxBoolItem, SID_HIDDEN, FALSE ); + + return LoadViewIntoFrame_Impl_NoThrow( + i_rDoc, + pFrameItem ? pFrameItem->GetFrame() : NULL, + i_nViewId, + pHiddenItem ? pHiddenItem->GetValue() : false + ); +} + +//-------------------------------------------------------------------- + +SfxViewFrame* SfxViewFrame::Get( const Reference< XController>& i_rController, const SfxObjectShell* i_pDoc ) +{ + if ( !i_rController.is() ) + return NULL; + + const SfxObjectShell* pDoc = i_pDoc; + if ( !pDoc ) + { + Reference< XModel > xDocument( i_rController->getModel() ); + for ( pDoc = SfxObjectShell::GetFirst( 0, false ); + pDoc; + pDoc = SfxObjectShell::GetNext( *pDoc, 0, false ) + ) + { + if ( pDoc->GetModel() == xDocument ) + break; + } + } + + SfxViewFrame* pViewFrame = NULL; + for ( pViewFrame = SfxViewFrame::GetFirst( pDoc, FALSE ); + pViewFrame; + pViewFrame = SfxViewFrame::GetNext( *pViewFrame, pDoc, FALSE ) + ) + { + if ( pViewFrame->GetViewShell()->GetController() == i_rController ) + break; + } + + return pViewFrame; +} + +//-------------------------------------------------------------------- sal_Bool SfxViewFrame::SwitchToViewShell_Impl ( - sal_uInt16 nViewId, /* > 0 - Registrierungs-Id der ::com::sun::star::sdbcx::View, auf die umge- + sal_uInt16 nViewIdOrNo, /* > 0 + Registrierungs-Id der View, auf die umge- schaltet werden soll, bzw. die erstmalig erzeugt werden soll. == 0 - Es soll die Default-::com::sun::star::sdbcx::View verwendet werden. */ + Es soll die Default-View verwendet werden. */ sal_Bool bIsIndex /* sal_True - 'nViewId' ist keine Registrations-Id sondern - ein ::com::sun::star::sdbcx::Index in die f"ur die in diesem + 'nViewIdOrNo' ist keine Registrations-Id sondern + ein Index in die f"ur die in diesem <SfxViewFrame> dargestellte <SfxObjectShell>. */ ) @@ -2402,174 +2188,64 @@ sal_Bool SfxViewFrame::SwitchToViewShell_Impl */ { - try{ - DBG_ASSERT( GetObjectShell(), "Kein Dokument!" ); - - SfxObjectFactory &rDocFact = GetObjectShell()->GetFactory(); - - // find index of old and new ViewShell - sal_uInt16 nOldNo = USHRT_MAX, nNewNo = USHRT_MAX; - bIsIndex |= 0 == nViewId; - for ( sal_uInt16 nNo = 0; nNo < rDocFact.GetViewFactoryCount(); ++nNo ) - { - sal_uInt16 nFoundId = rDocFact.GetViewFactory(nNo).GetOrdinal(); - if ( nNewNo == USHRT_MAX ) - { - if ( bIsIndex && nViewId == nNo ) - { - nNewNo = nNo; - nViewId = nFoundId; // for nViewId == 0 - } - else if ( !bIsIndex && nViewId == nFoundId ) - nNewNo = nNo; - } - if ( pImp->nCurViewId == nFoundId ) - nOldNo = nNo; - } - - if ( nNewNo == USHRT_MAX ) + try { - // unknown ID -> fall back to default - sal_uInt16 nFoundId = rDocFact.GetViewFactory(0).GetOrdinal(); - nNewNo = 0; - nViewId = nFoundId; - if ( pImp->nCurViewId == nFoundId ) - nOldNo = 0; - } - - SfxViewShell *pSh = GetViewShell(); + ENSURE_OR_THROW( GetObjectShell() != NULL, "not possible without a document" ); - DBG_ASSERT( !pSh || nOldNo != USHRT_MAX, "old shell id not found" ); - - // does a ViewShell exist already? - SfxViewShell *pOldSh = pSh; - if ( pOldSh ) - { - // ask wether it can be closed - if ( !pOldSh->PrepareClose() ) - return sal_False; - - // remove SubShells from Dispatcher before switching to new ViewShell - pOldSh->PushSubShells_Impl( sal_False ); - sal_uInt16 nLevel = pDispatcher->GetShellLevel( *pOldSh ); - if ( nLevel ) + // if we already have a view shell, remove it + SfxViewShell* pOldSh = GetViewShell(); + OSL_PRECOND( pOldSh, "SfxViewFrame::SwitchToViewShell_Impl: that's called *switch* (not for *initial-load*) for a reason" ); + if ( pOldSh ) { - SfxShell *pSubShell = pDispatcher->GetShell( nLevel-1 ); - if ( pSubShell == pOldSh->GetSubShell() ) - //"real" SubShells are not deleted - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL ); - else - // SubShells only known to Dispatcher must be deleted - pDispatcher->Pop( *pSubShell, SFX_SHELL_POP_UNTIL | SFX_SHELL_POP_DELETE ); - } - - pDispatcher->Pop( *pOldSh ); - GetBindings().Invalidate( nOldNo + SID_VIEWSHELL0 ); - } - - // remember ViewID - pImp->nCurViewId = nViewId; - GetBindings().Invalidate( nNewNo + SID_VIEWSHELL0 ); - - // create new ViewShell - SfxViewFactory &rViewFactory = rDocFact.GetViewFactory( nNewNo ); - LockAdjustPosSizePixel(); - - GetBindings().ENTERREGISTRATIONS(); - pSh = rViewFactory.CreateInstance(this, pOldSh); - - Window *pEditWin = pSh->GetWindow(); - DBG_ASSERT( !pEditWin || !pEditWin->IsReallyVisible(), "don`t show your ViewShell`s Window by yourself!" ); + // ask wether it can be closed + if ( !pOldSh->PrepareClose( TRUE ) ) + return sal_False; - // by setting the ViewShell it is prevented that disposing the Controller will destroy this ViewFrame also - GetDispatcher()->SetDisableFlags( 0 ); - SetViewShell_Impl(pSh); - - Reference < ::com::sun::star::awt::XWindow > xWindow( - GetFrame()->GetWindow().GetComponentInterface(), UNO_QUERY ); - Reference < XFrame > xFrame( GetFrame()->GetFrameInterface() ); - if ( !pSh->GetController().is() ) - pSh->SetController( new SfxBaseController( pSh ) ); - Reference < XController > xController( pSh->GetController() ); - xFrame->setComponent( xWindow, xController ); - - xController->attachFrame( xFrame ); - Reference < XModel > xModel( GetObjectShell()->GetModel() ); - if ( xModel.is() ) - { - xController->attachModel( xModel ); - xModel->connectController( xController ); - xModel->setCurrentController( xController ); - } - - GetDispatcher()->Push( *pSh ); - if ( pSh->GetSubShell() ) - GetDispatcher()->Push( *pSh->GetSubShell() ); - pSh->PushSubShells_Impl(); - GetDispatcher()->Flush(); - - if ( pImp->bRestoreView && pImp->aViewData.Len() ) - { - // restore view data if required - pSh->ReadUserData( pImp->aViewData, sal_True ); - pImp->bRestoreView = sal_False; - } + // remove sub shells from Dispatcher before switching to new ViewShell + PopShellAndSubShells_Impl( *pOldSh ); + } - // create UI elements before size is set - if ( SfxViewFrame::Current() == this ) - GetDispatcher()->Update_Impl( sal_True ); + GetBindings().ENTERREGISTRATIONS(); + LockAdjustPosSizePixel(); - // allow resize events to be processed - UnlockAdjustPosSizePixel(); + // ID of the new view + SfxObjectFactory& rDocFact = GetObjectShell()->GetFactory(); + const USHORT nViewId = ( bIsIndex || !nViewIdOrNo ) ? rDocFact.GetViewFactory( nViewIdOrNo ).GetOrdinal() : nViewIdOrNo; - Window* pFrameWin = &GetWindow(); - if ( pFrameWin != &GetFrame()->GetWindow() ) - pFrameWin->Show(); + // create and load new ViewShell + SfxViewShell* pNewSh = LoadViewIntoFrame_Impl( + *GetObjectShell(), + GetFrame().GetFrameInterface(), + Sequence< PropertyValue >(), // means "reuse existing model's args" + nViewId, + false + ); - if ( GetWindow().IsReallyVisible() ) - DoAdjustPosSizePixel( pSh, Point(), GetWindow().GetOutputSizePixel() ); + // allow resize events to be processed + UnlockAdjustPosSizePixel(); - if ( pEditWin && pSh->IsShowView_Impl() ) - pEditWin->Show(); + if ( GetWindow().IsReallyVisible() ) + DoAdjustPosSizePixel( pNewSh, Point(), GetWindow().GetOutputSizePixel() ); - GetBindings().LEAVEREGISTRATIONS(); - delete pOldSh; + GetBindings().LEAVEREGISTRATIONS(); + delete pOldSh; } - catch ( com::sun::star::uno::Exception& ) + catch ( const com::sun::star::uno::Exception& ) { // the SfxCode is not able to cope with exceptions thrown while creating views // the code will crash in the stack unwinding procedure, so we shouldn't let exceptions go through here - DBG_ERROR("Exception in SwitchToViewShell_Impl - urgent issue. Please contact development!"); + DBG_UNHANDLED_EXCEPTION(); + return sal_False; } DBG_ASSERT( SFX_APP()->GetViewFrames_Impl().Count() == SFX_APP()->GetViewShells_Impl().Count(), "Inconsistent view arrays!" ); return sal_True; } -//-------------------------------------------------------------------- - -void SfxViewFrame::SetViewData_Impl( sal_uInt16 nViewId, const String &rViewData ) -{ - pImp->bRestoreView = sal_True; - pImp->nCurViewId = nViewId; - pImp->aViewData = rViewData; -} //------------------------------------------------------------------------- -String& SfxViewFrame::GetViewData_Impl() +void SfxViewFrame::SetCurViewId_Impl( const USHORT i_nID ) { - return pImp->aViewData; -} - -//------------------------------------------------------------------------- -sal_Bool SfxViewFrame::IsRestoreView_Impl() const -{ - return pImp->bRestoreView; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetRestoreView_Impl( sal_Bool bOn ) -{ - pImp->bRestoreView = bOn; + pImp->nCurViewId = i_nID; } //------------------------------------------------------------------------- @@ -2607,58 +2283,17 @@ void SfxViewFrame::ExecView_Impl break; } - case SID_FILLFRAME: - { - // Bei Mail etc. k"onnen die Frames nicht angesprochen werden - SfxFrame *pParent = GetFrame()->GetParentFrame(); - if ( pParent && pParent->GetCurrentViewFrame()-> - GetViewShell()->IsImplementedAsFrameset_Impl() ) - break; - - SfxViewFrame *pRet = NULL; - SFX_REQUEST_ARG( - rReq, pItem, SfxStringItem, SID_FILLFRAME, sal_False ); - if ( pItem ) - { - String aName( pItem->GetValue() ); - sal_uInt16 nFrame = (sal_uInt16) aName.ToInt32(); - if ( nFrame == 0 ) - nFrame = USHRT_MAX; - - SfxFrameIterator aIter( *GetFrame(), sal_False ); - SfxFrame *pFrame = aIter.FirstFrame(); - sal_uInt16 nActFrame = 1; - while ( pFrame ) - { - SfxViewFrame *pView = pFrame->GetCurrentViewFrame(); - if ( - nActFrame == nFrame || - ( - pView && - aName.CompareIgnoreCaseToAscii( pView->SfxShell::GetName() ) == COMPARE_EQUAL - ) - ) - { - pRet = pView; - break; - } - - pFrame = aIter.NextFrame( *pFrame ); - nActFrame++; - } - } - - rReq.SetReturnValue( SfxObjectItem( SID_DOCFRAME, pRet ) ); - break; - } - case SID_VIEWSHELL: { const SfxPoolItem *pItem = 0; - if ( rReq.GetArgs() && - SFX_ITEM_SET == rReq.GetArgs()->GetItemState( SID_VIEWSHELL, sal_False, &pItem ) ) - rReq.SetReturnValue( SfxBoolItem(0, SwitchToViewShell_Impl( - (sal_uInt16)((const SfxUInt16Item*) pItem)->GetValue()) )); + if ( rReq.GetArgs() + && SFX_ITEM_SET == rReq.GetArgs()->GetItemState( SID_VIEWSHELL, sal_False, &pItem ) + ) + { + const sal_uInt16 nViewId = static_cast< const SfxUInt16Item* >( pItem )->GetValue(); + BOOL bSuccess = SwitchToViewShell_Impl( nViewId ); + rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) ); + } break; } @@ -2668,86 +2303,40 @@ void SfxViewFrame::ExecView_Impl case SID_VIEWSHELL3: case SID_VIEWSHELL4: { - rReq.SetReturnValue( SfxBoolItem(0, - SwitchToViewShell_Impl( rReq.GetSlot() - SID_VIEWSHELL0, sal_True ) ) ); + const sal_uInt16 nViewNo = rReq.GetSlot() - SID_VIEWSHELL0; + BOOL bSuccess = SwitchToViewShell_Impl( nViewNo, sal_True ); + rReq.SetReturnValue( SfxBoolItem( 0, bSuccess ) ); break; } case SID_NEWWINDOW: { // Hack. demnaechst virtuelle Funktion - if ( !GetViewShell()->NewWindowAllowed() && !GetObjectShell()->HasName() ) - return; - - // ViewData bei FrameSets rekursiv holen - GetFrame()->GetViewData_Impl(); - SfxMedium *pMed = GetObjectShell()->GetMedium(); - String aUserData; - GetViewShell()->WriteUserData( aUserData, sal_True ); if ( !GetViewShell()->NewWindowAllowed() ) { - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); - SfxFrame *pFrame = NULL; - Reference < XFrame > xFrame; - if ( pFrameItem ) - { - pFrameItem->GetValue() >>= xFrame; - pFrame = SfxTopFrame::Create( xFrame ); - } - else - pFrame = SfxTopFrame::Create(); - - SfxAllItemSet aSet( SFX_APP()->GetPool() ); - SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( pHiddenItem ) - aSet.Put( *pHiddenItem ); - - SFX_ITEMSET_ARG( pMed->GetItemSet(), pRefererItem, SfxStringItem, SID_REFERER, sal_False ); - SfxStringItem aReferer( SID_REFERER, DEFINE_CONST_UNICODE( "private:user" ) ); - if ( !pRefererItem ) - pRefererItem = &aReferer; - - aSet.Put( SfxStringItem( SID_FILE_NAME, pMed->GetName() ) ); - aSet.Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - aSet.Put( SfxUInt16Item( SID_VIEW_ID, GetCurViewId() ) ); - aSet.Put( *pRefererItem ); - if( pMed->GetFilter() ) - aSet.Put( SfxStringItem( SID_FILTER_NAME, pMed->GetFilter()->GetFilterName()) ); - aSet.Put( SfxFrameItem ( SID_DOCFRAME, pFrame ) ); - if ( xFrame.is() ) - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, aSet ); - else - GetDispatcher()->Execute( SID_OPENDOC, SFX_CALLMODE_ASYNCHRON, aSet ); - } - else - { - pMed->GetItemSet()->Put( SfxStringItem( SID_USER_DATA, aUserData ) ); - - BOOL bHidden = FALSE; - SFX_REQUEST_ARG( rReq, pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False ); - if ( pHiddenItem ) - bHidden = pHiddenItem->GetValue(); - SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoAnyItem, SID_FILLFRAME, sal_False ); - if ( pFrameItem ) - { - Reference < XFrame > xFrame; - pFrameItem->GetValue() >>= xFrame; - SfxFrame* pFrame = SfxTopFrame::Create( xFrame ); - pMed->GetItemSet()->ClearItem( SID_HIDDEN ); - pFrame->InsertDocument( GetObjectShell() ); - if ( !bHidden ) - xFrame->getContainerWindow()->setVisible( sal_True ); - } - else - { - SfxAllItemSet aSet( GetPool() ); - aSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, TRUE ) ); - SfxFrame* pFrame = SfxTopFrame::Create( GetObjectShell(), GetCurViewId(), bHidden, &aSet ); - if ( bHidden ) - pFrame->GetCurrentViewFrame()->LockObjectShell_Impl( TRUE ); - } + OSL_ENSURE( false, "You should have disabled the 'Window/New Window' slot!" ); + return; } + // ViewData bei FrameSets rekursiv holen + GetFrame().GetViewData_Impl(); + SfxMedium* pMed = GetObjectShell()->GetMedium(); + + // do not open the new window hidden + pMed->GetItemSet()->ClearItem( SID_HIDDEN ); + + // the view ID (optional arg. TODO: this is currently not supported in the slot definition ...) + SFX_REQUEST_ARG( rReq, pViewIdItem, SfxUInt16Item, SID_VIEW_ID, sal_False ); + const USHORT nViewId = pViewIdItem ? pViewIdItem->GetValue() : GetCurViewId(); + + Reference < XFrame > xFrame; + // the frame (optional arg. TODO: this is currently not supported in the slot definition ...) + SFX_REQUEST_ARG( rReq, pFrameItem, SfxUnoFrameItem, SID_FILLFRAME, sal_False ); + if ( pFrameItem ) + xFrame = pFrameItem->GetFrame(); + + LoadViewIntoFrame_Impl_NoThrow( *GetObjectShell(), xFrame, nViewId, false ); + rReq.Done(); break; } @@ -2911,13 +2500,10 @@ void SfxViewFrame::StateView_Impl case SID_NEWWINDOW: { - if ( !GetViewShell()->NewWindowAllowed() /* && !pDocSh->HasName() */ ) - rSet.DisableItem( nWhich ); - else - { - if (impl_maxOpenDocCountReached()) - rSet.DisableItem( nWhich ); - } + if ( !GetViewShell()->NewWindowAllowed() + || impl_maxOpenDocCountReached() + ) + rSet.DisableItem( nWhich ); break; } } @@ -2926,22 +2512,9 @@ void SfxViewFrame::StateView_Impl } //------------------------------------------------------------------------- -void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) -{ - if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) - { - uno::Any aAny; - aAny <<= GetViewShell()->GetVerbs(); - rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); - } - else - rSet.DisableItem( SID_OBJECT ); -} - -//------------------------------------------------------------------------- void SfxViewFrame::ToTop() { - GetFrame()->Appear(); + GetFrame().Appear(); } //------------------------------------------------------------------------- @@ -2951,66 +2524,41 @@ SfxViewFrame* SfxViewFrame::GetParentViewFrame() const Der ParentViewFrame ist der ViewFrame des ParentFrames */ { - SfxFrame *pFrame = GetFrame()->GetParentFrame(); + SfxFrame *pFrame = GetFrame().GetParentFrame(); return pFrame ? pFrame->GetCurrentViewFrame() : NULL; } //------------------------------------------------------------------------- -SfxFrame* SfxViewFrame::GetFrame() const +SfxFrame& SfxViewFrame::GetFrame() const /* Beschreibung: GetFrame liefert den Frame, in dem sich der ViewFrame befindet */ { - return pImp->pFrame; -} - -//------------------------------------------------------------------------- -void SfxViewFrame::SetFrame_Impl( SfxFrame *pFrame ) -{ - pImp->pFrame = pFrame; + return pImp->rFrame; } //------------------------------------------------------------------------- SfxViewFrame* SfxViewFrame::GetTopViewFrame() const { - return GetFrame()->GetTopFrame()->GetCurrentViewFrame(); -} - -//------------------------------------------------------------------------- - -SfxCancelManager *SfxViewFrame::GetCancelManager() const - -/* <H3>Description</H3> - - Returns a pointer to the <SfxCancelManager> of the top-view-frame of - this view-frame. -*/ - -{ - return GetTopViewFrame()->GetFrame()->GetCancelManager(); -} - -void SfxViewFrame::SetWindow_Impl( Window *pWin ) -{ - pImp->pWindow = pWin; + return GetFrame().GetTopFrame().GetCurrentViewFrame(); } Window& SfxViewFrame::GetWindow() const { - return pImp->pWindow ? *pImp->pWindow : GetFrame()->GetWindow(); + return pImp->pWindow ? *pImp->pWindow : GetFrame().GetWindow(); } sal_Bool SfxViewFrame::DoClose() { - return GetFrame()->DoClose(); + return GetFrame().DoClose(); } String SfxViewFrame::GetActualPresentationURL_Impl() const { if ( xObjSh.Is() ) return xObjSh->GetMedium()->GetName(); - return pImp->aActualPresentationURL; + return String(); } void SfxViewFrame::SetModalMode( sal_Bool bModal ) @@ -3027,7 +2575,7 @@ void SfxViewFrame::SetModalMode( sal_Bool bModal ) BOOL SfxViewFrame::IsInModalMode() const { - return pImp->bModal || GetFrame()->GetWindow().IsInModalMode(); + return pImp->bModal || GetFrame().GetWindow().IsInModalMode(); } void SfxViewFrame::Resize( BOOL bForce ) @@ -3039,18 +2587,14 @@ void SfxViewFrame::Resize( BOOL bForce ) SfxViewShell *pShell = GetViewShell(); if ( pShell ) { - if ( GetFrame()->IsInPlace() ) + if ( GetFrame().IsInPlace() ) { Point aPoint = GetWindow().GetPosPixel(); DoAdjustPosSizePixel( pShell, aPoint, aSize ); } else { - if ( pShell->UseObjectSize() ) - ForceOuterResize_Impl(TRUE); DoAdjustPosSizePixel( pShell, Point(), aSize ); - if ( pShell->UseObjectSize() ) - ForceOuterResize_Impl(FALSE); } } } @@ -3323,7 +2867,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) // try to find any active recorder on this frame ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet(xFrame,com::sun::star::uno::UNO_QUERY); @@ -3388,7 +2932,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_TOGGLESTATUSBAR: { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -3435,14 +2979,14 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) case SID_WIN_FULLSCREEN: { SFX_REQUEST_ARG(rReq, pItem, SfxBoolItem, rReq.GetSlot(), FALSE); - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); + SfxViewFrame *pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); if ( pWork ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< ::com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -3477,7 +3021,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) } pWork->ShowFullScreenMode( bNewFullScreenMode ); pWork->SetMenuBarMode( bNewFullScreenMode ? MENUBAR_MODE_HIDE : MENUBAR_MODE_NORMAL ); - GetFrame()->GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); + GetFrame().GetWorkWindow_Impl()->SetFullScreen_Impl( bNewFullScreenMode ); if ( !pItem ) rReq.AppendItem( SfxBoolItem( SID_WIN_FULLSCREEN, bNewFullScreenMode ) ); rReq.Done(); @@ -3531,7 +3075,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue(sProperty); @@ -3554,7 +3098,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) ::rtl::OUString sProperty = rtl::OUString::createFromAscii("DispatchRecorderSupplier"); com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue(sProperty); @@ -3568,7 +3112,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) { com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager; com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xSet( - GetFrame()->GetFrameInterface(), + GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); com::sun::star::uno::Any aProp = xSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )) ); @@ -3586,10 +3130,10 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) case SID_WIN_FULLSCREEN: { - SfxTopViewFrame *pTop= PTR_CAST( SfxTopViewFrame, GetTopViewFrame() ); + SfxViewFrame* pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetTopFrame_Impl()->GetTopWindow_Impl(); + WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); if ( pWork ) { rSet.Put( SfxBoolItem( nWhich, pWork->IsFullScreenMode() ) ); @@ -3638,7 +3182,7 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) { if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SDATABASE)) return; - Reference < XFrame > xFrame = GetFrame()->GetTopFrame()->GetFrameInterface(); + Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface(); Reference < XFrame > xBeamer( xFrame->findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ) ); BOOL bShow = FALSE; BOOL bHasChild = xBeamer.is(); @@ -3739,7 +3283,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) } else if ( nSID == SID_BROWSER ) { - Reference < XFrame > xFrame = GetFrame()->GetTopFrame()->GetFrameInterface()-> + Reference < XFrame > xFrame = GetFrame().GetTopFrame().GetFrameInterface()-> findFrame( DEFINE_CONST_UNICODE("_beamer"), FrameSearchFlag::CHILDREN ); if ( !xFrame.is() ) rState.DisableItem( nSID ); @@ -3757,7 +3301,7 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) SfxWorkWindow* SfxViewFrame::GetWorkWindow_Impl( USHORT /*nId*/ ) { SfxWorkWindow* pWork = 0; - pWork = GetFrame()->GetWorkWindow_Impl(); + pWork = GetFrame().GetWorkWindow_Impl(); return pWork; } @@ -3819,11 +3363,6 @@ SfxChildWindow* SfxViewFrame::GetChildWindow(USHORT nId) return pWork ? pWork->GetChildWindow_Impl(nId) : NULL; } -SfxMacro* SfxViewFrame::GetRecordingMacro_Impl() -{ - return pImp->pMacro; -} - void SfxViewFrame::UpdateDocument_Impl() { SfxObjectShell* pDoc = GetObjectShell(); @@ -3834,29 +3373,6 @@ void SfxViewFrame::UpdateDocument_Impl() pDoc->UpdateFromTemplate_Impl(); } -BOOL SfxViewFrame::ClearEventFlag_Impl() -{ - if ( pImp->bEventFlag ) - { - pImp->bEventFlag = FALSE; - return TRUE; - } - else - return FALSE; -} - -SfxViewFrame* SfxViewFrame::CreateViewFrame( SfxObjectShell& rDoc, sal_uInt16 nViewId, sal_Bool bHidden ) -{ - SfxItemSet *pSet = rDoc.GetMedium()->GetItemSet(); - if ( nViewId ) - pSet->Put( SfxUInt16Item( SID_VIEW_ID, nViewId ) ); - if ( bHidden ) - pSet->Put( SfxBoolItem( SID_HIDDEN, sal_True ) ); - - SfxFrame *pFrame = SfxTopFrame::Create( &rDoc, 0, bHidden ); - return pFrame->GetCurrentViewFrame(); -} - void SfxViewFrame::SetViewFrame( SfxViewFrame* pFrame ) { SFX_APP()->SetViewFrame_Impl( pFrame ); diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx new file mode 100644 index 000000000000..05ce981a51b6 --- /dev/null +++ b/sfx2/source/view/viewfrm2.cxx @@ -0,0 +1,523 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sfx2.hxx" + +#include "impviewframe.hxx" +#include "statcach.hxx" +#include "sfx2/viewfac.hxx" +#include "workwin.hxx" + +#include "sfx2/app.hxx" +#include "sfx2/bindings.hxx" +#include "sfx2/ctrlitem.hxx" +#include "sfx2/dispatch.hxx" +#include "sfx2/docfac.hxx" +#include "sfx2/docfile.hxx" +#include "sfx2/objitem.hxx" +#include "sfx2/objsh.hxx" +#include "sfx2/request.hxx" +#include "sfx2/viewfrm.hxx" +#include "sfx2/viewsh.hxx" + +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/beans/XMaterialHolder.hpp> +#include <com/sun/star/util/XCloseable.hpp> + +#include <comphelper/componentcontext.hxx> +#include <comphelper/namedvaluecollection.hxx> +#include <comphelper/processfactory.hxx> +#include <svtools/asynclink.hxx> +#include <svl/eitem.hxx> +#include <svl/intitem.hxx> +#include <svl/rectitem.hxx> +#include <svl/stritem.hxx> +#include <tools/diagnose_ex.h> +#include <tools/urlobj.hxx> +#include <unotools/bootstrap.hxx> +#include <unotools/configmgr.hxx> +#include <vcl/window.hxx> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using ::com::sun::star::lang::XMultiServiceFactory; +using ::com::sun::star::lang::XComponent; + +//------------------------------------------------------------------------ + +static ::rtl::OUString GetModuleName_Impl( const ::rtl::OUString& sDocService ) +{ + uno::Reference< container::XNameAccess > xMM( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")), uno::UNO_QUERY ); + ::rtl::OUString sVar; + if ( !xMM.is() ) + return sVar; + + try + { + ::comphelper::NamedValueCollection aAnalyzer( xMM->getByName( sDocService ) ); + sVar = aAnalyzer.getOrDefault( "ooSetupFactoryUIName", ::rtl::OUString() ); + } + catch( uno::Exception& ) + { + sVar = ::rtl::OUString(); + } + + return sVar; +} + +//-------------------------------------------------------------------- +void SfxFrameViewWindow_Impl::StateChanged( StateChangedType nStateChange ) +{ + if ( nStateChange == STATE_CHANGE_INITSHOW ) + { + SfxObjectShell* pDoc = pFrame->GetObjectShell(); + if ( pDoc && !pFrame->IsVisible() ) + pFrame->Show(); + + pFrame->Resize(); + } + else + Window::StateChanged( nStateChange ); +} + +void SfxFrameViewWindow_Impl::Resize() +{ + if ( IsReallyVisible() || IsReallyShown() || GetOutputSizePixel().Width() ) + pFrame->Resize(); +} + +static String _getTabString() +{ + String result; + + Reference < XMaterialHolder > xHolder( + ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE("com.sun.star.tab.tabreg") ), UNO_QUERY ); + if (xHolder.is()) + { + rtl::OUString aTabString; + Sequence< NamedValue > sMaterial; + if (xHolder->getMaterial() >>= sMaterial) { + for (int i=0; i < sMaterial.getLength(); i++) { + if ((sMaterial[i].Name.equalsAscii("title")) && + (sMaterial[i].Value >>= aTabString)) + { + result += ' '; + result += String(aTabString); + } + } + } + } + return result; +} + +//======================================================================== + +//-------------------------------------------------------------------- +String SfxViewFrame::UpdateTitle() + +/* [Beschreibung] + + Mit dieser Methode kann der SfxViewFrame gezwungen werden, sich sofort + den neuen Titel vom der <SfxObjectShell> zu besorgen. + + [Anmerkung] + + Dies ist z.B. dann notwendig, wenn man der SfxObjectShell als SfxListener + zuh"ort und dort auf den <SfxSimpleHint> SFX_HINT_TITLECHANGED reagieren + m"ochte, um dann die Titel seiner Views abzufragen. Diese Views (SfxTopViewFrames) + jedoch sind ebenfalls SfxListener und da die Reihenfolge der Benachrichtigung + nicht feststeht, mu\s deren Titel-Update vorab erzwungen werden. + + + [Beispiel] + + void SwDocShell::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) + { + if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + { + switch( ( (SfxSimpleHint&) rHint ).GetId() ) + { + case SFX_HINT_TITLECHANGED: + for ( SfxViewFrame *pTop = SfxViewFrame::GetFirst( this ); + pTop; + pTop = SfxViewFrame::GetNext( this ); + { + pTop->UpdateTitle(); + ... pTop->GetName() ... + } + break; + ... + } + } + } +*/ + +{ + DBG_CHKTHIS(SfxViewFrame, 0); + + const SfxObjectFactory &rFact = GetObjectShell()->GetFactory(); + pImp->aFactoryName = String::CreateFromAscii( rFact.GetShortName() ); + + SfxObjectShell *pObjSh = GetObjectShell(); + if ( !pObjSh ) + return String(); + +// if ( pObjSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED ) +// // kein UpdateTitle mit Embedded-ObjectShell +// return String(); + + const SfxMedium *pMedium = pObjSh->GetMedium(); + String aURL; + GetFrame(); // -Wall required?? + if ( pObjSh->HasName() ) + { + INetURLObject aTmp( pMedium->GetName() ); + aURL = aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET ); + } + + if ( aURL != pImp->aActualURL ) + // URL hat sich ge"andert + pImp->aActualURL = aURL; + + // gibt es noch eine weitere View? + sal_uInt16 nViews=0; + for ( SfxViewFrame *pView= GetFirst(pObjSh); + pView && nViews<2; + pView = GetNext(*pView,pObjSh) ) + if ( ( pView->GetFrameType() & SFXFRAME_HASTITLE ) && + !IsDowning_Impl()) + nViews++; + + // Titel des Fensters + String aTitle; + if ( nViews == 2 || pImp->nDocViewNo > 1 ) + // dann die Nummer dranh"angen + aTitle = pObjSh->UpdateTitle( NULL, pImp->nDocViewNo ); + else + aTitle = pObjSh->UpdateTitle(); + + // Name des SbxObjects + String aSbxName = pObjSh->SfxShell::GetName(); + if ( IsVisible() ) + { + aSbxName += ':'; + aSbxName += String::CreateFromInt32(pImp->nDocViewNo); + } + + SetName( aSbxName ); + pImp->aFrameTitle = aTitle; + GetBindings().Invalidate( SID_FRAMETITLE ); + GetBindings().Invalidate( SID_CURRENT_URL ); + + ::rtl::OUString aProductName; + ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= aProductName; + + aTitle += String::CreateFromAscii( " - " ); + aTitle += String(aProductName); + aTitle += ' '; + ::rtl::OUString aDocServiceName( GetObjectShell()->GetFactory().GetDocumentServiceName() ); + aTitle += String( GetModuleName_Impl( aDocServiceName ) ); +#ifdef DBG_UTIL + ::rtl::OUString aDefault; + aTitle += DEFINE_CONST_UNICODE(" ["); + String aVerId( utl::Bootstrap::getBuildIdData( aDefault )); + aTitle += aVerId; + aTitle += ']'; +#endif + + // append TAB string if available + aTitle += _getTabString(); + + GetBindings().Invalidate( SID_NEWDOCDIRECT ); + + /* AS_TITLE + Window* pWindow = GetFrame()->GetTopWindow_Impl(); + if ( pWindow && pWindow->GetText() != aTitle ) + pWindow->SetText( aTitle ); + */ + return aTitle; +} + +void SfxViewFrame::Exec_Impl(SfxRequest &rReq ) +{ + // Wenn gerade die Shells ausgetauscht werden... + if ( !GetObjectShell() || !GetViewShell() ) + return; + + switch ( rReq.GetSlot() ) + { + case SID_SHOWPOPUPS : + { + SFX_REQUEST_ARG(rReq, pShowItem, SfxBoolItem, SID_SHOWPOPUPS, FALSE); + BOOL bShow = pShowItem ? pShowItem->GetValue() : TRUE; + SFX_REQUEST_ARG(rReq, pIdItem, SfxUInt16Item, SID_CONFIGITEMID, FALSE); + USHORT nId = pIdItem ? pIdItem->GetValue() : 0; + + // ausfuehren + SfxWorkWindow *pWorkWin = GetFrame().GetWorkWindow_Impl(); + if ( bShow ) + { + // Zuerst die Floats auch anzeigbar machen + pWorkWin->MakeChildsVisible_Impl( bShow ); + GetDispatcher()->Update_Impl( TRUE ); + + // Dann anzeigen + GetBindings().HidePopups( !bShow ); + } + else + { + // Alles hiden + SfxBindings *pBind = &GetBindings(); + while ( pBind ) + { + pBind->HidePopupCtrls_Impl( !bShow ); + pBind = pBind->GetSubBindings_Impl(); + } + + pWorkWin->HidePopups_Impl( !bShow, TRUE, nId ); + pWorkWin->MakeChildsVisible_Impl( bShow ); + } + + Invalidate( rReq.GetSlot() ); + rReq.Done(); + break; + } + + case SID_ACTIVATE: + { + MakeActive_Impl( TRUE ); + rReq.SetReturnValue( SfxObjectItem( 0, this ) ); + break; + } + + case SID_NEWDOCDIRECT : + { + SFX_REQUEST_ARG( rReq, pFactoryItem, SfxStringItem, SID_NEWDOCDIRECT, FALSE); + String aFactName; + if ( pFactoryItem ) + aFactName = pFactoryItem->GetValue(); + else if ( pImp->aFactoryName.Len() ) + aFactName = pImp->aFactoryName; + else + { + DBG_ERROR("Missing argument!"); + break; + } + + SfxRequest aReq( SID_OPENDOC, SFX_CALLMODE_SYNCHRON, GetPool() ); + String aFact = String::CreateFromAscii("private:factory/"); + aFact += aFactName; + aReq.AppendItem( SfxStringItem( SID_FILE_NAME, aFact ) ); + aReq.AppendItem( SfxFrameItem( SID_DOCFRAME, &GetFrame() ) ); + aReq.AppendItem( SfxStringItem( SID_TARGETNAME, String::CreateFromAscii( "_blank" ) ) ); + SFX_APP()->ExecuteSlot( aReq ); + const SfxViewFrameItem* pItem = PTR_CAST( SfxViewFrameItem, aReq.GetReturnValue() ); + if ( pItem ) + rReq.SetReturnValue( SfxFrameItem( 0, pItem->GetFrame() ) ); + break; + } + + case SID_CLOSEWIN: + { + // disable CloseWin, if frame is not a task + Reference < XCloseable > xTask( GetFrame().GetFrameInterface(), UNO_QUERY ); + if ( !xTask.is() ) + break; + + if ( GetViewShell()->PrepareClose() ) + { + // weitere Views auf dasselbe Doc? + SfxObjectShell *pDocSh = GetObjectShell(); + int bOther = sal_False; + for ( const SfxViewFrame* pFrame = SfxViewFrame::GetFirst( pDocSh ); + !bOther && pFrame; + pFrame = SfxViewFrame::GetNext( *pFrame, pDocSh ) ) + bOther = (pFrame != this); + + // Doc braucht nur gefragt zu werden, wenn keine weitere View + sal_Bool bClosed = sal_False; + sal_Bool bUI = TRUE; + if ( ( bOther || pDocSh->PrepareClose( bUI ) ) ) + { + if ( !bOther ) + pDocSh->SetModified( FALSE ); + rReq.Done(); // unbedingt vor Close() rufen! + bClosed = sal_False; + try + { + xTask->close(sal_True); + bClosed = sal_True; + } + catch( CloseVetoException& ) + { + bClosed = sal_False; + } + } + + rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bClosed )); + } + return; + } + } + + rReq.Done(); +} + +void SfxViewFrame::GetState_Impl( SfxItemSet &rSet ) +{ + SfxObjectShell *pDocSh = GetObjectShell(); + + if ( !pDocSh ) + return; + + const sal_uInt16 *pRanges = rSet.GetRanges(); + DBG_ASSERT(pRanges, "Set ohne Bereich"); + while ( *pRanges ) + { + for ( sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich ) + { + switch(nWhich) + { + case SID_NEWDOCDIRECT : + { + if ( pImp->aFactoryName.Len() ) + { + String aFact = String::CreateFromAscii("private:factory/"); + aFact += pImp->aFactoryName; + rSet.Put( SfxStringItem( nWhich, aFact ) ); + } + break; + } + + case SID_NEWWINDOW: + rSet.DisableItem(nWhich); + break; + + case SID_CLOSEWIN: + { + // disable CloseWin, if frame is not a task + Reference < XCloseable > xTask( GetFrame().GetFrameInterface(), UNO_QUERY ); + if ( !xTask.is() ) + rSet.DisableItem(nWhich); + break; + } + + case SID_SHOWPOPUPS : + break; + + case SID_OBJECT: + if ( GetViewShell() && GetViewShell()->GetVerbs().getLength() && !GetObjectShell()->IsInPlaceActive() ) + { + uno::Any aAny; + aAny <<= GetViewShell()->GetVerbs(); + rSet.Put( SfxUnoAnyItem( USHORT( SID_OBJECT ), aAny ) ); + } + else + rSet.DisableItem( SID_OBJECT ); + break; + + default: + DBG_ERROR( "invalid message-id" ); + } + } + ++pRanges; + } +} + +void SfxViewFrame::INetExecute_Impl( SfxRequest &rRequest ) +{ + sal_uInt16 nSlotId = rRequest.GetSlot(); + switch( nSlotId ) + { + case SID_BROWSE_FORWARD: + case SID_BROWSE_BACKWARD: + OSL_ENSURE( false, "SfxViewFrame::INetExecute_Impl: SID_BROWSE_FORWARD/BACKWARD are dead!" ); + break; + case SID_CREATELINK: + { +/*! (pb) we need new implementation to create a link +*/ + break; + } + case SID_FOCUSURLBOX: + { + SfxStateCache *pCache = GetBindings().GetAnyStateCache_Impl( SID_OPENURL ); + if( pCache ) + { + SfxControllerItem* pCtrl = pCache->GetItemLink(); + while( pCtrl ) + { + pCtrl->StateChanged( SID_FOCUSURLBOX, SFX_ITEM_UNKNOWN, 0 ); + pCtrl = pCtrl->GetItemLink(); + } + } + } + } + + // Recording + rRequest.Done(); +} + +void SfxViewFrame::INetState_Impl( SfxItemSet &rItemSet ) +{ + rItemSet.DisableItem( SID_BROWSE_FORWARD ); + rItemSet.DisableItem( SID_BROWSE_BACKWARD ); + + // Add/SaveToBookmark bei BASIC-IDE, QUERY-EDITOR etc. disablen + SfxObjectShell *pDocSh = GetObjectShell(); + sal_Bool bPseudo = pDocSh && !( pDocSh->GetFactory().GetFlags() & SFXOBJECTSHELL_HASOPENDOC ); + sal_Bool bEmbedded = pDocSh && pDocSh->GetCreateMode() == SFX_CREATE_MODE_EMBEDDED; + if ( !pDocSh || bPseudo || bEmbedded || !pDocSh->HasName() ) + rItemSet.DisableItem( SID_CREATELINK ); +} + +void SfxViewFrame::SetZoomFactor( const Fraction &rZoomX, const Fraction &rZoomY ) +{ + GetViewShell()->SetZoomFactor( rZoomX, rZoomY ); +} + +void SfxViewFrame::Activate( sal_Bool bMDI ) +{ + DBG_ASSERT(GetViewShell(), "Keine Shell"); + if ( bMDI ) + pImp->bActive = sal_True; +//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +} + +void SfxViewFrame::Deactivate( sal_Bool bMDI ) +{ + DBG_ASSERT(GetViewShell(), "Keine Shell"); + if ( bMDI ) + pImp->bActive = sal_False; +//(mba): hier evtl. wie in Beanframe NotifyEvent ?! +} diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 97f86ee1f395..69ce837fb023 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: viewimp.hxx,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -58,6 +55,7 @@ typedef SfxShell* SfxShellPtr_Impl; SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 ) // struct SfxViewShell_Impl ---------------------------------------------- +#if 0 class SfxAsyncPrintExec_Impl : public SfxListener { SfxViewShell* pView; @@ -72,6 +70,7 @@ public: void AddRequest( SfxRequest& rReq ); }; +#endif class SfxClipboardChangeListener; @@ -85,12 +84,10 @@ struct SfxViewShell_Impl Size aOptimalSize; Size aMargin; USHORT nPrinterLocks; - BOOL bUseObjectSize; BOOL bCanPrint; BOOL bHasPrintOptions; BOOL bPlugInsActive; BOOL bIsShowView; - BOOL bFrameSetImpl; BOOL bOwnsMenu; BOOL bGotOwnerShip; BOOL bGotFrameOwnerShip; @@ -98,7 +95,7 @@ struct SfxViewShell_Impl USHORT nFamily; SfxBaseController* pController; ::svt::AcceleratorExecute* pAccExec; - SfxAsyncPrintExec_Impl* pPrinterCommandQueue; +// SfxAsyncPrintExec_Impl* pPrinterCommandQueue; com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aPrintOpts; ::rtl::Reference< SfxClipboardChangeListener > xClipboardListener; diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index f132bb80d96a..93d6dc19faf0 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: viewprn.cxx,v $ - * $Revision: 1.36.84.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,16 +30,12 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/view/PrintableState.hpp> +#include "com/sun/star/view/XRenderable.hpp" + #include <svl/itempool.hxx> -#ifndef _MSGBOX_HXX //autogen #include <vcl/msgbox.hxx> -#endif -#ifndef _SV_PRINTDLG_HXX //autogen #include <svtools/printdlg.hxx> -#endif -#ifndef _SV_PRNSETUP_HXX //autogen #include <svtools/prnsetup.hxx> -#endif #include <svl/flagitem.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> @@ -51,9 +44,9 @@ #include <unotools/useroptions.hxx> #include <unotools/printwarningoptions.hxx> #include <tools/datetime.hxx> - +#include <sfx2/bindings.hxx> +#include <sfx2/objface.hxx> #include <sfx2/viewsh.hxx> -#include <sfx2/dispatch.hxx> #include "viewimp.hxx" #include <sfx2/viewfrm.hxx> #include <sfx2/prnmon.hxx> @@ -65,50 +58,282 @@ #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> +#include "toolkit/awt/vclxdevice.hxx" + #include "view.hrc" #include "helpid.hrc" +using namespace com::sun::star; +using namespace com::sun::star::uno; + TYPEINIT1(SfxPrintingHint, SfxHint); // ----------------------------------------------------------------------- +class SfxPrinterController : public vcl::PrinterController, public SfxListener +{ + Any maCompleteSelection; + Any maSelection; + Reference< view::XRenderable > mxRenderable; + mutable Printer* mpLastPrinter; + mutable Reference<awt::XDevice> mxDevice; + SfxViewShell* mpViewShell; + SfxObjectShell* mpObjectShell; + sal_Bool m_bOrigStatus; + sal_Bool m_bNeedsChange; + sal_Bool m_bApi; + util::DateTime m_aLastPrinted; + ::rtl::OUString m_aLastPrintedBy; + + Sequence< beans::PropertyValue > getMergedOptions() const; + const Any& getSelectionObject() const; +public: + SfxPrinterController( const Any& i_rComplete, + const Any& i_rSelection, + const Any& i_rViewProp, + const Reference< view::XRenderable >& i_xRender, + sal_Bool i_bApi, sal_Bool i_bDirect, + SfxViewShell* pView, + const uno::Sequence< beans::PropertyValue >& rProps + ); + + virtual ~SfxPrinterController(); + virtual void Notify( SfxBroadcaster&, const SfxHint& ); + + virtual int getPageCount() const; + virtual Sequence< beans::PropertyValue > getPageParameters( int i_nPage ) const; + virtual void printPage( int i_nPage ) const; + virtual void jobStarted(); + virtual void jobFinished( com::sun::star::view::PrintableState ); +}; + +SfxPrinterController::SfxPrinterController( const Any& i_rComplete, + const Any& i_rSelection, + const Any& i_rViewProp, + const Reference< view::XRenderable >& i_xRender, + sal_Bool i_bApi, sal_Bool i_bDirect, + SfxViewShell* pView, + const uno::Sequence< beans::PropertyValue >& rProps + ) + : maCompleteSelection( i_rComplete ) + , maSelection( i_rSelection ) + , mxRenderable( i_xRender ) + , mpLastPrinter( NULL ) + , mpViewShell( pView ) + , mpObjectShell(0) + , m_bOrigStatus( sal_False ) + , m_bNeedsChange( sal_False ) + , m_bApi(i_bApi) +{ + if ( mpViewShell ) + { + StartListening( *mpViewShell ); + mpObjectShell = mpViewShell->GetObjectShell(); + StartListening( *mpObjectShell ); + m_bOrigStatus = mpObjectShell->IsEnableSetModified(); + + // check configuration: shall update of printing information in DocInfo set the document to "modified"? + if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) + { + mpObjectShell->EnableSetModified( sal_False ); + m_bNeedsChange = sal_True; + } + + // refresh document info + uno::Reference<document::XDocumentProperties> xDocProps(mpObjectShell->getDocProperties()); + m_aLastPrintedBy = xDocProps->getPrintedBy(); + m_aLastPrinted = xDocProps->getPrintDate(); + + xDocProps->setPrintedBy( mpObjectShell->IsUseUserData() + ? ::rtl::OUString( SvtUserOptions().GetFullName() ) + : ::rtl::OUString() ); + ::DateTime now; + + xDocProps->setPrintDate( util::DateTime( + now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(), + now.GetDay(), now.GetMonth(), now.GetYear() ) ); + } + + // initialize extra ui options + if( mxRenderable.is() ) + { + for (sal_Int32 nProp=0; nProp<rProps.getLength(); nProp++) + setValue( rProps[nProp].Name, rProps[nProp].Value ); + + Sequence< beans::PropertyValue > aRenderOptions( 3 ); + aRenderOptions[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ExtraPrintUIOptions" ) ); + aRenderOptions[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "View" ) ); + aRenderOptions[1].Value = i_rViewProp; + aRenderOptions[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ); + aRenderOptions[2].Value <<= sal_True; + Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) ); + int nProps = aRenderParms.getLength(); + for( int i = 0; i < nProps; i++ ) + { + if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) ) + { + Sequence< beans::PropertyValue > aUIProps; + aRenderParms[i].Value >>= aUIProps; + setUIOptions( aUIProps ); + break; + } + } + } + + // set some job parameters + setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsApi" ) ), makeAny( i_bApi ) ); + setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsDirect" ) ), makeAny( i_bDirect ) ); + setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) ), makeAny( sal_True ) ); + setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "View" ) ), i_rViewProp ); +} + +void SfxPrinterController::Notify( SfxBroadcaster& , const SfxHint& rHint ) +{ + if ( rHint.IsA(TYPE(SfxSimpleHint)) ) + { + if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING ) + { + EndListening(*mpViewShell); + EndListening(*mpObjectShell); + mpViewShell = 0; + mpObjectShell = 0; + } + } +} + +SfxPrinterController::~SfxPrinterController() +{ +} + +const Any& SfxPrinterController::getSelectionObject() const +{ + sal_Int32 nChoice = 0; + sal_Bool bSel = sal_False; + const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); + if( pVal ) + pVal->Value >>= nChoice; + pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ) ); + if( pVal ) + pVal->Value >>= bSel; + return (nChoice > 1 || bSel) ? maSelection : maCompleteSelection; +} + +Sequence< beans::PropertyValue > SfxPrinterController::getMergedOptions() const +{ + boost::shared_ptr<Printer> pPrinter( getPrinter() ); + if( pPrinter.get() != mpLastPrinter ) + { + mpLastPrinter = pPrinter.get(); + VCLXDevice* pXDevice = new VCLXDevice(); + pXDevice->SetOutputDevice( mpLastPrinter ); + mxDevice = Reference< awt::XDevice >( pXDevice ); + } + + Sequence< beans::PropertyValue > aRenderOptions( 1 ); + aRenderOptions[ 0 ].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ); + aRenderOptions[ 0 ].Value <<= mxDevice; + + aRenderOptions = getJobProperties( aRenderOptions ); + return aRenderOptions; +} + +int SfxPrinterController::getPageCount() const +{ + int nPages = 0; + boost::shared_ptr<Printer> pPrinter( getPrinter() ); + if( mxRenderable.is() && pPrinter ) + { + Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); + nPages = mxRenderable->getRendererCount( getSelectionObject(), aJobOptions ); + } + return nPages; +} + +Sequence< beans::PropertyValue > SfxPrinterController::getPageParameters( int i_nPage ) const +{ + boost::shared_ptr<Printer> pPrinter( getPrinter() ); + Sequence< beans::PropertyValue > aResult; + + if( mxRenderable.is() && pPrinter ) + { + Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); + aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions ); + } + return aResult; +} -void SfxAsyncPrintExec_Impl::AddRequest( SfxRequest& rReq ) +void SfxPrinterController::printPage( int i_nPage ) const { - if ( rReq.GetArgs() ) + boost::shared_ptr<Printer> pPrinter( getPrinter() ); + if( mxRenderable.is() && pPrinter ) { - // only queue API requests - if ( aReqs.empty() ) - StartListening( *pView->GetObjectShell() ); + Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() ); + try + { + mxRenderable->render( i_nPage, getSelectionObject(), aJobOptions ); + } + catch( lang::IllegalArgumentException& ) + { + // don't care enough about nonexistant page here + // to provoke a crash + } + } +} - aReqs.push( new SfxRequest( rReq ) ); +void SfxPrinterController::jobStarted() +{ + if ( mpObjectShell ) + { + // FIXME: how to get all print options incl. AdditionalOptions easily? + uno::Sequence < beans::PropertyValue > aOpts; + mpObjectShell->Broadcast( SfxPrintingHint( view::PrintableState_JOB_STARTED, aOpts ) ); } } -void SfxAsyncPrintExec_Impl::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) +void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nState ) { - if ( &rBC == pView->GetObjectShell() ) + if ( mpObjectShell ) { - SfxPrintingHint* pPrintHint = PTR_CAST( SfxPrintingHint, &rHint ); - if ( pPrintHint && pPrintHint->GetWhich() == com::sun::star::view::PrintableState_JOB_COMPLETED ) + mpObjectShell->Broadcast( SfxPrintingHint( nState ) ); + switch ( nState ) { - while ( aReqs.front() ) + case view::PrintableState_JOB_FAILED : { - SfxRequest* pReq = aReqs.front(); - aReqs.pop(); - pView->GetViewFrame()->GetDispatcher()->Execute( pReq->GetSlot(), SFX_CALLMODE_ASYNCHRON, *pReq->GetArgs() ); - USHORT nSlot = pReq->GetSlot(); - delete pReq; - if ( nSlot == SID_PRINTDOC || nSlot == SID_PRINTDOCDIRECT ) - // print jobs must be executed before the next command can be dispatched - break; + // "real" problem (not simply printing cancelled by user) + String aMsg( SfxResId( STR_NOSTARTPRINTER ) ); + if ( !m_bApi ) + ErrorBox( mpViewShell->GetWindow(), WB_OK | WB_DEF_OK, aMsg ).Execute(); + // intentionally no break + } + case view::PrintableState_JOB_ABORTED : + { + // printing not succesful, reset DocInfo + uno::Reference<document::XDocumentProperties> xDocProps(mpObjectShell->getDocProperties()); + xDocProps->setPrintedBy(m_aLastPrintedBy); + xDocProps->setPrintDate(m_aLastPrinted); + break; + } + + case view::PrintableState_JOB_SPOOLED : + case view::PrintableState_JOB_COMPLETED : + { + SfxBindings& rBind = mpViewShell->GetViewFrame()->GetBindings(); + rBind.Invalidate( SID_PRINTDOC ); + rBind.Invalidate( SID_PRINTDOCDIRECT ); + rBind.Invalidate( SID_SETUPPRINTER ); + break; } - if ( aReqs.empty() ) - EndListening( *pView->GetObjectShell() ); + default: + break; } + + if ( m_bNeedsChange ) + mpObjectShell->EnableSetModified( m_bOrigStatus ); } } +// ----------------------------------------------------------------------- + void DisableRanges( PrintDialog& rDlg, SfxPrinter* pPrinter ) /* [Beschreibung] @@ -391,68 +616,137 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter ) #pragma optimize ( "", off ) #endif -class SfxPrintGuard_Impl +void SfxViewShell::ExecPrint( const uno::Sequence < beans::PropertyValue >& rProps, sal_Bool bIsAPI, sal_Bool bIsDirect ) { - SfxObjectShell* m_pObjectShell; - sal_Bool m_bOrigStatus; - sal_Bool m_bNeedsChange; - -public: - SfxPrintGuard_Impl( SfxObjectShell* pObjectShell ) - : m_pObjectShell( pObjectShell ) - , m_bOrigStatus( sal_False ) - , m_bNeedsChange( sal_False ) - { - if ( m_pObjectShell ) - { - m_bOrigStatus = m_pObjectShell->IsEnableSetModified(); + // get the current selection; our controller should know it + Reference< frame::XController > xController( GetController() ); + Reference< view::XSelectionSupplier > xSupplier( xController, UNO_QUERY ); - // check configuration: shall update of printing information in DocInfo set the document to "modified"? - if ( m_bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) - { - m_pObjectShell->EnableSetModified( sal_False ); - m_bNeedsChange = sal_True; - } - } - } - - ~SfxPrintGuard_Impl() - { - if ( m_pObjectShell && m_bNeedsChange ) - m_pObjectShell->EnableSetModified( m_bOrigStatus ); - } -}; + Any aSelection; + if( xSupplier.is() ) + aSelection = xSupplier->getSelection(); + else + aSelection <<= GetObjectShell()->GetModel(); + Any aComplete( makeAny( GetObjectShell()->GetModel() ) ); + Any aViewProp( makeAny( xController ) ); + + boost::shared_ptr<vcl::PrinterController> pController( new SfxPrinterController( aComplete, + aSelection, + aViewProp, + GetRenderable(), + bIsAPI, + bIsDirect, + this, + rProps + ) ); + SfxObjectShell *pObjShell = GetObjectShell(); + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ), + makeAny( rtl::OUString( pObjShell->GetTitle(0) ) ) ); + + // FIXME: job setup + SfxPrinter* pDocPrt = GetPrinter(FALSE); + JobSetup aJobSetup = pDocPrt ? pDocPrt->GetJobSetup() : GetJobSetup(); + if( bIsDirect ) + aJobSetup.SetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ), + String( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) ); + + Printer::PrintJob( pController, aJobSetup ); +} void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { - USHORT nCopies=1; + // USHORT nCopies=1; USHORT nDialogRet = RET_CANCEL; - BOOL bCollate=TRUE; + // BOOL bCollate=FALSE; SfxPrinter* pPrinter = 0; PrintDialog* pPrintDlg = 0; SfxDialogExecutor_Impl* pExecutor = 0; bool bSilent = false; BOOL bIsAPI = rReq.GetArgs() && rReq.GetArgs()->Count(); - - if ( bIsAPI && GetPrinter( FALSE ) && GetPrinter( FALSE )->IsPrinting() ) + if ( bIsAPI ) { - pImp->pPrinterCommandQueue->AddRequest( rReq ); - return; + SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE); + bSilent = pSilentItem && pSilentItem->GetValue(); } + //FIXME: how to transport "bPrintOnHelp"? + + // no help button in dialogs if called from the help window + // (pressing help button would exchange the current page inside the help document that is going to be printed!) + String aHelpFilterName( DEFINE_CONST_UNICODE("writer_web_HTML_help") ); + SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium(); + const SfxFilter* pFilter = pMedium ? pMedium->GetFilter() : NULL; + sal_Bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == aHelpFilterName ); + const USHORT nId = rReq.GetSlot(); switch( nId ) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_PRINTDOC: - case SID_SETUPPRINTER: - case SID_PRINTER_NAME : + case SID_PRINTDOCDIRECT: { - // quiet mode (AppEvent, API call) - SFX_REQUEST_ARG(rReq, pSilentItem, SfxBoolItem, SID_SILENT, FALSE); - bSilent = pSilentItem && pSilentItem->GetValue(); + SfxObjectShell* pDoc = GetObjectShell(); + bool bDetectHidden = ( !bSilent && pDoc ); + if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES ) + break; + + SFX_REQUEST_ARG(rReq, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE); + sal_Bool bSelection = pSelectItem && pSelectItem->GetValue(); + if( pSelectItem && rReq.GetArgs()->Count() == 1 ) + bIsAPI = FALSE; + + uno::Sequence < beans::PropertyValue > aProps; + if ( bIsAPI ) + { + // supported properties: + // String PrinterName + // String FileName + // Int16 From + // Int16 To + // In16 Copies + // String RangeText + // bool Selection + // bool Asynchron + // bool Collate + // bool Silent + TransformItems( nId, *rReq.GetArgs(), aProps, GetInterface()->GetSlot(nId) ); + for ( sal_Int32 nProp=0; nProp<aProps.getLength(); nProp++ ) + { + if ( aProps[nProp].Name.equalsAscii("Copies") ) + aProps[nProp]. Name = rtl::OUString::createFromAscii("CopyCount"); + else if ( aProps[nProp].Name.equalsAscii("RangeText") ) + aProps[nProp]. Name = rtl::OUString::createFromAscii("Pages"); + if ( aProps[nProp].Name.equalsAscii("Asynchron") ) + { + aProps[nProp]. Name = rtl::OUString::createFromAscii("Wait"); + sal_Bool bAsynchron = sal_False; + aProps[nProp].Value >>= bAsynchron; + aProps[nProp].Value <<= (sal_Bool) (!bAsynchron); + } + if ( aProps[nProp].Name.equalsAscii("Silent") ) + { + aProps[nProp]. Name = rtl::OUString::createFromAscii("MonitorVisible"); + sal_Bool bPrintSilent = sal_False; + aProps[nProp].Value >>= bPrintSilent; + aProps[nProp].Value <<= (sal_Bool) (!bPrintSilent); + } + } + } + sal_Int32 nLen = aProps.getLength(); + aProps.realloc( nLen + 1 ); + aProps[nLen].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintSelectionOnly" ) ); + aProps[nLen].Value = makeAny( bSelection ); + + ExecPrint( aProps, bIsAPI, (nId == SID_PRINTDOCDIRECT) ); + + // FIXME: Recording + rReq.Done(); + break; + } + case SID_SETUPPRINTER : + case SID_PRINTER_NAME : // only for recorded macros + { // get printer and printer settings from the document SfxPrinter *pDocPrinter = GetPrinter(TRUE); @@ -473,7 +767,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) // just set a recorded printer name if ( pPrinter ) SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); - return; + break; } // no PrinterName parameter in ItemSet or the PrinterName points to an unknown printer @@ -487,7 +781,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) if ( bSilent ) { rReq.SetReturnValue(SfxBoolItem(0,FALSE)); - return; + break; } else ErrorBox( NULL, WB_OK | WB_DEF_OK, String( SfxResId( STR_NODEFPRINTER ) ) ).Execute(); @@ -497,112 +791,57 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) { // printer is not available, but standard printer should not be used rReq.SetReturnValue(SfxBoolItem(0,FALSE)); - return; + break; } + // FIXME: printer isn't used for printing anymore! if( pPrinter->IsPrinting() ) { // if printer is busy, abort printing if ( !bSilent ) InfoBox( NULL, String( SfxResId( STR_ERROR_PRINTER_BUSY ) ) ).Execute(); rReq.SetReturnValue(SfxBoolItem(0,FALSE)); - return; + break; } - // the print dialog shouldn't use a help button if it is called from the help window - // (pressing help button would exchange the current page inside the help document that is going to be printed!) - String aHelpFilterName( DEFINE_CONST_UNICODE("writer_web_HTML_help") ); - SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium(); - const SfxFilter* pFilter = pMedium ? pMedium->GetFilter() : NULL; - sal_Bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == aHelpFilterName ); - - SfxObjectShell* pDoc = NULL; - if ( SID_PRINTDOC == nId ) - pDoc = GetObjectShell(); - - // Let the document stay nonmodified during the printing if the configuration says to do so - SfxPrintGuard_Impl aGuard( pDoc ); - // if no arguments are given, retrieve them from a dialog if ( !bIsAPI ) { // PrinterDialog needs a temporary printer SfxPrinter* pDlgPrinter = pPrinter->Clone(); nDialogRet = 0; - if ( SID_PRINTDOC == nId ) + + // execute PrinterSetupDialog + PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() ); + + if ( pImp->bHasPrintOptions ) { - bool bDetectHidden = ( !bSilent && !bPrintOnHelp && pDoc ); - if ( !bDetectHidden - || pDoc->QueryHiddenInformation( WhenPrinting, NULL ) == RET_YES ) - { - // execute PrintDialog - pPrintDlg = CreatePrintDialog( NULL ); - if ( bPrintOnHelp ) - pPrintDlg->DisableHelp(); - - if ( pImp->bHasPrintOptions ) - { - // additional controls for dialog - pExecutor = new SfxDialogExecutor_Impl( this, pPrintDlg ); - if ( bPrintOnHelp ) - pExecutor->DisableHelp(); - pPrintDlg->SetOptionsHdl( pExecutor->GetLink() ); - pPrintDlg->ShowOptionsButton(); - } - - // set printer on dialog and execute - pPrintDlg->SetPrinter( pDlgPrinter ); - ::DisableRanges( *pPrintDlg, pDlgPrinter ); - nDialogRet = pPrintDlg->Execute(); - if ( pExecutor && pExecutor->GetOptions() ) - { - if ( nDialogRet == RET_OK ) - // remark: have to be recorded if possible! - pDlgPrinter->SetOptions( *pExecutor->GetOptions() ); - else - { - pPrinter->SetOptions( *pExecutor->GetOptions() ); - SetPrinter( pPrinter, SFX_PRINTER_OPTIONS ); - } - } - - DELETEZ( pExecutor ); - } + // additional controls for dialog + pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg ); + if ( bPrintOnHelp ) + pExecutor->DisableHelp(); + pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() ); } - else - { - // execute PrinterSetupDialog - PrinterSetupDialog* pPrintSetupDlg = new PrinterSetupDialog( GetWindow() ); - - if ( pImp->bHasPrintOptions ) - { - // additional controls for dialog - pExecutor = new SfxDialogExecutor_Impl( this, pPrintSetupDlg ); - if ( bPrintOnHelp ) - pExecutor->DisableHelp(); - pPrintSetupDlg->SetOptionsHdl( pExecutor->GetLink() ); - } - pPrintSetupDlg->SetPrinter( pDlgPrinter ); - nDialogRet = pPrintSetupDlg->Execute(); + pPrintSetupDlg->SetPrinter( pDlgPrinter ); + nDialogRet = pPrintSetupDlg->Execute(); - if ( pExecutor && pExecutor->GetOptions() ) + if ( pExecutor && pExecutor->GetOptions() ) + { + if ( nDialogRet == RET_OK ) + // remark: have to be recorded if possible! + pDlgPrinter->SetOptions( *pExecutor->GetOptions() ); + else { - if ( nDialogRet == RET_OK ) - // remark: have to be recorded if possible! - pDlgPrinter->SetOptions( *pExecutor->GetOptions() ); - else - { - pPrinter->SetOptions( *pExecutor->GetOptions() ); - SetPrinter( pPrinter, SFX_PRINTER_OPTIONS ); - } + pPrinter->SetOptions( *pExecutor->GetOptions() ); + SetPrinter( pPrinter, SFX_PRINTER_OPTIONS ); } + } - DELETEZ( pPrintSetupDlg ); + DELETEZ( pPrintSetupDlg ); - // no recording of PrinterSetup except printer name (is printer dependent) - rReq.Ignore(); - } + // no recording of PrinterSetup except printer name (is printer dependent) + rReq.Ignore(); if ( nDialogRet == RET_OK ) { @@ -623,14 +862,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) /* Now lets reset the Dialog printer, since its freed */ if (pPrintDlg) pPrintDlg->SetPrinter (pPrinter); - - if ( SID_PRINTDOC == nId ) - { - nCopies = pPrintDlg->GetCopyCount(); - bCollate = pPrintDlg->IsCollateChecked(); - } - else - break; } else { @@ -641,226 +872,11 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) rReq.Ignore(); if ( SID_PRINTDOC == nId ) rReq.SetReturnValue(SfxBoolItem(0,FALSE)); - break; - } - - // recording - rReq.AppendItem( SfxBoolItem( SID_PRINT_COLLATE, bCollate ) ); - rReq.AppendItem( SfxInt16Item( SID_PRINT_COPIES, (INT16) pPrintDlg->GetCopyCount() ) ); - if ( pPrinter->IsPrintFileEnabled() ) - rReq.AppendItem( SfxStringItem( SID_FILE_NAME, pPrinter->GetPrintFile() ) ); - if ( pPrintDlg->IsRangeChecked(PRINTDIALOG_SELECTION) ) - rReq.AppendItem( SfxBoolItem( SID_SELECTION, TRUE ) ); - else if ( pPrintDlg->IsRangeChecked(PRINTDIALOG_RANGE) ) - rReq.AppendItem( SfxStringItem( SID_PRINT_PAGES, pPrintDlg->GetRangeText() ) ); - else if ( pPrintDlg->IsRangeChecked(PRINTDIALOG_FROMTO) ) - { - // currently this doesn't seem to work -> return values of dialog are always 0 - // seems to be encoded as range string like "1-3" - rReq.AppendItem( SfxInt16Item( SID_PRINT_FIRST_PAGE, (INT16) pPrintDlg->GetFirstPage() ) ); - rReq.AppendItem( SfxInt16Item( SID_PRINT_LAST_PAGE, (INT16) pPrintDlg->GetLastPage() ) ); } } - else if ( rReq.GetArgs() ) - { - if ( SID_PRINTDOC != nId ) - { - DBG_ERROR("Wrong slotid!"); - break; - } - - // PrinterDialog is used to transfer information on printing - pPrintDlg = CreatePrintDialog( GetWindow() ); - if ( bPrintOnHelp ) - pPrintDlg->DisableHelp(); - pPrintDlg->SetPrinter( pPrinter ); - ::DisableRanges( *pPrintDlg, pPrinter ); - - // PrintToFile requested? - SFX_REQUEST_ARG(rReq, pFileItem, SfxStringItem, SID_FILE_NAME, FALSE); - if ( pFileItem ) - { - pPrinter->EnablePrintFile(TRUE); - pPrinter->SetPrintFile( pFileItem->GetValue() ); - } - - // Collate - SFX_REQUEST_ARG(rReq, pCollateItem, SfxBoolItem, SID_PRINT_COLLATE, FALSE); - if ( pCollateItem ) - { - bCollate = pCollateItem->GetValue(); - pPrintDlg->CheckCollate( bCollate ); - } - - // Selection - SFX_REQUEST_ARG(rReq, pSelectItem, SfxBoolItem, SID_SELECTION, FALSE); - - // Pages (as String) - SFX_REQUEST_ARG(rReq, pPagesItem, SfxStringItem, SID_PRINT_PAGES, FALSE); - - // FirstPage - SFX_REQUEST_ARG(rReq, pFirstPgItem, SfxInt16Item, SID_PRINT_FIRST_PAGE, FALSE); - USHORT nFrom = 1; - if ( pFirstPgItem ) - nFrom = pFirstPgItem->GetValue(); - - // LastPage - SFX_REQUEST_ARG(rReq, pLastPgItem, SfxInt16Item, SID_PRINT_LAST_PAGE, FALSE); - USHORT nTo = 9999; - if ( pLastPgItem ) - nTo = pLastPgItem->GetValue(); - - // CopyCount - SFX_REQUEST_ARG(rReq, pCopyItem, SfxInt16Item, SID_PRINT_COPIES, FALSE); - if ( pCopyItem ) - { - nCopies = pCopyItem->GetValue(); - pPrintDlg->SetCopyCount( nCopies ); - } - - // does the view support ranges? - if ( pSelectItem && pSelectItem->GetValue() ) - { - // print selection only - pPrintDlg->CheckRange(PRINTDIALOG_SELECTION); - } - else if ( pPagesItem ) - { - // get range text from parameter - // enable ranges - pPrintDlg->CheckRange(PRINTDIALOG_RANGE); - pPrintDlg->SetRangeText( pPagesItem->GetValue() ); - } - else if ( pPrintDlg->IsRangeEnabled(PRINTDIALOG_RANGE) ) - { - // enable ranges - // construct range text from page range - pPrintDlg->CheckRange(PRINTDIALOG_RANGE); - String aRange = String::CreateFromInt32( nFrom ); - aRange += '-'; - aRange += String::CreateFromInt32( nTo ); - pPrintDlg->SetRangeText( aRange ); - } - else - { - // print page rage - pPrintDlg->CheckRange(PRINTDIALOG_FROMTO); - pPrintDlg->SetFirstPage( nFrom ); - pPrintDlg->SetLastPage( nTo ); - } - } - - // intentionally no break for SID_PRINTDOC - // printing now proceeds like SID_PRINTDOCDIRECT } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_PRINTDOCDIRECT: - { - if ( SID_PRINTDOCDIRECT == nId ) - { - SfxObjectShell* pDoc = GetObjectShell(); - bool bDetectHidden = ( !bSilent && pDoc ); - if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES ) - return; - - // if no printer was selected before - if ( !pPrinter ) - pPrinter = GetPrinter(TRUE); - - if( !pPrinter->IsValid() ) - { - // redirect slot to call the print dialog if the document's printer is not valid! - rReq.SetSlot( SID_PRINTDOC ); - ExecPrint_Impl( rReq ); - return; - } - - if( pPrinter->IsOriginal() && pPrinter->GetName() != Printer::GetDefaultPrinterName() ) - { - // redirect slot to call the print dialog - // if the document's printer is available but not system default - rReq.SetSlot( SID_PRINTDOC ); - ExecPrint_Impl( rReq ); - return; - } - - pPrinter->SetNextJobIsQuick(); - } - - // if "Collate" was checked, the SfxPrinter must handle the CopyCount itself, - // usually this is handled by the printer driver - if( bCollate ) - // set printer to default, handle multiple copies explicitly - pPrinter->SetCopyCount( 1 ); - else - pPrinter->SetCopyCount( nCopies ); - - // enable background printing - pPrinter->SetPageQueueSize( 1 ); - - // refresh document info - using namespace ::com::sun::star; - SfxObjectShell *pObjSh = GetObjectShell(); - uno::Reference<document::XDocumentProperties> xDocProps( - pObjSh->getDocProperties()); - ::rtl::OUString aLastPrintedBy = xDocProps->getPrintedBy(); - util::DateTime aLastPrinted = xDocProps->getPrintDate(); - - // Let the document stay nonmodified during the printing if the configuration says to do so - SfxPrintGuard_Impl aGuard( pObjSh ); - - xDocProps->setPrintedBy( GetObjectShell()->IsUseUserData() - ? ::rtl::OUString( SvtUserOptions().GetFullName() ) - : ::rtl::OUString() ); - ::DateTime now; - xDocProps->setPrintDate( util::DateTime( - now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(), - now.GetDay(), now.GetMonth(), now.GetYear() ) ); - - GetObjectShell()->Broadcast( SfxPrintingHint( -1, pPrintDlg, pPrinter ) ); - ErrCode nError = DoPrint( pPrinter, pPrintDlg, bSilent, bIsAPI ); - if ( nError == PRINTER_OK ) - { - Invalidate( SID_PRINTDOC ); - Invalidate( SID_PRINTDOCDIRECT ); - Invalidate( SID_SETUPPRINTER ); - rReq.SetReturnValue(SfxBoolItem(0,TRUE)); - - SFX_REQUEST_ARG(rReq, pAsyncItem, SfxBoolItem, SID_ASYNCHRON, FALSE); - if ( pAsyncItem && !pAsyncItem->GetValue() ) - { - // synchronous execution wanted - wait for end of printing - while ( pPrinter->IsPrinting()) - Application::Yield(); - } - - rReq.Done(); - } - else - { - // printing not succesful, reset DocInfo - xDocProps->setPrintedBy(aLastPrintedBy); - xDocProps->setPrintDate(aLastPrinted); - - if ( nError != PRINTER_ABORT ) - { - // "real" problem (not simply printing cancelled by user) - String aMsg( SfxResId( STR_NOSTARTPRINTER ) ); - if ( !bIsAPI ) - ErrorBox( NULL, WB_OK | WB_DEF_OK, aMsg ).Execute(); - rReq.SetReturnValue(SfxBoolItem(0,FALSE)); - } - - rReq.Ignore(); - } - - pPrinter->SetNextJobIsQuick( false ); - - delete pPrintDlg; - break; - } + break; } } @@ -871,7 +887,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq ) //-------------------------------------------------------------------- -PrintDialog* SfxViewShell::CreatePrintDialog( Window* pParent ) +PrintDialog* SfxViewShell::CreatePrintDialog( Window* /*pParent*/ ) /* [Beschreibung] @@ -881,11 +897,15 @@ PrintDialog* SfxViewShell::CreatePrintDialog( Window* pParent ) */ { + #if 0 PrintDialog *pDlg = new PrintDialog( pParent, false ); pDlg->SetFirstPage( 1 ); pDlg->SetLastPage( 9999 ); pDlg->EnableCollate(); return pDlg; + #else + return NULL; + #endif } //-------------------------------------------------------------------- @@ -897,10 +917,11 @@ void SfxViewShell::PreparePrint( PrintDialog * ) //-------------------------------------------------------------------- -ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter, - PrintDialog *pPrintDlg, - BOOL bSilent, BOOL bIsAPI ) +ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/, + PrintDialog* /*pPrintDlg*/, + BOOL /*bSilent*/, BOOL /*bIsAPI*/ ) { + #if 0 // Printer-Dialogbox waehrend des Ausdrucks mu\s schon vor // StartJob erzeugt werden, da SV bei einem Quit-Event h"angt SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent ); @@ -910,11 +931,8 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter, else if ( pDocPrinter != pPrinter ) { pProgress->RestoreOnEndPrint( pDocPrinter->Clone() ); - USHORT nError = SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); - if ( nError != SFX_PRINTERROR_NONE ) - return PRINTER_ACCESSDENIED; + SetPrinter( pPrinter, SFX_PRINTER_PRINTER ); } - pProgress->SetWaitMode(FALSE); // Drucker starten @@ -935,6 +953,10 @@ ErrCode SfxViewShell::DoPrint( SfxPrinter *pPrinter, } return pPrinter->GetError(); + #else + DBG_ERROR( "DoPrint called, dead code !" ); + return ERRCODE_IO_NOTSUPPORTED; + #endif } //-------------------------------------------------------------------- @@ -990,23 +1012,12 @@ SfxTabPage* SfxViewShell::CreatePrintOptionsPage Window* /*pParent*/, const SfxItemSet& /*rOptions*/ ) - -/* [Beschreibung] - - Diese Factory-Methode wird vom SFx verwendet, um die TabPage mit den - Print-Optionen, welche "uber das <SfxItemSet> am <SfxPrinter> - transportiert werden, zu erzeugen. - - Abgeleitete Klassen k"onnen diese Methode also "uberladen um die zu - ihren SfxPrinter passenden Einstellungen vorzunehmen. Dieses sollte - genau die <SfxTabPage> sein, die auch unter Extras/Einstellungen - verwendet wird. - - Die Basisimplementierung liefert einen 0-Pointer. -*/ - { return 0; } +JobSetup SfxViewShell::GetJobSetup() const +{ + return JobSetup(); +} diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 167cd59eb71f..224176ca4a45 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -2,13 +2,10 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2008 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: viewsh.cxx,v $ - * $Revision: 1.82.98.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -84,8 +81,8 @@ #include "view.hrc" #include "sfxlocal.hrc" #include <sfx2/sfxbasecontroller.hxx> -#include <sfx2/topfrm.hxx> #include "sfx2/mailmodelapi.hxx" +#include <sfx2/viewfrm.hxx> #include <sfx2/event.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/ipclient.hxx> @@ -392,7 +389,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) case SID_ACTIVATE_STYLE_APPLY: { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( - GetViewFrame()->GetFrame()->GetFrameInterface(), + GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY); Reference< com::sun::star::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY ); @@ -488,7 +485,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) if ( pMailDocType ) aDocType = pMailDocType->GetValue(); - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); SfxMailModel::SendMailResult eResult = SfxMailModel::SEND_MAIL_ERROR; if ( nId == SID_MAIL_SENDDOC ) @@ -532,7 +529,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) const sal_Int32 FILTERFLAG_EXPORT = 0x00000002; css::uno::Reference< lang::XMultiServiceFactory > xSMGR(::comphelper::getProcessServiceFactory(), css::uno::UNO_QUERY_THROW); - css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + css::uno::Reference < css::frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); css::uno::Reference< css::frame::XModel > xModel; const rtl::OUString aModuleManager( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" )); @@ -689,8 +686,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) // ausfuehren if ( !pShowItem || bActive != pImp->bPlugInsActive ) { - SfxFrame* pTopFrame = GetFrame()->GetTopFrame(); - if ( pTopFrame != GetFrame()->GetFrame() ) + SfxFrame* pTopFrame = &GetFrame()->GetTopFrame(); + if ( pTopFrame != &GetFrame()->GetFrame() ) { // FramesetDocument SfxViewShell *pShell = pTopFrame->GetCurrentViewFrame()->GetViewShell(); @@ -776,7 +773,7 @@ void SfxViewShell::GetState_Impl( SfxItemSet &rSet ) aPrinterName = Printer::GetDefaultPrinterName(); if ( aPrinterName.getLength() > 0 ) { - uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xFrame( pFrame->GetFrame().GetFrameInterface() ); ::rtl::OUStringBuffer aBuffer( 60 ); aBuffer.append( RetrieveLabelFromCommand( @@ -874,7 +871,7 @@ ErrCode SfxViewShell::DoVerb(long /*nVerb*/) void SfxViewShell::OutplaceActivated( sal_Bool bActive, SfxInPlaceClient* /*pClient*/ ) { if ( !bActive ) - GetFrame()->GetFrame()->Appear(); + GetFrame()->GetFrame().Appear(); } //-------------------------------------------------------------------- @@ -896,7 +893,7 @@ void SfxViewShell::InplaceDeactivated( SfxInPlaceClient* /*pClient*/ ) void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ ) { - uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame()->GetFrameInterface() ); + uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); if ( xParentFrame.is() ) xParentFrame->setActiveFrame( xOwnFrame ); @@ -909,12 +906,12 @@ void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ ) void SfxViewShell::UIDeactivated( SfxInPlaceClient* /*pClient*/ ) { - if ( !pFrame->GetFrame()->IsClosing_Impl() || + if ( !pFrame->GetFrame().IsClosing_Impl() || SfxViewFrame::Current() != pFrame ) pFrame->GetDispatcher()->Update_Impl( TRUE ); pFrame->GetBindings().HidePopups(FALSE); - // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame()->GetFrameInterface() ); + // uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() ); // uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY ); // if ( xParentFrame.is() ) // xParentFrame->setActiveFrame( uno::Reference < frame::XFrame >() ); @@ -995,7 +992,7 @@ void SfxViewShell::Activate( BOOL bMDI ) { SfxObjectShell *pSh = GetViewFrame()->GetObjectShell(); if ( pSh->GetModel().is() ) - pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame()->GetController() ); + pSh->GetModel()->setCurrentController( GetViewFrame()->GetFrame().GetController() ); SetCurrentDocument(); } @@ -1255,22 +1252,16 @@ SfxViewShell::SfxViewShell ,pFrame(pViewFrame) ,pSubShell(0) ,pWindow(0) - ,bMaximizeFirst( 0 != (nFlags & SFX_VIEW_MAXIMIZE_FIRST) ) - ,bOptimizeEach(0 != (nFlags & SFX_VIEW_OPTIMIZE_EACH)) ,bNoNewWindow( 0 != (nFlags & SFX_VIEW_NO_NEWWINDOW) ) { DBG_CTOR(SfxViewShell, 0); - pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this ); + //pImp->pPrinterCommandQueue = new SfxAsyncPrintExec_Impl( this ); pImp->pController = 0; pImp->bIsShowView = !(SFX_VIEW_NO_SHOW == (nFlags & SFX_VIEW_NO_SHOW)); - pImp->bUseObjectSize = FALSE; -// SFX_CREATE_MODE_EMBEDDED==pFrame->GetObjectShell()->GetCreateMode() && -// SFX_VIEW_OBJECTSIZE_EMBEDDED == (nFlags & SFX_VIEW_OBJECTSIZE_EMBEDDED); pImp->bCanPrint = SFX_VIEW_CAN_PRINT == (nFlags & SFX_VIEW_CAN_PRINT); - pImp->bFrameSetImpl = (nFlags & SFX_VIEW_IMPLEMENTED_AS_FRAMESET) != 0; pImp->bHasPrintOptions = SFX_VIEW_HAS_PRINTOPTIONS == (nFlags & SFX_VIEW_HAS_PRINTOPTIONS); pImp->bPlugInsActive = TRUE; @@ -1322,7 +1313,7 @@ SfxViewShell::~SfxViewShell() DELETEZ( pImp->pAccExec ); } - DELETEZ( pImp->pPrinterCommandQueue ); + //DELETEZ( pImp->pPrinterCommandQueue ); DELETEZ( pImp ); DELETEZ( pIPClientList ); } @@ -1366,6 +1357,24 @@ SfxViewShell* SfxViewShell::Current() //-------------------------------------------------------------------- +SfxViewShell* SfxViewShell::Get( const Reference< XController>& i_rController ) +{ + if ( !i_rController.is() ) + return NULL; + + for ( SfxViewShell* pViewShell = SfxViewShell::GetFirst( NULL, FALSE ); + pViewShell; + pViewShell = SfxViewShell::GetNext( *pViewShell, NULL, FALSE ) + ) + { + if ( pViewShell->GetController() == i_rController ) + return pViewShell; + } + return NULL; +} + +//-------------------------------------------------------------------- + SdrView* SfxViewShell::GetDrawView() const /* [Beschreibung] @@ -1517,16 +1526,12 @@ void SfxViewShell::PushSubShells_Impl( BOOL bPush ) { for ( USHORT n=0; n<nCount; n++ ) pDisp->Push( *pImp->aArr[n] ); - -// HACK(evtl. PushSubShells fuer SW virtuell machen oder im SW umbauen) -// Notify( *this, SfxSimpleHint( SFX_HINT_RESERVED4 ) ); } else if ( nCount ) { - pDisp->Pop( *pImp->aArr[0], SFX_SHELL_POP_UNTIL ); - -// HACK(evtl. PushSubShells fuer SW virtuell machen oder im SW umbauen) -// Notify( *this, SfxSimpleHint( SFX_HINT_RESERVED3 ) ); + SfxShell& rPopUntil = *pImp->aArr[0]; + if ( pDisp->GetShellLevel( rPopUntil ) != USHRT_MAX ) + pDisp->Pop( rPopUntil, SFX_SHELL_POP_UNTIL ); } pDisp->Flush(); @@ -1578,7 +1583,7 @@ SfxViewShell* SfxViewShell::GetFirst if ( pFrame == pShell->GetViewFrame() ) { // only ViewShells with a valid ViewFrame will be returned - if ( ( !bOnlyVisible || pFrame->IsVisible_Impl() ) && ( !pType || pShell->IsA(*pType) ) ) + if ( ( !bOnlyVisible || pFrame->IsVisible() ) && ( !pType || pShell->IsA(*pType) ) ) return pShell; break; } @@ -1620,7 +1625,7 @@ SfxViewShell* SfxViewShell::GetNext if ( pFrame == pShell->GetViewFrame() ) { // only ViewShells with a valid ViewFrame will be returned - if ( ( !bOnlyVisible || pFrame->IsVisible_Impl() ) && ( !pType || pShell->IsA(*pType) ) ) + if ( ( !bOnlyVisible || pFrame->IsVisible() ) && ( !pType || pShell->IsA(*pType) ) ) return pShell; break; } @@ -1677,7 +1682,7 @@ BOOL SfxViewShell::ExecKey_Impl(const KeyEvent& aKey) if (!pImp->pAccExec) { pImp->pAccExec = ::svt::AcceleratorExecute::createAcceleratorHelper(); - pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame()->GetFrameInterface()); + pImp->pAccExec->init(::comphelper::getProcessServiceFactory(), pFrame->GetFrame().GetFrameInterface()); } return pImp->pAccExec->execute(aKey.GetKeyCode()); @@ -1782,13 +1787,6 @@ void SfxViewShell::DisconnectAllClients() //-------------------------------------------------------------------- -BOOL SfxViewShell::UseObjectSize() const -{ - return pImp->bUseObjectSize; -} - -//-------------------------------------------------------------------- - void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const { } @@ -1798,14 +1796,7 @@ void SfxViewShell::QueryObjAreaPixel( Rectangle& ) const void SfxViewShell::AdjustVisArea(const Rectangle& rRect) { DBG_ASSERT (pFrame, "Kein Frame?"); - if ( UseObjectSize() ) - { - Point aPos = rRect.TopLeft(); - Size aSize = GetObjectShell()->GetVisArea().GetSize(); - GetObjectShell()->SetVisArea( Rectangle(aPos, aSize) ); - } - else - GetObjectShell()->SetVisArea( rRect ); + GetObjectShell()->SetVisArea( rRect ); } //-------------------------------------------------------------------- @@ -1977,13 +1968,6 @@ SfxFrame* SfxViewShell::GetSmartSelf( SfxFrame* pSelf, SfxMedium& /*rMedium*/ ) return pSelf; } -//-------------------------------------------------------------------- - -BOOL SfxViewShell::IsImplementedAsFrameset_Impl( ) const -{ - return pImp->bFrameSetImpl; -} - //------------------------------------------------------------------------ void SfxViewShell::JumpToMark( const String& rMark ) @@ -2023,6 +2007,11 @@ Reference < XController > SfxViewShell::GetController() return pImp->pController; } +SfxBaseController* SfxViewShell::GetBaseController_Impl() const +{ + return pImp->pController; +} + void SfxViewShell::AddContextMenuInterceptor_Impl( const REFERENCE< XCONTEXTMENUINTERCEPTOR >& xInterceptor ) { pImp->aInterceptorContainer.addInterface( xInterceptor ); @@ -2177,7 +2166,7 @@ void SfxViewShell::CheckOwnerShip_Impl() { // document couldn't be closed or it shouldn't, now try at least to close the frame com::sun::star::uno::Reference < com::sun::star::util::XCloseable > xFrame( - GetViewFrame()->GetFrame()->GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); + GetViewFrame()->GetFrame().GetFrameInterface(), com::sun::star::uno::UNO_QUERY ); if ( xFrame.is() ) { try @@ -2211,7 +2200,7 @@ BOOL SfxViewShell::HasMouseClickListeners_Impl() void SfxViewShell::SetAdditionalPrintOptions( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& rOpts ) { pImp->aPrintOpts = rOpts; - GetObjectShell()->Broadcast( SfxPrintingHint( -3, NULL, NULL, rOpts ) ); +// GetObjectShell()->Broadcast( SfxPrintingHint( -3, NULL, NULL, rOpts ) ); } BOOL SfxViewShell::Escape() @@ -2219,6 +2208,19 @@ BOOL SfxViewShell::Escape() return GetViewFrame()->GetBindings().Execute( SID_TERMINATE_INPLACEACTIVATION ); } +Reference< view::XRenderable > SfxViewShell::GetRenderable() +{ + Reference< view::XRenderable >xRender; + SfxObjectShell* pObj = GetObjectShell(); + if( pObj ) + { + Reference< frame::XModel > xModel( pObj->GetModel() ); + if( xModel.is() ) + xRender = Reference< view::XRenderable >( xModel, UNO_QUERY ); + } + return xRender; +} + void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransfer::clipboard::XClipboardListener >& rClp, BOOL bAdd ) { try @@ -2243,3 +2245,4 @@ void SfxViewShell::AddRemoveClipboardListener( const uno::Reference < datatransf { } } + |