CWS-TOOLING: integrate CWS alf01

2008-12-10 09:35:35 +0100 as  r265152 : #158798# hide internal service
2008-12-09 15:29:11 +0100 cd  r265098 : #158857# Check index correctly, must be zero
2008-12-09 12:06:21 +0100 mhu  r265075 : #158857# Fixed compiler warning(s).
2008-12-09 11:09:34 +0100 cd  r265064 : #158857# Added access to the window state configuration to support setting title of internal docking windows via <Module>WindowState.xcu files
2008-12-09 10:43:53 +0100 as  r265063 : #158798# make resizes working better
2008-12-08 17:08:05 +0100 mhu  r265010 : #158857# Fixed compiler warning(s).
2008-12-08 15:19:04 +0100 as  r264999 : #158857# make WindowContentFactories.xcs part of installation set
2008-12-08 13:23:37 +0100 as  r264993 : #158857# actualize size on child window
2008-12-08 10:14:05 +0100 cd  r264977 : #158857# More helper functions and support to show/hide internal docking windows
2008-12-08 10:13:08 +0100 cd  r264976 : #158857# SfxTitleDockingWindow now uses a factory for content window. Additional documentation for special IDs
2008-12-05 07:58:07 +0100 as  r264885 : remove obsolete code (not referenced inside makefile any longer)
2008-12-04 18:57:08 +0100 mhu  r264871 : #158857# Fixed compiler warning.
2008-12-04 16:13:12 +0100 mhu  r264851 : #158857# Fixed compiler warning.
2008-12-04 15:46:45 +0100 as  r264849 : solve merge conflicts right
2008-12-04 09:20:26 +0100 cd  r264818 : 2008-12-04 09:19:32 +0100 cd  r264817 : 2008-12-04 09:19:07 +0100 cd  r264816 : Resolved conflicts
2008-12-04 09:13:27 +0100 cd  r264815 : New window content factory manager with configuration support added.
2008-12-03 15:15:50 +0100 as  r264791 : #158798# make sure tab window will show its content the first time its made visible
2008-12-03 10:59:30 +0100 as  r264752 : #158798# new helper service for a dockable tab control window
2008-12-02 15:39:48 +0100 as  r264707 : #158798# fix crash in MouseButtonDown for TabControl
2008-12-02 10:28:20 +0100 cd  r264665 : #158857# Resolved conflicts on merge
2008-12-02 09:58:36 +0100 cd  r264662 : #158857# Added predefined slots for the internal docking windows. Currently only ten predefined docking windows are possible
2008-12-01 09:44:49 +0100 cd  r264586 : #158857# Fix problem with close the floated docking window with closer
2008-11-28 13:42:34 +0100 cd  r264550 : #158857# First additional code to create a docking window. Very preliminary and not near to final code
2008-11-28 11:53:51 +0100 cd  r264538 : #158857# First additional code to create a docking window. Very preliminary and not near to final code
2008-11-28 11:32:38 +0100 cd  r264534 : #158857# First version of docking window factory and additional helper classes
2008-11-21 09:46:36 +0100 jsc  r264110 : #158798# remove warnings
2008-11-20 17:59:07 +0100 pb  r264090 : fix: #158798# tabcontainerwindow.obj and tabdialog.obj added
2008-11-20 17:55:57 +0100 pb  r264089 : fix: #i158798# implementation of service TabContainerWindow
2008-11-20 17:52:52 +0100 pb  r264088 : fix: #158798# implementation of the TabDialog and its Pages for the TabContainerWindow service
2008-11-20 17:51:26 +0100 pb  r264087 : fix: #i158798# TabContainerWindow added
2008-11-20 17:50:11 +0100 pb  r264086 : fix: #158798# tabcontainerwindow.obj and tabdialog.obj added
2008-11-20 17:47:16 +0100 pb  r264085 : fix: #158798# new resource: TabDialog DLG_TABCONTAINER
2008-11-20 17:46:06 +0100 pb  r264084 : fix: #i158798# added ids for TABCONTAINER...
2008-11-20 17:43:19 +0100 pb  r264082 : fix: #158798# IMPLEMENTATION/SERVICENAME_TABCONTAINERWINDOW added
2008-11-20 17:43:00 +0100 pb  r264081 : fix: #i158798# implementation of service TabContainerWindow
2008-11-20 17:40:42 +0100 pb  r264080 : fix: #158798# TabContainerWindow.idl added
2008-11-20 17:36:57 +0100 pb  r264079 : fix: #158798# new service TabContainerWindow
2008-11-20 17:33:05 +0100 pb  r264077 : fix: #158798# show tooltip if only a image is shown
2008-11-18 15:10:08 +0100 jsc  r263770 : CWS-TOOLING: rebase CWS alf01 to trunk@263288 (milestone: DEV300:m35)
2008-11-18 09:55:21 +0100 jsc  r263749 : merge from trunk
2008-11-18 09:54:30 +0100 jsc  r263748 : merge from trunk
2008-11-13 17:01:17 +0100 pl  r263655 : fix some warnings
2008-10-21 15:38:37 +0200 pl  r262572 : #i95201# add: EnablePage
2008-10-20 18:57:53 +0200 pl  r262335 : #i95201# add: images for tab items
2008-10-20 17:26:50 +0200 pl  r262330 : #i95201# remove old tools list
This commit is contained in:
Rüdiger Timm
2008-12-16 16:42:03 +00:00
parent 4ee46e177a
commit b1da5a57d9
38 changed files with 3246 additions and 1300 deletions

View File

@@ -0,0 +1,140 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: backingwindow.hxx,v $
* $Revision: 1.10 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef FRAMEWORK_TABWINDOW_HXX
#define FRAMEWORK_TABWINDOW_HXX
#include <general.h>
#include <vector>
#include <com/sun/star/uno/Reference.h>
#include <vcl/tabctrl.hxx>
#include <vcl/tabdlg.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/button.hxx>
namespace com { namespace sun { namespace star {
namespace awt {
class XWindow;
class XContainerWindowProvider;
class XContainerWindowEventHandler; }
namespace beans {
struct NamedValue; }
} } }
namespace framework
{
class FwkTabControl : public TabControl
{
public:
FwkTabControl( Window* pParent, const ResId& rResId );
void BroadcastEvent( ULONG nEvent );
};
class FwkTabPage : public TabPage
{
private:
rtl::OUString m_sPageURL;
rtl::OUString m_sEventHdl;
css::uno::Reference< css::awt::XWindow > m_xPage;
css::uno::Reference< css::awt::XContainerWindowEventHandler > m_xEventHdl;
css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
void CreateDialog();
sal_Bool CallMethod( const rtl::OUString& rMethod );
public:
FwkTabPage(
Window* pParent,
const rtl::OUString& rPageURL,
const rtl::OUString& rEventHdl,
const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider );
virtual ~FwkTabPage();
virtual void ActivatePage();
virtual void DeactivatePage();
virtual void Resize();
void Reset();
void Save();
};
struct TabEntry
{
sal_Int32 m_nIndex;
FwkTabPage* m_pPage;
::rtl::OUString m_sPageURL;
::rtl::OUString m_sEventHdl;
TabEntry() :
m_nIndex( -1 ), m_pPage( NULL ) {}
TabEntry( sal_Int32 nIndex, ::rtl::OUString sURL, ::rtl::OUString sEvent ) :
m_nIndex( nIndex ), m_pPage( NULL ), m_sPageURL( sURL ), m_sEventHdl( sEvent ) {}
~TabEntry() { delete m_pPage; }
};
typedef std::vector< TabEntry* > TabEntryList;
class FwkTabWindow : public Window
{
private:
FwkTabControl m_aTabCtrl;
TabEntryList m_TabList;
css::uno::Reference< css::awt::XContainerWindowProvider > m_xWinProvider;
void ClearEntryList();
TabEntry* FindEntry( sal_Int32 nIndex ) const;
DECL_DLLPRIVATE_LINK( ActivatePageHdl, TabControl * );
DECL_DLLPRIVATE_LINK( DeactivatePageHdl, TabControl * );
DECL_DLLPRIVATE_LINK( CloseHdl, PushButton * );
public:
FwkTabWindow( Window* pParent );
~FwkTabWindow();
void AddEventListener( const Link& rEventListener );
FwkTabPage* AddTabPage( sal_Int32 nIndex, const css::uno::Sequence< css::beans::NamedValue >& rProperties );
void ActivatePage( sal_Int32 nIndex );
void RemovePage( sal_Int32 nIndex );
sal_Int32 GetActivePageId() const;
virtual void Resize();
};
} // namespace framework
#endif

View File

@@ -41,6 +41,8 @@
typedef svt::ToolboxController* ( *pfunc_setToolBoxControllerCreator)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL );
typedef svt::StatusbarController* ( *pfunc_setStatusBarControllerCreator)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL );
typedef void ( *pfunc_getRefreshToolbars)( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
typedef void ( *pfunc_createDockingWindow)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL );
typedef bool ( *pfunc_isDockingWindowVisible)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL );
namespace framework
{
@@ -57,6 +59,13 @@ pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars p
void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow );
void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL );
pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible );
bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL );
}
#endif // __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_

View File

@@ -80,5 +80,9 @@
#define BMP_BACKING_BACKGROUND_RTL_LEFT 4
#define BMP_BACKING_BACKGROUND_RTL_RIGHT 5
// Ids of TabWindow
#define WIN_TABWINDOW (RID_FWK_DIALOG_START+101)
#define TC_TABCONTROL 1
#endif

View File

@@ -255,7 +255,7 @@ namespace framework{
#define OFFICEFACTORY_PROPNAME_ICON ::rtl::OUString::createFromAscii( OFFICEFACTORY_PROPNAME_ASCII_ICON )
//_______________________________________________
/** properties for tab window */
/** properties for tab window (old) */
#define TABWINDOW_PROPNAME_ASCII_PARENTWINDOW "ParentWindow"
#define TABWINDOW_PROPNAME_ASCII_TOPWINDOW "TopWindow"
#define TABWINDOW_PROPNAME_PARENTWINDOW ::rtl::OUString::createFromAscii( TABWINDOW_PROPNAME_ASCII_PARENTWINDOW )
@@ -265,6 +265,14 @@ namespace framework{
#define TABWINDOW_PROPHANDLE_TOPWINDOW 1
#define TABWINDOW_PROPCOUNT 2
//_______________________________________________
/** properties for tab window service (new) */
#define TABWINDOWSERVICE_PROPNAME_ASCII_WINDOW "Window"
#define TABWINDOWSERVICE_PROPNAME_WINDOW ::rtl::OUString::createFromAscii( TABWINDOWSERVICE_PROPNAME_ASCII_WINDOW )
#define TABWINDOWSERVICE_PROPHANDLE_WINDOW 0
#define TABWINDOWSERVICE_PROPCOUNT 1
//_______________________________________________
/** properties of tabreg service */
static const char* TABREG_PROPNAME_ASCII_TITLE = "title";

View File

@@ -125,6 +125,8 @@ namespace framework{
#define SERVICENAME_TABWINDOW DECLARE_ASCII("com.sun.star.frame.TabWindow" )
#define SERVICENAME_STRINGABBREVIATION DECLARE_ASCII("com.sun.star.util.UriAbbreviation" )
#define SERVICENAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.ui.ImageManager" )
#define SERVICENAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow" )
#define SERVICENAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager" )
//_________________________________________________________________________________________________________________
// used implementationnames by framework
@@ -209,7 +211,10 @@ namespace framework{
#define IMPLEMENTATIONNAME_LANGSELECTIONSTATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.LangSelectionStatusbarController" )
#define IMPLEMENTATIONNAME_LANGUAGESELECTIONMENUCONTROLLER DECLARE_ASCII("com.sum.star.comp.framework.LanguageSelectionMenuController" )
#define IMPLEMENTATIONNAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ImageManager" )
#define IMPLEMENTATIONNAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.comp.framework.TabWindowService" )
#define IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.comp.framework.WindowContentFactoryManager" )
} // namespace framework
#endif // #ifndef __FRAMEWORK_SERVICES_H_

View File

@@ -0,0 +1,234 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: urltransformer.hxx,v $
* $Revision: 1.8 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
#define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_
/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
with solaris headers ...
*/
#include <vector>
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <classes/fwktabwindow.hxx>
#include <classes/propertysethelper.hxx>
#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/debug.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <general.h>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/awt/XSimpleTabController.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#include <cppuhelper/weak.hxx>
#include <vcl/window.hxx>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// exported definitions
//_________________________________________________________________________________________________________________
struct TTabPageInfo
{
public:
TTabPageInfo()
: m_nIndex ( -1 )
, m_bCreated (sal_False)
, m_pPage ( NULL )
, m_lProperties ( )
{}
TTabPageInfo(::sal_Int32 nID)
: m_nIndex ( nID )
, m_bCreated (sal_False)
, m_pPage ( NULL )
, m_lProperties ( )
{}
public:
::sal_Int32 m_nIndex;
::sal_Bool m_bCreated;
FwkTabPage* m_pPage;
css::uno::Sequence< css::beans::NamedValue > m_lProperties;
};
typedef ::std::hash_map< ::sal_Int32 ,
TTabPageInfo ,
Int32HashCode ,
::std::equal_to< ::sal_Int32 > > TTabPageInfoHash;
/*-************************************************************************************************************//**
@short implements a helper service providing a dockable tab control window
*//*-*************************************************************************************************************/
class TabWindowService : public css::lang::XTypeProvider
, public css::lang::XServiceInfo
, public css::awt::XSimpleTabController
, public ThreadHelpBase
, public TransactionBase
, public PropertySetHelper
, public ::cppu::OWeakObject
{
//-------------------------------------------------------------------------------------------------------------
// public methods
//-------------------------------------------------------------------------------------------------------------
public:
//---------------------------------------------------------------------------------------------------------
// constructor / destructor
//---------------------------------------------------------------------------------------------------------
TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
virtual ~TabWindowService();
//---------------------------------------------------------------------------------------------------------
// XInterface, XTypeProvider, XServiceInfo
//---------------------------------------------------------------------------------------------------------
FWK_DECLARE_XINTERFACE
FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
//---------------------------------------------------------------------------------------------------------
// XSimpleTabController
//---------------------------------------------------------------------------------------------------------
virtual sal_Int32 SAL_CALL insertTab() throw ( css::uno::RuntimeException );
virtual void SAL_CALL removeTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
virtual void SAL_CALL setTabProps( sal_Int32 nID, const css::uno::Sequence< css::beans::NamedValue >& aProperties ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
virtual void SAL_CALL activateTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException );
virtual sal_Int32 SAL_CALL getActiveTabID() throw ( css::uno::RuntimeException );
virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException );
virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException );
//---------------------------------------------------------------------------------------------------------
// XComponent
//---------------------------------------------------------------------------------------------------------
virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException );
virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException );
virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException );
//-------------------------------------------------------------------------------------------------------------
// protected methods
//-------------------------------------------------------------------------------------------------------------
protected:
//-------------------------------------------------------------------------------------------------------------
// private methods
//-------------------------------------------------------------------------------------------------------------
private:
void impl_initializePropInfo();
virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty,
sal_Int32 nHandle ,
const css::uno::Any& aValue );
virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty,
sal_Int32 nHandle );
DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * );
void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
FwkTabWindow* mem_TabWin ();
/*
::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor();
static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL
createPropertySetInfo( ::cppu::IPropertyArrayHelper& rProperties ) SAL_THROW( () );
*/
//-------------------------------------------------------------------------------------------------------------
// variables
// (should be private everyway!)
//-------------------------------------------------------------------------------------------------------------
private:
/// reference to factory, which has created this instance
css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
/// the tab window as XWindow ( to hold window* alive !)
css::uno::Reference< css::awt::XWindow > m_xTabWin;
/// the VCL tab window
FwkTabWindow* m_pTabWin;
/// container of inserted tab pages
TTabPageInfoHash m_lTabPageInfos;
/// container of the added TabListener
::cppu::OMultiTypeInterfaceContainerHelper m_lListener;
/// counter of the tabpage indexes
::sal_Int32 m_nPageIndexCounter;
/// index of the current active page
::sal_Int32 m_nCurrentPageIndex;
/// title of the tabcontrolled window
::rtl::OUString m_sTitle;
}; // class TabWindowService
} // namespace framework
#endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_

