diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-06 10:41:26 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-06 10:41:26 +0000 |
commit | 99424695db45102f334b3222284175381c5fd8ce (patch) | |
tree | 4f56e914aad2b673b9cc5ace910ec2ea6fa3e288 /toolkit | |
parent | 111e4cd0f5fcda92c1da0cffcf675a8cf8ac3f49 (diff) |
INTEGRATION: CWS layout_DEV300 (1.1.2); FILE ADDED
2008/02/11 15:13:37 jcn 1.1.2.2: Make layout stuff in toolkit build with --enable-layout.
2008/02/08 18:44:42 jcn 1.1.2.1: Initial toolkit import from ee9a2fcc29d7e2f01cc80ef7c13bf7bc7d55ae7e.
layout/source/awt -> toolkit/source/awt
layout/source/core -> toolkit/source/layout
layout/source/wrapper -> toolkit/source/vclcompat
layout/inc/layout -> toolkit/inc/layout
layout/source/inc -> toolkit/inc/layout
layout/workben -> toolkit/workben/layout
That's ooo-build trunk r11539 @ ooh680-m5/src680-m245.
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxdialog.cxx | 355 | ||||
-rw-r--r-- | toolkit/source/awt/vclxdialog.hxx | 114 | ||||
-rw-r--r-- | toolkit/source/awt/vclxscroller.hxx | 84 |
3 files changed, 553 insertions, 0 deletions
diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx new file mode 100644 index 000000000000..2c7fdcf40424 --- /dev/null +++ b/toolkit/source/awt/vclxdialog.cxx @@ -0,0 +1,355 @@ +#include "vclxdialog.hxx" + +#ifndef _TOOLKIT_HELPER_PROPERTY_HXX_ +#include "toolkit/helper/property.hxx" +#endif +#ifndef _COM_SUN_STAR_AWT_SCROLLBARORIENTATION_HPP_ +#include <com/sun/star/awt/ScrollBarOrientation.hpp> +#endif + + +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + +#include <vcl/msgbox.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/syswin.hxx> +#include <vcl/menu.hxx> +#include <vcl/dialog.hxx> + +#include <vcl/svapp.hxx> +#include <vcl/syschild.hxx> +#include <vcl/sysdata.hxx> +#include <cppuhelper/typeprovider.hxx> + +#include <toolkit/awt/vclxmenu.hxx> +#include <toolkit/helper/macros.hxx> + +#include <com/sun/star/lang/SystemDependent.hpp> +#include <com/sun/star/awt/SystemDependentXWindow.hpp> + +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/helper/vclunohelper.hxx> +#endif + +#include <com/sun/star/awt/PosSize.hpp> + +#include "../layout/timer.hxx" + +using namespace toolkit; +//........................................................................ +namespace layoutimpl +{ +//........................................................................ + +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star; + +//==================================================================== +//= VCLXDialog +//==================================================================== +DBG_NAME( VCLXDialog ) +//-------------------------------------------------------------------- +VCLXDialog::VCLXDialog() +: VCLXWindow() + , VCLXDialog_Base() + , Bin() + , bRealized( false ), bResizeSafeguard( false ) +{ + DBG_CTOR( VCLXDialog, NULL ); + +/* mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() ); + assert(mxLayoutUnit.is());*/ +} + +//-------------------------------------------------------------------- +VCLXDialog::~VCLXDialog() +{ + DBG_DTOR( VCLXDialog, NULL ); +} + +//-------------------------------------------------------------------- +IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXDialog, VCLXWindow, Bin, VCLXDialog_Base ) + +//-------------------------------------------------------------------- +IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXDialog, VCLXWindow, VCLXDialog_Base ) + +//-------------------------------------------------------------------- +void SAL_CALL VCLXDialog::dispose( ) throw(RuntimeException) +{ + { + ::vos::OGuard aGuard( GetMutex() ); + + EventObject aDisposeEvent; + aDisposeEvent.Source = *this; +// maTabListeners.disposeAndClear( aDisposeEvent ); + } + + VCLXWindow::dispose(); +} + +void VCLXDialog::resizedCb() +{ + queueResize(); +} + +void SAL_CALL VCLXDialog::allocateArea( const css::awt::Rectangle &rArea ) + throw (css::uno::RuntimeException) +{ + awt::Size reqSize = Bin::getMinimumSize(); + reqSize.Height = getHeightForWidth( rArea.Width ); + + if ( !bRealized ) + { + setPosSize( 0, 0, reqSize.Width, reqSize.Height, PosSize::SIZE ); + bRealized = true; + setVisible( true ); + } + else + { + awt::Size curSize = getSize(); + if ( reqSize.Width > curSize.Width ) + setPosSize( 0, 0, reqSize.Width, 0, PosSize::WIDTH ); + if ( reqSize.Height > curSize.Height ) + setPosSize( 0, 0, 0, reqSize.Height, PosSize::HEIGHT ); + } + + awt::Size size = getSize(); + maAllocation.Width = size.Width; + maAllocation.Height = size.Height; + + Bin::allocateArea( maAllocation ); +} + +//-------------------------------------------------------------------- +void VCLXDialog::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) +{ + ::vos::OClearableGuard aGuard( GetMutex() ); + + switch ( _rVclWindowEvent.GetId() ) + { + case VCLEVENT_WINDOW_RESIZE: + resizedCb(); + default: + aGuard.clear(); + VCLXWindow::ProcessWindowEvent( _rVclWindowEvent ); + break; + } +} + +//-------------------------------------------------------------------- +void SAL_CALL VCLXDialog::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( GetWindow() ) + { + sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); + switch ( nPropertyId ) + { + default: + VCLXWindow::setProperty( PropertyName, Value ); + } + } +} + +//-------------------------------------------------------------------- +Any SAL_CALL VCLXDialog::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Any aReturn; + if ( GetWindow() ) + { + sal_uInt16 nPropertyId = GetPropertyId( PropertyName ); + switch ( nPropertyId ) + { + default: + aReturn = VCLXWindow::getProperty( PropertyName ); + } + } + return aReturn; +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Any VCLXDialog::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::com::sun::star::uno::Any aRet; + Window* pWindow = VCLXWindow::GetWindow(); + if ( pWindow ) + { + const SystemEnvData* pSysData = ((SystemWindow *)pWindow)->GetSystemData(); + if ( pSysData ) + { +#if (defined WNT) + if ( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 ) + { + aRet <<= (sal_Int32)pSysData->hWnd; + } +#elif (defined OS2) + if ( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 ) + { + aRet <<= (sal_Int32)pSysData->hWnd; + } +#elif (defined QUARTZ) + if ( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC ) + { + aRet <<= (sal_IntPtr)pSysData->rWindow; + } +#elif (defined UNX) + if ( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW ) + { + ::com::sun::star::awt::SystemDependentXWindow aSD; + aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay)); + aSD.WindowHandle = pSysData->aWindow; + aRet <<= aSD; + } +#endif + } + } + return aRet; +} + + +void VCLXDialog::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ +#if 1 + ::vos::OGuard aGuard( GetMutex() ); + + GetTopWindowListeners().addInterface( rxListener ); +#else +#endif +} + +void VCLXDialog::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException) +{ +#if 1 + ::vos::OGuard aGuard( GetMutex() ); + + GetTopWindowListeners().removeInterface( rxListener ); +#endif +} + +void VCLXDialog::toFront( ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + ((WorkWindow*)pWindow)->ToTop( TOTOP_RESTOREWHENMIN ); +} + +void VCLXDialog::toBack( ) throw(::com::sun::star::uno::RuntimeException) +{ +/* Not possible in VCL... + + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + { + ((WorkWindow*)pWindow)->ToBack(); + } +*/ +} + +void VCLXDialog::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& /*rxMenu*/ ) throw(::com::sun::star::uno::RuntimeException) +{ +#if 0 + ::vos::OGuard aGuard( GetMutex() ); + + SystemWindow* pWindow = (SystemWindow*) GetWindow(); + if ( pWindow ) + { + pWindow->SetMenuBar( NULL ); + if ( rxMenu.is() ) + { + VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu ); + if ( pMenu && !pMenu->IsPopupMenu() ) + pWindow->SetMenuBar( (MenuBar*) pMenu->GetMenu() ); + } + } + mxMenuBar = rxMenu; +#endif +} + +void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + Window* pWindow = GetWindow(); + if ( pWindow ) + pWindow->SetText( Title ); +} + +::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + ::rtl::OUString aTitle; + Window* pWindow = GetWindow(); + if ( pWindow ) + aTitle = pWindow->GetText(); + return aTitle; +} + +sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + sal_Int16 nRet = 0; + if ( GetWindow() ) + { + Dialog* pDlg = (Dialog*) GetWindow(); + Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP ); + Window* pOldParent = NULL; + if ( pParent && !pParent->IsReallyVisible() ) + { + pOldParent = pDlg->GetParent(); + Window* pFrame = pDlg->GetWindow( WINDOW_FRAME ); + if ( pFrame != pDlg ) + pDlg->SetParent( pFrame ); + } + nRet = pDlg->Execute(); + if ( pOldParent ) + pDlg->SetParent( pOldParent ); + } + return nRet; +} + +void VCLXDialog::endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException) +{ + ::vos::OGuard aGuard( GetMutex() ); + + if ( nResult == BUTTONID_HELP ) + { + // UGH: c&p button.cxx + ::Window* pFocusWin = Application::GetFocusWindow(); + if ( !pFocusWin ) + pFocusWin = GetWindow(); + + HelpEvent aEvt( pFocusWin->GetPointerPosPixel(), HELPMODE_CONTEXT ); + pFocusWin->RequestHelp( aEvt ); + return; + } + + Dialog* pDlg = (Dialog*) GetWindow(); + if ( pDlg ) + pDlg->EndDialog( nResult ); +} + +void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException) +{ + endDialog( 0 ); +} + +//........................................................................ +} // namespace toolkit +//........................................................................ diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx new file mode 100644 index 000000000000..6f08334d94c2 --- /dev/null +++ b/toolkit/source/awt/vclxdialog.hxx @@ -0,0 +1,114 @@ +#ifndef LAYOUT_AWT_VCLXDIALOG_HXX +#define LAYOUT_AWT_VCLXDIALOG_HXX + +#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_ +#include <toolkit/awt/vclxwindow.hxx> +#endif +#ifndef _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ +#include <toolkit/helper/listenermultiplexer.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> +#endif +#ifndef _COMPHELPER_UNO3_HXX_ +#include <comphelper/uno3.hxx> +#endif + +#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> +#include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/awt/XDialog2.hpp> + +#include <com/sun/star/awt/XSimpleTabController.hpp> +#include "../layout/bin.hxx" + +#include <com/sun/star/awt/MaxChildrenException.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include "forward.hxx" + +using namespace toolkit; + +//........................................................................ +namespace layoutimpl +{ +//........................................................................ + +//==================================================================== +//= VCLXDialog +//==================================================================== + +typedef ::cppu::ImplHelper3 < ::com::sun::star::awt::XTopWindow, + ::com::sun::star::awt::XSystemDependentWindowPeer, + ::com::sun::star::awt::XDialog2 + > VCLXDialog_Base; + +class VCLXDialog :public VCLXWindow + ,public VCLXDialog_Base + ,public Bin +{ +public: + VCLXDialog(); + + // ::com::sun::star::awt::XDialog2 + void SAL_CALL endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException); + +protected: + ~VCLXDialog( ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // VclWindowPeer + virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + + // VCLXWindow + void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); + + // ::com::sun::star::awt::XSystemDependendtWindowPeer + ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XTopWindow + void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL toFront( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL toBack( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XDialog + void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException); + ::rtl::OUString SAL_CALL getTitle( ) throw(::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException); + void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutContainer + virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea ) + throw (css::uno::RuntimeException); + + void resizedCb(); + + static void ImplGetPropertyIds( std::list< sal_uInt16 > &/*aIds*/ ) + { + } + virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); } + +private: + VCLXDialog( const VCLXDialog& ); // never implemented + VCLXDialog& operator=( const VCLXDialog& ); // never implemented + bool bRealized, bResizeSafeguard; + + css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit; +}; + +//........................................................................ +} // namespace layoutimpl +//........................................................................ + +#endif /*LAYOUT_AWT_VCLXDIALOG_HXX*/ diff --git a/toolkit/source/awt/vclxscroller.hxx b/toolkit/source/awt/vclxscroller.hxx new file mode 100644 index 000000000000..084afc87fd3c --- /dev/null +++ b/toolkit/source/awt/vclxscroller.hxx @@ -0,0 +1,84 @@ +#ifndef LAYOUT_AWT_VCLXSCROLLER_HXX +#define LAYOUT_AWT_VCLXSCROLLER_HXX + +#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_ +#include <toolkit/awt/vclxwindow.hxx> +#endif +#ifndef _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_ +#include <toolkit/helper/listenermultiplexer.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif +#ifndef _COMPHELPER_UNO3_HXX_ +#include <comphelper/uno3.hxx> +#endif +#include "../layout/bin.hxx" + +#include <com/sun/star/awt/MaxChildrenException.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include "forward.hxx" + +class ScrollBar; +class FixedImage; +using namespace toolkit; + +//........................................................................ +namespace layoutimpl +{ +//........................................................................ + +//==================================================================== +//= VCLXScroller +//==================================================================== + +class VCLXScroller :public VCLXWindow + ,public Bin +{ +public: + VCLXScroller( ); + +protected: + ~VCLXScroller( ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XLayoutContainer + virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize() + throw(::com::sun::star::uno::RuntimeException); + + // VclWindowPeer + virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException); + + // VCLXWindow + void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); + +private: + VCLXScroller( const VCLXScroller& ); // never implemented + VCLXScroller& operator=( const VCLXScroller& ); // never implemented + + // because the underlying window is only setup-ed after construction, init + // scrollbars at play-time + void ensureScrollBars(); + + FixedImage *mpContent; // dummy + ScrollBar *mpHorScrollBar, *mpVerScrollBar; + DECL_LINK( ScrollHdl, ScrollBar* ); +}; + +//........................................................................ +} // namespacetoolkit +//........................................................................ + +#endif /*LAYOUT_AWT_VCLXSCROLLER_HXX*/ |