diff options
Diffstat (limited to 'framework/source')
34 files changed, 686 insertions, 525 deletions
diff --git a/framework/source/classes/bmkmenu.cxx b/framework/source/classes/bmkmenu.cxx index 6bee8c399d..e17672b4a0 100644 --- a/framework/source/classes/bmkmenu.cxx +++ b/framework/source/classes/bmkmenu.cxx @@ -61,7 +61,7 @@ //_________________________________________________________________________________________________________________ #include <tools/config.hxx> #include <vcl/svapp.hxx> -#include <svtools/dynamicmenuoptions.hxx> +#include <unotools/dynamicmenuoptions.hxx> #include <svtools/menuoptions.hxx> #include <rtl/logfile.hxx> @@ -130,7 +130,7 @@ USHORT BmkMenu_Impl::GetMID() // ------------------------------------------------------------------------ -BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType, BmkMenu* pRoot ) +BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType, BmkMenu* pRoot ) :AddonMenu(xFrame) ,m_nType( nType ) { @@ -139,7 +139,7 @@ BmkMenu::BmkMenu( com::sun::star::uno::Reference< XFrame >& xFrame, BmkMenu::Bmk } BmkMenu::BmkMenu( Reference< XFrame >& xFrame, BmkMenu::BmkMenuType nType ) - :AddonMenu(xFrame) + :AddonMenu(xFrame) ,m_nType( nType ) { _pImp = new BmkMenu_Impl(); diff --git a/framework/source/classes/fwktabwindow.cxx b/framework/source/classes/fwktabwindow.cxx index 8ffa00a492..af8319c193 100644 --- a/framework/source/classes/fwktabwindow.cxx +++ b/framework/source/classes/fwktabwindow.cxx @@ -65,7 +65,6 @@ namespace framework { // class FwkTabControl --------------------------------------------------- - FwkTabControl::FwkTabControl( Window* pParent, const ResId& rResId ) : TabControl( pParent, rResId ) @@ -336,6 +335,11 @@ void FwkTabWindow::AddEventListener( const Link& rEventListener ) m_aTabCtrl.AddEventListener( rEventListener ); } +void FwkTabWindow::RemoveEventListener( const Link& rEventListener ) +{ + m_aTabCtrl.RemoveEventListener( rEventListener ); +} + // ----------------------------------------------------------------------- FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties ) diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index b245cff3ad..8928bf6ea7 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -66,8 +66,8 @@ #include <comphelper/extract.hxx> #include <svtools/menuoptions.hxx> -#include <svtools/historyoptions.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/historyoptions.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/localfilehelper.hxx> #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ @@ -140,11 +140,11 @@ const ::rtl::OUString aSpecialWindowCommand( RTL_CONSTASCII_USTRINGPARAM( "Windo const ::rtl::OUString UNO_COMMAND( RTL_CONSTASCII_USTRINGPARAM( ".uno:" )); // #110897# -MenuManager::MenuManager( +MenuManager::MenuManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ) + REFERENCE< XFRAME >& rFrame, Menu* pMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ) : // #110897# - ThreadHelpBase( &Application::GetSolarMutex() ), + ThreadHelpBase( &Application::GetSolarMutex() ), mxServiceFactory(xServiceFactory) { m_bActive = sal_False; @@ -191,13 +191,13 @@ MenuManager::MenuManager( aItemCommand == aSlotSpecialToolsMenu ) && AddonMenuManager::HasAddonMenuElements() ) { - USHORT nCount = 0; + USHORT nCount = 0; AddonMenu* pSubMenu = AddonMenuManager::CreateAddonMenu( rFrame ); if ( pSubMenu && ( pSubMenu->GetItemCount() > 0 )) { if ( pPopupMenu->GetItemType( nCount-1 ) != MENUITEM_SEPARATOR ) pPopupMenu->InsertSeparator(); - + // Use resource to load popup menu title String aAddonsStrRes = String( FwkResId( STR_MENU_ADDONS )); pPopupMenu->InsertItem( ITEMID_ADDONLIST, aAddonsStrRes ); @@ -208,7 +208,7 @@ MenuManager::MenuManager( aItemCommand = aSlotString; aItemCommand += ::rtl::OUString::valueOf( (sal_Int32)ITEMID_ADDONLIST ); pPopupMenu->SetItemCommand( ITEMID_ADDONLIST, aItemCommand ); - + // #110897# // MenuManager* pSubMenuManager = new MenuManager( rFrame, pSubMenu, sal_True, sal_False ); AddMenu(pSubMenu,::rtl::OUString(),nItemId,sal_True,sal_False); @@ -248,7 +248,7 @@ MenuManager::MenuManager( if ( pMenu->GetItemText( nItemId ).Len() == 0 ) aQueryLabelItemIdVector.push_back( nItemId ); #endif - + if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId )) { Image aImage = GetImageFromURL( rFrame, aItemCommand, FALSE, m_bWasHiContrast ); @@ -273,7 +273,7 @@ MenuManager::MenuManager( if ( pMenu->GetItemText( nItemId ).Len() == 0 ) aQueryLabelItemIdVector.push_back( nItemId ); #endif - + if ( m_bShowMenuImages && !pMenu->GetItemImage( nItemId )) { Image aImage = GetImageFromURL( rFrame, aItemCommand, FALSE, m_bWasHiContrast ); @@ -290,7 +290,7 @@ MenuManager::MenuManager( // Add-Ons uses a images from different places Image aImage; rtl::OUString aImageId; - + MenuConfiguration::Attributes* pMenuAttributes = (MenuConfiguration::Attributes*)pMenu->GetUserValue( nItemId ); @@ -306,7 +306,7 @@ MenuManager::MenuManager( if ( !aImage ) aImage = AddonsOptions().GetImageFromURL( aItemCommand, FALSE, m_bWasHiContrast ); } - + if ( !!aImage ) pMenu->SetItemImage( nItemId, aImage ); } @@ -317,7 +317,7 @@ MenuManager::MenuManager( pMenu->SetItemImage( nItemId, aImage ); } } - + REFERENCE< XDISPATCH > aXDispatchRef; m_aMenuItemHandlerVector.push_back( new MenuItemHandler( nItemId, NULL, aXDispatchRef )); #if 0 @@ -355,11 +355,11 @@ MenuManager::MenuManager( } // #110897# -MenuManager::MenuManager( +MenuManager::MenuManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - REFERENCE< XFRAME >& rFrame, AddonMenu* pAddonMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ) + REFERENCE< XFRAME >& rFrame, AddonMenu* pAddonMenu, sal_Bool bDelete, sal_Bool bDeleteChildren ) : // #110897# - ThreadHelpBase( &Application::GetSolarMutex() ), + ThreadHelpBase( &Application::GetSolarMutex() ), mxServiceFactory(xServiceFactory) { m_bActive = sal_False; @@ -788,7 +788,7 @@ void MenuManager::UpdateSpecialWindowMenu( Menu* pMenu,const Reference< XMultiSe { Reference< XFrame > xFrame; xList->getByIndex(i) >>= xFrame; - + if (xFrame.is()) { if ( xFrame == xCurrentFrame ) @@ -1033,7 +1033,7 @@ IMPL_LINK( MenuManager, Select, Menu *, pMenu ) { Reference< XFrame > xFrame; xList->getByIndex(i) >>= xFrame; - + if ( xFrame.is() && nTaskId == nCurItemId ) { Window* pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); @@ -1096,7 +1096,7 @@ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFac void MenuManager::AddMenu(PopupMenu* _pPopupMenu,const ::rtl::OUString& _sItemCommand,USHORT _nItemId,sal_Bool _bDelete,sal_Bool _bDeleteChildren) { MenuManager* pSubMenuManager = new MenuManager( getServiceFactory(), m_xFrame, _pPopupMenu, _bDelete, _bDeleteChildren ); - + // store menu item command as we later have to know which menu is active (see Activate handler) pSubMenuManager->m_aMenuItemCommand = _sItemCommand; @@ -1158,7 +1158,7 @@ void MenuManager::FillMenuImages(Reference< XFrame >& _xFrame,Menu* _pMenu,sal_B Image aImage = GetImageFromURL( _xFrame, aMenuItemCommand, FALSE, bIsHiContrast ); if ( !aImage ) aImage = aAddonOptions.GetImageFromURL( aMenuItemCommand, FALSE, bIsHiContrast ); - + _pMenu->SetItemImage( nId, aImage ); } } diff --git a/framework/source/classes/protocolhandlercache.cxx b/framework/source/classes/protocolhandlercache.cxx index 3a1c4131c5..150cae4f0a 100644 --- a/framework/source/classes/protocolhandlercache.cxx +++ b/framework/source/classes/protocolhandlercache.cxx @@ -357,4 +357,8 @@ void HandlerCFGAccess::Notify(const css::uno::Sequence< rtl::OUString >& /*lProp } } +void HandlerCFGAccess::Commit() +{ +} + } // namespace framework diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index b49c29e2c8..4652b768e1 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -58,7 +58,7 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> //_______________________________________________ // namespace @@ -394,7 +394,7 @@ IMPL_LINK( CloseDispatcher, impl_asyncCallback, void*, EMPTYARG ) // on mac close down, quickstarter keeps the process alive // however if someone has shut down the quickstarter // behave as any other platform - + bool bQuickstarterRunning = false; // get quickstart service try @@ -429,7 +429,7 @@ IMPL_LINK( CloseDispatcher, impl_asyncCallback, void*, EMPTYARG ) if (xController.is()) xController->suspend(sal_False); } - + // inform listener sal_Int16 nState = css::frame::DispatchResultState::FAILURE; if (bSuccess) @@ -469,7 +469,7 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc // Frame already dead ... so this view is closed ... is closed ... is ... .-) if (! xFrame.is()) return sal_True; - + // Close all views to the same document ... if forced to do so. // But dont touch our own frame here! // We must do so ... because the may be following controller->suspend() @@ -481,7 +481,7 @@ sal_Bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Referenc css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; aReadLock.unlock(); // <- SAFE ---------------------------------- - + css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL); @@ -614,14 +614,14 @@ css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRig return xFrame; OSL_ENSURE((sTarget.getLength() < 1), "CloseDispatch used for unexpected target. Magic things will happen now .-)"); - + css::uno::Reference< css::frame::XFrame > xTarget = xFrame; while(sal_True) { // a) top frames wil be closed if (xTarget->isTop()) return xTarget; - + // b) even child frame containing top level windows (e.g. query designer of database) will be closed css::uno::Reference< css::awt::XWindow > xWindow = xTarget->getContainerWindow(); css::uno::Reference< css::awt::XTopWindow > xTopWindowCheck(xWindow, css::uno::UNO_QUERY); @@ -640,14 +640,14 @@ css::uno::Reference< css::frame::XFrame > CloseDispatcher::static_impl_searchRig ) return xTarget; } - + // c) try to find better results on parent frame // If no parent frame exists (because this frame is used outside the desktop tree) // the given frame must be used directly. css::uno::Reference< css::frame::XFrame > xParent(xTarget->getCreator(), css::uno::UNO_QUERY); if ( ! xParent.is()) return xTarget; - + // c1) check parent frame inside next loop ... xTarget = xParent; } diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx index def4f785be..9326181c64 100644 --- a/framework/source/dispatch/startmoduledispatcher.cxx +++ b/framework/source/dispatch/startmoduledispatcher.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -60,7 +60,7 @@ #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <vos/mutex.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> //_______________________________________________ // namespace diff --git a/framework/source/helper/popupmenucontrollerbase.cxx b/framework/source/helper/popupmenucontrollerbase.cxx index e8215eccca..8b6f75aa53 100644 --- a/framework/source/helper/popupmenucontrollerbase.cxx +++ b/framework/source/helper/popupmenucontrollerbase.cxx @@ -186,7 +186,9 @@ void SAL_CALL PopupMenuControllerBase::highlight( const css::awt::MenuEvent& ) t void PopupMenuControllerBase::impl_select(const Reference< XDispatch >& _xDispatch,const ::com::sun::star::util::URL& aURL) { Sequence<PropertyValue> aArgs; - _xDispatch->dispatch( aURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"PopupMenuControllerBase::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aURL, aArgs ); } void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) @@ -204,7 +206,7 @@ void SAL_CALL PopupMenuControllerBase::select( const css::awt::MenuEvent& rEvent xServiceManager = m_xServiceManager; aLock.unlock(); - if ( xPopupMenu.is() && xDispatch.is() ) + if ( xPopupMenu.is() ) { VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu ); if ( pPopupMenu ) diff --git a/framework/source/helper/titlebarupdate.cxx b/framework/source/helper/titlebarupdate.cxx index 1db613237d..962bbbf0f1 100644 --- a/framework/source/helper/titlebarupdate.cxx +++ b/framework/source/helper/titlebarupdate.cxx @@ -371,6 +371,12 @@ void TitleBarUpdate::impl_updateIcon(const css::uno::Reference< css::frame::XFra { WorkWindow* pWorkWindow = (WorkWindow*)pWindow; pWorkWindow->SetIcon( (sal_uInt16)nIcon ); + + css::uno::Reference< css::frame::XModel > xModel = xController->getModel(); + rtl::OUString aURL; + if( xModel.is() ) + aURL = xModel->getURL(); + pWorkWindow->SetRepresentedURL( aURL ); } aSolarLock.clear(); diff --git a/framework/source/helper/titlehelper.cxx b/framework/source/helper/titlehelper.cxx index 2eb1707ae3..3dd9467ef2 100644 --- a/framework/source/helper/titlehelper.cxx +++ b/framework/source/helper/titlehelper.cxx @@ -616,7 +616,7 @@ void TitleHelper::impl_appendModuleName (::rtl::OUStringBuffer& sTitle) } //***************************************************************************************************************** -#ifndef PRODUCT +#ifdef DBG_UTIL void TitleHelper::impl_appendDebugVersion (::rtl::OUStringBuffer& sTitle) { ::rtl::OUString sDefault ; diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index f4d4f2ce7e..4d5f3c4b00 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -67,17 +67,13 @@ #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/XSystemDependentMenuPeer.hpp> -#ifndef _COM_SUN_STAR_LANG_XYSTEMDEPENDENT_HPP_ #include <com/sun/star/lang/SystemDependent.hpp> -#endif #include <com/sun/star/awt/VclWindowPeerAttribute.hpp> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> #include <com/sun/star/awt/XTopWindow.hpp> -#ifndef _COM_SUN_STAR_UI_XMODULEUICONFIGURATIONMANAGER_HPP_ #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> -#endif #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/container/XNameReplace.hpp> @@ -92,20 +88,20 @@ // other includes //_________________________________________________________________________________________________________________ #include <svtools/imgdef.hxx> +#include <tools/diagnose_ex.h> #include <vcl/window.hxx> #include <vcl/wrkwin.hxx> #include <vcl/dockingarea.hxx> #include <vcl/svapp.hxx> #include <vcl/i18nhelp.hxx> #include <vcl/wall.hxx> -#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> -#endif #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <comphelper/mediadescriptor.hxx> +#include <comphelper/uno3.hxx> #include <rtl/logfile.hxx> -#include <svtools/cmdoptions.hxx> +#include <unotools/cmdoptions.hxx> #include <algorithm> #include <boost/bind.hpp> @@ -318,7 +314,7 @@ static void impl_setDockingWindowVisibility( const css::uno::Reference< css::lan { const ::rtl::OUString aDockWinPrefixCommand( RTL_CONSTASCII_USTRINGPARAM( "DockingWindow" )); css::uno::WeakReference< css::frame::XDispatchHelper > xDispatchHelper; - + sal_Int32 nID = rDockingWindowName.toInt32(); sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; @@ -327,9 +323,9 @@ static void impl_setDockingWindowVisibility( const css::uno::Reference< css::lan { ::rtl::OUString aDockWinCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:" )); ::rtl::OUString aDockWinArgName( aDockWinPrefixCommand ); - + aDockWinArgName += ::rtl::OUString::valueOf( nIndex ); - + css::uno::Sequence< css::beans::PropertyValue > aArgs(1); aArgs[0].Name = aDockWinArgName; aArgs[0].Value = css::uno::makeAny( bVisible ); @@ -354,40 +350,8 @@ static void impl_setDockingWindowVisibility( const css::uno::Reference< css::lan //***************************************************************************************************************** // XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XINTERFACE_14 ( LayoutManager , - OWeakObject , - DIRECT_INTERFACE( css::lang::XTypeProvider ), - DIRECT_INTERFACE( css::lang::XServiceInfo ), - DIRECT_INTERFACE( ::com::sun::star::frame::XLayoutManager ), - DIRECT_INTERFACE( css::awt::XWindowListener ), - DIRECT_INTERFACE( css::frame::XFrameActionListener ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationListener ), - DIRECT_INTERFACE( ::com::sun::star::frame::XInplaceLayout ), - DIRECT_INTERFACE( css::awt::XDockableWindowListener ), - DIRECT_INTERFACE( ::com::sun::star::frame::XMenuBarMergingAcceptor ), - DIRECT_INTERFACE( css::frame::XLayoutManagerEventBroadcaster ), - DERIVED_INTERFACE( css::lang::XEventListener, css::frame::XFrameActionListener ), - DIRECT_INTERFACE( ::com::sun::star::beans::XMultiPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet ) - ) - -DEFINE_XTYPEPROVIDER_14 ( LayoutManager , - css::lang::XTypeProvider , - css::lang::XServiceInfo , - ::com::sun::star::frame::XLayoutManager , - css::awt::XWindowListener , - css::frame::XFrameActionListener , - css::lang::XEventListener , - ::com::sun::star::ui::XUIConfigurationListener , - ::com::sun::star::frame::XInplaceLayout , - css::awt::XDockableWindowListener , - ::com::sun::star::frame::XMenuBarMergingAcceptor , - css::frame::XLayoutManagerEventBroadcaster , - ::com::sun::star::beans::XMultiPropertySet , - ::com::sun::star::beans::XFastPropertySet , - ::com::sun::star::beans::XPropertySet - ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( LayoutManager, LayoutManager_Base, LayoutManager_PBase ) +IMPLEMENT_FORWARD_XINTERFACE2( LayoutManager, LayoutManager_Base, LayoutManager_PBase ) DEFINE_XSERVICEINFO_MULTISERVICE ( LayoutManager , ::cppu::OWeakObject , @@ -398,15 +362,14 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( LayoutManager , DEFINE_INIT_SERVICE ( LayoutManager, {} ) -LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceManager ) : - ThreadHelpBase( &Application::GetSolarMutex() ) +LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceManager ) + : LayoutManager_Base ( ) + , ThreadHelpBase ( &Application::GetSolarMutex() ) , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ) - , ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) - , ::cppu::OWeakObject ( ) + , LayoutManager_PBase ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) , m_xSMGR( xServiceManager ) - , m_xURLTransformer( Reference< XURLTransformer >( xServiceManager->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY )) + , m_xURLTransformer( xServiceManager->createInstance( SERVICENAME_URLTRANSFORMER ), UNO_QUERY ) + , m_xDisplayAccess( xServiceManager->createInstance( SERVICENAME_DISPLAYACCESS ), UNO_QUERY ) , m_nLockCount( 0 ) , m_bActive( sal_False ) , m_bInplaceMenuSet( sal_False ) @@ -421,6 +384,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , m_bStoreWindowState( sal_False ) , m_bHideCurrentUI( false ) , m_bGlobalSettings( sal_False ) + , m_bPreserveContentSize( false ) , m_eDockOperation( DOCKOP_ON_COLROW ) , m_pInplaceMenuBar( NULL ) , m_xModuleManager( Reference< XModuleManager >( @@ -455,13 +419,22 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM m_pMiscOptions = new SvtMiscOptions(); - m_pMiscOptions->AddListener( LINK( this, LayoutManager, OptionsChanged ) ); + m_pMiscOptions->AddListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) ); m_eSymbolsSize = m_pMiscOptions->GetSymbolsSize(); m_eSymbolsStyle = m_pMiscOptions->GetCurrentSymbolsStyle(); m_aAsyncLayoutTimer.SetTimeout( 50 ); m_aAsyncLayoutTimer.SetTimeoutHdl( LINK( this, LayoutManager, AsyncLayoutHdl ) ); + + + registerProperty( LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, css::beans::PropertyAttribute::TRANSIENT, &m_bAutomaticToolbars, ::getCppuType( &m_bAutomaticToolbars ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, css::beans::PropertyAttribute::TRANSIENT, &m_bHideCurrentUI, ::getCppuType( &m_bHideCurrentUI ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY, &m_nLockCount, getCppuType( &m_nLockCount ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, css::beans::PropertyAttribute::TRANSIENT, &m_bMenuBarCloser, ::getCppuType( &m_bMenuBarCloser ) ); + const sal_Bool bRefreshVisibility = sal_False; + registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, css::beans::PropertyAttribute::TRANSIENT, ::getCppuType( &bRefreshVisibility ), &bRefreshVisibility ); + registerProperty( LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE, LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, css::beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, ::getCppuType( &m_bPreserveContentSize ) ); } LayoutManager::~LayoutManager() @@ -469,7 +442,7 @@ LayoutManager::~LayoutManager() Application::RemoveEventListener( LINK( this, LayoutManager, SettingsChanged ) ); if ( m_pMiscOptions ) { - m_pMiscOptions->RemoveListener( LINK( this, LayoutManager, OptionsChanged ) ); + m_pMiscOptions->RemoveListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); delete m_pMiscOptions; m_pMiscOptions = 0; } @@ -2289,7 +2262,7 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; - + rRowColumnWindowData.aRowColumnWindowSizes.push_back( css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), rElement.m_aDockedData.m_aPos.Y(), @@ -2307,7 +2280,7 @@ void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea rRowColumnWindowData.nSpace += nSpace; else nSpace = 0; - + nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; rRowColumnWindowData.aRowColumnWindowSizes.push_back( @@ -3240,7 +3213,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible ) if ( bSetVisible ) { implts_createNonContextSensitiveToolBars(); - doLayout(); + implts_doLayout_notify( sal_False ); } else { @@ -3516,7 +3489,7 @@ sal_Bool LayoutManager::implts_showProgressBar() if ( !pWindow->IsVisible() ) { pWindow->Show(); - doLayout(); + implts_doLayout_notify( sal_False ); } return sal_True; } @@ -3557,7 +3530,7 @@ sal_Bool LayoutManager::implts_hideProgressBar() ( bHideStatusBar || bInternalStatusBar )) { pWindow->Hide(); - doLayout(); + implts_doLayout_notify( sal_False ); return sal_True; } @@ -3829,6 +3802,7 @@ throw ( RuntimeException ) { m_aDockingArea = css::awt::Rectangle(); m_xContainerWindow = m_xDockingAreaAcceptor->getContainerWindow(); + m_xContainerTopWindow.set( m_xContainerWindow, UNO_QUERY ); m_xContainerWindow->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); // we always must keep a connection to the window of our frame for resize events @@ -3913,7 +3887,7 @@ throw ( RuntimeException ) implts_createNonContextSensitiveToolBars(); } implts_sortUIElements(); - implts_doLayout( sal_True ); + implts_doLayout( sal_True, sal_False ); } } @@ -4279,7 +4253,7 @@ throw (RuntimeException) else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) { aWriteLock.unlock(); - + // The docking window is created by a factory method located in the sfx2 library. CreateDockingWindow( xFrame, aElementName ); } @@ -5309,7 +5283,7 @@ throw (RuntimeException) ReadGuard aReadGuard( m_aLock ); css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); aReadGuard.unlock(); - + return IsDockingWindowVisible( xFrame, aElementName ); } } @@ -5477,26 +5451,33 @@ throw (RuntimeException) implts_notifyListeners( css::frame::LayoutManagerEvents::UNLOCK, a ); if ( bDoLayout ) - doLayout(); + implts_doLayout_notify( sal_True ); } void SAL_CALL LayoutManager::doLayout() throw (RuntimeException) { - sal_Bool bLayouted = implts_doLayout( sal_False ); + implts_doLayout_notify( sal_True ); +} +void LayoutManager::implts_doLayout_notify( sal_Bool bOuterResize ) +{ + sal_Bool bLayouted = implts_doLayout( sal_False, bOuterResize ); if ( bLayouted ) implts_notifyListeners( css::frame::LayoutManagerEvents::LAYOUT, Any() ); } -sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) +sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::implts_doLayout" ); sal_Bool bNoLock( sal_False ); css::awt::Rectangle aCurrBorderSpace; Reference< css::awt::XWindow > xContainerWindow; + Reference< css::awt::XTopWindow2 > xContainerTopWindow; + Reference< css::awt::XWindow > xComponentWindow; Reference< XDockingAreaAcceptor > xDockingAreaAcceptor; + bool bPreserveContentSize( false ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); @@ -5507,8 +5488,11 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) bNoLock = ( m_nLockCount == 0 ); xContainerWindow = m_xContainerWindow; + xContainerTopWindow = m_xContainerTopWindow; + xComponentWindow = m_xFrame->getComponentWindow(); xDockingAreaAcceptor = m_xDockingAreaAcceptor; aCurrBorderSpace = m_aDockingArea; + bPreserveContentSize = m_bPreserveContentSize; aReadLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -5516,7 +5500,8 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) if ( bNoLock && xDockingAreaAcceptor.is() && - xContainerWindow.is() ) + xContainerWindow.is() && + xComponentWindow.is() ) { bLayouted = sal_True; @@ -5532,11 +5517,44 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace ) if ( !bEqual || bForceRequestBorderSpace || bMustDoLayout ) { - bGotRequestedBorderSpace = xDockingAreaAcceptor->requestDockingAreaSpace( aBorderSpace ); - if ( bGotRequestedBorderSpace ) + // we always resize the content window (instead of the complete container window) if we're not set up + // to (attempt to) preserve the content window's size + if ( bOuterResize && !bPreserveContentSize ) + bOuterResize = sal_False; + + // maximized windows can resized their content window only, not their container window + if ( bOuterResize && xContainerTopWindow.is() && xContainerTopWindow->getIsMaximized() ) + bOuterResize = sal_False; + + // if the component window does not have a size (yet), then we can't use it to calc the container + // window size + css::awt::Rectangle aComponentRect = xComponentWindow->getPosSize(); + if ( bOuterResize && ( aComponentRect.Width == 0 ) && ( aComponentRect.Height == 0 ) ) + bOuterResize = sal_False; + + bGotRequestedBorderSpace = sal_False; + if ( bOuterResize ) { - xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace ); + Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY ); + awt::DeviceInfo aContainerInfo = xDevice->getInfo(); + awt::Size aRequestedSize( aComponentRect.Width + aContainerInfo.LeftInset + aContainerInfo.RightInset + aBorderSpace.X + aBorderSpace.Width, + aComponentRect.Height + aContainerInfo.TopInset + aContainerInfo.BottomInset + aBorderSpace.Y + aBorderSpace.Height ); + awt::Point aComponentPos( aBorderSpace.X, aBorderSpace.Y ); + + bGotRequestedBorderSpace = implts_resizeContainerWindow( aRequestedSize, aComponentPos ); + } + + // if we did not do an container window resize, or it failed, then use the DockingAcceptor as usual + if ( !bGotRequestedBorderSpace ) + { + bGotRequestedBorderSpace = xDockingAreaAcceptor->requestDockingAreaSpace( aBorderSpace ); + if ( bGotRequestedBorderSpace ) + xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace ); + } + + if ( bGotRequestedBorderSpace ) + { /* SAFE AREA ----------------------------------------------------------------------------------------------- */ aWriteGuard.lock(); m_aDockingArea = aBorderSpace; @@ -5603,6 +5621,52 @@ sal_Bool LayoutManager::implts_compareRectangles( const css::awt::Rectangle& rRe ( rRect1.Height == rRect2.Height )); } +sal_Bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSize, + const awt::Point& rComponentPos ) +{ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + ReadGuard aReadLock( m_aLock ); + Reference< awt::XWindow > xContainerWindow = m_xContainerWindow; + Reference< awt::XTopWindow2 > xContainerTopWindow = m_xContainerTopWindow; + Reference< awt::XWindow > xComponentWindow = m_xFrame->getComponentWindow(); + Reference< container::XIndexAccess > xDisplayAccess = m_xDisplayAccess; + aReadLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + // calculate the maximum size we have for the container window + awt::Rectangle aWorkArea; + try + { + sal_Int32 nDisplay = xContainerTopWindow->getDisplay(); + Reference< beans::XPropertySet > xDisplayInfo( xDisplayAccess->getByIndex( nDisplay ), UNO_QUERY_THROW ); + OSL_VERIFY( xDisplayInfo->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WorkArea" ) ) ) >>= aWorkArea ); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + + if ( ( aWorkArea.Width > 0 ) && ( aWorkArea.Height > 0 ) ) + { + if ( ( rContainerSize.Width > aWorkArea.Width ) + || ( rContainerSize.Height > aWorkArea.Height ) + ) + return sal_False; + // Strictly, this is not correct. If we have a multi-screen display (css.awt.DisplayAccess.MultiDisplay == true), + // the the "effective work area" would be much larger than the work area of a single display, since we could in theory + // position the container window across multiple screens. + // However, this should suffice as a heuristics here ... (nobody really wants to check whethere the different screens are + // stacked horizontally or vertically, whether their work areas can really be combined, or are separated by non-work-areas, + // and the like ... right?) + } + + // resize our container window + xContainerWindow->setPosSize( 0, 0, rContainerSize.Width, rContainerSize.Height, css::awt::PosSize::SIZE ); + // position the component window + xComponentWindow->setPosSize( rComponentPos.X, rComponentPos.Y, 0, 0, css::awt::PosSize::POS ); + return sal_True; +} + void SAL_CALL LayoutManager::setVisible( sal_Bool bVisible ) throw (::com::sun::star::uno::RuntimeException) { @@ -5662,7 +5726,7 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin sal_Int32 nSpace = rRowColumnWindowData.aRowColumnSpace[i]; if ( nSpace >= -nDiff ) { - + if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) || ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) { @@ -7028,7 +7092,7 @@ IMPL_LINK( LayoutManager, AsyncLayoutHdl, Timer *, EMPTYARG ) aReadLock.unlock(); implts_setDockingAreaWindowSizes( aDockingArea ); - implts_doLayout( sal_True ); + implts_doLayout( sal_True, sal_False ); return 0; } @@ -7079,7 +7143,8 @@ throw ( RuntimeException ) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ implts_reset( sal_True ); - implts_doLayout( sal_True ); + implts_doLayout( sal_True, sal_False ); + implts_doLayout( sal_True, sal_True ); } else if (( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ) || ( aEvent.Action == FrameAction_FRAME_UI_DEACTIVATING )) @@ -7106,7 +7171,6 @@ throw ( RuntimeException ) // SAFE AREA ----------------------------------------------------------------------------------------------- implts_reset( sal_False ); - } } @@ -7127,7 +7191,7 @@ throw( RuntimeException ) Application::RemoveEventListener( LINK( this, LayoutManager, SettingsChanged ) ); if ( m_pMiscOptions ) { - m_pMiscOptions->RemoveListener( LINK( this, LayoutManager, OptionsChanged ) ); + m_pMiscOptions->RemoveListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); delete m_pMiscOptions; m_pMiscOptions = 0; } @@ -7148,6 +7212,7 @@ throw( RuntimeException ) } m_xInplaceMenuBar.clear(); m_xContainerWindow.clear(); + m_xContainerTopWindow.clear(); implts_destroyDockingAreaWindows(); if ( m_xModuleCfgMgr.is() ) @@ -7198,6 +7263,7 @@ throw( RuntimeException ) } m_xInplaceMenuBar.clear(); m_xContainerWindow.clear(); + m_xContainerTopWindow.clear(); } else if ( rEvent.Source == Reference< XInterface >( m_xDocCfgMgr, UNO_QUERY )) { @@ -7412,65 +7478,21 @@ sal_Bool SAL_CALL LayoutManager::convertFastPropertyValue( Any& aConverted sal_Int32 nHandle , const Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) { - // Initialize state with FALSE !!! - // (Handle can be invalid) - sal_Bool bReturn = sal_False; - - switch( nHandle ) - { - case LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER : - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bMenuBarCloser), - aValue, - aOldValue, - aConvertedValue); - break; - case LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bAutomaticToolbars), - aValue, - aOldValue, - aConvertedValue); - break; - case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(sal_False), - aValue, - aOldValue, - aConvertedValue); - break; - case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bHideCurrentUI), - aValue, - aOldValue, - aConvertedValue); - break; - } - - // Return state of operation. - return bReturn ; + return LayoutManager_PBase::convertFastPropertyValue( aConvertedValue, aOldValue, nHandle, aValue ); } void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ) { + if ( nHandle != LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY ) + LayoutManager_PBase::setFastPropertyValue_NoBroadcast( nHandle, aValue ); + switch( nHandle ) { case LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER: - { - sal_Bool bCloserState = sal_False; - aValue >>= bCloserState; - implts_setMenuBarCloser( bCloserState ); + implts_updateMenuBarClose(); break; - } - case LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS: - { - sal_Bool bValue = sal_Bool(); - if ( aValue >>= bValue ) - m_bAutomaticToolbars = bValue; - break; - } + case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: { sal_Bool bValue = sal_Bool(); @@ -7478,40 +7500,17 @@ void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 implts_refreshContextToolbarsVisibility(); break; } + case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: - { - sal_Bool bValue = sal_Bool(); - if ( aValue >>= bValue ) - { - m_bHideCurrentUI = bValue; - implts_setCurrentUIVisibility( !bValue ); - } + implts_setCurrentUIVisibility( !m_bHideCurrentUI ); break; - } } } void SAL_CALL LayoutManager::getFastPropertyValue( com::sun::star::uno::Any& aValue , sal_Int32 nHandle ) const { - switch( nHandle ) - { - case LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER: - aValue <<= m_bMenuBarCloser; - break; - case LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS: - aValue <<= m_bAutomaticToolbars; - break; - case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: - aValue <<= sal_False; - break; - case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: - aValue <<= m_bHideCurrentUI; - break; - case LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT: - aValue <<= m_nLockCount; - break; - } + LayoutManager_PBase::getFastPropertyValue( aValue, nHandle ); } ::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::getInfoHelper() @@ -7530,9 +7529,9 @@ void SAL_CALL LayoutManager::getFastPropertyValue( com::sun::star::uno::Any& aVa if( pInfoHelper == NULL ) { // Define static member to give structure of properties to baseclass "OPropertySetHelper". - // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable. - // "sal_True" say: Table is sorted by name. - static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True ); + uno::Sequence< beans::Property > aProperties; + describeProperties( aProperties ); + static ::cppu::OPropertyArrayHelper aInfoHelper( aProperties, sal_True ); pInfoHelper = &aInfoHelper; } } @@ -7564,28 +7563,5 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CA return (*pInfo); } -const com::sun::star::uno::Sequence< com::sun::star::beans::Property > LayoutManager::impl_getStaticPropertyDescriptor() -{ - // Create a new static property array to initialize sequence! - // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! - // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! - // It's necessary for methods of OPropertySetHelper. - // ATTENTION: - // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - - static const com::sun::star::beans::Property pProperties[] = - { - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, ::getCppuType((const sal_Int32*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT|com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ) - }; - // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, LAYOUTMANAGER_PROPCOUNT ); - // Return static "PropertyDescriptor" - return lPropertyDescriptor; -} - } // namespace framework diff --git a/framework/source/layoutmanager/makefile.mk b/framework/source/layoutmanager/makefile.mk index b9b6bcf248..3af616971a 100644 --- a/framework/source/layoutmanager/makefile.mk +++ b/framework/source/layoutmanager/makefile.mk @@ -39,6 +39,8 @@ ENABLE_EXCEPTIONS= TRUE .INCLUDE : settings.mk +VISIBILITY_HIDDEN = TRUE + # --- Generate ----------------------------------------------------- SLOFILES= \ diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index d131a3b6e8..9fb939e9db 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -106,7 +106,7 @@ #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> #endif -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <svtools/sfxecode.hxx> #include <unotools/processfactory.hxx> #include <comphelper/configurationhelper.hxx> @@ -252,7 +252,7 @@ css::uno::Reference< css::lang::XComponent > LoadEnv::loadComponentFromURL(const if ( pIt != lModelDescriptor.end() ) lDescriptor[::comphelper::MediaDescriptor::PROP_MACROEXECUTIONMODE()] = pIt->second; } - + return lDescriptor; } @@ -1363,7 +1363,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() // frame we referr to any hidden frame also (but as fallback only). css::uno::Reference< css::frame::XFrame > xHiddenTask; css::uno::Reference< css::frame::XFrame > xTask; - + sal_Int32 count = xTaskList->getCount(); for (sal_Int32 i=0; i<count; ++i) { @@ -1410,7 +1410,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() xTask.clear (); continue; } - + // Hidden frames are special. // They will be used as "last chance" if there is no visible frame pointing to the same model. // Safe the result but continue with current loop might be looking for other visible frames. @@ -1424,7 +1424,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() xTask.clear (); continue; } - + // We found a visible task pointing to the right model ... // Break search. break; @@ -1441,7 +1441,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() else if (xHiddenTask.is()) xResult = xHiddenTask; - + if (xResult.is()) { // Now we are shure, that this task includes the searched document. @@ -1449,11 +1449,11 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchAlreadyLoaded() // if an optional jumpmark is given too. if (m_aURL.Mark.getLength()) impl_jumpToMark(xResult, m_aURL); - + // bring it to front and make sure it's visible... impl_makeFrameWindowVisible(xResult->getContainerWindow(), sal_True); } - + aReadLock.unlock(); // <- SAFE @@ -1604,7 +1604,7 @@ css::uno::Reference< css::frame::XFrame > LoadEnv::impl_searchRecycleTarget() m_bReactivateControllerOnError = bReactivateOldControllerOnError; aWriteLock.unlock(); // <- SAFE .................................. - + // bring it to front ... impl_makeFrameWindowVisible(xTask->getContainerWindow(), sal_True); @@ -1738,7 +1738,7 @@ void LoadEnv::impl_reactForLoadingState() 16.01.2005 13:04 -----------------------------------------------*/ void LoadEnv::impl_makeFrameWindowVisible(const css::uno::Reference< css::awt::XWindow >& xWindow , - sal_Bool bForceToFront) + sal_Bool bForceToFront) { // SAFE -> ---------------------------------- ReadGuard aReadLock(m_aLock); diff --git a/framework/source/register/makefile.mk b/framework/source/register/makefile.mk index 1e15c55bd2..7d7f00e945 100644 --- a/framework/source/register/makefile.mk +++ b/framework/source/register/makefile.mk @@ -40,6 +40,8 @@ LIBTARGET= NO .INCLUDE : settings.mk +VISIBILITY_HIDDEN = TRUE + # --- Generate ----------------------------------------------------- SLOFILES= \ diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index ca7b94f2c5..c8731b0af5 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -80,7 +80,7 @@ #include <comphelper/configurationhelper.hxx> #include <comphelper/mediadescriptor.hxx> #include <vcl/svapp.hxx> -#include <svtools/pathoptions.hxx> +#include <unotools/pathoptions.hxx> #include <tools/link.hxx> #include <tools/string.hxx> #include <unotools/tempfile.hxx> @@ -91,7 +91,7 @@ #include <osl/file.hxx> #include <unotools/bootstrap.hxx> #include <unotools/configmgr.hxx> -#include <svtools/documentlockfile.hxx> +#include <svl/documentlockfile.hxx> #include <tools/urlobj.hxx> @@ -170,6 +170,7 @@ static const ::rtl::OUString CMD_DO_RECOVERY = ::rtl::OUString:: static const ::rtl::OUString CMD_DO_ENTRY_BACKUP = ::rtl::OUString::createFromAscii("/doEntryBackup" ); // try to store a temp or original file to a user defined location static const ::rtl::OUString CMD_DO_ENTRY_CLEANUP = ::rtl::OUString::createFromAscii("/doEntryCleanUp" ); // remove the specified entry from the recovery cache static const ::rtl::OUString CMD_DO_SESSION_SAVE = ::rtl::OUString::createFromAscii("/doSessionSave" ); // save all open documents if e.g. a window manager closes an user session +static const ::rtl::OUString CMD_DO_SESSION_QUIET_QUIT = ::rtl::OUString::createFromAscii("/doSessionQuietQuit" ); // let the current session be quietly closed ( the saving should be done using doSessionSave previously ) if e.g. a window manager closes an user session static const ::rtl::OUString CMD_DO_SESSION_RESTORE = ::rtl::OUString::createFromAscii("/doSessionRestore" ); // restore a saved user session from disc static const ::rtl::OUString CMD_DO_DISABLE_RECOVERY = ::rtl::OUString::createFromAscii("/disableRecovery" ); // disable recovery and auto save (!) temp. for this office session static const ::rtl::OUString CMD_DO_SET_AUTOSAVE_STATE = ::rtl::OUString::createFromAscii("/setAutoSaveState" ); // disable/enable auto save (not crash save) for this office session @@ -725,6 +726,16 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams) } else if ( + ((eJob & AutoRecovery::E_SESSION_QUIET_QUIT ) == AutoRecovery::E_SESSION_QUIET_QUIT ) && + ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) + ) + { + LOG_RECOVERY("... do session quiet quit ...") + bAllowAutoSaveReactivation = sal_False; + implts_doSessionQuietQuit(aParams); + } + else + if ( ((eJob & AutoRecovery::E_SESSION_RESTORE ) == AutoRecovery::E_SESSION_RESTORE ) && ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY) ) @@ -1916,7 +1927,7 @@ void AutoRecovery::implts_markDocumentAsSaved(const css::uno::Reference< css::fr ::comphelper::MediaDescriptor lDescriptor(rInfo.Document->getArgs()); rInfo.RealFilter = lDescriptor.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_FILTERNAME(), ::rtl::OUString()); - + css::uno::Reference< css::frame::XTitle > xDocTitle(xDocument, css::uno::UNO_QUERY); if (xDocTitle.is ()) rInfo.Title = xDocTitle->getTitle (); @@ -1987,6 +1998,30 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible) } //----------------------------------------------- +/* Currently the document is not closed in case of crash, + so the lock file must be removed explicitly +*/ +void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo) +{ + if ( rInfo.Document.is() ) + { + try + { + css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW); + ::rtl::OUString aURL = xStore->getLocation(); + if ( aURL.getLength() ) + { + ::svt::DocumentLockFile aLockFile( aURL ); + aLockFile.RemoveFile(); + } + } + catch( const css::uno::Exception& ) + {} + } +} + + +//----------------------------------------------- void AutoRecovery::implts_prepareSessionShutdown() { LOG_RECOVERY("AutoRecovery::implts_prepareSessionShutdown() starts ...") @@ -2004,6 +2039,10 @@ void AutoRecovery::implts_prepareSessionShutdown() { AutoRecovery::TDocumentInfo& rInfo = *pIt; + // WORKAROUND... Since the documents are not closed the lock file must be removed explicitly + // it is not done on documents saving since shutdown can be cancelled + lc_removeLockFile( rInfo ); + // Prevent us from deregistration of these documents. // Because we close these documents by ourself (see XClosable below) ... // it's fact, that we reach our deregistration method. There we @@ -2014,31 +2053,38 @@ void AutoRecovery::implts_prepareSessionShutdown() // reset modified flag of these documents (ignoring the notification about it!) // Otherwise a message box is shown on closing these models. implts_stopModifyListeningOnDoc(rInfo); - css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); - if (xModify.is()) - xModify->setModified(sal_False); - // close the model. - css::uno::Reference< css::util::XCloseable > xClose(rInfo.Document, css::uno::UNO_QUERY); - if (xClose.is()) + // if the session save is still running the documents should not be thrown away, + // actually that would be a bad sign, that means that the SessionManager tryes + // to kill the session before the saving is ready + if ((m_eJob & AutoRecovery::E_SESSION_SAVE) != AutoRecovery::E_SESSION_SAVE) { - try + css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY); + if (xModify.is()) + xModify->setModified(sal_False); + + // close the model. + css::uno::Reference< css::util::XCloseable > xClose(rInfo.Document, css::uno::UNO_QUERY); + if (xClose.is()) { - xClose->close(sal_False); - } - /* - catch(const css::lang::DisposedException&) + try { - // closed ... disposed ... always the same .-) - } - */ - catch(const css::uno::Exception&) - { - // At least it's only a try to close these documents before anybody else it does. - // So it seams to be possible to ignore any error here .-) + xClose->close(sal_False); } + /* + catch(const css::lang::DisposedException&) + { + // closed ... disposed ... always the same .-) + } + */ + catch(const css::uno::Exception&) + { + // At least it's only a try to close these documents before anybody else it does. + // So it seams to be possible to ignore any error here .-) + } - rInfo.Document.clear(); + rInfo.Document.clear(); + } } } @@ -2047,30 +2093,6 @@ void AutoRecovery::implts_prepareSessionShutdown() } //----------------------------------------------- -/* Currently the document is not closed in case of crash, - so the lock file must be removed explicitly -*/ -void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo) -{ - if ( rInfo.Document.is() ) - { - try - { - css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW); - ::rtl::OUString aURL = xStore->getLocation(); - if ( aURL.getLength() ) - { - ::svt::DocumentLockFile aLockFile( aURL ); - aLockFile.RemoveFile(); - } - } - catch( const css::uno::Exception& ) - {} - } -} - - -//----------------------------------------------- /* TODO WORKAROUND: #i64599# @@ -2311,7 +2333,7 @@ void AutoRecovery::implts_saveOneDoc(const ::rtl::OUString& // #i66598# use special handling of property "DocumentBaseURL" (it must be an empty string!) // for make hyperlinks working lNewArgs[::comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL()] <<= ::rtl::OUString(); - + // try to save this document as a new temp file everytimes. // Mark AutoSave state as "INCOMPLETE" if it failed. // Because the last temp file is to old and does not include all changes. @@ -2750,6 +2772,9 @@ void AutoRecovery::implts_informListener( sal_Int32 eJ if ((eJob & AutoRecovery::E_SESSION_SAVE) == AutoRecovery::E_SESSION_SAVE) sFeature.append(CMD_DO_SESSION_SAVE); else + if ((eJob & AutoRecovery::E_SESSION_QUIET_QUIT) == AutoRecovery::E_SESSION_QUIET_QUIT) + sFeature.append(CMD_DO_SESSION_QUIET_QUIT); + else if ((eJob & AutoRecovery::E_SESSION_RESTORE) == AutoRecovery::E_SESSION_RESTORE) sFeature.append(CMD_DO_SESSION_RESTORE); else @@ -2792,6 +2817,9 @@ sal_Int32 AutoRecovery::implst_classifyJob(const css::util::URL& aURL) if (aURL.Path.equals(CMD_DO_SESSION_SAVE)) return AutoRecovery::E_SESSION_SAVE; else + if (aURL.Path.equals(CMD_DO_SESSION_QUIET_QUIT)) + return AutoRecovery::E_SESSION_QUIET_QUIT; + else if (aURL.Path.equals(CMD_DO_SESSION_RESTORE)) return AutoRecovery::E_SESSION_RESTORE; else @@ -2926,10 +2954,10 @@ void AutoRecovery::implts_doEmergencySave(const DispatchParams& aParams) // Of course following recovery session must be started without // any "handle" state ... implts_resetHandleStates(sal_False); - + // flush config cached back to disc. impl_flushALLConfigChanges(); - + // try to make sure next time office will be started user wont be // notified about any other might be running office instance // remove ".lock" file from disc ! @@ -2968,14 +2996,6 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) { LOG_RECOVERY("AutoRecovery::implts_doSessionSave()") - // try to make sure next time office will be started user wont be - // notified about any other might be running office instance - // remove ".lock" file from disc ! - // it is done as a first action for session save since Gnome sessions - // do not provide enough time for shutdown, and the dialog looks to be - // confusing for the user - AutoRecovery::st_impl_removeLockFile(); - // Be sure to know all open documents realy .-) implts_verifyCacheAgainstDesktopDocumentList(); @@ -2991,7 +3011,8 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) AutoRecovery::ETimerType eSuggestedTimer = AutoRecovery::E_DONT_START_TIMER; do { - eSuggestedTimer = implts_saveDocs(bAllowUserIdleLoop, sal_True, &aParams); + // do not remove lock files of the documents, it will be done on session quit + eSuggestedTimer = implts_saveDocs(bAllowUserIdleLoop, sal_False, &aParams); } while(eSuggestedTimer == AutoRecovery::E_CALL_ME_BACK); @@ -3002,6 +3023,23 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) // any "handle" state ... implts_resetHandleStates(sal_False); + // flush config cached back to disc. + impl_flushALLConfigChanges(); +} + +//----------------------------------------------- +void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/) +{ + LOG_RECOVERY("AutoRecovery::implts_doSessionQuietQuit()") + + // try to make sure next time office will be started user wont be + // notified about any other might be running office instance + // remove ".lock" file from disc ! + // it is done as a first action for session save since Gnome sessions + // do not provide enough time for shutdown, and the dialog looks to be + // confusing for the user + AutoRecovery::st_impl_removeLockFile(); + // reset all modified documents, so the dont show any UI on closing ... // and close all documents, so we can shutdown the OS! implts_prepareSessionShutdown(); @@ -3015,11 +3053,12 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams) CFG_ENTRY_SESSIONDATA, css::uno::makeAny(sal_True), ::comphelper::ConfigurationHelper::E_STANDARD); - + // flush config cached back to disc. impl_flushALLConfigChanges(); } + //----------------------------------------------- void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams) { @@ -3505,10 +3544,10 @@ void AutoRecovery::impl_flushALLConfigChanges() css::uno::Reference< css::uno::XInterface > xRecoveryCfg(m_xRecoveryCFG, css::uno::UNO_QUERY); aReadLock.unlock(); // <- SAFE - + if (xRecoveryCfg.is()) ::comphelper::ConfigurationHelper::flush(xRecoveryCfg); - + // SOLAR SAFE -> ::vos::OGuard aGuard( Application::GetSolarMutex() ); ::utl::ConfigManager* pCfgMgr = ::utl::ConfigManager::GetConfigManager(); @@ -3541,12 +3580,12 @@ void AutoRecovery::st_impl_removeLockFile() { ::rtl::OUString sUserURL; ::utl::Bootstrap::locateUserInstallation( sUserURL ); - + ::rtl::OUStringBuffer sLockURLBuf; sLockURLBuf.append (sUserURL); sLockURLBuf.appendAscii("/.lock"); ::rtl::OUString sLockURL = sLockURLBuf.makeStringAndClear(); - + AutoRecovery::st_impl_removeFile(sLockURL); } catch(const css::uno::Exception&) diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx index 3ec5ac5f99..ef981f7feb 100644 --- a/framework/source/services/backingcomp.cxx +++ b/framework/source/services/backingcomp.cxx @@ -77,7 +77,7 @@ #ifndef _SOLAR_HRC #include <vcl/solar.hrc> #endif -#include <svtools/urihelper.hxx> +#include <svl/urihelper.hxx> #include <osl/file.hxx> #include <unotools/configmgr.hxx> diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index a33339003a..1c4324ef03 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -43,9 +43,9 @@ #include "tools/urlobj.hxx" -#include "svtools/dynamicmenuoptions.hxx" +#include "unotools/dynamicmenuoptions.hxx" #include "svtools/imagemgr.hxx" -#include "svtools/svtools.hrc" +#include "svl/svtools.hrc" #include "comphelper/processfactory.hxx" #include "comphelper/sequenceashashmap.hxx" @@ -104,7 +104,7 @@ void DecoToolBox::calcMinSize() aTbx.InsertItem( nId, GetItemImage( nId ) ); } aTbx.SetOutStyle( TOOLBOX_STYLE_FLAT ); - maMinSize = aTbx.CalcWindowSizePixel(); + maMinSize = aTbx.CalcWindowSizePixel(); } Size DecoToolBox::getMinSize() @@ -145,7 +145,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : mpAccExec( NULL ) { mnColumnWidth[0] = mnColumnWidth[1] = 0; - + // get icon images from vcl resource and set them on the appropriate buttons loadImage( FwkResId( BMP_BACKING_WRITER ), maWriterButton ); loadImage( FwkResId( BMP_BACKING_CALC ), maCalcButton ); @@ -155,7 +155,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : loadImage( FwkResId( BMP_BACKING_FORMULA ), maMathButton ); loadImage( FwkResId( BMP_BACKING_OPENFILE ), maOpenButton ); loadImage( FwkResId( BMP_BACKING_OPENTEMPLATE ), maTemplateButton ); - + BitmapEx aExtImage( FwkResId( BMP_BACKING_EXT ) ); String aExtHelpText( FwkResId( STR_BACKING_EXTHELP ) ); BitmapEx aRegImage( FwkResId( BMP_BACKING_REG ) ); @@ -164,20 +164,20 @@ BackingWindow::BackingWindow( Window* i_pParent ) : String aInfoHelpText( FwkResId( STR_BACKING_INFOHELP ) ); BitmapEx aTplRepImage( FwkResId( BMP_BACKING_TPLREP ) ); String aTplRepHelpText( FwkResId( STR_BACKING_TPLREP ) ); - + // clean up resource stack FreeResource(); - + maWelcome.SetPaintTransparent( TRUE ); maProduct.SetPaintTransparent( TRUE ); EnableChildTransparentMode(); - + SetStyle( GetStyle() | WB_DIALOGCONTROL ); - + // add some breathing space for the images maButtonImageSize.Width() += 12; maButtonImageSize.Height() += 12; - + // force tab cycling in toolbox maToolbox.SetStyle( maToolbox.GetStyle() | WB_FORCETABCYCLE ); @@ -193,13 +193,13 @@ BackingWindow::BackingWindow( Window* i_pParent ) : maToolbox.SetItemText( nItemId_Extensions, aExtHelpText ); maToolbox.SetItemCommand( nItemId_Extensions, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Extensions" ) ) ); maToolbox.ShowItem( nItemId_Extensions ); - + maToolbox.InsertItem( nItemId_Reg, Image( aRegImage ) ); maToolbox.SetQuickHelpText( nItemId_Reg, aRegHelpText ); maToolbox.SetItemText( nItemId_Reg, aRegHelpText ); maToolbox.SetItemCommand( nItemId_Reg, String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Register" ) ) ); maToolbox.ShowItem( nItemId_Reg ); - + maToolbox.InsertItem( nItemId_Info, Image( aInfoImage ) ); maToolbox.SetItemText( nItemId_Info, aInfoHelpText ); maToolbox.SetQuickHelpText( nItemId_Info, aInfoHelpText ); @@ -210,7 +210,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : mxDesktop = Reference<XDesktop>( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_DESKTOP ),UNO_QUERY ); if( mxDesktop.is() ) mxDesktopDispatchProvider = Reference< XDispatchProvider >( mxDesktop, UNO_QUERY ); - + maWriterButton.SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:WriterButton" ) ) ) ); maCalcButton.SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:CalcButton" ) ) ) ); maImpressButton.SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:ImpressButton" ) ) ) ); @@ -220,7 +220,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : maTemplateButton.SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:TemplateButton" ) ) ) ); maOpenButton.SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:OpenButton" ) ) ) ); maToolbox.SetSmartHelpId( SmartId( String( RTL_CONSTASCII_USTRINGPARAM( ".HelpId:StartCenter:Toolbox" ) ) ) ); - + // init background initBackground(); } @@ -231,6 +231,13 @@ BackingWindow::~BackingWindow() delete mpAccExec; } +void BackingWindow::GetFocus() +{ + if( IsVisible() ) + maWriterButton.GrabFocus(); + Window::GetFocus(); +} + class ImageContainerRes : public Resource { public: @@ -252,7 +259,7 @@ void BackingWindow::DataChanged( const DataChangedEvent& rDCEvt ) void BackingWindow::initBackground() { SetBackground( GetSettings().GetStyleSettings().GetWorkspaceGradient() ); - + bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode(); maWelcomeTextColor = maLabelTextColor = bDark ? Color( COL_WHITE ) : Color( 0x26, 0x35, 0x42 ); Color aTextBGColor( bDark ? COL_BLACK : COL_WHITE ); @@ -269,7 +276,7 @@ void BackingWindow::initBackground() // and scale it to previous size if( aMiddleSize.Width() && aMiddleSize.Height() ) maBackgroundMiddle.Scale( aMiddleSize ); - + if( GetSettings().GetLayoutRTL() ) { // replace images by RTL versions @@ -310,9 +317,9 @@ void BackingWindow::initControls() { if( mbInitControls ) return; - + mbInitControls = true; - + // calculate dialog size // begin with background bitmap maControlRect = Rectangle( Point(), maBackgroundLeft.GetSizePixel() ); @@ -320,7 +327,7 @@ void BackingWindow::initControls() maControlRect.Right() -= nShadowRight; maControlRect.Top() += nShadowTop; maControlRect.Bottom() -= nShadowBottom; - + long nYPos = 0; // set bigger welcome string maWelcome.SetText( maWelcomeString ); @@ -336,16 +343,16 @@ void BackingWindow::initControls() maWelcome.SetControlFont( maTextFont ); maWelcomeSize = Size( maWelcome.GetTextWidth( maWelcomeString ), maWelcome.GetTextHeight() ); maWelcomeSize.Width() = (maWelcomeSize.Width() * 20)/19; - + nYPos += (maWelcomeSize.Height()*3)/2; - + if( maControlRect.GetWidth() < nBtnPos + maWelcomeSize.Width() + 20 ) maControlRect.Right() = maControlRect.Left() + maWelcomeSize.Width() + nBtnPos + 20; maWelcome.Show(); - + nYPos += maWelcomeSize.Height(); - + // set product string maTextFont.SetSize( Size( 0, 30 ) ); maProduct.SetFont( maTextFont ); @@ -359,24 +366,24 @@ void BackingWindow::initControls() maProduct.SetText( maProductString ); maProductSize = Size( maProduct.GetTextWidth( maProductString ), maProduct.GetTextHeight() ); maProductSize.Width() = (maProductSize.Width() * 20)/19; - + if( maControlRect.GetWidth() < maProductSize.Width() + nBtnPos + 10 ) maControlRect.Right() = maControlRect.Left() + maProductSize.Width() + nBtnPos + 10; maProduct.Show(); - + nYPos += (maProductSize.Height()*3)/2; - + // set a slighly larger font than normal labels on the texts maTextFont.SetSize( Size( 0, 11 ) ); maTextFont.SetWeight( WEIGHT_NORMAL ); - + maCreateText.SetText( maCreateString ); maCreateText.SetFont( maTextFont ); maCreateText.SetControlFont( maTextFont ); maCreateSize = Size( maCreateText.GetTextWidth( maCreateString ), maCreateText.GetTextHeight() ); maCreateText.Show(); - + nYPos += (maCreateSize.Height()*3)/2; // collect the URLs of the entries in the File/New menu @@ -395,12 +402,12 @@ void BackingWindow::initControls() if ( sURL.getLength() ) aFileNewAppsAvailable.insert( sURL ); } - + // create mnemonics on the fly, preregister the mnemonics of the menu MnemonicGenerator aMnemns; maTemplateString = MnemonicGenerator::EraseAllMnemonicChars( maTemplateString ); maOpenString = MnemonicGenerator::EraseAllMnemonicChars( maOpenString ); - + SystemWindow* pSysWin = GetSystemWindow(); if( pSysWin ) { @@ -416,7 +423,7 @@ void BackingWindow::initControls() } } } - + // layout the buttons layoutButtonAndText( WRITER_URL, 0, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SWRITER, @@ -438,7 +445,7 @@ void BackingWindow::initControls() layoutButtonAndText( MATH_URL, 1, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SMATH, maMathButton, maMathText, aMnemns ); - + nYPos += 3*maButtonImageSize.Height() / 2; layoutButtonAndText( NULL, -1, aFileNewAppsAvailable, aModuleOptions, SvtModuleOptions::E_SWRITER, @@ -449,18 +456,18 @@ void BackingWindow::initControls() aModuleOptions, SvtModuleOptions::E_SWRITER, maOpenButton, maOpenText, aMnemns, maOpenString ); nYPos += 10; - + DBG_ASSERT( nYPos < maControlRect.GetHeight(), "misformatting !" ); if( mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20 > maControlRect.GetWidth() ) maControlRect.Right() = maControlRect.Left() + mnColumnWidth[0] + mnColumnWidth[1] + nBtnPos + 20; - + maToolbox.SetSelectHdl( LINK( this, BackingWindow, ToolboxHdl ) ); maToolbox.Show(); - + // scale middle map to formatted width Size aMiddleSegmentSize( maControlRect.GetSize().Width() + nShadowLeft + nShadowRight, maBackgroundMiddle.GetSizePixel().Height() ); - + long nLW = maBackgroundLeft.GetSizePixel().Width(); long nRW = maBackgroundRight.GetSizePixel().Width(); if( aMiddleSegmentSize.Width() > nLW + nRW ) @@ -471,7 +478,7 @@ void BackingWindow::initControls() } else maBackgroundMiddle = BitmapEx(); - + Resize(); } @@ -503,7 +510,7 @@ void BackingWindow::layoutButtonAndText( { i_rBtn.Enable( FALSE ); } - + // setup text i_rText.SetFont( maTextFont ); i_rText.SetControlFont( maTextFont ); @@ -520,7 +527,7 @@ void BackingWindow::layoutButtonAndText( if( nTextWidth > mnColumnWidth[nColumn] ) mnColumnWidth[nColumn] = nTextWidth; } - + // show the controls i_rBtn.Show(); i_rText.Show(); @@ -529,14 +536,14 @@ void BackingWindow::layoutButtonAndText( void BackingWindow::Paint( const Rectangle& ) { bool bDark = GetSettings().GetStyleSettings().GetHighContrastMode(); - + Color aBackColor( bDark ? COL_BLACK : COL_WHITE ); // fill control rect SetLineColor(); SetFillColor( aBackColor ); DrawRect( maControlRect ); - + // draw bitmap if( GetSettings().GetLayoutRTL() ) { @@ -577,7 +584,7 @@ long BackingWindow::Notify( NotifyEvent& rNEvt ) mpAccExec = svt::AcceleratorExecute::createAcceleratorHelper(); mpAccExec->init( comphelper::getProcessServiceFactory(), mxFrame); } - + const KeyEvent* pEvt = rNEvt.GetKeyEvent(); if( pEvt && mpAccExec->execute(pEvt->GetKeyCode()) ) return 1; @@ -599,7 +606,7 @@ void BackingWindow::Resize() maControlRect = Rectangle( Point( (aWindowSize.Width() - aControlSize.Width()) / 2, (aWindowSize.Height() - aControlSize.Height()) / 2 ), aControlSize ); - + maToolbox.calcMinSize(); Size aTBSize( maToolbox.getMinSize() ); Point aTBPos( maControlRect.Right() - aTBSize.Width() - 10, @@ -629,18 +636,18 @@ void BackingWindow::Resize() { nDiff++; } - + long nYPos = maControlRect.Top(); nYPos += nW2Delta - nDiff; maWelcome.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maWelcomeSize.Height()*20)/19 ) ); - nYPos += nWDelta - nDiff; + nYPos += nWDelta - nDiff; maProduct.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, (maProductSize.Height()*20)/19 ) ); nYPos += nPDelta - nDiff; - + maCreateText.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), Size( maControlRect.GetWidth() - nBtnPos - 5, maCreateSize.Height() ) ); - + nYPos += nCDelta - nDiff; maWriterButton.SetPosSizePixel( Point( maControlRect.Left() + nBtnPos, nYPos ), maButtonImageSize ); @@ -679,7 +686,7 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) { const char* pNodePath = NULL; const char* pNode = NULL; - + switch( maToolbox.GetCurItemId() ) { case nItemId_Extensions: @@ -737,7 +744,7 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) //throws css::container::NoSuchElementException, css::lang::WrappedTargetException Any value( xNameAccess->getByName(rtl::OUString::createFromAscii(pNode)) ); sURL = value.get<rtl::OUString> (); - + Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute( comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" ) ) ), @@ -751,7 +758,7 @@ IMPL_LINK( BackingWindow, ToolboxHdl, void*, EMPTYARG ) { } } - + return 0; } @@ -773,7 +780,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) else if( pButton == &maOpenButton ) { Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY ); - + Sequence< com::sun::star::beans::PropertyValue > aArgs(1); PropertyValue* pArg = aArgs.getArray(); pArg[0].Name = rtl::OUString::createFromAscii("Referer"); @@ -784,7 +791,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) else if( pButton == &maTemplateButton ) { Reference< XDispatchProvider > xFrame( mxFrame, UNO_QUERY ); - + Sequence< com::sun::star::beans::PropertyValue > aArgs(1); PropertyValue* pArg = aArgs.getArray(); pArg[0].Name = rtl::OUString::createFromAscii("Referer"); @@ -798,7 +805,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) Window* BackingWindow::GetParentLabelFor( const Window* pLabel ) const { const Window* pRet = NULL; - + if( pLabel == &maWriterText ) pRet = &maWriterButton; else if( pLabel == &maCalcText ) @@ -815,14 +822,14 @@ Window* BackingWindow::GetParentLabelFor( const Window* pLabel ) const pRet = &maTemplateButton; else if( pLabel == &maOpenText ) pRet = &maOpenButton; - + return const_cast<Window*>(pRet); } Window* BackingWindow::GetParentLabeledBy( const Window* pLabeled ) const { const Window *pRet = NULL; - + if( pLabeled == &maWriterButton ) pRet = &maWriterText; else if( pLabeled == &maCalcButton ) @@ -839,7 +846,7 @@ Window* BackingWindow::GetParentLabeledBy( const Window* pLabeled ) const pRet = &maTemplateText; else if( pLabeled == &maOpenButton ) pRet = &maOpenText; - + return const_cast<Window*>(pRet); } @@ -848,7 +855,7 @@ struct ImplDelayedDispatch Reference< XDispatch > xDispatch; com::sun::star::util::URL aDispatchURL; Sequence< PropertyValue > aArgs; - + ImplDelayedDispatch( const Reference< XDispatch >& i_xDispatch, const com::sun::star::util::URL& i_rURL, const Sequence< PropertyValue >& i_rArgs ) @@ -870,10 +877,10 @@ static long implDispatchDelayed( void*, void* pArg ) catch( Exception ) { } - + // clean up delete pDispatch; - + return 0; } @@ -888,7 +895,7 @@ void BackingWindow::dispatchURL( const rtl::OUString& i_rURL, // check for dispatch provider if( !xProvider.is()) return; - + // get an URL transformer to clean up the URL com::sun::star::util::URL aDispatchURL; aDispatchURL.Complete = i_rURL; diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index 9722ddfc86..e02206cf5f 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -38,7 +38,7 @@ #include "vcl/bitmapex.hxx" #include "vcl/toolbox.hxx" -#include "svtools/moduleoptions.hxx" +#include "unotools/moduleoptions.hxx" #include "svtools/acceleratorexecute.hxx" #include "com/sun/star/frame/XDispatchProvider.hpp" @@ -66,25 +66,25 @@ namespace framework class DecoToolBox : public ToolBox { Size maMinSize; - + using Window::ImplInit; public: DecoToolBox( Window* pParent, WinBits nStyle = 0 ); DecoToolBox( Window* pParent, const ResId& rResId ); - + void DataChanged( const DataChangedEvent& rDCEvt ); - + void calcMinSize(); Size getMinSize(); }; - + class BackingWindow : public Window { com::sun::star::uno::Reference<com::sun::star::frame::XDesktop> mxDesktop; com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider; com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame; com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster> mxBroadcaster; - + FixedText maWelcome; Size maWelcomeSize; FixedText maProduct; @@ -107,32 +107,32 @@ namespace framework ImageButton maTemplateButton; FixedText maOpenText; ImageButton maOpenButton; - + DecoToolBox maToolbox; - + BitmapEx maBackgroundLeft; BitmapEx maBackgroundMiddle; BitmapEx maBackgroundRight; - + String maWelcomeString; String maProductString; String maCreateString; String maOpenString; String maTemplateString; - + Font maTextFont; Rectangle maControlRect; - + long mnColumnWidth[2]; Color maLabelTextColor; Color maWelcomeTextColor; - + Size maButtonImageSize; - + bool mbInitControls; svt::AcceleratorExecute* mpAccExec; - + static const long nBtnPos = 240; static const int nItemId_Extensions = 1; static const int nItemId_Reg = 2; @@ -142,37 +142,38 @@ namespace framework static const int nShadowLeft = 35; static const int nShadowRight = 45; static const int nShadowBottom = 50; - + void loadImage( const ResId& i_rId, ImageButton& i_rButton ); - + void layoutButtonAndText( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, ImageButton& i_rBtn, FixedText& i_rText, MnemonicGenerator& i_rMnemonicGen, const String& i_rStr = String() ); - + void dispatchURL( const rtl::OUString& i_rURL, const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ), const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(), const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >() ); - + DECL_LINK( ClickHdl, Button* ); DECL_LINK( ToolboxHdl, void* ); - + void initControls(); void initBackground(); public: BackingWindow( Window* pParent ); ~BackingWindow(); - + virtual void Paint( const Rectangle& rRect ); virtual void Resize(); virtual long Notify( NotifyEvent& rNEvt ); virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual Window* GetParentLabelFor( const Window* pLabel ) const; virtual Window* GetParentLabeledBy( const Window* pLabeled ) const; + virtual void GetFocus(); void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); }; diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 1d63a503b2..709bfb6bd0 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -106,7 +106,7 @@ #endif #include <toolkit/awt/vclxwindow.hxx> #include <comphelper/processfactory.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #ifdef ENABLE_ASSERTIONS #ifndef _RTL_STRBUF_HXX_ @@ -630,7 +630,7 @@ void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& implts_startWindowListening(); impl_enablePropertySet(); - + // create WindowCommandDispatch; it is supposed to release itself at frame destruction (void)new WindowCommandDispatch(xSMGR, this); @@ -2297,7 +2297,7 @@ aEvent // Look for rejected calls. // Sometimes called during dispose() => soft exceptions TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); - + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); @@ -2652,7 +2652,7 @@ void SAL_CALL Frame::impl_setPropertyValue(const ::rtl::OUString& /*sProperty*/, css::uno::Reference< css::frame::XLayoutManager > xOldLayoutManager = m_xLayoutManager; css::uno::Reference< css::frame::XLayoutManager > xNewLayoutManager; aValue >>= xNewLayoutManager; - + if (xOldLayoutManager != xNewLayoutManager) { m_xLayoutManager = xNewLayoutManager; diff --git a/framework/source/services/mediatypedetectionhelper.cxx b/framework/source/services/mediatypedetectionhelper.cxx index b5b7cfe062..74087a50bb 100644 --- a/framework/source/services/mediatypedetectionhelper.cxx +++ b/framework/source/services/mediatypedetectionhelper.cxx @@ -36,7 +36,7 @@ //_________________________________________________________________________________________________________________ #include <services/mediatypedetectionhelper.hxx> #include <services.h> -#include <svtools/inettype.hxx> +#include <svl/inettype.hxx> #include <tools/string.hxx> #include <rtl/logfile.hxx> diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index 9bda14b891..eabcfcedf1 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -60,14 +60,15 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/URL.hpp> #include <osl/time.h> #include <comphelper/processfactory.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/internaloptions.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/internaloptions.hxx> #include <stdio.h> //_______________________________________________ // interface includes @@ -103,12 +104,13 @@ namespace framework{ //*********************************************** // XInterface, XTypeProvider, XServiceInfo -DEFINE_XINTERFACE_5( +DEFINE_XINTERFACE_6( SessionListener, OWeakObject, DIRECT_INTERFACE(css::lang::XTypeProvider), DIRECT_INTERFACE(css::lang::XInitialization), DIRECT_INTERFACE(css::frame::XSessionManagerListener), + DIRECT_INTERFACE(css::frame::XSessionManagerListener2), DIRECT_INTERFACE(css::frame::XStatusListener), DIRECT_INTERFACE(css::lang::XServiceInfo)) @@ -116,7 +118,7 @@ DEFINE_XTYPEPROVIDER_5( SessionListener, css::lang::XTypeProvider, css::lang::XInitialization, - css::frame::XSessionManagerListener, + css::frame::XSessionManagerListener2, css::frame::XStatusListener, css::lang::XServiceInfo) @@ -137,19 +139,79 @@ SessionListener::SessionListener(const css::uno::Reference< css::lang::XMultiSer : ThreadHelpBase (&Application::GetSolarMutex()) , OWeakObject ( ) , m_xSMGR (xSMGR ) - , m_bRestored( false ) + , m_bRestored( sal_False ) + , m_bSessionStoreRequested( sal_False ) + , m_bAllowUserInteractionOnQuit( sal_False ) + , m_bTerminated( sal_False ) { } SessionListener::~SessionListener() { - if (m_rSessionManager.is()) + if (m_rSessionManager.is()) { css::uno::Reference< XSessionManagerListener> me(this); m_rSessionManager->removeSessionManagerListener(me); } } +void SessionListener::StoreSession( sal_Bool bAsync ) +{ + ResetableGuard aGuard(m_aLock); + try + { + // xd create SERVICENAME_AUTORECOVERY -> XDispatch + // xd->dispatch("vnd.sun.star.autorecovery:/doSessionSave, async=bAsync + // on stop event m_rSessionManager->saveDone(this); in case of asynchronous call + // in case of synchronous call the caller should do saveDone() call himself! + + css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); + css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); + URL aURL; + aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionSave"); + xURLTransformer->parseStrict(aURL); + + // in case of asynchronous call the notification will trigger saveDone() + if ( bAsync ) + xDispatch->addStatusListener(this, aURL); + + Sequence< PropertyValue > args(1); + args[0] = PropertyValue(OUString::createFromAscii("DispatchAsynchron"),-1,makeAny(bAsync),PropertyState_DIRECT_VALUE); + xDispatch->dispatch(aURL, args); + } catch (com::sun::star::uno::Exception& e) { + OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8); + OSL_ENSURE(sal_False, aMsg.getStr()); + // save failed, but tell manager to go on if we havent yet dispatched the request + // in case of synchronous saving the notification is done by the caller + if ( bAsync && m_rSessionManager.is() ) + m_rSessionManager->saveDone(this); + } +} + +void SessionListener::QuitSessionQuietly() +{ + ResetableGuard aGuard(m_aLock); + try + { + // xd create SERVICENAME_AUTORECOVERY -> XDispatch + // xd->dispatch("vnd.sun.star.autorecovery:/doSessionQuietQuit, async=false + // it is done synchronously to avoid conflict with normal quit process + + css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); + css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); + URL aURL; + aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionQuietQuit"); + xURLTransformer->parseStrict(aURL); + + Sequence< PropertyValue > args(1); + args[0] = PropertyValue(OUString::createFromAscii("DispatchAsynchron"),-1,makeAny(sal_False),PropertyState_DIRECT_VALUE); + xDispatch->dispatch(aURL, args); + } catch (com::sun::star::uno::Exception& e) { + OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8); + OSL_ENSURE(sal_False, aMsg.getStr()); + } +} + void SAL_CALL SessionListener::disposing(const com::sun::star::lang::EventObject&) throw (RuntimeException) { } @@ -170,6 +232,8 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any >& args) v.Value >>= aSMgr; else if (v.Name.equalsAscii("SessionManager")) v.Value >>= m_rSessionManager; + else if (v.Name.equalsAscii("AllowUserInteractionOnQuit")) + v.Value >>= m_bAllowUserInteractionOnQuit; } } } @@ -181,7 +245,7 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any >& args) { m_rSessionManager->addSessionManagerListener(this); } -} +} void SAL_CALL SessionListener::statusChanged(const FeatureStateEvent& event) throw (css::uno::RuntimeException) @@ -190,8 +254,8 @@ void SAL_CALL SessionListener::statusChanged(const FeatureStateEvent& event) { if (event.FeatureDescriptor.compareToAscii("update")==0) m_bRestored = sal_True; // a document was restored - // if (event.FeatureDescriptor.compareToAscii("stop")==0) - + // if (event.FeatureDescriptor.compareToAscii("stop")==0) + } else if (event.FeatureURL.Complete.equalsAscii("vnd.sun.star.autorecovery:/doSessionSave")) { @@ -207,11 +271,11 @@ void SAL_CALL SessionListener::statusChanged(const FeatureStateEvent& event) sal_Bool SAL_CALL SessionListener::doRestore() throw (RuntimeException) { - ResetableGuard aGuard(m_aLock); + ResetableGuard aGuard(m_aLock); m_bRestored = sal_False; try { css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - + URL aURL; aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionRestore"); css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); @@ -220,7 +284,7 @@ sal_Bool SAL_CALL SessionListener::doRestore() xDispatch->addStatusListener(this, aURL); xDispatch->dispatch(aURL, args); m_bRestored = sal_True; - + } catch (com::sun::star::uno::Exception& e) { OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8); OSL_ENSURE(sal_False, aMsg.getStr()); @@ -235,46 +299,73 @@ void SAL_CALL SessionListener::doSave( sal_Bool bShutdown, sal_Bool /*bCancelabl { if (bShutdown) { - sal_Bool bDispatched = sal_False; - ResetableGuard aGuard(m_aLock); - try - { - // xd create SERVICENAME_AUTORECOVERY -> XDispatch - // xd->dispatch("vnd.sun.star.autorecovery:/doSessionSave, async=true - // on stop event m_rSessionManager->saveDone(this); - - css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); - URL aURL; - aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionSave"); - xURLTransformer->parseStrict(aURL); - xDispatch->addStatusListener(this, aURL); - Sequence< PropertyValue > args(1); - args[0] = PropertyValue(OUString::createFromAscii("DispatchAsynchron"),-1,makeAny(sal_True),PropertyState_DIRECT_VALUE); - xDispatch->dispatch(aURL, args); - bDispatched = sal_True; - // on stop event set call m_rSessionManager->saveDone(this); - } catch (com::sun::star::uno::Exception& e) { - OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8); - OSL_ENSURE(sal_False, aMsg.getStr()); - // save failed, but tell manager to go on if we havent yet dispatched the request - if (m_rSessionManager.is() && !bDispatched) - m_rSessionManager->saveDone(this); - } + m_bSessionStoreRequested = sal_True; // there is no need to protect it with mutex + if ( m_bAllowUserInteractionOnQuit && m_rSessionManager.is() ) + m_rSessionManager->queryInteraction( static_cast< css::frame::XSessionManagerListener* >( this ) ); + else + StoreSession( sal_True ); } // we don't have anything to do so tell the session manager we're done else if( m_rSessionManager.is() ) m_rSessionManager->saveDone( this ); } - - -void SAL_CALL SessionListener::approveInteraction( sal_Bool /*bInteractionGranted*/ ) +void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted ) throw (RuntimeException) -{} +{ + // do AutoSave as the first step + ResetableGuard aGuard(m_aLock); + + if ( bInteractionGranted ) + { + // close the office documents in normal way + try + { + // first of all let the session be stored to be sure that we lose no information + StoreSession( sal_False ); + + css::uno::Reference< css::frame::XDesktop > xDesktop( m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW); + m_bTerminated = xDesktop->terminate(); + + if ( m_rSessionManager.is() ) + { + // false means that the application closing has been cancelled + if ( !m_bTerminated ) + m_rSessionManager->cancelShutdown(); + else + m_rSessionManager->interactionDone( this ); + } + } + catch( css::uno::Exception& ) + { + StoreSession( sal_True ); + m_rSessionManager->interactionDone( this ); + } + + if ( m_rSessionManager.is() ) + m_rSessionManager->saveDone(this); + } + else + { + StoreSession( sal_True ); + } +} void SessionListener::shutdownCanceled() throw (RuntimeException) -{} +{ + // set the state back + m_bSessionStoreRequested = sal_False; // there is no need to protect it with mutex +} + +void SessionListener::doQuit() + throw (RuntimeException) +{ + if ( m_bSessionStoreRequested && !m_bTerminated ) + { + // let the session be closed quietly in this case + QuitSessionQuietly(); + } +} } diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index ee766efeee..3080f7cd8b 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -319,6 +319,11 @@ void SubstitutePathVariables_Impl::Notify( const com::sun::star::uno::Sequence< // NOT implemented yet! } +void SubstitutePathVariables_Impl::Commit() +{ +} + + //_________________________________________________________________________________________________________________ // private methods //_________________________________________________________________________________________________________________ diff --git a/framework/source/services/tabwindowservice.cxx b/framework/source/services/tabwindowservice.cxx index 6c78600aa9..71136a9ac4 100644 --- a/framework/source/services/tabwindowservice.cxx +++ b/framework/source/services/tabwindowservice.cxx @@ -75,18 +75,20 @@ namespace framework{ // css::uno::XInterface, XTypeProvider, XServiceInfo //***************************************************************************************************************** -DEFINE_XINTERFACE_5 ( TabWindowService , +DEFINE_XINTERFACE_6 ( TabWindowService , OWeakObject , DIRECT_INTERFACE(css::lang::XTypeProvider ), DIRECT_INTERFACE(css::lang::XServiceInfo ), + DIRECT_INTERFACE(css::lang::XComponent), DIRECT_INTERFACE(css::awt::XSimpleTabController), DIRECT_INTERFACE(css::beans::XPropertySet ), DIRECT_INTERFACE(css::beans::XPropertySetInfo ) ) -DEFINE_XTYPEPROVIDER_5 ( TabWindowService , +DEFINE_XTYPEPROVIDER_6 ( TabWindowService , css::lang::XTypeProvider , css::lang::XServiceInfo , + css::lang::XComponent , css::awt::XSimpleTabController , css::beans::XPropertySet , css::beans::XPropertySetInfo @@ -100,7 +102,7 @@ DEFINE_XSERVICEINFO_MULTISERVICE ( TabWindowService , DEFINE_INIT_SERVICE ( TabWindowService, { - impl_initializePropInfo();
+ impl_initializePropInfo(); m_aTransactionManager.setWorkingMode( E_WORK ); } ) @@ -141,7 +143,12 @@ TabWindowService::TabWindowService( const css::uno::Reference< css::lang::XMulti // destructor //***************************************************************************************************************** TabWindowService::~TabWindowService() -{
+{ + // SAFE-> + ResetableGuard aGuard(m_aLock); + + if (m_pTabWin) + m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) ); } //***************************************************************************************************************** @@ -286,8 +293,11 @@ void SAL_CALL TabWindowService::dispose() m_lListener.disposeAndClear (aEvent); + if (m_pTabWin) + m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) ); + m_pTabWin = NULL; - m_xTabWin.clear (); + m_xTabWin.clear(); } //***************************************************************************************************************** @@ -357,6 +367,7 @@ css::uno::Any SAL_CALL TabWindowService::impl_getPropertyValue(const ::rtl::OUSt //***************************************************************************************************************** IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent ) { + if ( !pEvent && !pEvent->ISA(VclWindowEvent)) return 0; @@ -369,6 +380,11 @@ IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent ) if (nEventId == VCLEVENT_OBJECT_DYING) { m_lListener.disposeAndClear (aEvent); + + m_pTabWin->RemoveEventListener( LINK( this, TabWindowService, EventListener ) ); + m_pTabWin = NULL; + m_xTabWin.clear(); + return 0; } @@ -454,9 +470,9 @@ FwkTabWindow* TabWindowService::mem_TabWin () FwkTabWindow* pWin = NULL; if ( ! m_xTabWin.is ()) - {
- Window* pFakeParent = dynamic_cast< Window* >(Application::GetDefaultDevice ());
-
+ { + Window* pFakeParent = dynamic_cast< Window* >(Application::GetDefaultDevice ()); + m_pTabWin = new FwkTabWindow (pFakeParent); m_xTabWin = VCLUnoHelper::GetInterface (m_pTabWin); diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 320e7ffbe1..24e879b5ad 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -188,7 +188,9 @@ void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,co m_xFrame, aTargetURL, Sequence<PropertyValue>()); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"FontMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index e3ff3f2033..56a14f4ba4 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -326,7 +326,9 @@ void FontSizeMenuController::impl_select(const Reference< XDispatch >& _xDispatc Sequence<PropertyValue> aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# UiEventLogHelper(::rtl::OUString::createFromAscii("FontSizeMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"FontSizeMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } // XPopupMenuController diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 7882abbb94..3ab8386c87 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -254,7 +254,9 @@ void HeaderMenuController::impl_select(const Reference< XDispatch >& _xDispatch, Sequence<PropertyValue> aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# UiEventLogHelper(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(m_bFooter ? "FooterMenuController" : "HeaderMenuController"))).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"HeaderMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } void SAL_CALL HeaderMenuController::updatePopupMenu() throw (::com::sun::star::uno::RuntimeException) diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index a2f8ec271a..d91d389931 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -68,7 +68,7 @@ #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> #include <map> #include <i18npool/mslangid.hxx> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <com/sun/star/awt/MenuItemStyle.hpp> #include <svtools/langtab.hxx> #include <classes/fwlresid.hxx> diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index a99c60a10e..d56a120c75 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -71,7 +71,7 @@ #include <toolkit/unohlp.hxx> #include <tools/gen.hxx> #include <com/sun/star/awt/Command.hpp> -#include <svtools/languageoptions.hxx> +#include <svl/languageoptions.hxx> #include <com/sun/star/linguistic2/XLanguageGuessing.hpp> #include <dispatch/uieventloghelper.hxx> @@ -337,7 +337,7 @@ void LangSelectionStatusbarController::LangMenu()throw (::com::sun::star::uno::R mRectangle.Y = mMousePos.Y(); sal_Int16 nId = xPopupMenu->execute( xParent, mRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); //click "More..." - if ( m_xFrame.is() ) + if ( nId && m_xFrame.is() ) { uno::Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); util::URL aURL; diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index f5991c9d86..730e022ab0 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -82,9 +82,9 @@ #include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> #include <svtools/menuoptions.hxx> -#include <svtools/historyoptions.hxx> -#include <svtools/pathoptions.hxx> -#include <svtools/cmdoptions.hxx> +#include <unotools/historyoptions.hxx> +#include <unotools/pathoptions.hxx> +#include <unotools/cmdoptions.hxx> #include <unotools/localfilehelper.hxx> #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> @@ -541,7 +541,7 @@ throw ( RuntimeException ) ) bEnabledItem = sal_True; #endif - + // Enable/disable item if ( bEnabledItem != bMenuItemEnabled ) m_pVCLMenu->EnableItem( pMenuItemHandler->nItemId, bEnabledItem ); @@ -2104,7 +2104,7 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen PopupMenu* pCtlPopupMenu = (PopupMenu *)pVCLXPopupMenu->GetMenu(); pAddonMenu->SetPopupMenu( pMenuItemHandler->nItemId, pCtlPopupMenu ); pMenuItemHandler->xPopupMenu = Reference< com::sun::star::awt::XPopupMenu >( (OWeakObject *)pVCLXPopupMenu, UNO_QUERY ); - + } } m_aMenuItemHandlerVector.push_back( pMenuItemHandler ); diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 7dc52b4f5a..fa90f0c161 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -68,7 +68,7 @@ #include <osl/file.hxx> #include <svtools/menuoptions.hxx> #include <svtools/acceleratorexecute.hxx> -#include <svtools/moduleoptions.hxx> +#include <unotools/moduleoptions.hxx> #include <dispatch/uieventloghelper.hxx> //_________________________________________________________________________________________________________________ @@ -112,11 +112,11 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, sal_Bool bSetImage { sal_Bool bImageSet( sal_False ); ::rtl::OUString aImageId; - + AddInfoForId::const_iterator pInfo = m_aAddInfoForItem.find( nItemId ); if ( pInfo != m_aAddInfoForItem.end() ) aImageId = pInfo->second.aImageId; // Retrieve image id for menu item - + if ( aImageId.getLength() > 0 ) { aImage = GetImageFromURL( xFrame, aImageId, FALSE, bHiContrast ); @@ -132,7 +132,7 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, sal_Bool bSetImage String aCmd( pPopupMenu->GetItemCommand( nItemId ) ); if ( aCmd.Len() ) aImage = GetImageFromURL( xFrame, aCmd, FALSE, bHiContrast ); - + if ( !!aImage ) pPopupMenu->SetItemImage( nItemId, aImage ); } @@ -149,7 +149,7 @@ void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const USHORT nId( 0 ); sal_Bool bFound( sal_False ); rtl::OUString aCommand; - + if ( m_aEmptyDocURL.getLength() > 0 ) { // Search for the empty document URL @@ -169,7 +169,7 @@ void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const } } } - + if ( !bFound ) { // Search for the default module name @@ -265,25 +265,25 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) aCmds.push_back( pPopupMenu->GetItemCommand( nId )); } } - + sal_uInt32 nSeqCount( aIds.size() ); if ( m_bNewMenu ) nSeqCount+=1; Sequence< rtl::OUString > aSeq( nSeqCount ); - + // Add a special command for our "New" menu. if ( m_bNewMenu ) { aSeq[nSeqCount-1] = m_aCommandURL; aMenuShortCuts.push_back( aEmptyKeyCode ); } - + const sal_uInt32 nCount = aCmds.size(); for ( sal_uInt32 i = 0; i < nCount; i++ ) aSeq[i] = aCmds[i]; - + if ( m_xGlobalAcceleratorManager.is() ) retrieveShortcutsFromConfiguration( xGlobalAccelCfg, aSeq, aMenuShortCuts ); if ( m_xModuleAcceleratorManager.is() ) @@ -305,7 +305,7 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) } } -void NewMenuController::retrieveShortcutsFromConfiguration( +void NewMenuController::retrieveShortcutsFromConfiguration( const Reference< XAcceleratorConfiguration >& rAccelCfg, const Sequence< rtl::OUString >& rCommands, std::vector< KeyCode >& aMenuShortCuts ) @@ -359,7 +359,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup { MenuConfiguration aMenuCfg( m_xServiceManager ); BmkMenu* pSubMenu( 0 ); - + if ( m_bNewMenu ) pSubMenu = (BmkMenu*)aMenuCfg.CreateBookmarkMenu( m_xFrame, BOOKMARK_NEWMENU ); else @@ -370,13 +370,13 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup Image aImage; AddInfo aAddInfo; - + // retrieve additional parameters from bookmark menu and // store it in a hash_map. for ( USHORT i = 0; i < pSubMenu->GetItemCount(); i++ ) { USHORT nItemId = pSubMenu->GetItemId( sal::static_int_cast<USHORT>( i ) ); - if (( nItemId != 0 ) && + if (( nItemId != 0 ) && ( pSubMenu->GetItemType( nItemId ) != MENUITEM_SEPARATOR )) { MenuConfiguration::Attributes* pBmkAttributes = (MenuConfiguration::Attributes *)(pSubMenu->GetUserValue( nItemId )); @@ -384,15 +384,15 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& rPopup { aAddInfo.aTargetFrame = pBmkAttributes->aTargetFrame; aAddInfo.aImageId = pBmkAttributes->aImageId; - + m_aAddInfoForItem.insert( AddInfoForId::value_type( nItemId, aAddInfo )); } } } - + if ( m_bShowImages ) setMenuImages( pVCLPopupMenu, m_bShowImages, m_bHiContrast ); - + delete pSubMenu; } } @@ -489,8 +489,8 @@ void SAL_CALL NewMenuController::activate( const css::awt::MenuEvent& ) throw (R sal_Bool bHiContrast( rSettings.GetHighContrastMode() ); PopupMenu* pVCLPopupMenu = (PopupMenu *)pPopupMenu->GetMenu(); - - if (( m_bShowImages != bShowImages ) || + + if (( m_bShowImages != bShowImages ) || ( m_bHiContrast != bHiContrast )) { m_bShowImages = bShowImages; @@ -498,7 +498,7 @@ void SAL_CALL NewMenuController::activate( const css::awt::MenuEvent& ) throw (R setMenuImages( pVCLPopupMenu, m_bShowImages, m_bHiContrast ); } - + setAccelerators( pVCLPopupMenu ); } } @@ -507,7 +507,7 @@ void SAL_CALL NewMenuController::activate( const css::awt::MenuEvent& ) throw (R // XPopupMenuController void NewMenuController::impl_setPopupMenu() { - + if ( m_xPopupMenu.is() ) fillPopupMenu( m_xPopupMenu ); diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index accc576f31..16be5513e2 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -160,7 +160,9 @@ void ObjectMenuController::impl_select(const Reference< XDispatch >& _xDispatch, Sequence<PropertyValue> aArgs; if(::comphelper::UiEventsLogger::isEnabled()) //#i88653# UiEventLogHelper(::rtl::OUString::createFromAscii("ObjectMenuController")).log(m_xServiceManager, m_xFrame, aTargetURL, aArgs); - _xDispatch->dispatch( aTargetURL, aArgs ); + OSL_ENSURE(_xDispatch.is(),"ObjectMenuController::impl_select: No dispatch"); + if ( _xDispatch.is() ) + _xDispatch->dispatch( aTargetURL, aArgs ); } } diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 7ab450d59c..5bf8611801 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -62,7 +62,7 @@ #include <vcl/i18nhelp.hxx> #include <tools/urlobj.hxx> #include <rtl/ustrbuf.hxx> -#include <svtools/historyoptions.hxx> +#include <unotools/historyoptions.hxx> #include <cppuhelper/implbase1.hxx> #include <osl/file.hxx> //#include <tools/solar.hrc> @@ -135,7 +135,7 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > Reference< XStringWidth > xStringLength( new RecentFilesStringLength ); int nPickListMenuItems = ( aHistoryList.getLength() > 99 ) ? 99 : aHistoryList.getLength(); - + // New vnd.sun.star.popup: command URL to support direct dispatches const rtl::OUString aCmdPrefix( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.popup:RecentFileList?entry=" )); @@ -253,11 +253,11 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) xDispatchProvider = Reference< XDispatchProvider >( m_xFrame, UNO_QUERY ); xServiceManager = m_xServiceManager; aLock.unlock(); - + css::util::URL aTargetURL; Sequence< PropertyValue > aArgsList; - - if (( nIndex >= 0 ) && + + if (( nIndex >= 0 ) && ( nIndex < sal::static_int_cast<sal_Int32>( m_aRecentFilesItems.size() ))) { const RecentFile& rRecentFile = m_aRecentFilesItems[ nIndex ]; @@ -353,7 +353,7 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve VCLXPopupMenu* pPopupMenu = (VCLXPopupMenu *)VCLXPopupMenu::GetImplementation( xPopupMenu ); if ( pPopupMenu ) executeEntry( rEvent.MenuId-1 ); - } + } } void SAL_CALL RecentFilesMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) @@ -372,7 +372,7 @@ void RecentFilesMenuController::impl_setPopupMenu() void SAL_CALL RecentFilesMenuController::updatePopupMenu() throw (RuntimeException) { ResetableGuard aLock( m_aLock ); - + if ( m_bDisposed ) throw DisposedException(); @@ -392,17 +392,17 @@ void SAL_CALL RecentFilesMenuController::updatePopupMenu() throw (RuntimeExcepti } // XDispatchProvider -Reference< XDispatch > SAL_CALL RecentFilesMenuController::queryDispatch( - const URL& aURL, - const ::rtl::OUString& /*sTarget*/, - sal_Int32 /*nFlags*/ ) +Reference< XDispatch > SAL_CALL RecentFilesMenuController::queryDispatch( + const URL& aURL, + const ::rtl::OUString& /*sTarget*/, + sal_Int32 /*nFlags*/ ) throw( RuntimeException ) { ResetableGuard aLock( m_aLock ); - + if ( m_bDisposed ) throw DisposedException(); - + if ( aURL.Complete.indexOf( m_aBaseURL ) == 0 ) return Reference< XDispatch >( static_cast< OWeakObject* >( this ), UNO_QUERY ); else @@ -410,13 +410,13 @@ throw( RuntimeException ) } // XDispatch -void SAL_CALL RecentFilesMenuController::dispatch( - const URL& aURL, - const Sequence< PropertyValue >& /*seqProperties*/ ) +void SAL_CALL RecentFilesMenuController::dispatch( + const URL& aURL, + const Sequence< PropertyValue >& /*seqProperties*/ ) throw( RuntimeException ) { ResetableGuard aLock( m_aLock ); - + if ( m_bDisposed ) throw DisposedException(); @@ -433,7 +433,7 @@ throw( RuntimeException ) { sal_Int32 nAddArgs = aURL.Complete.indexOf( '&', nEntryPos ); rtl::OUString aEntryArg; - + if ( nAddArgs < 0 ) aEntryArg = aURL.Complete.copy( nEntryPos ); else @@ -446,22 +446,22 @@ throw( RuntimeException ) } } -void SAL_CALL RecentFilesMenuController::addStatusListener( - const Reference< XStatusListener >& xControl, - const URL& aURL ) +void SAL_CALL RecentFilesMenuController::addStatusListener( + const Reference< XStatusListener >& xControl, + const URL& aURL ) throw( RuntimeException ) { ResetableGuard aLock( m_aLock ); - + if ( m_bDisposed ) throw DisposedException(); - + PopupMenuControllerBase::addStatusListener( xControl, aURL ); } void SAL_CALL RecentFilesMenuController::removeStatusListener( - const Reference< XStatusListener >& xControl, - const URL& aURL ) + const Reference< XStatusListener >& xControl, + const URL& aURL ) throw( RuntimeException ) { PopupMenuControllerBase::removeStatusListener( xControl, aURL ); diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 6d5add117e..d9a35ede35 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -85,13 +85,13 @@ //_________________________________________________________________________________________________________________ #include <svtools/imgdef.hxx> #include <svtools/toolboxcontroller.hxx> -#include <svtools/cmdoptions.hxx> +#include <unotools/cmdoptions.hxx> #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ #include <toolkit/unohlp.hxx> #endif #include <comphelper/mediadescriptor.hxx> #include <svtools/miscopt.hxx> -#include <svtools/imageitm.hxx> +#include <svl/imageitm.hxx> #include <svtools/framestatuslistener.hxx> #include <vcl/svapp.hxx> #include <vcl/menu.hxx> @@ -99,7 +99,7 @@ #include <vcl/taskpanelist.hxx> #include <rtl/logfile.hxx> #include <svtools/menuoptions.hxx> -#include <svtools/cmdoptions.hxx> +#include <unotools/cmdoptions.hxx> #include <boost/bind.hpp> //_________________________________________________________________________________________________________________ @@ -341,9 +341,11 @@ void ToolBarManager::Destroy() delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId )); } + // Hide toolbar as lazy delete can destroy the toolbar much later. + m_pToolBar->Hide(); /* #i99167# removed change for i93173 since there is some weird crash */ // #i93173# delete toolbar lazily as we can still be in one of its handlers - m_pToolBar->doLazyDelete(); + m_pToolBar->doLazyDelete(); Link aEmpty; m_pToolBar->SetSelectHdl( aEmpty ); @@ -1388,7 +1390,7 @@ void ToolBarManager::RequestImages() // empty image. if ( !aImage ) aImage = QueryAddonsImage( aCmdURLSeq[i], bBigImages, m_bIsHiContrast ); - + pIter->second.nImageInfo = 1; // mark image as module based } else diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index f0359f3fba..86aad1a41c 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -1,7 +1,7 @@ /************************************************************************* * * 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 @@ -80,7 +80,7 @@ #endif #include <vcl/window.hxx> #include <svtools/menuoptions.hxx> -#include <svtools/cmdoptions.hxx> +#include <unotools/cmdoptions.hxx> #include <dispatch/uieventloghelper.hxx> #include <rtl/logfile.hxx> @@ -143,7 +143,7 @@ Reference< XLayoutManager > getLayoutManagerFromFrame( const Reference< XFrame > { Reference< XPropertySet > xPropSet( rFrame, UNO_QUERY ); Reference< XLayoutManager > xLayoutManager; - + try { xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager; @@ -183,7 +183,7 @@ ToolbarsMenuController::~ToolbarsMenuController() { } -void ToolbarsMenuController::addCommand( +void ToolbarsMenuController::addCommand( Reference< css::awt::XPopupMenu >& rPopupMenu, const rtl::OUString& rCommandURL, USHORT nHelpId, const rtl::OUString& rLabel ) { USHORT nItemId = m_xPopupMenu->getItemCount()+1; @@ -193,11 +193,11 @@ void ToolbarsMenuController::addCommand( aLabel = getUINameFromCommand( rCommandURL ); else aLabel = rLabel; - + rPopupMenu->insertItem( nItemId, aLabel, 0, nItemId ); Reference< awt::XMenuExtended > xMenuExtended( m_xPopupMenu, UNO_QUERY ); xMenuExtended->setCommand( nItemId, rCommandURL ); - + bool bInternal = ( rCommandURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STATIC_INTERNAL_CMD_PART ))) == 0); if ( !bInternal ) { @@ -206,10 +206,10 @@ void ToolbarsMenuController::addCommand( } vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - + Image aImage; const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - + if ( rSettings.GetUseImagesInMenus() ) aImage = GetImageFromURL( m_xFrame, rCommandURL, FALSE, rSettings.GetHighContrastMode() ); @@ -407,8 +407,8 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r Sequence< Sequence< com::sun::star::beans::PropertyValue > > aSeqToolBars = m_xModuleCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR ); fillHashMap( aSeqToolBars, aToolbarHashMap ); - } - + } + std::vector< ToolBarEntry > aSortedTbs; rtl::OUString aStaticCmdPart( RTL_CONSTASCII_USTRINGPARAM( STATIC_CMD_PART )); @@ -524,14 +524,14 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r sal_Bool bAddCommand( sal_True ); SvtCommandOptions aCmdOptions; rtl::OUString aConfigureToolbar( RTL_CONSTASCII_USTRINGPARAM( CONFIGURE_TOOLBARS )); - + if ( aCmdOptions.HasEntries( SvtCommandOptions::CMDOPTION_DISABLED )) { - if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, + if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CONFIGURE_TOOLBARS_CMD )))) bAddCommand = sal_False; } - + if ( bAddCommand ) { // Create command for configure @@ -777,7 +777,7 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent } else { - // closing means: + // closing means: // hide and destroy element xLayoutManager->hideElement( aToolBarResName ); xLayoutManager->destroyElement( aToolBarResName ); @@ -833,7 +833,7 @@ void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) thr void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::XPopupMenu >& xPopupMenu ) throw ( RuntimeException ) { ResetableGuard aLock( m_aLock ); - + if ( m_bDisposed ) throw DisposedException(); @@ -841,13 +841,13 @@ void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::X { // Create popup menu on demand vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); - + m_xPopupMenu = xPopupMenu; m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( (OWeakObject*)this, UNO_QUERY )); fillPopupMenu( m_xPopupMenu ); - } + } } - + // XInitialization void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) { @@ -856,14 +856,14 @@ void SAL_CALL ToolbarsMenuController::initialize( const Sequence< Any >& aArgume if ( !bInitalized ) { PopupMenuControllerBase::initialize(aArguments); - + if ( m_bInitialized ) { - Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( - SERVICENAME_MODULEMANAGER ), + Reference< XModuleManager > xModuleManager( m_xServiceManager->createInstance( + SERVICENAME_MODULEMANAGER ), UNO_QUERY ); - Reference< XNameAccess > xPersistentWindowStateSupplier( m_xServiceManager->createInstance( - SERVICENAME_WINDOWSTATECONFIGURATION ), + Reference< XNameAccess > xPersistentWindowStateSupplier( m_xServiceManager->createInstance( + SERVICENAME_WINDOWSTATECONFIGURATION ), UNO_QUERY ); // Retrieve persistent window state reference for our module @@ -916,7 +916,7 @@ IMPL_STATIC_LINK_NOINSTANCE( ToolbarsMenuController, ExecuteHdl_Impl, ExecuteInf catch ( Exception& ) { } - + delete pExecuteInfo; return 0; } diff --git a/framework/source/xml/menuconfiguration.cxx b/framework/source/xml/menuconfiguration.cxx index 7dbe62e38a..2c540fd4c3 100644 --- a/framework/source/xml/menuconfiguration.cxx +++ b/framework/source/xml/menuconfiguration.cxx @@ -44,10 +44,6 @@ #include <xml/saxnamespacefilter.hxx> #include <services.h> -#ifndef _FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ -#include <services/layoutmanager.hxx> -#endif - #ifndef _FRAMEWORK_UIELEMENT_ROOTITEMCONTAINER_HXX_ #include <uielement/rootitemcontainer.hxx> #endif |