View File

@@ -78,12 +78,20 @@ struct OUStringHashCode
struct ShortHashCode
{
size_t operator()( const sal_Int16& nShort ) const
size_t operator()( const ::sal_Int16& nShort ) const
{
return (size_t)nShort;
}
};
struct Int32HashCode
{
size_t operator()( const ::sal_Int32& nValue ) const
{
return (size_t)nValue;
}
};
struct KeyEventHashCode
{
size_t operator()( const css::awt::KeyEvent& aEvent ) const

View File

@@ -0,0 +1,98 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: uielementfactorymanager.hxx,v $
* $Revision: 1.7 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef __FRAMEWORK_UIFACTORY_WINDOWCONTENTFACTORYMANAGER_HXX_
#define __FRAMEWORK_UIFACTORY_WINDOWCONTENTFACTORYMANAGER_HXX_
/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
with solaris headers ...
*/
#include <vector>
#include <list>
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/threadhelpbase.hxx>
#include <macros/generic.hxx>
#include <macros/xinterface.hxx>
#include <macros/xtypeprovider.hxx>
#include <macros/xserviceinfo.hxx>
#include <stdtypes.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include "com/sun/star/frame/XModuleManager.hpp"
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
#include <cppuhelper/weak.hxx>
#include <rtl/ustring.hxx>
namespace framework
{
class ConfigurationAccess_WindowContentFactoryManager;
class WindowContentFactoryManager : public com::sun::star::lang::XTypeProvider ,
public com::sun::star::lang::XServiceInfo ,
public com::sun::star::lang::XSingleComponentFactory ,
private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses.
public ::cppu::OWeakObject
{
public:
WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
virtual ~WindowContentFactoryManager();
// XInterface, XTypeProvider, XServiceInfo
FWK_DECLARE_XINTERFACE
FWK_DECLARE_XTYPEPROVIDER
DECLARE_XSERVICEINFO
// XSingleComponentFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
private:
void RetrieveTypeNameFromResourceURL( const ::rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName );
sal_Bool m_bConfigRead;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager;
ConfigurationAccess_WindowContentFactoryManager* m_pConfigAccess;
};
} // namespace framework
#endif // __FRAMEWORK_UIFACTORY_WINDOWCONTENTFACTORYMANAGER_HXX_

View File

@@ -0,0 +1,392 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: backingwindow.cxx,v $
* $Revision: 1.12 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// autogen include statement, do not remove
#include "precompiled_framework.hxx"
#include <classes/fwktabwindow.hxx>
#include "framework.hrc"
#include <classes/fwkresid.hxx>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/XContainerWindowEventHandler.hpp>
#include <com/sun/star/awt/XContainerWindowProvider.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/XWindowPeer.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/stream.hxx>
#include <vcl/bitmap.hxx>
#include <vcl/image.hxx>
#include <vcl/msgbox.hxx>
const ::rtl::OUString SERVICENAME_WINPROVIDER
= ::rtl::OUString::createFromAscii("com.sun.star.awt.ContainerWindowProvider");
const ::rtl::OUString EXTERNAL_EVENT = ::rtl::OUString::createFromAscii("external_event");
const ::rtl::OUString BACK_METHOD = ::rtl::OUString::createFromAscii("back");
const ::rtl::OUString INITIALIZE_METHOD = ::rtl::OUString::createFromAscii("initialize");
const ::rtl::OUString OK_METHOD = ::rtl::OUString::createFromAscii("ok");
using namespace ::com::sun::star;
namespace framework
{
// class FwkTabControl ---------------------------------------------------
FwkTabControl::FwkTabControl( Window* pParent, const ResId& rResId ) :
TabControl( pParent, rResId )
{
}
// -----------------------------------------------------------------------
void FwkTabControl::BroadcastEvent( ULONG nEvent )
{
if ( VCLEVENT_TABPAGE_ACTIVATE == nEvent || VCLEVENT_TABPAGE_DEACTIVATE == nEvent )
ImplCallEventListeners( nEvent, (void*)(ULONG)GetCurPageId() );
else
{
DBG_ERRORFILE( "FwkTabControl::BroadcastEvent(): illegal event" );
}
}
// class FwkTabPage ------------------------------------------------
FwkTabPage::FwkTabPage(
Window* pParent, const rtl::OUString& rPageURL, const rtl::OUString& rEventHdl,
const css::uno::Reference< css::awt::XContainerWindowProvider >& rProvider ) :
TabPage( pParent, WB_DIALOGCONTROL ),
m_sPageURL ( rPageURL ),
m_sEventHdl ( rEventHdl ),
m_xWinProvider ( rProvider )
{
}
// -----------------------------------------------------------------------
FwkTabPage::~FwkTabPage()
{
Hide();
DeactivatePage();
}
// -----------------------------------------------------------------------
void FwkTabPage::CreateDialog()
{
try
{
uno::Reference< uno::XInterface > xHandler;
if ( m_sEventHdl.getLength() > 0 )
{
uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
m_xEventHdl = uno::Reference< awt::XContainerWindowEventHandler >(
xFactory->createInstance( m_sEventHdl ), uno::UNO_QUERY );
xHandler = m_xEventHdl;
}
uno::Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), uno::UNO_QUERY );
m_xPage = uno::Reference < awt::XWindow >(
m_xWinProvider->createContainerWindow(
m_sPageURL, rtl::OUString(), xParent, xHandler ), uno::UNO_QUERY );
CallMethod( INITIALIZE_METHOD );
}
catch ( lang::IllegalArgumentException& )
{
DBG_ERRORFILE( "FwkTabPage::CreateDialog(): illegal argument" );
}
catch ( uno::Exception& )
{
DBG_ERRORFILE( "FwkTabPage::CreateDialog(): exception of XDialogProvider2::createContainerWindow()" );
}
}
// -----------------------------------------------------------------------
sal_Bool FwkTabPage::CallMethod( const rtl::OUString& rMethod )
{
sal_Bool bRet = sal_False;
if ( m_xEventHdl.is() )
{
try
{
bRet = m_xEventHdl->callHandlerMethod( m_xPage, uno::makeAny( rMethod ), EXTERNAL_EVENT );
}
catch ( uno::Exception& )
{
DBG_ERRORFILE( "FwkTabPage::CallMethod(): exception of XDialogEventHandler::callHandlerMethod()" );
}
}
return bRet;
}
// -----------------------------------------------------------------------
void FwkTabPage::ActivatePage()
{
TabPage::ActivatePage();
if ( !m_xPage.is() )
CreateDialog();
if ( m_xPage.is() )
{
Resize ();
m_xPage->setVisible( sal_True );
}
}
// -----------------------------------------------------------------------
void FwkTabPage::DeactivatePage()
{
TabPage::DeactivatePage();
if ( m_xPage.is() )
m_xPage->setVisible( sal_False );
}
// -----------------------------------------------------------------------
void FwkTabPage::Resize()
{
if ( m_xPage.is () )
{
Size aSize = GetSizePixel ();
Point aPos = GetPosPixel ();
m_xPage->setPosSize( 0, 0, aSize.Width()-1 , aSize.Height()-1, awt::PosSize::POSSIZE );
}
}
// -----------------------------------------------------------------------
void FwkTabPage::Reset()
{
CallMethod( BACK_METHOD );
ActivatePage();
}
// -----------------------------------------------------------------------
void FwkTabPage::Save()
{
CallMethod( OK_METHOD );
}
// class FwkTabWindow ---------------------------------------------
FwkTabWindow::FwkTabWindow( Window* pParent ) :
Window( pParent, FwkResId( WIN_TABWINDOW ) ),
m_aTabCtrl ( this, FwkResId( TC_TABCONTROL ) )
{
uno::Reference < lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
m_xWinProvider = uno::Reference < awt::XContainerWindowProvider >(
xFactory->createInstance( SERVICENAME_WINPROVIDER ), uno::UNO_QUERY );
SetPaintTransparent(true);
m_aTabCtrl.SetActivatePageHdl( LINK( this, FwkTabWindow, ActivatePageHdl ) );
m_aTabCtrl.SetDeactivatePageHdl( LINK( this, FwkTabWindow, DeactivatePageHdl ) );
m_aTabCtrl.Show();
}
// -----------------------------------------------------------------------
FwkTabWindow::~FwkTabWindow()
{
ClearEntryList();
}
// -----------------------------------------------------------------------
void FwkTabWindow::ClearEntryList()
{
TabEntryList::const_iterator pIt;
for ( pIt = m_TabList.begin();
pIt != m_TabList.end();
++pIt )
{
delete *pIt;
}
m_TabList.clear();
}
// -----------------------------------------------------------------------
TabEntry* FwkTabWindow::FindEntry( sal_Int32 nIndex ) const
{
TabEntry* pEntry = NULL;
TabEntryList::const_iterator pIt;
for ( pIt = m_TabList.begin();
pIt != m_TabList.end();
++pIt )
{
if ( (*pIt)->m_nIndex == nIndex )
{
pEntry = *pIt;
break;
}
}
return pEntry;
}
// -----------------------------------------------------------------------
IMPL_LINK( FwkTabWindow, ActivatePageHdl, TabControl *, EMPTYARG )
{
const USHORT nId = m_aTabCtrl.GetCurPageId();
FwkTabPage* pTabPage = static_cast< FwkTabPage* >( m_aTabCtrl.GetTabPage( nId ) );
if ( !pTabPage )
{
TabEntry* pEntry = FindEntry( nId );
if ( pEntry )
{
pTabPage = new FwkTabPage( &m_aTabCtrl, pEntry->m_sPageURL, pEntry->m_sEventHdl, m_xWinProvider );
pTabPage->Show();
pTabPage->ActivatePage();
m_aTabCtrl.SetTabPage( nId, pTabPage );
}
}
m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_ACTIVATE );
return 1;
}
// -----------------------------------------------------------------------
IMPL_LINK( FwkTabWindow, DeactivatePageHdl, TabControl *, EMPTYARG )
{
m_aTabCtrl.BroadcastEvent( VCLEVENT_TABPAGE_DEACTIVATE );
return 1;
}
// -----------------------------------------------------------------------
IMPL_LINK( FwkTabWindow, CloseHdl, PushButton *, EMPTYARG )
{
// Close();
return 0;
}
// -----------------------------------------------------------------------
void FwkTabWindow::AddEventListener( const Link& rEventListener )
{
m_aTabCtrl.AddEventListener( rEventListener );
}
// -----------------------------------------------------------------------
FwkTabPage* FwkTabWindow::AddTabPage( sal_Int32 nIndex, const uno::Sequence< beans::NamedValue >& rProperties )
{
::rtl::OUString sTitle, sToolTip, sPageURL, sEventHdl;
uno::Reference< graphic::XGraphic > xImage;
bool bDisabled = false;
sal_Int32 i = 0, nLen = rProperties.getLength();
for ( i = 0; i < nLen; ++i )
{
beans::NamedValue aValue = rProperties[i];
::rtl::OUString sName = aValue.Name;
uno::Any aAny = aValue.Value;
if ( sName.equalsAscii("Title") )
aAny >>= sTitle;
else if ( sName.equalsAscii("ToolTip") )
aAny >>= sToolTip;
else if ( sName.equalsAscii("PageURL") )
aAny >>= sPageURL;
else if ( sName.equalsAscii("EventHdl") )
aAny >>= sEventHdl;
else if ( sName.equalsAscii("Image") )
aAny >>= xImage;
else if ( sName.equalsAscii("Disabled") )
aAny >>= bDisabled;
}
TabEntry* pEntry = new TabEntry( nIndex, sPageURL, sEventHdl );
m_TabList.push_back( pEntry );
USHORT nIdx = static_cast< USHORT >( nIndex );
m_aTabCtrl.InsertPage( nIdx, sTitle );
if ( sToolTip.getLength() > 0 )
m_aTabCtrl.SetHelpText( nIdx, sToolTip );
if ( xImage.is() )
m_aTabCtrl.SetPageImage( nIdx, Image( xImage ) );
if ( bDisabled )
m_aTabCtrl.EnablePage( nIdx, false );
return pEntry->m_pPage;
}
// -----------------------------------------------------------------------
void FwkTabWindow::ActivatePage( sal_Int32 nIndex )
{
m_aTabCtrl.SetCurPageId( static_cast< USHORT >( nIndex ) );
ActivatePageHdl( &m_aTabCtrl );
}
// -----------------------------------------------------------------------
void FwkTabWindow::RemovePage( sal_Int32 nIndex )
{
m_aTabCtrl.RemovePage( static_cast< USHORT >( nIndex ) );
}
// -----------------------------------------------------------------------
sal_Int32 FwkTabWindow::GetActivePageId() const
{
return m_aTabCtrl.GetCurPageId();
}
// -----------------------------------------------------------------------
void FwkTabWindow::Resize()
{
Size aPageSize = GetSizePixel();
m_aTabCtrl.SetTabPageSizePixel( aPageSize );
}
} // namespace framework

View File

@@ -59,7 +59,8 @@ SLOFILES= \
$(SLO)$/fwkresid.obj \
$(SLO)$/framelistanalyzer.obj \
$(SLO)$/sfxhelperfunctions.obj \
$(SLO)$/menuextensionsupplier.obj
$(SLO)$/menuextensionsupplier.obj \
$(SLO)$/fwktabwindow.obj
SRS1NAME=$(TARGET)
SRC1FILES =\

View File

@@ -38,6 +38,9 @@
static pfunc_setToolBoxControllerCreator pToolBoxControllerCreator = NULL;
static pfunc_setStatusBarControllerCreator pStatusBarControllerCreator = NULL;
static pfunc_getRefreshToolbars pRefreshToolbars = NULL;
static pfunc_createDockingWindow pCreateDockingWindow = NULL;
static pfunc_isDockingWindowVisible pIsDockingWindowVisible = NULL;
using namespace ::com::sun::star::uno;
@@ -48,6 +51,7 @@ namespace framework
pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pfunc_setToolBoxControllerCreator pOldSetToolBoxControllerCreator = pToolBoxControllerCreator;
pToolBoxControllerCreator = pSetToolBoxControllerCreator;
return pOldSetToolBoxControllerCreator;
@@ -55,14 +59,21 @@ pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_se
svt::ToolboxController* SAL_CALL CreateToolBoxController( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL )
{
if ( pToolBoxControllerCreator )
return (*pToolBoxControllerCreator)( rFrame, pToolbox, nID, aCommandURL );
pfunc_setToolBoxControllerCreator pFactory = NULL;
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pFactory = pToolBoxControllerCreator;
}
if ( pFactory )
return (*pFactory)( rFrame, pToolbox, nID, aCommandURL );
else
return NULL;
}
pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pfunc_setStatusBarControllerCreator pOldSetStatusBarControllerCreator = pSetStatusBarControllerCreator;
pStatusBarControllerCreator = pSetStatusBarControllerCreator;
return pOldSetStatusBarControllerCreator;
@@ -70,14 +81,21 @@ pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfun
svt::StatusbarController* SAL_CALL CreateStatusBarController( const Reference< XFrame >& rFrame, StatusBar* pStatusBar, unsigned short nID, const ::rtl::OUString& aCommandURL )
{
if ( pStatusBarControllerCreator )
return (*pStatusBarControllerCreator)( rFrame, pStatusBar, nID, aCommandURL );
pfunc_setStatusBarControllerCreator pFactory = NULL;
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pFactory = pStatusBarControllerCreator;
}
if ( pFactory )
return (*pFactory)( rFrame, pStatusBar, nID, aCommandURL );
else
return NULL;
}
pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pNewRefreshToolbarsFunc )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pfunc_getRefreshToolbars pOldFunc = pRefreshToolbars;
pRefreshToolbars = pNewRefreshToolbarsFunc;
@@ -86,8 +104,58 @@ pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars p
void SAL_CALL RefreshToolbars( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame )
{
if ( pRefreshToolbars )
(*pRefreshToolbars)( rFrame );
pfunc_getRefreshToolbars pCallback = NULL;
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pCallback = pRefreshToolbars;
}
if ( pCallback )
(*pCallback)( rFrame );
}
pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pNewCreateDockingWindow )
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pfunc_createDockingWindow pOldFunc = pCreateDockingWindow;
pCreateDockingWindow = pNewCreateDockingWindow;
return pOldFunc;
}
void SAL_CALL CreateDockingWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL )
{
pfunc_createDockingWindow pFactory = NULL;
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pFactory = pCreateDockingWindow;
}
if ( pFactory )
(*pFactory)( rFrame, rResourceURL );
}
pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pNewIsDockingWindowVisible)
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pfunc_isDockingWindowVisible pOldFunc = pIsDockingWindowVisible;
pIsDockingWindowVisible = pNewIsDockingWindowVisible;
return pOldFunc;
}
bool SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rResourceURL )
{
pfunc_isDockingWindowVisible pCall = NULL;
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
pCall = pIsDockingWindowVisible;
}
if ( pIsDockingWindowVisible )
return (*pIsDockingWindowVisible)( rFrame, rResourceURL );
else
return false;
}
}

View File

@@ -126,6 +126,10 @@ using namespace ::com::sun::star::frame;
#define UIRESOURCE_URL_ASCII "private:resource"
#define UIRESOURCE_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCE_URL_ASCII ))
// ATTENTION!
// This value is directly copied from the sfx2 project.
// You have to change BOTH values, see sfx2/inc/sfx2/sfxsids.hrc (SID_DOCKWIN_START)
static const sal_Int32 DOCKWIN_ID_BASE = 9800;
// convert alignment constant to vcl's WindowAlign type
static WindowAlign ImplConvertAlignment( sal_Int16 aAlignment )
@@ -299,6 +303,43 @@ static sal_Bool implts_isFrameOrWindowTop( const css::uno::Reference< css::frame
return sal_False;
}
static void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMGR, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible )
{
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;
css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY);
if ( nIndex >= 0 && xProvider.is() )
{
::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 );
css::uno::Reference< css::frame::XDispatchHelper > xDispatcher( xDispatchHelper );
if ( !xDispatcher.is())
{
xDispatcher = css::uno::Reference< css::frame::XDispatchHelper >(
rSMGR->createInstance(SERVICENAME_DISPATCHHELPER), css::uno::UNO_QUERY_THROW);
}
aDockWinCommand = aDockWinCommand + aDockWinArgName;
xDispatcher->executeDispatch(
xProvider,
aDockWinCommand,
::rtl::OUString::createFromAscii("_self"),
0,
aArgs);
}
}
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
@@ -4249,6 +4290,13 @@ throw (RuntimeException)
implts_createProgressBar();
bNotify = sal_True;
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" ))
{
aWriteLock.unlock();
// The docking window is created by a factory method located in the sfx2 library.
CreateDockingWindow( xFrame, aElementName );
}
}
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -4305,7 +4353,7 @@ throw (RuntimeException)
bMustLayouted = sal_True;
bNotify = sal_True;
}
else
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ))
{
UIElementVector::iterator pIter;
@@ -4364,6 +4412,16 @@ throw (RuntimeException)
}
}
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" ))
{
css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame );
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR );
aWriteLock.unlock();
impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false );
bMustLayouted = sal_False;
bNotify = sal_False;
}
}
aWriteLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
@@ -4445,7 +4503,7 @@ throw (::com::sun::star::uno::RuntimeException)
bResult = sal_True;
bNotify = sal_True;
}
else
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ))
{
if ( m_bVisible )
{
@@ -4526,6 +4584,13 @@ throw (::com::sun::star::uno::RuntimeException)
}
}
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" ))
{
css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame );
aWriteLock.unlock();
CreateDockingWindow( xFrame, aElementName );
}
}
if ( bNotify )
@@ -4636,7 +4701,7 @@ throw (RuntimeException)
{
bNotify = bResult = implts_showProgressBar();
}
else
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ))
{
UIElementVector::iterator pIter;
@@ -4677,6 +4742,15 @@ throw (RuntimeException)
}
}
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" ))
{
ReadGuard aReadGuard( m_aLock );
css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame );
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR );
aReadGuard.unlock();
impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, true );
}
}
if ( bNotify )
@@ -4752,7 +4826,7 @@ throw (RuntimeException)
{
bResult = bNotify = implts_hideProgressBar();
}
else
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ))
{
UIElementVector::iterator pIter;
@@ -4781,6 +4855,15 @@ throw (RuntimeException)
}
}
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" ))
{
ReadGuard aReadGuard( m_aLock );
css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame );
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR );
aReadGuard.unlock();
impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false );
}
}
if ( bNotify )
@@ -5225,7 +5308,7 @@ throw (RuntimeException)
if ( m_aProgressBarElement.m_xUIElement.is() )
return m_aProgressBarElement.m_bVisible;
}
else
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ))
{
UIElementVector::const_iterator pIter;
@@ -5246,6 +5329,14 @@ throw (RuntimeException)
}
}
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" ))
{
ReadGuard aReadGuard( m_aLock );
css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame );
aReadGuard.unlock();
return IsDockingWindowVisible( xFrame, aElementName );
}
}
return sal_False;

View File

@@ -61,13 +61,10 @@
=================================================================================================================*/
#include <services/urltransformer.hxx>
#include <services/desktop.hxx>
#include <services/tabwindowservice.hxx>
#include <services/frame.hxx>
#include <services/modulemanager.hxx>
#include <dispatch/oxt_handler.hxx>
#include <jobs/jobexecutor.hxx>
#include <recording/dispatchrecordersupplier.hxx>
#include <recording/dispatchrecorder.hxx>
@@ -87,10 +84,7 @@
#include <uielement/footermenucontroller.hxx>
#include <uielement/controlmenucontroller.hxx>
#include <uielement/macrosmenucontroller.hxx>
#ifndef __FRAMEWORK_UIELEMENT_UICOMMANDDESCRIPTION_HXX_
#include <uielement/uicommanddescription.hxx>
#endif
#include <uiconfiguration/uiconfigurationmanager.hxx>
#include <uiconfiguration/moduleuicfgsupplier.hxx>
#include <uiconfiguration/moduleuiconfigurationmanager.hxx>
@@ -109,10 +103,7 @@
#include <helper/statusindicatorfactory.hxx>
#include <uielement/recentfilesmenucontroller.hxx>
#include <uifactory/statusbarfactory.hxx>
#ifndef __FRAMEWORK_UIELEMENT_UICATEGORYDESCRPTION_HXX_
#include <uiconfiguration/uicategorydescription.hxx>
#endif
#include <services/sessionlistener.hxx>
#include <uielement/logoimagestatusbarcontroller.hxx>
#include <uielement/logotextstatusbarcontroller.hxx>
@@ -120,13 +111,11 @@
#include <services/taskcreatorsrv.hxx>
#include <uielement/simpletextstatusbarcontroller.hxx>
#include <services/uriabbreviation.hxx>
#include <dispatch/popupmenudispatcher.hxx>
#include <uielement/langselectionstatusbarcontroller.hxx>
#include <uielement/langselectionmenucontroller.hxx>
#include <uiconfiguration/imagemanager.hxx>
#include <uifactory/windowcontentfactorymanager.hxx>
COMPONENTGETIMPLEMENTATIONENVIRONMENT
@@ -184,6 +173,8 @@ COMPONENTWRITEINFO ( COMPONENTINFO( ::framework::URLTransformer
COMPONENTINFO( ::framework::ImageManager )
COMPONENTINFO( ::framework::LangSelectionStatusbarController )
COMPONENTINFO( ::framework::LanguageSelectionMenuController )
COMPONENTINFO( ::framework::TabWindowService )
COMPONENTINFO( ::framework::WindowContentFactoryManager )
)
COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer ) else
@@ -241,6 +232,8 @@ COMPONENTGETFACTORY ( IFFACTORY( ::framework::URLTransformer
IFFACTORY( ::framework::ImageManager ) else
IFFACTORY( ::framework::PopupMenuDispatcher ) else
IFFACTORY( ::framework::LangSelectionStatusbarController ) else
IFFACTORY( ::framework::LanguageSelectionMenuController )
IFFACTORY( ::framework::LanguageSelectionMenuController ) else
IFFACTORY( ::framework::WindowContentFactoryManager ) else
IFFACTORY( ::framework::TabWindowService )
)

View File

@@ -170,4 +170,13 @@ Resource RES_BACKING_IMAGES_HC
};
};
Window WIN_TABWINDOW
{
OutputSize = TRUE ;
SVLook = TRUE ;
TabControl TC_TABCONTROL
{
OutputSize = TRUE ;
};
};

View File

@@ -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
@@ -41,22 +41,23 @@ ENABLE_EXCEPTIONS= TRUE
# --- Generate -----------------------------------------------------
SLOFILES= \
$(SLO)$/desktop.obj \
$(SLO)$/frame.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/mediatypedetectionhelper.obj \
$(SLO)$/substitutepathvars.obj \
$(SLO)$/pathsettings.obj \
$(SLO)$/backingcomp.obj \
$(SLO)$/backingwindow.obj \
$(SLO)$/dispatchhelper.obj \
$(SLO)$/license.obj \
$(SLO)$/modulemanager.obj \
$(SLO)$/autorecovery.obj \
$(SLO)$/sessionlistener.obj \
$(SLO)$/taskcreatorsrv.obj \
$(SLO)$/uriabbreviation.obj
SLOFILES=\
$(SLO)$/desktop.obj \
$(SLO)$/frame.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/mediatypedetectionhelper.obj \
$(SLO)$/substitutepathvars.obj \
$(SLO)$/pathsettings.obj \
$(SLO)$/backingcomp.obj \
$(SLO)$/backingwindow.obj \
$(SLO)$/dispatchhelper.obj \
$(SLO)$/license.obj \
$(SLO)$/modulemanager.obj \
$(SLO)$/autorecovery.obj \
$(SLO)$/sessionlistener.obj \
$(SLO)$/taskcreatorsrv.obj \
$(SLO)$/uriabbreviation.obj \
$(SLO)$/tabwindowservice.obj
SRS1NAME=$(TARGET)
SRC1FILES= fwk_services.src

View File

@@ -0,0 +1,476 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: urltransformer.cxx,v $
* $Revision: 1.17 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <services/tabwindowservice.hxx>
#include <classes/fwktabwindow.hxx>
#include <threadhelp/resetableguard.hxx>
#include <services.h>
#include <properties.h>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/urlobj.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported definitions
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// declarations
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// css::uno::XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
DEFINE_XINTERFACE_5 ( TabWindowService ,
OWeakObject ,
DIRECT_INTERFACE(css::lang::XTypeProvider ),
DIRECT_INTERFACE(css::lang::XServiceInfo ),
DIRECT_INTERFACE(css::awt::XSimpleTabController),
DIRECT_INTERFACE(css::beans::XPropertySet ),
DIRECT_INTERFACE(css::beans::XPropertySetInfo )
)
DEFINE_XTYPEPROVIDER_5 ( TabWindowService ,
css::lang::XTypeProvider ,
css::lang::XServiceInfo ,
css::awt::XSimpleTabController ,
css::beans::XPropertySet ,
css::beans::XPropertySetInfo
)
DEFINE_XSERVICEINFO_MULTISERVICE ( TabWindowService ,
OWeakObject ,
SERVICENAME_TABWINDOWSERVICE ,
IMPLEMENTATIONNAME_TABWINDOWSERVICE
)
DEFINE_INIT_SERVICE ( TabWindowService,
{
impl_initializePropInfo();
m_aTransactionManager.setWorkingMode( E_WORK );
}
)
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
TabWindowService::TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory )
// Init baseclasses first
// Attention:
// Don't change order of initialization!
// ThreadHelpBase is a struct with a mutex as member. We can't use a mutex as member, while
// we must garant right initialization and a valid value of this! First initialize
// baseclasses and then members. And we need the mutex for other baseclasses !!!
: ThreadHelpBase ( &Application::GetSolarMutex() )
, TransactionBase ( )
, PropertySetHelper ( xFactory ,
&m_aLock ,
&m_aTransactionManager ,
sal_False ) // FALSE => dont release shared mutex on calling us!
, OWeakObject ( )
// Init member
, m_xFactory ( xFactory )
, m_xTabWin ( )
, m_pTabWin ( NULL )
, m_lTabPageInfos ( )
, m_lListener ( m_aLock.getShareableOslMutex())
, m_nPageIndexCounter ( 1 )
, m_nCurrentPageIndex ( 0 )
{
// Safe impossible cases.
// Method not defined for all incoming parameter.
LOG_ASSERT( xFactory.is(), "TabWindowService::TabWindowService()\nInvalid parameter detected!\n" )
}
//*****************************************************************************************************************
// destructor
//*****************************************************************************************************************
TabWindowService::~TabWindowService()
{
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
::sal_Int32 SAL_CALL TabWindowService::insertTab()
throw ( css::uno::RuntimeException )
{
// SAFE ->
ResetableGuard aGuard( m_aLock );
::sal_Int32 nID = m_nPageIndexCounter++;
TTabPageInfo aInfo(m_nPageIndexCounter);
m_lTabPageInfos[nID] = aInfo;
return nID;
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
void SAL_CALL TabWindowService::removeTab(::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException )
{
// SAFE ->
ResetableGuard aGuard(m_aLock);
// throws suitable IndexOutOfBoundsException .-)
TTabPageInfoHash::iterator pIt = impl_getTabPageInfo (nID);
m_lTabPageInfos.erase(pIt);
FwkTabWindow* pTabWin = mem_TabWin ();
if (pTabWin)
pTabWin->RemovePage(nID);
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
void SAL_CALL TabWindowService::setTabProps( ::sal_Int32 nID ,
const css::uno::Sequence< css::beans::NamedValue >& lProperties)
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException )
{
// SAFE ->
ResetableGuard aGuard(m_aLock);
// throws suitable IndexOutOfBoundsException .-)
TTabPageInfoHash::iterator pIt = impl_getTabPageInfo (nID);
TTabPageInfo& rInfo = pIt->second;
rInfo.m_lProperties = lProperties;
if ( ! rInfo.m_bCreated)
{
FwkTabWindow* pTabWin = mem_TabWin ();
if (pTabWin)
{
pTabWin->AddTabPage(rInfo.m_nIndex, rInfo.m_lProperties);
pTabWin->ActivatePage (rInfo.m_nIndex);
rInfo.m_bCreated = sal_True;
}
}
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
css::uno::Sequence< css::beans::NamedValue > SAL_CALL TabWindowService::getTabProps(::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException )
{
// SAFE ->
ResetableGuard aGuard(m_aLock);
// throws suitable IndexOutOfBoundsException .-)
TTabPageInfoHash::const_iterator pIt = impl_getTabPageInfo (nID);
const TTabPageInfo& rInfo = pIt->second;
return rInfo.m_lProperties;
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
void SAL_CALL TabWindowService::activateTab(::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException,
css::uno::RuntimeException )
{
// SAFE ->
ResetableGuard aGuard(m_aLock);
// throws suitable IndexOutOfBoundsException .-)
impl_checkTabIndex (nID);
m_nCurrentPageIndex = nID;
FwkTabWindow* pTabWin = mem_TabWin ();
if (pTabWin)
pTabWin->ActivatePage(nID);
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
::sal_Int32 SAL_CALL TabWindowService::getActiveTabID()
throw (css::uno::RuntimeException)
{
// SAFE->
ResetableGuard aGuard( m_aLock );
return m_nCurrentPageIndex;
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
void SAL_CALL TabWindowService::addTabListener(const css::uno::Reference< css::awt::XTabListener >& xListener)
throw (css::uno::RuntimeException)
{
m_lListener.addInterface(::getCppuType((const css::uno::Reference< css::awt::XTabListener >*)NULL), xListener);
}
//*****************************************************************************************************************
// XSimpleTabController
//*****************************************************************************************************************
void SAL_CALL TabWindowService::removeTabListener(const css::uno::Reference< css::awt::XTabListener >& xListener)
throw (css::uno::RuntimeException)
{
m_lListener.removeInterface(::getCppuType((const css::uno::Reference< css::awt::XTabListener >*)NULL), xListener);
}
//*****************************************************************************************************************
// XComponent
//*****************************************************************************************************************
void SAL_CALL TabWindowService::dispose()
throw (css::uno::RuntimeException)
{
// SAFE->
ResetableGuard aGuard(m_aLock);
css::uno::Reference< css::uno::XInterface > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
css::lang::EventObject aEvent(xThis);
m_lListener.disposeAndClear (aEvent);
m_pTabWin = NULL;
m_xTabWin.clear ();
}
//*****************************************************************************************************************
// XComponent
//*****************************************************************************************************************
void SAL_CALL TabWindowService::addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener)
throw (css::uno::RuntimeException)
{
m_lListener.addInterface(::getCppuType((const css::uno::Reference< css::lang::XEventListener >*)NULL), xListener);
}
//*****************************************************************************************************************
// XComponent
//*****************************************************************************************************************
void SAL_CALL TabWindowService::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener)
throw (css::uno::RuntimeException)
{
m_lListener.removeInterface(::getCppuType((const css::uno::Reference< css::lang::XEventListener >*)NULL), xListener);
}
//*****************************************************************************************************************
void TabWindowService::impl_initializePropInfo()
{
impl_setPropertyChangeBroadcaster(static_cast< css::awt::XSimpleTabController* >(this));
impl_addPropertyInfo(
css::beans::Property(
TABWINDOWSERVICE_PROPNAME_WINDOW,
TABWINDOWSERVICE_PROPHANDLE_WINDOW,
::getCppuType((const css::uno::Reference< css::awt::XWindow >*)NULL),
css::beans::PropertyAttribute::TRANSIENT));
}
//*****************************************************************************************************************
void SAL_CALL TabWindowService::impl_setPropertyValue(const ::rtl::OUString& /*sProperty*/,
sal_Int32 /*nHandle */,
const css::uno::Any& /*aValue */)
{
}
//*****************************************************************************************************************
css::uno::Any SAL_CALL TabWindowService::impl_getPropertyValue(const ::rtl::OUString& /*sProperty*/,
sal_Int32 nHandle )
{
/* There is no need to lock any mutex here. Because we share the
solar mutex with our base class. And we said to our base class: "dont release it on calling us" .-)
see ctor of PropertySetHelper for further informations.
*/
css::uno::Any aValue;
switch (nHandle)
{
case TABWINDOWSERVICE_PROPHANDLE_WINDOW:
{
mem_TabWin (); // force "creation on demand" of m_xTabWin :-)
aValue <<= m_xTabWin;
}
break;
}
return aValue;
}
//*****************************************************************************************************************
// TabWindowService
//*****************************************************************************************************************
IMPL_LINK( TabWindowService, EventListener, VclSimpleEvent*, pEvent )
{
if (
( ! pEvent ) ||
( pEvent->ISA(VclWindowEvent) )
)
return 0;
ULONG nEventId = pEvent->GetId();
VclWindowEvent* pWinEvt = static_cast< VclWindowEvent* >(pEvent);
css::uno::Reference< css::uno::XInterface > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
css::lang::EventObject aEvent( xThis );
if (nEventId == VCLEVENT_OBJECT_DYING)
{
m_lListener.disposeAndClear (aEvent);
return 0;
}
::cppu::OInterfaceContainerHelper* pContainer = m_lListener.getContainer(::getCppuType((const css::uno::Reference< css::awt::XTabListener >*) NULL));
if ( ! pContainer)
return 0;
::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
while (pIterator.hasMoreElements())
{
try
{
css::awt::XTabListener* pListener = (css::awt::XTabListener*)pIterator.next();
switch (nEventId)
{
case VCLEVENT_TABPAGE_ACTIVATE :
pListener->activated( (sal_Int32)(ULONG)pWinEvt->GetData() );
break;
case VCLEVENT_TABPAGE_DEACTIVATE :
pListener->deactivated( (sal_Int32)(ULONG)pWinEvt->GetData() );
break;
case VCLEVENT_TABPAGE_INSERTED :
pListener->inserted( (sal_Int32)(ULONG)pWinEvt->GetData() );
break;
case VCLEVENT_TABPAGE_REMOVED :
pListener->removed( (sal_Int32)(ULONG)pWinEvt->GetData() );
break;
case VCLEVENT_TABPAGE_PAGETEXTCHANGED :
case VCLEVENT_TABPAGE_REMOVEDALL :
break;
}
}
catch(const css::uno::RuntimeException&)
{
pIterator.remove();
}
}
return 0;
}
//*****************************************************************************************************************
// TabWindowService
//*****************************************************************************************************************
void TabWindowService::impl_checkTabIndex (::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException)
{
if (
(nID <= 0 ) ||
(nID > m_nPageIndexCounter)
)
{
throw css::lang::IndexOutOfBoundsException(
::rtl::OUString::createFromAscii("Tab index out of bounds."),
css::uno::Reference< css::uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ));
}
}
//*****************************************************************************************************************
// TabWindowService
//*****************************************************************************************************************
TTabPageInfoHash::iterator TabWindowService::impl_getTabPageInfo(::sal_Int32 nID)
throw (css::lang::IndexOutOfBoundsException)
{
TTabPageInfoHash::iterator pIt = m_lTabPageInfos.find(nID);
if (pIt == m_lTabPageInfos.end ())
throw css::lang::IndexOutOfBoundsException(
::rtl::OUString::createFromAscii("Tab index out of bounds."),
css::uno::Reference< css::uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ));
return pIt;
}
//*****************************************************************************************************************
// TabWindowService
//*****************************************************************************************************************
FwkTabWindow* TabWindowService::mem_TabWin ()
{
FwkTabWindow* pWin = NULL;
if ( ! m_xTabWin.is ())
{
Window* pFakeParent = dynamic_cast< Window* >(Application::GetDefaultDevice ());
m_pTabWin = new FwkTabWindow (pFakeParent);
m_xTabWin = VCLUnoHelper::GetInterface (m_pTabWin);
m_pTabWin->AddEventListener( LINK( this, TabWindowService, EventListener ) );
}
if (m_xTabWin.is ())
pWin = m_pTabWin;
return pWin;
}
} // namespace framework

View File

@@ -1,250 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: fairrwlock.cxx,v $
* $Revision: 1.7 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/fairrwlock.hxx>
#include <threadhelp/resetableguard.hxx>
#include <macros/debug.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported declarations
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
/*-****************************************************************************************************//**
@short standard ctor
@descr Initialize instance with right start values for correct working.
no reader could exist => m_nReadCount = 0
don't block first comming writer => m_aWriteCondition.set()
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
FairRWLock::FairRWLock()
: m_nReadCount( 0 )
{
m_aWriteCondition.set();
}
/*-****************************************************************************************************//**
@short set lock for reading
@descr A guard should call this method to acquire read access on your member.
Writing isn't allowed then - but nobody could check it for you!
@seealso method releaseReadAccess()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void SAL_CALL FairRWLock::acquireReadAccess()
{
// Put call in "SERIALIZE"-queue!
// After successful acquiring this mutex we are alone ...
ResetableGuard aSerializeGuard( m_aSerializer );
// ... but we should synchronize us with other reader!
// May be - they will unregister himself by using releaseReadAccess()!
ResetableGuard aAccessGuard( m_aAccessLock );
// Now we must register us as reader by increasing counter.
// If this the first writer we must close door for possible writer.
// Other reader don't look for this barrier - they work parallel to us!
if( m_nReadCount == 0 )
{
m_aWriteCondition.reset();
}
++m_nReadCount;
}
/*-****************************************************************************************************//**
@short reset lock for reading
@descr A guard should call this method to release read access on your member.
@seealso method acquireReadAccess()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void SAL_CALL FairRWLock::releaseReadAccess()
{
// The access lock is enough at this point
// because it's not allowed to wait for all reader or writer here!
// That will cause a deadlock!
ResetableGuard aAccessGuard( m_aAccessLock );
// Unregister as reader first!
// Open writer barrier then if it was the last reader.
--m_nReadCount;
if( m_nReadCount == 0 )
{
m_aWriteCondition.set();
}
}
/*-****************************************************************************************************//**
@short set lock for writing
@descr A guard should call this method to acquire write access on your member.
Reading is allowed too - of course.
After successfully calling of this method you are the only writer.
@seealso method setWorkingMode()
@seealso method releaseWriteAccess()
@param "eRejectReason" , is the reason for rejected calls.
@param "eExceptionMode" , use to enable/disable throwing exceptions automaticly for rejected calls
@return -
@onerror -
*//*-*****************************************************************************************************/
void SAL_CALL FairRWLock::acquireWriteAccess()
{
// You have to stand in our serialize-queue till all reader
// are registered (not for releasing them!) or writer finished their work!
// Don't use a guard to do so - because you must hold the mutex till
// you call releaseWriteAccess()!
// After succesfull acquire you have to wait for current working reader.
// Used condition will open by last gone reader object.
m_aSerializer.acquire();
m_aWriteCondition.wait();
#ifdef ENABLE_MUTEXDEBUG
// A writer is an exclusiv accessor!
LOG_ASSERT2( m_nReadCount!=0, "FairRWLock::acquireWriteAccess()", "No threadsafe code detected ... : Read count != 0!" )
#endif
}
/*-****************************************************************************************************//**
@short reset lock for writing
@descr A guard should call this method to release write access on your member.
@seealso method acquireWriteAccess()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void SAL_CALL FairRWLock::releaseWriteAccess()
{
// The only one you have to do here is to release
// hold seriliaze-mutex. All other user of these instance are blocked
// by these mutex!
// You don't need any other mutex here - you are the only one in the moment!
#ifdef ENABLE_MUTEXDEBUG
// A writer is an exclusiv accessor!
LOG_ASSERT2( m_nReadCount!=0, "FairRWLock::releaseWriteAccess()", "No threadsafe code detected ... : Read count != 0!" )
#endif
m_aSerializer.release();
}
/*-****************************************************************************************************//**
@short downgrade a write access to a read access
@descr A guard should call this method to change a write to a read access.
New readers can work too - new writer are blocked!
@attention Don't call this method if you are not a writer!
Results are not defined then ...
An upgrade can't be implemented realy ... because acquiring new access
will be the same - there no differences!
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void SAL_CALL FairRWLock::downgradeWriteAccess()
{
// You must be a writer to call this method!
// We can't check it - but otherwise it's your problem ...
// Thats why you don't need any mutex here.
#ifdef ENABLE_MUTEXDEBUG
// A writer is an exclusiv accessor!
LOG_ASSERT2( m_nReadCount!=0, "FairRWLock::downgradeWriteAccess()", "No threadsafe code detected ... : Read count != 0!" )
#endif
// Register himself as "new" reader.
// This value must be 0 before - because we support single writer access only!
++m_nReadCount;
// Close barrier for other writer!
// Why?
// You hold the serializer mutex - next one can be a reader OR a writer.
// They must blocked then - because you will be a reader after this call
// and writer use this condition to wait for current reader!
m_aWriteCondition.reset();
// Open door for next waiting thread in serialize queue!
m_aSerializer.release();
}
} // namespace framework

View File

@@ -1,167 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: gate.cxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/gate.hxx>
#include <threadhelp/resetableguard.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported declarations
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
Gate::Gate()
: m_bClosed ( sal_False )
, m_bGapOpen ( sal_False )
{
open();
}
//*****************************************************************************************************************
// destructor
//*****************************************************************************************************************
Gate::~Gate()
{
open();
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
void Gate::open()
{
// We must safe access to our internal member!
ResetableGuard aLock( m_aAccessLock );
// Set condition -> wait don't block any longer -> gate is open
m_aPassage.set();
// Check if operation was successful!
// Check returns false if condition isn't set => m_bClosed will be true then => we must return false; opening failed
m_bClosed = ( m_aPassage.check() == sal_False );
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
void Gate::close()
{
// We must safe access to our internal member!
ResetableGuard aLock( m_aAccessLock );
// Reset condition -> wait blocks now -> gate is closed
m_aPassage.reset();
// Check if operation was successful!
// Check returns false if condition was reseted => m_bClosed will be true then => we can return true; closing ok
m_bClosed = ( m_aPassage.check() == sal_False );
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
void Gate::openGap()
{
// We must safe access to our internal member!
ResetableGuard aLock( m_aAccessLock );
// Open passage for current waiting threads.
m_aPassage.set();
// Check state of condition.
// If condition is set check() returns true => m_bGapOpen will be true too => we can use it as return value.
m_bGapOpen = ( m_aPassage.check() == sal_True );
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
sal_Bool Gate::wait( const TimeValue* pTimeOut )
{
// We must safe access to our internal member!
ResetableGuard aLock( m_aAccessLock );
// If gate not closed - caller can pass it.
sal_Bool bSuccessful = sal_True;
if( m_bClosed == sal_True )
{
// Otherwise first new thread must close an open gap!
if( m_bGapOpen == sal_True )
{
m_bGapOpen = sal_False;
m_aPassage.reset();
}
// Then we must release used access lock -
// because next call will block ...
// and if we hold the access lock nobody else can use this object without a dadlock!
aLock.unlock();
// Wait for opening gate ...
bSuccessful = ( m_aPassage.wait( pTimeOut ) == osl_cond_result_ok );
}
return bSuccessful;
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
sal_Bool Gate::isOpen() const
{
// I think we never need the access lock for pure reading of this bool member ...
return !m_bClosed;
}
} // namespace framework

View File

@@ -1,170 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: readguard.cxx,v $
* $Revision: 1.6 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/readguard.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported declarations
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
/*-****************************************************************************************************//**
@short ctor
@descr These ctors initialize the guard with a reference to used lock member of object to protect.
Null isn't allowed as value!
@seealso -
@param "pLock" ,reference to used lock member of object to protect
@param "rLock" ,reference to used lock member of object to protect
@return -
@onerror -
*//*-*****************************************************************************************************/
ReadGuard::ReadGuard( IRWLock* pLock )
: m_pLock ( pLock )
, m_bLocked ( sal_False )
{
lock();
}
//*****************************************************************************************************************
ReadGuard::ReadGuard( IRWLock& rLock )
: m_pLock ( &rLock )
, m_bLocked ( sal_False )
{
lock();
}
/*-****************************************************************************************************//**
@short dtor
@descr We unlock the used lock member automaticly if user forget it.
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
ReadGuard::~ReadGuard()
{
unlock();
}
/*-****************************************************************************************************//**
@short set read lock
@descr Call this method to set the read lock. The call will block till all current threads are synchronized!
@seealso method unlock()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void ReadGuard::lock()
{
if( m_bLocked == sal_False )
{
m_pLock->acquireReadAccess();
m_bLocked = sal_True;
}
}
/*-****************************************************************************************************//**
@short unset read lock
@descr Call this method to unlock the rw-lock temp.!
Normaly we do it at dtor automaticly for you ...
@seealso method lock()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void ReadGuard::unlock()
{
if( m_bLocked == sal_True )
{
m_pLock->releaseReadAccess();
m_bLocked = sal_False;
}
}
/*-****************************************************************************************************//**
@short return internal lock state
@descr For user they dont know what they are doing there ...
@seealso -
@param -
@return true, if lock is set, false otherwise.
@onerror -
*//*-*****************************************************************************************************/
sal_Bool ReadGuard::isLocked() const
{
return m_bLocked;
}
} // namespace framework

View File

@@ -1,141 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: resetableguard.cxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/resetableguard.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
using namespace ::osl ;
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported declarations
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
ResetableGuard::ResetableGuard( Mutex* pMutex )
: m_pMutex ( pMutex )
, m_bLocked ( sal_False )
{
lock();
}
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
ResetableGuard::ResetableGuard( Mutex& rMutex )
: m_pMutex ( &rMutex )
, m_bLocked ( sal_False )
{
lock();
}
//*****************************************************************************************************************
// destructor
//*****************************************************************************************************************
ResetableGuard::~ResetableGuard()
{
unlock();
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
void ResetableGuard::lock()
{
if( m_bLocked == sal_False )
{
m_bLocked = m_pMutex->acquire();
}
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
void ResetableGuard::unlock()
{
if( m_bLocked == sal_True )
{
m_bLocked = !(m_pMutex->release());
}
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
sal_Bool ResetableGuard::tryToLock()
{
if( m_bLocked == sal_False )
{
m_bLocked = m_pMutex->tryToAcquire();
}
return m_bLocked;
}
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
sal_Bool ResetableGuard::isLocked() const
{
return m_bLocked;
}
} // namespace framework

View File

@@ -1,162 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: transactionguard.cxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/transactionguard.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported declarations
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
/*-************************************************************************************************************//**
@short ctors
@descr Use these ctor methods to initialize the guard right.
Given reference must be valid - otherwise crashes could occure!
@attention It's not neccessary to lock any mutex here! Because a ctor should not be called
from different threads at the same time ... this class use no refcount mechanism!
@seealso -
@param "pManager" pointer to transaction manager for using to register a request
@param "rManager" same as reference
@param "eMode" enable/disable throwing of exceptions for rejected calls
@param "eReason" returns reason for rejected calls if "eMode=E_NOEXCEPTIONS"!
@return -
@onerror -
*//*-*************************************************************************************************************/
TransactionGuard::TransactionGuard( ITransactionManager* pManager, EExceptionMode eMode, ERejectReason* eReason )
: m_pManager( pManager )
{
// If exception mode is set to E_HARDEXCETIONS we don't need a buffer to return reason!
// We handle it private. If a call is rejected, our manager throw some exceptions ... and the reason
// could be ignorable ...
if( eReason == NULL )
{
ERejectReason eMyReason;
m_pManager->acquire( eMode, eMyReason );
}
else
{
m_pManager->acquire( eMode, *eReason );
}
}
//*****************************************************************************************************************
TransactionGuard::TransactionGuard( ITransactionManager& rManager, EExceptionMode eMode, ERejectReason* eReason )
: m_pManager( &rManager )
{
// If exception mode is set to E_HARDEXCETIONS we don't need a buffer to return reason!
// We handle it private. If a call is rejected, our manager throw some exceptions ... and the reason
// could be ignorable ...
if( eReason == NULL )
{
ERejectReason eMyReason;
m_pManager->acquire( eMode, eMyReason );
}
else
{
m_pManager->acquire( eMode, *eReason );
}
}
/*-************************************************************************************************************//**
@short dtor
@descr We must release the transaction manager and can forget his pointer.
@seealso -
@param -
@return -
@onerror -
*//*-*************************************************************************************************************/
TransactionGuard::~TransactionGuard()
{
stop();
}
/*-************************************************************************************************************//**
@short stop current transaction
@descr We must release the transaction manager and can forget his pointer.
@attention We don't support any start() method here - because it is not easy to
detect if a transaction already started or not!
(combination of EExceptionMode and ERejectReason)
@seealso -
@param -
@return -
@onerror -
*//*-*************************************************************************************************************/
void TransactionGuard::stop()
{
if( m_pManager != NULL )
{
m_pManager->release();
m_pManager = NULL;
}
}
} // namespace framework

View File

@@ -1,214 +0,0 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: writeguard.cxx,v $
* $Revision: 1.6 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <threadhelp/writeguard.hxx>
#include <macros/debug.hxx>
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// other includes
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// namespace
//_________________________________________________________________________________________________________________
namespace framework{
//_________________________________________________________________________________________________________________
// non exported const
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// non exported declarations
//_________________________________________________________________________________________________________________
//_________________________________________________________________________________________________________________
// definitions
//_________________________________________________________________________________________________________________
/*-****************************************************************************************************//**
@short ctor
@descr These ctors initialize the guard with a reference to used lock member of object to protect.
Null isn't allowed as value!
@seealso -
@param "pLock" ,reference to used lock member of object to protect
@param "rLock" ,reference to used lock member of object to protect
@return -
@onerror -
*//*-*****************************************************************************************************/
WriteGuard::WriteGuard( IRWLock* pLock )
: m_pLock ( pLock )
, m_eMode ( E_NOLOCK )
{
lock();
}
//*****************************************************************************************************************
WriteGuard::WriteGuard( IRWLock& rLock )
: m_pLock ( &rLock )
, m_eMode ( E_NOLOCK )
{
lock();
}
/*-****************************************************************************************************//**
@short dtor
@descr We unlock the used lock member automaticly if user forget it.
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
WriteGuard::~WriteGuard()
{
unlock();
}
/*-****************************************************************************************************//**
@short set write lock
@descr Call this method to set the write lock. The call will block till all current threads are synchronized!
@seealso method unlock()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void WriteGuard::lock()
{
switch( m_eMode )
{
case E_NOLOCK : {
// Acquire write access and set return state.
// Mode is set later if it was successful!
m_pLock->acquireWriteAccess();
m_eMode = E_WRITELOCK;
}
break;
case E_READLOCK : {
// User has downgrade to read access before!
// We must release it before we can set a new write access!
m_pLock->releaseReadAccess ();
m_pLock->acquireWriteAccess();
m_eMode = E_WRITELOCK;
}
break;
}
}
/*-****************************************************************************************************//**
@short unset write lock
@descr Call this method to unlock the rw-lock temp.!
Normaly we do it at dtor automaticly for you ...
@seealso method lock()
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void WriteGuard::unlock()
{
switch( m_eMode )
{
case E_READLOCK : {
// Use has downgraded to a read lock!
m_pLock->releaseReadAccess();
m_eMode = E_NOLOCK;
}
break;
case E_WRITELOCK : {
m_pLock->releaseWriteAccess();
m_eMode = E_NOLOCK;
}
break;
}
}
/*-****************************************************************************************************//**
@short downgrade write access to read access without new blocking!
@descr If this write lock is set you can change it to a "read lock".
An "upgrade" is the same like new calling "lock()"!
@seealso -
@param -
@return -
@onerror -
*//*-*****************************************************************************************************/
void WriteGuard::downgrade()
{
if( m_eMode == E_WRITELOCK )
{
m_pLock->downgradeWriteAccess();
m_eMode = E_READLOCK;
}
}
/*-****************************************************************************************************//**
@short return internal lock state
@descr For user they dont know what they are doing there ...
@seealso -
@param -
@return Current set lock mode.
@onerror No error should occure.
*//*-*****************************************************************************************************/
ELockMode WriteGuard::getMode() const
{
return m_eMode;
}
} // namespace framework

View File

@@ -48,7 +48,8 @@ SLOFILES= \
$(SLO)$/addonstoolboxfactory.obj \
$(SLO)$/toolbarcontrollerfactory.obj \
$(SLO)$/statusbarfactory.obj \
$(SLO)$/statusbarcontrollerfactory.obj
$(SLO)$/statusbarcontrollerfactory.obj \
$(SLO)$/windowcontentfactorymanager.obj
# --- Targets ------------------------------------------------------

View File

@@ -0,0 +1,550 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: uielementfactorymanager.cxx,v $
* $Revision: 1.10.12.1 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_framework.hxx"
//_________________________________________________________________________________________________________________
// my own includes
//_________________________________________________________________________________________________________________
#include <uifactory/windowcontentfactorymanager.hxx>
#include <threadhelp/resetableguard.hxx>
#include "services.h"
//_________________________________________________________________________________________________________________
// interface includes
//_________________________________________________________________________________________________________________
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/awt/XToolkit.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/awt/XControl.hpp>
//_________________________________________________________________________________________________________________
// includes of other projects
//_________________________________________________________________________________________________________________
#include <rtl/ustrbuf.hxx>
#include <cppuhelper/weak.hxx>
#include <tools/urlobj.hxx>
#include <vcl/svapp.hxx>
//_________________________________________________________________________________________________________________
// Defines
//_________________________________________________________________________________________________________________
//
using namespace ::com::sun::star;
//_________________________________________________________________________________________________________________
// Namespace
//_________________________________________________________________________________________________________________
//
namespace framework
{
// global function needed by both implementations
static rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUString& aName, const rtl::OUString& aModuleName )
{
rtl::OUStringBuffer aKey( aType );
aKey.appendAscii( "^" );
aKey.append( aName );
aKey.appendAscii( "^" );
aKey.append( aModuleName );
return aKey.makeStringAndClear();
}
//*****************************************************************************************************************
// Configuration access class for UIElementFactoryManager implementation
//*****************************************************************************************************************
class ConfigurationAccess_WindowContentFactoryManager : // interfaces
public lang::XTypeProvider ,
public container::XContainerListener ,
// baseclasses
// Order is neccessary for right initialization!
private ThreadHelpBase ,
public ::cppu::OWeakObject
{
public:
FWK_DECLARE_XINTERFACE
FWK_DECLARE_XTYPEPROVIDER
ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager );
virtual ~ConfigurationAccess_WindowContentFactoryManager();
void readConfigurationData();
rtl::OUString getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule );
// container.XContainerListener
virtual void SAL_CALL elementInserted( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
virtual void SAL_CALL elementRemoved ( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
virtual void SAL_CALL elementReplaced( const container::ContainerEvent& aEvent ) throw(uno::RuntimeException);
// lang.XEventListener
virtual void SAL_CALL disposing( const lang::EventObject& aEvent ) throw(uno::RuntimeException);
private:
class FactoryMap : public std::hash_map< rtl::OUString,
rtl::OUString,
OUStringHashCode,
::std::equal_to< ::rtl::OUString > >
{
inline void free()
{
FactoryMap().swap( *this );
}
};
sal_Bool impl_getElementProps( const uno::Any& rElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const;
rtl::OUString m_aPropType;
rtl::OUString m_aPropName;
rtl::OUString m_aPropModule;
rtl::OUString m_aPropFactory;
FactoryMap m_aFactoryMap;
uno::Reference< lang::XMultiServiceFactory > m_xServiceManager;
uno::Reference< lang::XMultiServiceFactory > m_xConfigProvider;
uno::Reference< container::XNameAccess > m_xConfigAccess;
bool m_bConfigAccessInitialized;
bool m_bConfigDirty;
};
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
DEFINE_XINTERFACE_3 ( ConfigurationAccess_WindowContentFactoryManager ,
OWeakObject ,
DIRECT_INTERFACE ( lang::XTypeProvider ),
DIRECT_INTERFACE ( container::XContainerListener ),
DERIVED_INTERFACE( lang::XEventListener, XContainerListener )
)
DEFINE_XTYPEPROVIDER_3 ( ConfigurationAccess_WindowContentFactoryManager ,
lang::XTypeProvider ,
container::XContainerListener ,
lang::XEventListener
)
ConfigurationAccess_WindowContentFactoryManager::ConfigurationAccess_WindowContentFactoryManager( uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) :
ThreadHelpBase(),
m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
m_xServiceManager( rServiceManager ),
m_bConfigAccessInitialized( false ),
m_bConfigDirty( true )
{
m_xConfigProvider = uno::Reference< lang::XMultiServiceFactory >( rServiceManager->createInstance(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.ConfigurationProvider" ))),
uno::UNO_QUERY );
}
ConfigurationAccess_WindowContentFactoryManager::~ConfigurationAccess_WindowContentFactoryManager()
{
// SAFE
ResetableGuard aLock( m_aLock );
uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
if ( xContainer.is() )
xContainer->removeContainerListener( this );
}
rtl::OUString ConfigurationAccess_WindowContentFactoryManager::getFactorySpecifierFromTypeNameModule( const rtl::OUString& rType, const rtl::OUString& rName, const rtl::OUString& rModule )
{
// SAFE
ResetableGuard aLock( m_aLock );
// Make sure that we read the configuration data at least once.
// May be more dependent on the dirty flag!
readConfigurationData();
FactoryMap::const_iterator pIter =
m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rModule ));
if ( pIter != m_aFactoryMap.end() )
return pIter->second;
else
{
pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rName, rtl::OUString() ));
if ( pIter != m_aFactoryMap.end() )
return pIter->second;
else
{
// Support factories which uses a defined prefix for their element names.
sal_Int32 nIndex = rName.indexOf( '_' );
if ( nIndex > 0 )
{
rtl::OUString aName = rName.copy( 0, nIndex );
pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, aName, rtl::OUString() ));
if ( pIter != m_aFactoryMap.end() )
return pIter->second;
}
pIter = m_aFactoryMap.find( getHashKeyFromStrings( rType, rtl::OUString(), rtl::OUString() ));
if ( pIter != m_aFactoryMap.end() )
return pIter->second;
}
}
return rtl::OUString();
}
// container.XContainerListener
void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementInserted( const container::ContainerEvent& ) throw(uno::RuntimeException)
{
// SAFE
ResetableGuard aLock( m_aLock );
m_bConfigDirty = true;
}
void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementRemoved ( const container::ContainerEvent& ) throw(uno::RuntimeException)
{
// SAFE
ResetableGuard aLock( m_aLock );
m_bConfigDirty = true;
}
void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::elementReplaced( const container::ContainerEvent& ) throw(uno::RuntimeException)
{
// SAFE
ResetableGuard aLock( m_aLock );
m_bConfigDirty = true;
}
// lang.XEventListener
void SAL_CALL ConfigurationAccess_WindowContentFactoryManager::disposing( const lang::EventObject& ) throw(uno::RuntimeException)
{
// SAFE
// remove our reference to the config access
ResetableGuard aLock( m_aLock );
m_xConfigAccess.clear();
}
void ConfigurationAccess_WindowContentFactoryManager::readConfigurationData()
{
// SAFE
ResetableGuard aLock( m_aLock );
bool bConfigAccessInitialized(m_bConfigAccessInitialized);
if ( !m_bConfigAccessInitialized )
{
uno::Sequence< uno::Any > aArgs( 1 );
beans::PropertyValue aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
aPropValue.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" ));
aArgs[0] <<= aPropValue;
try
{
m_xConfigAccess = uno::Reference< container::XNameAccess >( m_xConfigProvider->createInstanceWithArguments(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.ConfigurationAccess" )),
aArgs ),
uno::UNO_QUERY );
}
catch ( lang::WrappedTargetException& )
{
}
m_bConfigAccessInitialized = sal_True;
}
if ( m_xConfigAccess.is() && m_bConfigDirty )
{
uno::Sequence< rtl::OUString > aUIElementFactories = m_xConfigAccess->getElementNames();
uno::Any a;
rtl::OUString aType;
rtl::OUString aName;
rtl::OUString aModule;
rtl::OUString aService;
rtl::OUString aHashKey;
uno::Reference< beans::XPropertySet > xPropertySet;
m_aFactoryMap.clear();
for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ )
{
if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService ))
{
// Create hash key from type, name and module as they are together a primary key to
// the UNO service that implements the user interface element factory.
aHashKey = getHashKeyFromStrings( aType, aName, aModule );
m_aFactoryMap.insert( FactoryMap::value_type( aHashKey, aService ));
}
}
uno::Reference< container::XContainer > xContainer( m_xConfigAccess, uno::UNO_QUERY );
m_bConfigDirty = false;
aLock.unlock();
// UNSAFE
if ( xContainer.is() && !bConfigAccessInitialized)
xContainer->addContainerListener( this );
}
}
sal_Bool ConfigurationAccess_WindowContentFactoryManager::impl_getElementProps( const uno::Any& aElement, rtl::OUString& rType, rtl::OUString& rName, rtl::OUString& rModule, rtl::OUString& rServiceSpecifier ) const
{
uno::Reference< beans::XPropertySet > xPropertySet;
uno::Reference< container::XNameAccess > xNameAccess;
aElement >>= xPropertySet;
aElement >>= xNameAccess;
if ( xPropertySet.is() )
{
try
{
xPropertySet->getPropertyValue( m_aPropType ) >>= rType;
xPropertySet->getPropertyValue( m_aPropName ) >>= rName;
xPropertySet->getPropertyValue( m_aPropModule ) >>= rModule;
xPropertySet->getPropertyValue( m_aPropFactory ) >>= rServiceSpecifier;
}
catch ( beans::UnknownPropertyException& )
{
return sal_False;
}
catch ( lang::WrappedTargetException& )
{
return sal_False;
}
}
return sal_True;
}
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
DEFINE_XINTERFACE_3 ( WindowContentFactoryManager ,
OWeakObject ,
DIRECT_INTERFACE( lang::XTypeProvider ),
DIRECT_INTERFACE( lang::XServiceInfo ),
DIRECT_INTERFACE( lang::XSingleComponentFactory )
)
DEFINE_XTYPEPROVIDER_3 ( WindowContentFactoryManager ,
lang::XTypeProvider ,
lang::XServiceInfo ,
lang::XSingleComponentFactory
)
DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager ,
::cppu::OWeakObject ,
SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
)
DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} )
WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
m_bConfigRead( sal_False ),
m_xServiceManager( xServiceManager )
{
m_pConfigAccess = new ConfigurationAccess_WindowContentFactoryManager( m_xServiceManager );
m_pConfigAccess->acquire();
m_xModuleManager = uno::Reference< frame::XModuleManager >( m_xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), uno::UNO_QUERY );
}
WindowContentFactoryManager::~WindowContentFactoryManager()
{
ResetableGuard aLock( m_aLock );
// reduce reference count
m_pConfigAccess->release();
}
void WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aType, rtl::OUString& aName )
{
const sal_Int32 RESOURCEURL_PREFIX_SIZE = 17;
const char RESOURCEURL_PREFIX[] = "private:resource/";
if (( aResourceURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( RESOURCEURL_PREFIX ))) == 0 ) &&
( aResourceURL.getLength() > RESOURCEURL_PREFIX_SIZE ))
{
rtl::OUString aTmpStr( aResourceURL.copy( RESOURCEURL_PREFIX_SIZE ));
sal_Int32 nToken = 0;
sal_Int32 nPart = 0;
do
{
::rtl::OUString sToken = aTmpStr.getToken( 0, '/', nToken);
if ( sToken.getLength() )
{
if ( nPart == 0 )
aType = sToken;
else if ( nPart == 1 )
aName = sToken;
else
break;
nPart++;
}
}
while( nToken >=0 );
}
}
// XSingleComponentFactory
uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithContext(
const uno::Reference< uno::XComponentContext >& /*xContext*/ )
throw (uno::Exception, uno::RuntimeException)
{
/*
// Currently this method cannot be implemented for generic use. There is no way for external
code to get a handle to the dialog model.
uno::Reference< lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), uno::UNO_QUERY );
const ::rtl::OUString sToolkitService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit"));
uno::Reference< awt::XToolkit > xToolkit( xServiceManager->createInstance( sToolkitService ), uno::UNO_QUERY_THROW );
const ::rtl::OUString sDialogModelService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialogModel"));
uno::Reference< awt::XControlModel > xDialogModel( xServiceManager->createInstance( sDialogModelService ), uno::UNO_QUERY_THROW );
const ::rtl::OUString sDecoration(RTL_CONSTASCII_USTRINGPARAM("Decoration"));
uno::Reference< beans::XPropertySet > xPropSet( xDialogModel, uno::UNO_QUERY_THROW );
xPropSet->setPropertyValue( sDecoration, uno::makeAny(false));
const ::rtl::OUString sDialogService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDialog"));
uno::Reference< awt::XControl > xDialogControl( xServiceManager->createInstance( sDialogService ), uno::UNO_QUERY_THROW );
xDialogControl->setModel( xDialogModel );
uno::Reference< awt::XWindowPeer > xWindowParentPeer( xToolkit->getDesktopWindow(), uno::UNO_QUERY );
xDialogControl->createPeer( xToolkit, xWindowParentPeer );
uno::Reference< uno::XInterface > xWindow( xDialogControl->getPeer(), uno::UNO_QUERY );
*/
uno::Reference< uno::XInterface > xWindow;
return xWindow;
}
uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createInstanceWithArgumentsAndContext(
const uno::Sequence< uno::Any >& Arguments, const uno::Reference< uno::XComponentContext >& Context )
throw (uno::Exception, uno::RuntimeException)
{
uno::Reference< uno::XInterface > xWindow;
uno::Reference< frame::XFrame > xFrame;
::rtl::OUString aResourceURL;
for (sal_Int32 i=0; i < Arguments.getLength(); i++ )
{
beans::PropertyValue aPropValue;
if ( Arguments[i] >>= aPropValue )
{
if ( aPropValue.Name.equalsAscii( "Frame" ))
aPropValue.Value >>= xFrame;
else if ( aPropValue.Name.equalsAscii( "ResourceURL" ))
aPropValue.Value >>= aResourceURL;
}
}
uno::Reference< frame::XModuleManager > xModuleManager;
// SAFE
{
ResetableGuard aLock( m_aLock );
xModuleManager = m_xModuleManager;
}
// UNSAFE
// Determine the module identifier
::rtl::OUString aType;
::rtl::OUString aName;
::rtl::OUString aModuleId;
try
{
if ( xFrame.is() && xModuleManager.is() )
aModuleId = xModuleManager->identify( uno::Reference< uno::XInterface >( xFrame, uno::UNO_QUERY ) );
}
catch ( frame::UnknownModuleException& )
{
}
RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
if ( aType.getLength() > 0 &&
aName.getLength() > 0 &&
aModuleId.getLength() > 0 )
{
::rtl::OUString aImplementationName;
uno::Reference< uno::XInterface > xHolder( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
// Detetmine the implementation name of the window content factory dependent on the
// module identifier, user interface element type and name
// SAFE
ResetableGuard aLock( m_aLock );
aImplementationName = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId );
if ( aImplementationName.getLength() > 0 )
{
aLock.unlock();
// UNSAFE
uno::Reference< lang::XMultiServiceFactory > xServiceManager( Context->getServiceManager(), uno::UNO_QUERY );
if ( xServiceManager.is() )
{
uno::Reference< lang::XSingleComponentFactory > xFactory(
xServiceManager->createInstance( aImplementationName ), uno::UNO_QUERY );
if ( xFactory.is() )
{
// Be careful: We call external code. Therefore here we have to catch all exceptions
try
{
xWindow = xFactory->createInstanceWithArgumentsAndContext( Arguments, Context );
}
catch ( uno::RuntimeException& )
{
}
catch ( uno::Exception& )
{
}
}
}
}
}
// UNSAFE
if ( !xWindow.is())
{
// Fallback: Use internal factory code to create a toolkit dialog as a content window
xWindow = createInstanceWithContext(Context);
}
return xWindow;
}
} // namespace framework

View File

@@ -297,7 +297,7 @@ SHL4OBJS= \
$(SLO)$/simpletextstatusbarcontroller.obj \
$(SLO)$/spinfieldtoolbarcontroller.obj \
$(SLO)$/statusbarcontrollerfactory.obj\
$(SLO)$/statusbarfactory.obj \
$(SLO)$/statusbarfactory.obj \
$(SLO)$/statusbarmanager.obj \
$(SLO)$/statusbar.obj \
$(SLO)$/statusbarwrapper.obj \
@@ -305,30 +305,33 @@ SHL4OBJS= \
$(SLO)$/statusindicatorinterfacewrapper.obj \
$(SLO)$/statusindicator.obj \
$(SLO)$/stillinteraction.obj \
$(SLO)$/storageholder.obj \
$(SLO)$/tagwindowasmodified.obj \
$(SLO)$/storageholder.obj \
$(SLO)$/tabwindowservice.obj \
$(SLO)$/fwktabwindow.obj \
$(SLO)$/tagwindowasmodified.obj \
$(SLO)$/targethelper.obj \
$(SLO)$/taskcreator.obj \
$(SLO)$/taskcreatorsrv.obj \
$(SLO)$/taskcreatorsrv.obj \
$(SLO)$/titlebarupdate.obj \
$(SLO)$/togglebuttontoolbarcontroller.obj \
$(SLO)$/toolbarcontrollerfactory.obj\
$(SLO)$/toolbarmanager.obj \
$(SLO)$/toolbarmerger.obj \
$(SLO)$/toolbarmerger.obj \
$(SLO)$/toolbar.obj \
$(SLO)$/toolbarsmenucontroller.obj \
$(SLO)$/toolbarwrapper.obj \
$(SLO)$/toolboxfactory.obj \
$(SLO)$/uicategorydescription.obj \
$(SLO)$/uicategorydescription.obj \
$(SLO)$/uicommanddescription.obj \
$(SLO)$/uiconfigurationmanager.obj \
$(SLO)$/uielementfactorymanager.obj \
$(SLO)$/uriabbreviation.obj \
$(SLO)$/uriabbreviation.obj \
$(SLO)$/urltransformer.obj \
$(SLO)$/vclstatusindicator.obj \
$(SLO)$/wakeupthread.obj \
$(SLO)$/windowcommanddispatch.obj \
$(SLO)$/windowstateconfiguration.obj \
$(SLO)$/vclstatusindicator.obj \
$(SLO)$/wakeupthread.obj \
$(SLO)$/windowcommanddispatch.obj \
$(SLO)$/windowstateconfiguration.obj \
$(SLO)$/windowcontentfactorymanager.obj
SHL4STDLIBS= \
$(FWILIB) \

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: Factories.xcs,v $
* $Revision: 1.6 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************ -->
<!DOCTYPE oor:component-schema SYSTEM "../../../../../component-schema.dtd">
<oor:component-schema xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" oor:name="WindowContentFactories" oor:package="org.openoffice.Office.UI" xml:lang="en-US"> <info>
<author>CD</author>
<desc >Contains implementation of user interface element factories.</desc>
</info>
<templates>
<group oor:name="FactoryType">
<info>
<desc>Describes a factory implementation.</desc>
</info>
<prop oor:name="Type" oor:type="xs:string">
<info>
<desc>Specifies the user interface element type which is associated with the factory.</desc>
</info>
</prop>
<prop oor:name="Name" oor:type="xs:string">
<info>
<desc>Specifies a name or prefix for a specific window. An empty entry/string means that it matches for all names.</desc>
</info>
</prop>
<prop oor:name="Module" oor:type="xs:string">
<info>
<desc>Specifies a module that the factory is associated with. An empty entry/string means that the factory can be used for every module.</desc>
</info>
</prop>
<prop oor:name="FactoryImplementation" oor:type="xs:string">
<info>
<desc>Specifies the UNO service implementation name which creates/provides a com.sun.star.awt.XWindow. See com.sun.star.ui.WindowContentFactory</desc>
</info>
</prop>
</group>
</templates>
<component>
<group oor:name="Registered">
<info>
<desc>Contains all registered factories for docking window contents.</desc>
</info>
<set oor:name="ContentFactories" oor:node-type="FactoryType">
<info>
<desc>Contains UNO component implementation names that implements .</desc>
</info>
</set>
</group>
</component>
</oor:component-schema>

View File

@@ -77,7 +77,8 @@ XCSFILES= \
Effects.xcs \
Category.xcs \
GenericCategories.xcs \
GlobalSettings.xcs
GlobalSettings.xcs \
WindowContentFactories.xcs
.INCLUDE : target.mk

View File

@@ -51,8 +51,10 @@
#define SID_DELETE (SID_SFX_START + 713)
#define SID_INTERNET_ONLINE (SID_SFX_START + 1370)
// Don't let SID_CHAOS_END grow. Internal docking windows use the range between
// SID_CHAOS_END and SID_LIB_START!! Look into sfxsids.hrc for more information!
#define SID_CHAOS_START 9000
#define SID_CHAOS_END 9999
#define SID_CHAOS_END 9799
#define SID_BCC (SID_CHAOS_START + 2)
#define SID_CC (SID_CHAOS_START + 3)

View File

@@ -1,129 +1,145 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dockwin.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _SFXDOCKWIN_HXX
#define _SFXDOCKWIN_HXX
#include "sal/config.h"
#include "sfx2/dllapi.h"
#include "sal/types.h"
#ifndef _DOCKWIN_HXX //autogen
#include <vcl/dockwin.hxx>
#endif
#include <sfx2/childwin.hxx>
class SfxSplitWindow;
class SfxDockingWindow_Impl;
class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
{
private:
Rectangle aInnerRect;
Rectangle aOuterRect;
SfxBindings* pBindings;
Size aFloatSize;
SfxChildWindow* pMgr;
SfxDockingWindow_Impl* pImp;
SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
protected:
SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
void CalcSplitPosition(const Point rPos, Rectangle& rRect,
SfxChildAlignment eAlign);
virtual Size CalcDockingSize(SfxChildAlignment);
virtual SfxChildAlignment
CheckAlignment(SfxChildAlignment,SfxChildAlignment);
virtual void Resize();
virtual BOOL PrepareToggleFloatingMode();
virtual void ToggleFloatingMode();
virtual void StartDocking();
virtual BOOL Docking( const Point& rPos, Rectangle& rRect );
virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode );
virtual void Resizing( Size& rSize );
virtual void Paint( const Rectangle& rRect );
virtual BOOL Close();
virtual void Move();
//#if 0 // _SOLAR__PRIVATE
SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
//#endif
public:
SfxDockingWindow( SfxBindings *pBindings,
SfxChildWindow *pCW,
Window* pParent,
WinBits nWinBits=0);
SfxDockingWindow( SfxBindings *pBindings,
SfxChildWindow *pCW,
Window* pParent,
const ResId& rResId);
~SfxDockingWindow();
void Initialize (SfxChildWinInfo* pInfo);
virtual void FillInfo(SfxChildWinInfo&) const;
virtual void StateChanged( StateChangedType nStateChange );
void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
{ aInnerRect = rInner; aOuterRect = rOuter; }
const Rectangle& GetInnerRect() const { return aInnerRect; }
const Rectangle& GetOuterRect() const { return aOuterRect; }
SfxBindings& GetBindings() const { return *pBindings; }
USHORT GetType() const { return pMgr->GetType(); }
SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
Size GetFloatingSize() const { return aFloatSize; }
void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
void SetMinOutputSizePixel( const Size& rSize );
Size GetMinOutputSizePixel() const;
virtual long Notify( NotifyEvent& rNEvt );
virtual void FadeIn( BOOL );
void AutoShow( BOOL bShow = TRUE );
DECL_LINK( TimerHdl, Timer* );
//#if 0 // _SOLAR__PRIVATE
SAL_DLLPRIVATE void Initialize_Impl();
SAL_DLLPRIVATE USHORT GetWinBits_Impl() const;
SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
SAL_DLLPRIVATE void Disappear_Impl();
SAL_DLLPRIVATE void Reappear_Impl();
SAL_DLLPRIVATE BOOL IsAutoHide_Impl() const;
SAL_DLLPRIVATE BOOL IsPinned_Impl() const;
SAL_DLLPRIVATE void AutoShow_Impl( BOOL bShow = TRUE );
SAL_DLLPRIVATE void Pin_Impl( BOOL bPinned );
SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const;
SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
//#endif
};
#endif // #ifndef _SFXDOCKWIN_HXX
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: dockwin.hxx,v $
* $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _SFXDOCKWIN_HXX
#define _SFXDOCKWIN_HXX
#include "sal/config.h"
#include "sal/types.h"
#include <vcl/dockwin.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include "sfx2/dllapi.h"
#include <sfx2/childwin.hxx>
class SfxSplitWindow;
class SfxDockingWindow_Impl;
void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
{
private:
Rectangle aInnerRect;
Rectangle aOuterRect;
SfxBindings* pBindings;
Size aFloatSize;
SfxChildWindow* pMgr;
SfxDockingWindow_Impl* pImp;
SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
protected:
SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
void CalcSplitPosition(const Point rPos, Rectangle& rRect,
SfxChildAlignment eAlign);
virtual Size CalcDockingSize(SfxChildAlignment);
virtual SfxChildAlignment
CheckAlignment(SfxChildAlignment,SfxChildAlignment);
virtual void Resize();
virtual BOOL PrepareToggleFloatingMode();
virtual void ToggleFloatingMode();
virtual void StartDocking();
virtual BOOL Docking( const Point& rPos, Rectangle& rRect );
virtual void EndDocking( const Rectangle& rRect, BOOL bFloatMode );
virtual void Resizing( Size& rSize );
virtual void Paint( const Rectangle& rRect );
virtual BOOL Close();
virtual void Move();
//#if 0 // _SOLAR__PRIVATE
SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
//#endif
public:
SfxDockingWindow( SfxBindings *pBindings,
SfxChildWindow *pCW,
Window* pParent,
WinBits nWinBits=0);
SfxDockingWindow( SfxBindings *pBindings,
SfxChildWindow *pCW,
Window* pParent,
const ResId& rResId);
~SfxDockingWindow();
void Initialize (SfxChildWinInfo* pInfo);
virtual void FillInfo(SfxChildWinInfo&) const;
virtual void StateChanged( StateChangedType nStateChange );
void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
{ aInnerRect = rInner; aOuterRect = rOuter; }
const Rectangle& GetInnerRect() const { return aInnerRect; }
const Rectangle& GetOuterRect() const { return aOuterRect; }
SfxBindings& GetBindings() const { return *pBindings; }
USHORT GetType() const { return pMgr->GetType(); }
SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
Size GetFloatingSize() const { return aFloatSize; }
void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
void SetMinOutputSizePixel( const Size& rSize );
Size GetMinOutputSizePixel() const;
virtual long Notify( NotifyEvent& rNEvt );
virtual void FadeIn( BOOL );
void AutoShow( BOOL bShow = TRUE );
DECL_LINK( TimerHdl, Timer* );
//#if 0 // _SOLAR__PRIVATE
SAL_DLLPRIVATE void Initialize_Impl();
SAL_DLLPRIVATE USHORT GetWinBits_Impl() const;
SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
SAL_DLLPRIVATE void Disappear_Impl();
SAL_DLLPRIVATE void Reappear_Impl();
SAL_DLLPRIVATE BOOL IsAutoHide_Impl() const;
SAL_DLLPRIVATE BOOL IsPinned_Impl() const;
SAL_DLLPRIVATE void AutoShow_Impl( BOOL bShow = TRUE );
SAL_DLLPRIVATE void Pin_Impl( BOOL bPinned );
SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const;
SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
//#endif
};
class SfxDockingWrapper : public SfxChildWindow
{
public:
SfxDockingWrapper( Window* pParent ,
USHORT nId ,
SfxBindings* pBindings ,
SfxChildWinInfo* pInfo );
SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
};
#endif // #ifndef _SFXDOCKWIN_HXX

View File

@@ -43,6 +43,45 @@
#include <sfx2/cntids.hrc>
#endif
// Please be careful:
// Changing just one part here doesn't add new
// docking windows automatically!
//
#define SID_DOCKWIN_START 9800
#define SID_DOCKWIN_0 9800
#define SID_DOCKWIN_1 9801
#define SID_DOCKWIN_2 9802
#define SID_DOCKWIN_3 9803
#define SID_DOCKWIN_4 9804
#define SID_DOCKWIN_5 9805
#define SID_DOCKWIN_6 9806
#define SID_DOCKWIN_7 9807
#define SID_DOCKWIN_8 9808
#define SID_DOCKWIN_9 9809
/*
#define SID_DOCKWIN_10 9810
#define SID_DOCKWIN_11 9811
#define SID_DOCKWIN_12 9812
#define SID_DOCKWIN_13 9813
#define SID_DOCKWIN_14 9814
#define SID_DOCKWIN_15 9815
#define SID_DOCKWIN_16 9816
#define SID_DOCKWIN_17 9817
#define SID_DOCKWIN_18 9818
#define SID_DOCKWIN_19 9819
#define SID_DOCKWIN_20 9820
#define SID_DOCKWIN_21 9821
#define SID_DOCKWIN_22 9822
#define SID_DOCKWIN_23 9823
#define SID_DOCKWIN_24 9824
#define SID_DOCKWIN_25 9825
#define SID_DOCKWIN_26 9826
#define SID_DOCKWIN_27 9827
#define SID_DOCKWIN_28 9828
#define SID_DOCKWIN_29 9829
*/
#define SID_DOCKWIN_END 9999
#define SID_LIB_START 10000
#define SID_LIB_END 19999

View File

@@ -115,6 +115,165 @@ interface Window
StateMethod = ChildWindowState ;
]
// Pre-defined docking window slots (usable by internal docking windows)
SID_DOCKWIN_0
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_1
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_2
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_3
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_4
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_5
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_6
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_7
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_8
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_9
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
/* Be careful!
You also have to make changes in:
- sfx2/sdi/sfx.sdi
- sfx2/source/dialog/dockwin.cxx
- sfx2/sdi/frmslots.sdi
- sfx2/inc/sfx2/sfxsids.hrc
SID_DOCKWIN_10
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_11
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_12
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_13
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_14
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_15
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_16
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_17
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_18
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_19
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_20
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_21
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_22
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_23
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_24
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_25
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_26
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_27
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_28
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
SID_DOCKWIN_29
[
ExecMethod = ChildWindowExecute ;
StateMethod = ChildWindowState ;
]
*/
// Window.GetFrameWindow( "Name" )
SID_FILLFRAME
[

View File

@@ -8480,3 +8480,273 @@ SfxVoidItem ActivateStyleApply SID_ACTIVATE_STYLE_APPLY
ToolBoxConfig = TRUE,
GroupId = GID_TEMPLATE;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow0 SID_DOCKWIN_0
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow1 SID_DOCKWIN_1
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow2 SID_DOCKWIN_2
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow3 SID_DOCKWIN_3
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow4 SID_DOCKWIN_4
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow5 SID_DOCKWIN_5
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow6 SID_DOCKWIN_6
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow7 SID_DOCKWIN_7
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow8 SID_DOCKWIN_8
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]
//--------------------------------------------------------------------------
SfxBoolItem DockingWindow9 SID_DOCKWIN_9
[
/* flags: */
AutoUpdate = TRUE,
Cachable = Cachable,
FastCall = TRUE,
HasCoreId = FALSE,
HasDialog = FALSE,
ReadOnlyDoc = FALSE,
Toggle = FALSE,
Container = FALSE,
RecordAbsolute = FALSE,
RecordPerSet;
Synchron;
Readonly = FALSE,
/* config: */
AccelConfig = FALSE,
MenuConfig = FALSE,
StatusBarConfig = FALSE,
ToolBoxConfig = FALSE,
GroupId = GID_APPLICATION;
]

View File

@@ -125,6 +125,7 @@
#include <sfx2/sfxdlg.hxx>
#include "stbitem.hxx"
#include "eventsupplier.hxx"
#include <sfx2/dockwin.hxx>
#ifdef DBG_UTIL
#include <sfx2/tbxctrl.hxx>
@@ -323,6 +324,8 @@ SfxApplication* SfxApplication::GetOrCreate()
::framework::SetRefreshToolbars( RefreshToolbars );
::framework::SetToolBoxControllerCreator( SfxToolBoxControllerFactory );
::framework::SetStatusBarControllerCreator( SfxStatusBarControllerFactory );
::framework::SetDockingWindowCreator( SfxDockingWindowFactory );
::framework::SetIsDockingWindowVisible( IsDockingWindowVisible );
SfxHelp* pSfxHelp = new SfxHelp;
Application::SetHelp( pSfxHelp );

View File

@@ -150,6 +150,16 @@ IMPL_LINK( SfxSpecialConfigError_Impl, TimerHdl, Timer*, pTimer )
SFX_IMPL_INTERFACE(SfxApplication,SfxShell,SfxResId(RID_DESKTOP))
{
SFX_STATUSBAR_REGISTRATION(SfxResId(SFX_ITEMTYPE_STATBAR));
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_0);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_1);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_2);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_3);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_4);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_5);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_6);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_7);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_8);
SFX_CHILDWINDOW_REGISTRATION(SID_DOCKWIN_9);
}
//--------------------------------------------------------------------

View File

@@ -71,6 +71,7 @@ void SfxApplication::Registrations_Impl()
SfxNavigatorWrapper::RegisterChildWindow( FALSE, NULL, SFX_CHILDWIN_NEVERHIDE );
SfxPartChildWnd_Impl::RegisterChildWindow();
SfxTemplateDialogWrapper::RegisterChildWindow(TRUE);
SfxDockingWrapper::RegisterChildWindow();
// Controller
SfxToolBoxControl::RegisterControl(SID_REPEAT);

View File

@@ -30,11 +30,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sfx2.hxx"
#include <svtools/eitem.hxx>
#include <vcl/decoview.hxx>
#include <vcl/svapp.hxx>
#include <vcl/timer.hxx>
#include <rtl/instance.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <comphelper/processfactory.hxx>
#include <sfx2/dockwin.hxx>
#include <sfx2/bindings.hxx>
@@ -44,14 +48,393 @@
#include "splitwin.hxx"
#include <sfx2/viewsh.hxx>
#include "sfxhelp.hxx"
#include <sfx2/objsh.hxx>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#define MAX_TOGGLEAREA_WIDTH 20
#define MAX_TOGGLEAREA_HEIGHT 20
using namespace ::com::sun::star;
// implemented in 'sfx2/source/appl/childwin.cxx'
extern sal_Bool GetPosSizeFromString( const String& rStr, Point& rPos, Size& rSize );
extern sal_Bool GetSplitSizeFromString( const String& rStr, Size& rSize );
// If you want to change the number you also have to:
// - Add new slot ids to sfxsids.hrc
// - Add new slots to frmslots.sdi
// - Add new slot definitions to sfx.sdi
static const int NUM_OF_DOCKINGWINDOWS = 10;
class SfxTitleDockingWindow;
class SfxTitleDockingWindow : public SfxDockingWindow
{
Window* m_pWrappedWindow;
USHORT m_nID;
public:
SfxTitleDockingWindow(
SfxBindings* pBindings ,
SfxChildWindow* pChildWin ,
Window* pParent ,
WinBits nBits,
USHORT nID);
virtual ~SfxTitleDockingWindow();
Window* GetWrappedWindow() const { return m_pWrappedWindow; }
void SetWrappedWindow(Window* const pWindow);
virtual void StateChanged( StateChangedType nType );
virtual long Notify( NotifyEvent& rNEvt );
virtual void Resize();
virtual void Resizing( Size& rSize );
virtual BOOL Close();
};
namespace
{
struct WindowState
{
::rtl::OUString sTitle;
};
}
static uno::WeakReference< container::XNameAccess > m_xWindowStateConfiguration;
static uno::WeakReference< frame::XModuleManager > m_xModuleManager;
static bool lcl_getWindowState( const uno::Reference< container::XNameAccess >& xWindowStateMgr, const ::rtl::OUString& rResourceURL, WindowState& rWindowState )
{
bool bResult = false;
try
{
uno::Any a;
uno::Sequence< beans::PropertyValue > aWindowState;
a = xWindowStateMgr->getByName( rResourceURL );
if ( a >>= aWindowState )
{
for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ )
{
if ( aWindowState[n].Name.equalsAscii( "UIName" ))
{
aWindowState[n].Value >>= rWindowState.sTitle;
}
}
}
bResult = true;
}
catch ( container::NoSuchElementException& )
{
bResult = false;
}
return bResult;
}
SfxDockingWrapper::SfxDockingWrapper( Window* pParentWnd ,
USHORT nId ,
SfxBindings* pBindings ,
SfxChildWinInfo* pInfo )
: SfxChildWindow( pParentWnd , nId )
{
uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory();
const rtl::OUString aDockWindowResourceURL( RTL_CONSTASCII_USTRINGPARAM( "private:resource/dockingwindow/" ));
SfxTitleDockingWindow* pTitleDockWindow = new SfxTitleDockingWindow( pBindings, this, pParentWnd,
WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE, nId);
pWindow = pTitleDockWindow;
eChildAlignment = SFX_ALIGN_NOALIGNMENT;
// Use factory manager to retrieve XWindow factory. That can be used to instanciate
// the real window factory.
uno::Reference< lang::XSingleComponentFactory > xFactoryMgr(
xServiceManager->createInstance(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.ui.WindowContentFactoryManager"))),
uno::UNO_QUERY );
if (xFactoryMgr.is())
{
SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame()->GetFrameInterface(), uno::UNO_QUERY );
uno::Sequence< uno::Any > aArgs(2);
beans::PropertyValue aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" ));
aPropValue.Value = uno::makeAny( xFrame );
aArgs[0] <<= aPropValue;
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" ));
// create a resource URL from the nId provided by the sfx2
::rtl::OUString aResourceURL( aDockWindowResourceURL );
aResourceURL += ::rtl::OUString::valueOf(sal_Int32(nId));
aPropValue.Value = uno::makeAny( aResourceURL );
aArgs[1] <<= aPropValue;
uno::Reference< awt::XWindow > xWindow;
try
{
uno::Reference< beans::XPropertySet > xProps( xServiceManager, uno::UNO_QUERY );
uno::Reference< uno::XComponentContext > xContext;
if ( xProps.is() )
xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
if ( xContext.is() )
{
xWindow = uno::Reference< awt::XWindow>(
xFactoryMgr->createInstanceWithArgumentsAndContext( aArgs, xContext ),
uno::UNO_QUERY );
}
uno::Reference< frame::XModuleManager > xModuleManager( m_xModuleManager );
if ( !xModuleManager.is() )
{
xModuleManager = uno::Reference< frame::XModuleManager >(
xServiceManager->createInstance(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ))),
uno::UNO_QUERY );
m_xModuleManager = xModuleManager;
}
uno::Reference< container::XNameAccess > xWindowStateConfiguration( m_xWindowStateConfiguration );
if ( !xWindowStateConfiguration.is() )
{
xWindowStateConfiguration = uno::Reference< container::XNameAccess >(
xServiceManager->createInstance(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.WindowStateConfiguration" ))),
uno::UNO_QUERY );
m_xWindowStateConfiguration = xWindowStateConfiguration;
}
::rtl::OUString sModuleIdentifier = xModuleManager->identify( xFrame );
uno::Reference< container::XNameAccess > xModuleWindowState(
xWindowStateConfiguration->getByName( sModuleIdentifier ),
uno::UNO_QUERY );
if ( xModuleWindowState.is() )
{
WindowState aDockWinState;
if ( lcl_getWindowState( xModuleWindowState, aResourceURL, aDockWinState ))
pTitleDockWindow->SetText( aDockWinState.sTitle );
}
}
catch ( beans::UnknownPropertyException& )
{
}
catch ( uno::RuntimeException& )
{
}
catch ( uno::Exception& )
{
}
Window* pContentWindow = VCLUnoHelper::GetWindow(xWindow);
pTitleDockWindow->SetWrappedWindow(pContentWindow);
}
pWindow->SetOutputSizePixel( Size( 270, 240 ) );
( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo );
SetHideNotDelete( TRUE );
}
SfxChildWindow* SfxDockingWrapper::CreateImpl(
Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo* pInfo )
{
SfxChildWindow *pWin = new SfxDockingWrapper(pParent, nId, pBindings, pInfo); return pWin;
}
sal_uInt16 SfxDockingWrapper::GetChildWindowId ()
{
DBG_ASSERT( false, "This method shouldn't be called!" );
return 0;
}
void SfxDockingWrapper::RegisterChildWindow (sal_Bool bVis, SfxModule *pMod, sal_uInt16 nFlags)
{
// pre-register a couple of docking windows
for (int i=0; i < NUM_OF_DOCKINGWINDOWS; i++ )
{
USHORT nID = USHORT(SID_DOCKWIN_START+i);
SfxChildWinFactory *pFact = new SfxChildWinFactory( SfxDockingWrapper::CreateImpl, nID, 0xffff );
pFact->aInfo.nFlags |= nFlags;
pFact->aInfo.bVisible = bVis;
SfxChildWindow::RegisterChildWindow(pMod, pFact);
}
}
SfxChildWinInfo SfxDockingWrapper::GetInfo() const
{
SfxChildWinInfo aInfo = SfxChildWindow::GetInfo();
((SfxDockingWindow*)GetWindow())->FillInfo( aInfo );
return aInfo;
};
SfxTitleDockingWindow::SfxTitleDockingWindow( SfxBindings* pBind ,
SfxChildWindow* pChildWin ,
Window* pParent ,
WinBits nBits,
USHORT nID ) :
SfxDockingWindow( pBind ,
pChildWin ,
pParent ,
nBits ),
m_pWrappedWindow(0),
m_nID(nID)
{
}
SfxTitleDockingWindow::~SfxTitleDockingWindow()
{
delete m_pWrappedWindow;
}
void SfxTitleDockingWindow::SetWrappedWindow( Window* const pWindow )
{
m_pWrappedWindow = pWindow;
if (m_pWrappedWindow)
{
m_pWrappedWindow->SetParent(this);
m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
m_pWrappedWindow->Show();
}
}
long SfxTitleDockingWindow::Notify( NotifyEvent& rNEvt )
{
return SfxDockingWindow::Notify( rNEvt );
}
void SfxTitleDockingWindow::StateChanged( StateChangedType nType )
{
if ( nType == STATE_CHANGE_INITSHOW )
{
Window* pWindow = GetWrappedWindow();
if ( pWindow )
{
pWindow->SetSizePixel( GetOutputSizePixel() );
pWindow->Show();
}
}
SfxDockingWindow::StateChanged(nType);
}
void SfxTitleDockingWindow::Resize()
{
SfxDockingWindow::Resize();
if (m_pWrappedWindow)
m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
}
void SfxTitleDockingWindow::Resizing( Size &rSize )
{
SfxDockingWindow::Resizing( rSize );
if (m_pWrappedWindow)
m_pWrappedWindow->SetSizePixel( GetOutputSizePixel() );
}
BOOL SfxTitleDockingWindow::Close()
{
return SfxDockingWindow::Close();
}
namespace
{
struct ChildrenRegisteredMap : public rtl::Static< bool, ChildrenRegisteredMap > {};
}
static bool lcl_checkDockingWindowID( USHORT nID )
{
if (nID < SID_DOCKWIN_START || nID >= USHORT(SID_DOCKWIN_START+NUM_OF_DOCKINGWINDOWS))
return false;
else
return true;
}
static SfxWorkWindow* lcl_getWorkWindowFromXFrame( const uno::Reference< frame::XFrame >& rFrame )
{
// We need to find the corresponding SfxFrame of our XFrame
SfxFrame* pFrame = SfxFrame::GetFirst();
SfxFrame* pXFrame = 0;
while ( pFrame )
{
uno::Reference< frame::XFrame > xViewShellFrame( pFrame->GetFrameInterface() );
if ( xViewShellFrame == rFrame )
{
pXFrame = pFrame;
break;
}
else
pFrame = SfxFrame::GetNext( *pFrame );
}
// If we have a SfxFrame we can retrieve the work window (Sfx layout manager for docking windows)
if ( pXFrame )
return pXFrame->GetWorkWindow_Impl();
else
return NULL;
}
/*
Factory function used by the framework layout manager to "create" a docking window with a special name.
The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot range located
in sfxsids.hrc (currently SID_DOCKWIN_START = 9800).
*/
void SAL_CALL SfxDockingWindowFactory( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName )
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
USHORT nID = USHORT(rDockingWindowName.toInt32());
// Check the range of the provided ID otherwise nothing will happen
if ( lcl_checkDockingWindowID( nID ))
{
SfxWorkWindow* pWorkWindow = lcl_getWorkWindowFromXFrame( rFrame );
if ( pWorkWindow )
{
SfxChildWindow* pChildWindow = pWorkWindow->GetChildWindow_Impl(nID);
if ( !pChildWindow )
{
// Register window at the workwindow child window list
pWorkWindow->SetChildWindow_Impl( nID, true, false );
}
}
}
}
/*
Function used by the framework layout manager to determine the visibility state of a docking window with
a special name. The string rDockingWindowName MUST BE a valid ID! The ID is pre-defined by a certain slot
range located in sfxsids.hrc (currently SID_DOCKWIN_START = 9800).
*/
bool SAL_CALL IsDockingWindowVisible( const uno::Reference< frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName )
{
::vos::OGuard aGuard( Application::GetSolarMutex() );
USHORT nID = USHORT(rDockingWindowName.toInt32());
// Check the range of the provided ID otherwise nothing will happen
if ( lcl_checkDockingWindowID( nID ))
{
SfxWorkWindow* pWorkWindow = lcl_getWorkWindowFromXFrame( rFrame );
if ( pWorkWindow )
{
SfxChildWindow* pChildWindow = pWorkWindow->GetChildWindow_Impl(nID);
if ( pChildWindow )
return true;
}
}
return false;
}
class SfxDockingWindow_Impl
{
friend class SfxDockingWindow;

View File

@@ -50,7 +50,8 @@ EXCEPTIONSFILES=\
$(SLO)$/partwnd.obj \
$(SLO)$/recfloat.obj \
$(SLO)$/templdlg.obj \
$(SLO)$/dinfdlg.obj
$(SLO)$/dinfdlg.obj \
$(SLO)$/dockwin.obj
SLOFILES =\
$(EXCEPTIONSFILES) \
@@ -58,7 +59,6 @@ SLOFILES =\
$(SLO)$/alienwarn.obj \
$(SLO)$/basedlgs.obj \
$(SLO)$/dinfedt.obj \
$(SLO)$/dockwin.obj \
$(SLO)$/intro.obj \
$(SLO)$/macropg.obj \
$(SLO)$/mgetempl.obj \

View File

@@ -62,13 +62,13 @@ SfxNavigatorWrapper::SfxNavigatorWrapper( Window* pParentWnd ,
}
SfxNavigator::SfxNavigator( SfxBindings* pBind ,
SfxChildWindow* pChildWin ,
Window* pParent ,
WinBits nBits )
SfxChildWindow* pChildWin ,
Window* pParent ,
WinBits nBits )
: SfxDockingWindow( pBind ,
pChildWin ,
pParent ,
nBits )
pChildWin ,
pParent ,
nBits )
, pWrapper( pChildWin )
{
SetText( String( SfxResId( SID_NAVIGATOR ) ) );