diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-09 11:45:13 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-09 11:45:13 +0200 |
commit | 0cb550725d7e128e72e67739aff5338865c28abc (patch) | |
tree | 0ffabe03dd8b83e273539f26f633273d50c37397 /toolkit | |
parent | aa611d78df11fcc1e35ead5fa093143bf17e4cf6 (diff) | |
parent | 1f0839c836781bc41f8c301b6262eabc978c90f8 (diff) |
merge commit to DEV300_m57
Diffstat (limited to 'toolkit')
30 files changed, 1684 insertions, 25 deletions
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx index 24a16d5868dd..543c8a85c401 100644 --- a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx +++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx @@ -129,7 +129,7 @@ DECL_LISTENERMULTIPLEXER_END // ---------------------------------------------------- // class MouseListenerMultiplexer // ---------------------------------------------------- -DECL_LISTENERMULTIPLEXER_START( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener ) +DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener ) void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException); diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index da2de08c9544..fbfe90494279 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -165,7 +165,7 @@ namespace rtl { #define BASEPROPERTY_IMAGEPOSITION 113 // sal_Int16 #define BASEPROPERTY_NATIVE_WIDGET_LOOK 114 // sal_Bool #define BASEPROPERTY_VERTICALALIGN 115 // VerticalAlignment -#define BASEPROPERTY_WHEELWITHOUTFOCUS 116 // sal_Bool +#define BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR 116 // sal_Int16 #define BASEPROPERTY_GRAPHIC 117 // css.graphic.XGraphic #define BASEPROPERTY_STEP_TIME 118 // sal_Int32 #define BASEPROPERTY_DECORATION 119 // sal_Bool @@ -191,6 +191,13 @@ namespace rtl { #define BASEPROPERTY_IMAGE_SCALE_MODE 137 #define BASEPROPERTY_WRITING_MODE 138 #define BASEPROPERTY_CONTEXT_WRITING_MODE 139 +#define BASEPROPERTY_GRID_SHOWROWHEADER 140 +#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER 141 +#define BASEPROPERTY_GRID_DATAMODEL 142 +#define BASEPROPERTY_GRID_COLUMNMODEL 143 +#define BASEPROPERTY_GRID_SELECTIONMODE 144 +#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool + // Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen. #define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx index 31513f0f2358..89810ae69482 100644 --- a/toolkit/inc/toolkit/helper/servicenames.hxx +++ b/toolkit/inc/toolkit/helper/servicenames.hxx @@ -95,6 +95,12 @@ extern const sal_Char __FAR_DATA szServiceName_TreeControl[]; extern const sal_Char __FAR_DATA szServiceName_TreeControlModel[]; extern const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[]; +extern const sal_Char __FAR_DATA szServiceName_GridControl[]; +extern const sal_Char __FAR_DATA szServiceName_GridControlModel[]; +extern const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[]; +extern const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[]; +extern const sal_Char __FAR_DATA szServiceName_GridColumn[]; + extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[]; extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[]; extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[]; diff --git a/toolkit/inc/toolkit/helper/vclunohelper.hxx b/toolkit/inc/toolkit/helper/vclunohelper.hxx index 68583f99b447..1c5d89a3cc64 100644 --- a/toolkit/inc/toolkit/helper/vclunohelper.hxx +++ b/toolkit/inc/toolkit/helper/vclunohelper.hxx @@ -135,11 +135,15 @@ public: static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException); static sal_Int16 /* com.sun.star.util.MeasureUnit.* */ ConvertToMeasurementUnit(MapUnit /* MapModeUnit */ _nMapModeUnit) throw (::com::sun::star::lang::IllegalArgumentException); + static ::Size /* VCLSize */ ConvertToVCLSize(::com::sun::star::awt::Size const& _aSize); static ::com::sun::star::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize); + static ::Point /* VCLPoint */ ConvertToVCLPoint(::com::sun::star::awt::Point const& _aPoint); static ::com::sun::star::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint); + static ::Rectangle ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect ); + static ::com::sun::star::awt::Rectangle ConvertToAWTRect( ::Rectangle const & _rRect ); }; diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst index 7fa0efaded53..304d0e7c978f 100644 --- a/toolkit/prj/build.lst +++ b/toolkit/prj/build.lst @@ -7,6 +7,7 @@ ti toolkit\source\helper nmake - all ti_helper ti_inc NULL ti toolkit\source\awt nmake - all ti_awt ti_inc NULL ti toolkit\source\controls nmake - all ti_controls ti_inc NULL ti toolkit\source\controls\tree nmake - all ti_tree NULL +ti toolkit\source\controls\grid nmake - all ti_grid NULL ti toolkit\source\layout\core nmake - all ti_layout_core NULL ti toolkit\source\layout\vcl nmake - all ti_layout_vcl NULL -ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_layout_vcl NULL +ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_grid ti_layout_vcl NULL diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index 09e318800184..337400c08713 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -35,6 +35,7 @@ #include <com/sun/star/awt/KeyModifier.hpp> #include <com/sun/star/awt/MouseEvent.hpp> #include <com/sun/star/awt/MouseButton.hpp> +#include <com/sun/star/awt/MouseWheelBehavior.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/Style.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> @@ -82,6 +83,7 @@ using ::com::sun::star::style::VerticalAlignment_BOTTOM; using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE; namespace WritingMode2 = ::com::sun::star::text::WritingMode2; +namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior; //==================================================================== @@ -226,6 +228,8 @@ private: ::toolkit::AccessibilityClient maAccFactory; bool mbDisposed; bool mbDrawingOntoParent; // no bit mask, is passed around by reference + sal_Bool mbEnableVisible; + sal_Bool mbDirectVisible; ::osl::Mutex maListenerContainerMutex; ::cppu::OInterfaceContainerHelper maWindow2Listeners; @@ -273,6 +277,15 @@ public: */ VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps ); + /** synchronously mbEnableVisible + */ + void setEnableVisible( sal_Bool bEnableVisible ) { mbEnableVisible = bEnableVisible; } + sal_Bool isEnableVisible() { return mbEnableVisible; } + /** synchronously mbDirectVisible; + */ + void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; } + sal_Bool isDirectVisible() { return mbDirectVisible; } + /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners */ void notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType ); @@ -347,6 +360,8 @@ VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, ,mrMutex( _rMutex ) ,mbDisposed( false ) ,mbDrawingOntoParent( false ) + ,mbEnableVisible(sal_True) + ,mbDirectVisible(sal_True) ,maListenerContainerMutex( ) ,maWindow2Listeners( maListenerContainerMutex ) ,maDockableWindowListeners( maListenerContainerMutex ) @@ -625,7 +640,12 @@ void VCLXWindow::SetWindow( Window* pWindow ) SetOutputDevice( pWindow ); if ( GetWindow() ) + { GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) ); + sal_Bool bDirectVisible = pWindow ? pWindow->IsVisible() : false; + mpImpl->setDirectVisible( bDirectVisible ); + } + } void VCLXWindow::suspendVclEventListening( ) @@ -1226,7 +1246,8 @@ void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::Ru } } */ - pWindow->Show( bVisible ); + mpImpl->setDirectVisible( bVisible ); + pWindow->Show( bVisible && mpImpl->isEnableVisible() ); } } @@ -1529,6 +1550,7 @@ void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDe BASEPROPERTY_HELPURL, BASEPROPERTY_TEXT, BASEPROPERTY_PRINTABLE, + BASEPROPERTY_ENABLEVISIBLE, // for visibility BASEPROPERTY_TABSTOP, 0); @@ -1634,19 +1656,27 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: } break; - case BASEPROPERTY_WHEELWITHOUTFOCUS: + case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR: { - sal_Bool bWheelOnHover( sal_True ); - if ( Value >>= bWheelOnHover ) - { - AllSettings aSettings = pWindow->GetSettings(); - MouseSettings aMouseSettings = aSettings.GetMouseSettings(); + sal_uInt16 nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY ); + OSL_VERIFY( Value >>= nWheelBehavior ); - aMouseSettings.SetNoWheelActionWithoutFocus( !bWheelOnHover ); - aSettings.SetMouseSettings( aMouseSettings ); + AllSettings aSettings = pWindow->GetSettings(); + MouseSettings aMouseSettings = aSettings.GetMouseSettings(); - pWindow->SetSettings( aSettings, TRUE ); + USHORT nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY ); + switch ( nWheelBehavior ) + { + case MouseWheelBehavior::SCROLL_DISABLED: nVclBehavior = MOUSE_WHEEL_DISABLE; break; + case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclBehavior = MOUSE_WHEEL_FOCUS_ONLY; break; + case MouseWheelBehavior::SCROLL_ALWAYS: nVclBehavior = MOUSE_WHEEL_ALWAYS; break; + default: + OSL_ENSURE( false, "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" ); } + + aMouseSettings.SetWheelBehavior( nWheelBehavior ); + aSettings.SetMouseSettings( aMouseSettings ); + pWindow->SetSettings( aSettings, TRUE ); } break; @@ -1672,6 +1702,19 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: setEnable( b ); } break; + case BASEPROPERTY_ENABLEVISIBLE: + { + sal_Bool b = sal_False; + if ( Value >>= b ) + { + if( b != mpImpl->isEnableVisible() ) + { + mpImpl->setEnableVisible( b ); + pWindow->Show( b && mpImpl->isDirectVisible() ); + } + } + } + break; case BASEPROPERTY_TEXT: case BASEPROPERTY_LABEL: case BASEPROPERTY_TITLE: @@ -2122,10 +2165,19 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: aProp <<= mpImpl->mnWritingMode; break; - case BASEPROPERTY_WHEELWITHOUTFOCUS: + case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR: { - sal_Bool bWheelOnHover = !GetWindow()->GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus(); - aProp <<= bWheelOnHover; + USHORT nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior(); + sal_Int16 nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; + switch ( nVclBehavior ) + { + case MOUSE_WHEEL_DISABLE: nBehavior = MouseWheelBehavior::SCROLL_DISABLED; break; + case MOUSE_WHEEL_FOCUS_ONLY: nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; break; + case MOUSE_WHEEL_ALWAYS: nBehavior = MouseWheelBehavior::SCROLL_ALWAYS; break; + default: + OSL_ENSURE( false, "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" ); + } + aProp <<= nBehavior; } break; @@ -2137,6 +2189,10 @@ void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com:: aProp <<= (sal_Bool) GetWindow()->IsEnabled(); break; + case BASEPROPERTY_ENABLEVISIBLE: + aProp <<= (sal_Bool) mpImpl->isEnableVisible(); + break; + case BASEPROPERTY_TEXT: case BASEPROPERTY_LABEL: case BASEPROPERTY_TITLE: @@ -2411,7 +2467,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: if ( !pWindow ) return; - if ( pWindow ) + if ( isDesignMode() || mpImpl->isEnableVisible() ) { TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow ); if ( pTabPage ) @@ -2481,7 +2537,7 @@ void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno: vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData()); bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER ) || ( pDev->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW ) - || ( pPDFExport && ! pPDFExport->GetIsExportFormFields() ); + || ( pPDFExport != NULL ); if ( bDrawSimple ) { pWindow->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS ); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 59cb9632b7e1..b49fa1a621d6 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -386,6 +386,7 @@ void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DEFAULTBUTTON, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_GRAPHIC, BASEPROPERTY_HELPTEXT, @@ -668,6 +669,7 @@ void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BORDERCOLOR, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_GRAPHIC, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -796,6 +798,7 @@ void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) PushPropertyIds( rIds, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_GRAPHIC, BASEPROPERTY_HELPTEXT, @@ -1095,6 +1098,7 @@ void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) PushPropertyIds( rIds, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_GRAPHIC, BASEPROPERTY_HELPTEXT, @@ -1380,6 +1384,9 @@ void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled ) // ---------------------------------------------------- void VCLXSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) { + PushPropertyIds( rIds, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, + 0 ); VCLXEdit::ImplGetPropertyIds( rIds ); } @@ -1519,6 +1526,7 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_DROPDOWN, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -1532,6 +1540,7 @@ void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXWindow::ImplGetPropertyIds( rIds ); } @@ -2709,6 +2718,7 @@ void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BORDERCOLOR, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -2737,6 +2747,7 @@ void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BORDERCOLOR, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -2879,6 +2890,7 @@ void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BORDERCOLOR, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, BASEPROPERTY_LINEINCREMENT, @@ -3358,6 +3370,7 @@ void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ECHOCHAR, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HARDLINEBREAKS, BASEPROPERTY_HELPTEXT, @@ -3734,6 +3747,7 @@ void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_DROPDOWN, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -3748,6 +3762,7 @@ void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_ALIGN, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box // #i92690# / 2008-08-12 / frank.schoenheit@sun.com @@ -4250,6 +4265,7 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_DROPDOWN, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_EXTDATEFORMAT, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, @@ -4266,6 +4282,7 @@ void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -4586,6 +4603,7 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_BORDERCOLOR, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_EXTTIMEFORMAT, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, @@ -4605,6 +4623,7 @@ void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -4887,6 +4906,7 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DECIMALACCURACY, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -4906,6 +4926,7 @@ void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5227,6 +5248,7 @@ void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DECIMALACCURACY, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -5244,6 +5266,7 @@ void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_CUSTOMUNITTEXT, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5477,6 +5500,7 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DECIMALACCURACY, BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -5496,6 +5520,7 @@ void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } @@ -5828,6 +5853,7 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_DEFAULTCONTROL, BASEPROPERTY_EDITMASK, BASEPROPERTY_ENABLED, + BASEPROPERTY_ENABLEVISIBLE, BASEPROPERTY_FONTDESCRIPTOR, BASEPROPERTY_HELPTEXT, BASEPROPERTY_HELPURL, @@ -5841,6 +5867,7 @@ void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) BASEPROPERTY_HIDEINACTIVESELECTION, BASEPROPERTY_WRITING_MODE, BASEPROPERTY_CONTEXT_WRITING_MODE, + BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR, 0); VCLXFormattedSpinField::ImplGetPropertyIds( rIds ); } diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 47028cc8e071..07d459a6111a 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -66,6 +66,7 @@ #include <vcl/image.hxx> #include "tree/treecontrol.hxx" +#include "grid/gridcontrol.hxx" #include <map> #include <algorithm> @@ -453,6 +454,8 @@ Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUSt pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >; else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 ) pNewModel = new OGeometryControlModel< UnoTreeModel >; + else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 ) + pNewModel = new OGeometryControlModel< UnoGridModel >; if ( !pNewModel ) { @@ -515,6 +518,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() th pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel ); pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel ); pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel ); + pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel ); } return *pNamesSeq; diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx index 19fb4c3609d0..6171067f1185 100644 --- a/toolkit/source/controls/formattedcontrol.cxx +++ b/toolkit/source/controls/formattedcontrol.cxx @@ -142,6 +142,7 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX ); ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); ImplRegisterProperty( BASEPROPERTY_FORMATKEY ); ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER ); @@ -161,6 +162,7 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT ); ImplRegisterProperty( BASEPROPERTY_WRITING_MODE ); ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE ); + ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR ); Any aTreatAsNumber; aTreatAsNumber <<= (sal_Bool) sal_True; diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx new file mode 100644 index 000000000000..bdd7fb475afe --- /dev/null +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * 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: treedatamodel.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_toolkit.hxx" +#include "defaultgridcolumnmodel.hxx" +#include <comphelper/sequence.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <rtl/ref.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; + +#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" )) + +namespace toolkit +{ + +/////////////////////////////////////////////////////////////////////// +// class DefaultGridColumnModel +/////////////////////////////////////////////////////////////////////// + +DefaultGridColumnModel::DefaultGridColumnModel() +: columns(std::vector< Reference< XGridColumn > >()) +{ +} + +//--------------------------------------------------------------------- + +DefaultGridColumnModel::~DefaultGridColumnModel() +{ +} + +//--------------------------------------------------------------------- + +void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent ) +{ + ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() ); + if( pIter ) + { + ::cppu::OInterfaceIteratorHelper aListIter(*pIter); + while(aListIter.hasMoreElements()) + { + XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next()); + switch( eType ) + { + case column_added: pListener->columnAdded(aEvent); break; + case column_removed: pListener->columnRemoved(aEvent); break; + case column_changed: pListener->columnChanged(aEvent); break; + } + } + } +} + +//--------------------------------------------------------------------- + +void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL ); + broadcast( column_changed, aEvent); +} + +//--------------------------------------------------------------------- + +void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); + broadcast( column_added, aEvent); +} + +//--------------------------------------------------------------------- + +void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn ); + broadcast( column_changed, aEvent); +} + +//--------------------------------------------------------------------- +// XDefaultGridColumnModel +//--------------------------------------------------------------------- +::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException) +{ + return selectionAllowed; +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException) +{ + sal_Bool oldValue = selectionAllowed; + selectionAllowed = value; + broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed)); +} + +//--------------------------------------------------------------------- + +::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException) +{ + return columns.size(); +} + +//--------------------------------------------------------------------- + +::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + columns.push_back(column); + + sal_Int32 index = columns.size() - 1; + broadcast_add(index, column ); + return index; +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (::com::sun::star::uno::RuntimeException) +{ + return comphelper::containerToSequence(columns); +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +{ + if ( index >=0 && index < ((sal_Int32)columns.size())) + return columns[index]; + else + return Reference< XGridColumn >(); +} + +void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- +// XComponent +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridColumnModel::dispose() throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) ); + BrdcstHelper.aLC.disposeAndClear( aEvent ); + +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridColumnModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.addListener( XEventListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridColumnModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.removeListener( XEventListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- +// XServiceInfo +//--------------------------------------------------------------------- + +::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridColumnModel" ) ); + return aImplName; +} + +//--------------------------------------------------------------------- + +sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + return ServiceName.equalsAscii( szServiceName_DefaultGridColumnModel ); +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) ); + static const Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +} + +Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& ) +{ + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel ); +} + diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx new file mode 100644 index 000000000000..b230188f9107 --- /dev/null +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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: griddatamodel.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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_toolkit.hxx" +#include <com/sun/star/awt/grid/XGridColumnModel.hpp> +#include <com/sun/star/awt/grid/XGridColumn.hpp> +#include <com/sun/star/awt/grid/GridColumnEvent.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <rtl/ref.hxx> +#include <vector> +#include <toolkit/helper/mutexandbroadcasthelper.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; + +namespace toolkit +{ + +enum broadcast_type { column_added, column_removed, column_changed}; + +class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >, + public MutexAndBroadcastHelper +{ +public: + DefaultGridColumnModel(); + virtual ~DefaultGridColumnModel(); + + // XGridColumnModel + + virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException); + + // XComponent + virtual void SAL_CALL dispose( ) throw (RuntimeException); + virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + +private: + + void broadcast( broadcast_type eType, const GridColumnEvent& aEvent ); + void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ); + void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ); + void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn ); + + std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns; + sal_Bool selectionAllowed; +}; + +} diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx new file mode 100644 index 000000000000..865be80f55a7 --- /dev/null +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -0,0 +1,310 @@ +/************************************************************************* + * + * 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: treedatamodel.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_toolkit.hxx" +#include "defaultgriddatamodel.hxx" +#include <comphelper/sequence.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <rtl/ref.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; + +#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" )) +#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" )) + +namespace toolkit +{ + +/////////////////////////////////////////////////////////////////////// +// class DefaultGridDataModel +/////////////////////////////////////////////////////////////////////// + +DefaultGridDataModel::DefaultGridDataModel() +: rowHeight(0), + rowHeaders(std::vector< ::rtl::OUString >()) +{ +} + +//--------------------------------------------------------------------- + +DefaultGridDataModel::~DefaultGridDataModel() +{ +} + +void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent ) +{ + ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() ); + if( pIter ) + { + ::cppu::OInterfaceIteratorHelper aListIter(*pIter); + while(aListIter.hasMoreElements()) + { + XGridDataListener* pListener = static_cast<XGridDataListener*>(aListIter.next()); + switch( eType ) + { + case row_added: pListener->rowAdded(aEvent); break; + case row_removed: pListener->rowRemoved(aEvent); break; + case data_changed: pListener->dataChanged(aEvent); break; + } + } + } +} + +//--------------------------------------------------------------------- + +void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() ); + broadcast( data_changed, aEvent); +} + +//--------------------------------------------------------------------- + +void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData ); + broadcast( row_added, aEvent); +} + +//--------------------------------------------------------------------- + +void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ) +{ + Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) ); + GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData ); + broadcast( row_removed, aEvent); +} + +//--------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// XDefaultGridDataModel +//--------------------------------------------------------------------- +::sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeight() throw (::com::sun::star::uno::RuntimeException) +{ + return rowHeight; +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int32 oldValue = rowHeight; + rowHeight = value; + + broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) ); +} + +//--------------------------------------------------------------------- + +::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException) +{ + return data.size(); +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getRowHeaders() throw (::com::sun::star::uno::RuntimeException) +{ + return comphelper::containerToSequence(rowHeaders); +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > oldValue( comphelper::containerToSequence(rowHeaders) ); + + std::vector< rtl::OUString>::iterator iterator; + int i = 0; + int sequenceSize = value.getLength(); + + for(iterator = rowHeaders.begin(); iterator != rowHeaders.end(); iterator++) + { + if ( sequenceSize > i ) + *iterator = value[i]; + else + *iterator = ::rtl::OUString(); + i++; + } + + broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) ); +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException) +{ + // store header name + rowHeaders.push_back(headername); + + + // store row data + std::vector< rtl::OUString > newRow( + comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rRowdata)); + + data.push_back( newRow ); + + broadcast_add( data.size()-1, headername, rRowdata); + +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +{ + if ( index >= 0 && index <= getRowCount()-1) + { + /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index )) + { + ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection(); + selectedRow.erase(selectedRows.begin()+index); + }*/ + + ::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] ); + rowHeaders.erase(rowHeaders.begin() + index); + + Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] ); + data.erase(data.begin() + index); + broadcast_remove( index, headerName, rowData); + } + else + return; +} +//--------------------------------------------------------------------- +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException) +{ + + std::vector< std::vector< ::rtl::OUString > >::iterator iterator; + std::vector< Sequence< ::rtl::OUString > > dummyContainer(0); + + + for(iterator = data.begin(); iterator != data.end(); iterator++) + { + Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator)); + dummyContainer.push_back( cols ); + } + Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer)); + + return dataSequence; +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.addListener( XGridDataListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener ); +} + +void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException) +{ + rowHeaders.clear(); + data.clear(); + broadcast_remove( -1, ::rtl::OUString(), 0); +} + +//--------------------------------------------------------------------- +// XComponent +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::dispose() throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + ::com::sun::star::lang::EventObject aEvent; + aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) ); + BrdcstHelper.aLC.disposeAndClear( aEvent ); + +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.addListener( XEventListener::static_type(), xListener ); +} + +//--------------------------------------------------------------------- + +void SAL_CALL DefaultGridDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) +{ + BrdcstHelper.removeListener( XEventListener::static_type(), xListener ); +} +//--------------------------------------------------------------------- +// XServiceInfo +//--------------------------------------------------------------------- + +::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) ); + return aImplName; +} + +//--------------------------------------------------------------------- + +sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel ); +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridDataModel ) ); + static const Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +} + +Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& ) +{ + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel ); +} + diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx new file mode 100644 index 000000000000..18000c9f5a71 --- /dev/null +++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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: griddatamodel.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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_toolkit.hxx" +#include <com/sun/star/awt/grid/XGridDataModel.hpp> +#include <com/sun/star/awt/grid/GridDataEvent.hpp> +#include <com/sun/star/awt/grid/XGridDataListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <rtl/ref.hxx> +#include <vector> +#include <toolkit/helper/mutexandbroadcasthelper.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; + +namespace toolkit +{ + +enum broadcast_type { row_added, row_removed, data_changed}; + +class DefaultGridDataModel : public ::cppu::WeakImplHelper2< XGridDataModel, XServiceInfo >, + public MutexAndBroadcastHelper +{ +public: + DefaultGridDataModel(); + virtual ~DefaultGridDataModel(); + + // XGridDataModel + virtual ::sal_Int32 SAL_CALL getRowHeight() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRowHeight(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeAll() throw (RuntimeException); + + // XComponent + virtual void SAL_CALL dispose( ) throw (RuntimeException); + virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + +private: + + void broadcast( broadcast_type eType, const GridDataEvent& aEvent ); + void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue ); + void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ); + void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData ); + + sal_Int32 rowHeight; + std::vector< std::vector < ::rtl::OUString > > data; + std::vector< ::rtl::OUString > rowHeaders; +}; + +} diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx new file mode 100644 index 000000000000..8b398b4aed58 --- /dev/null +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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: treedatamodel.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_toolkit.hxx" +#include "gridcolumn.hxx" +#include <comphelper/sequence.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <rtl/ref.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; + +namespace toolkit +{ + +/////////////////////////////////////////////////////////////////////// +// class GridColumn +/////////////////////////////////////////////////////////////////////// + +GridColumn::GridColumn() +: identifier(Any()) +{ +} + +//--------------------------------------------------------------------- + +GridColumn::~GridColumn() +{ +} + +//--------------------------------------------------------------------- + +//--------------------------------------------------------------------- +// XGridColumn +//--------------------------------------------------------------------- + +::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException) +{ + return identifier; +} + +//--------------------------------------------------------------------- + +void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException) +{ + value >>= identifier; +} + +//-------------------------------------------------------------------- + +::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException) +{ + return columnWidth; +} + +//-------------------------------------------------------------------- + +void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException) +{ + columnWidth = value; +} + +//-------------------------------------------------------------------- + +::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException) +{ + return title; +} + +//-------------------------------------------------------------------- + +void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException) +{ + title = value; +} + +//--------------------------------------------------------------------- +// XComponent +//--------------------------------------------------------------------- + +void SAL_CALL GridColumn::dispose() throw (RuntimeException) +{ +} + +//--------------------------------------------------------------------- + +void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) +{ + (void) xListener; +} + +//--------------------------------------------------------------------- + +void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException) +{ + (void) xListener; +} + +//--------------------------------------------------------------------- +// XServiceInfo +//--------------------------------------------------------------------- + +::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.GridColumn" ) ); + return aImplName; +} + +//--------------------------------------------------------------------- + +sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + return ServiceName.equalsAscii( szServiceName_GridColumn ); +} + +//--------------------------------------------------------------------- + +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException) +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + static const OUString aServiceName( OUString::createFromAscii( szServiceName_GridColumn ) ); + static const Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +} + +Reference< XInterface > SAL_CALL GridColumn_CreateInstance( const Reference< XMultiServiceFactory >& ) +{ + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::GridColumn ); +} + diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx new file mode 100644 index 000000000000..a451054ce93f --- /dev/null +++ b/toolkit/source/controls/grid/gridcolumn.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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: griddatamodel.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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_toolkit.hxx" +#include <com/sun/star/awt/grid/XGridColumn.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <rtl/ref.hxx> +#include <vector> +#include <toolkit/helper/mutexandbroadcasthelper.hxx> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; + +namespace toolkit +{ + +class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >, + public MutexAndBroadcastHelper +{ +public: + GridColumn(); + virtual ~GridColumn(); + + // XGridColumn + virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose( ) throw (RuntimeException); + virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException); + virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException); + + +private: + Any identifier; + sal_Int32 columnWidth; + ::rtl::OUString title; +}; + +} diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx new file mode 100644 index 000000000000..c642d8a0dcce --- /dev/null +++ b/toolkit/source/controls/grid/gridcontrol.cxx @@ -0,0 +1,273 @@ +/************************************************************************* + * + * 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: gridcontrol.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_toolkit.hxx" + +#include <gridcontrol.hxx> + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/view/SelectionType.hpp> +#include <com/sun/star/awt/grid/XGridDataModel.hpp> +#include <com/sun/star/awt/grid/ScrollBarMode.hpp> +#include <toolkit/helper/unopropertyarrayhelper.hxx> +#include <toolkit/helper/property.hxx> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <comphelper/processfactory.hxx> +#include <osl/diagnose.h> + +using ::rtl::OUString; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt::grid; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::view; + +namespace toolkit +{ +// ---------------------------------------------------- +// class UnoGridModel +// ---------------------------------------------------- +UnoGridModel::UnoGridModel() +{ + ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); + ImplRegisterProperty( BASEPROPERTY_BORDER ); + ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); + ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); + ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_FILLCOLOR ); + ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); + ImplRegisterProperty( BASEPROPERTY_HELPURL ); + ImplRegisterProperty( BASEPROPERTY_PRINTABLE ); + ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable + ImplRegisterProperty( BASEPROPERTY_HSCROLL ); + ImplRegisterProperty( BASEPROPERTY_VSCROLL ); + ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER ); + ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER ); + ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL ); + ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL ); + ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE ); + +} + +UnoGridModel::UnoGridModel( const UnoGridModel& rModel ) +: UnoControlModel( rModel ) +{ +} + +UnoControlModel* UnoGridModel::Clone() const +{ + return new UnoGridModel( *this ); +} + +OUString UnoGridModel::getServiceName() throw(RuntimeException) +{ + return OUString::createFromAscii( szServiceName_GridControlModel ); +} + +Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const +{ + switch( nPropId ) + { + case BASEPROPERTY_DEFAULTCONTROL: + return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) ); + case BASEPROPERTY_GRID_SELECTIONMODE: + return uno::makeAny( SelectionType(1) ); + default: + return UnoControlModel::ImplGetDefaultValue( nPropId ); + } + +} + +::cppu::IPropertyArrayHelper& UnoGridModel::getInfoHelper() +{ + static UnoPropertyArrayHelper* pHelper = NULL; + if ( !pHelper ) + { + Sequence<sal_Int32> aIDs = ImplGetPropertyIds(); + pHelper = new UnoPropertyArrayHelper( aIDs ); + } + return *pHelper; +} + +// XMultiPropertySet +Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(RuntimeException) +{ + static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + + +// ---------------------------------------------------- +// class UnoGridControl +// ---------------------------------------------------- +UnoGridControl::UnoGridControl() +: mSelectionMode(SelectionType(1)) +{ +} + +OUString UnoGridControl::GetComponentServiceName() +{ + return OUString::createFromAscii( "Grid" ); +} + +void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException) +{ + UnoControl::dispose(); +} + +void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException) +{ + UnoControlBase::createPeer( rxToolkit, rParentPeer ); + + Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW ); + + Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW ); + Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW ); + + Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW ); + xGridDataModel->addDataListener(xListener); +} + + +// ------------------------------------------------------------------- +// XGridControl +// ------------------------------------------------------------------- + +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException) +{ + Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW ); + Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW ); + + return xGridColumnModel; +} + +void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException) +{ + Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW ); + xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model)); +} + +::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException) +{ + Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW ); + Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW ); + + return xGridDataModel; +} + +void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException) +{ + Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW ); + xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model)); +} + +::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +{ + return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y ); +} + +/* +void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener ); +} + +void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener ); +} +*/ +// ------------------------------------------------------------------- +// XGridSelection +// ------------------------------------------------------------------- + +::sal_Int32 SAL_CALL UnoGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +{ + return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMinSelectionIndex(); +} + +::sal_Int32 SAL_CALL UnoGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +{ + return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex(); +} + +void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length); +} + +void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length ); +} + +::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException) +{ + return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection(); +} + +::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +{ + return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty(); +} + +::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +{ + return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ); +} + +void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( y ); +} + +void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener ); +} + +void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener ); +} +} + +Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& ) +{ + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl ); +} + +Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& ) +{ + return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel ); +} diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx new file mode 100644 index 000000000000..5648c812fbff --- /dev/null +++ b/toolkit/source/controls/grid/gridcontrol.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * 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: gridcontrol.hxx,v $ + * $Revision: 1.3 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef TOOLKIT_GRID_CONTROL_HXX +#define TOOLKIT_GRID_CONTROL_HXX + +#include <com/sun/star/awt/grid/XGridControl.hpp> +#include <com/sun/star/view/SelectionType.hpp> +#include <toolkit/controls/unocontrols.hxx> +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/helper/servicenames.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <toolkit/helper/listenermultiplexer.hxx> + +namespace toolkit { + +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::container; + +// =================================================================== +// = UnoGridModel +// =================================================================== +class UnoGridModel : public UnoControlModel +{ +protected: + Any ImplGetDefaultValue( sal_uInt16 nPropId ) const; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + +public: + UnoGridModel(); + UnoGridModel( const UnoGridModel& rModel ); + + UnoControlModel* Clone() const; + + // ::com::sun::star::beans::XMultiPropertySet + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::io::XPersistObject + ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel ) +}; + + +// =================================================================== +// = UnoGridControl +// =================================================================== +class UnoGridControl : public ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::grid::XGridControl > +{ +public: + UnoGridControl(); + ::rtl::OUString GetComponentServiceName(); + + // ::com::sun::star::lang::XComponent + void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::XControl + void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::grid::XGridControl + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException); + //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::awt::grid::XGridSelection + + virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, szServiceName_GridControl ) + + using UnoControl::getPeer; +private: + ::com::sun::star::view::SelectionType mSelectionMode; +}; + +} // toolkit + +#endif // _TOOLKIT_TREE_CONTROL_HXX diff --git a/toolkit/source/controls/grid/makefile.mk b/toolkit/source/controls/grid/makefile.mk new file mode 100644 index 000000000000..7c904b3ef02e --- /dev/null +++ b/toolkit/source/controls/grid/makefile.mk @@ -0,0 +1,54 @@ +#************************************************************************* +# +# 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: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +PRJ=..$/..$/.. + +PRJNAME=toolkit +TARGET=grid + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- + +SLOFILES= \ + $(SLO)$/gridcontrol.obj\ + $(SLO)$/defaultgriddatamodel.obj\ + $(SLO)$/defaultgridcolumnmodel.obj\ + $(SLO)$/gridcolumn.obj + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk diff --git a/toolkit/source/controls/tkspinbutton.cxx b/toolkit/source/controls/tkspinbutton.cxx index 5c4e47e240dc..138b849a190c 100644 --- a/toolkit/source/controls/tkspinbutton.cxx +++ b/toolkit/source/controls/tkspinbutton.cxx @@ -60,6 +60,7 @@ namespace toolkit ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); ImplRegisterProperty( BASEPROPERTY_ORIENTATION ); diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx index 68c3212f5692..2949954bb13c 100644 --- a/toolkit/source/controls/tree/treecontrol.cxx +++ b/toolkit/source/controls/tree/treecontrol.cxx @@ -65,6 +65,7 @@ UnoTreeModel::UnoTreeModel() ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_FILLCOLOR ); ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 92c27e33ead0..0775b6ee74f3 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -1049,7 +1049,13 @@ void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException) } if ( xDrawPeerView.is() ) + { + Reference< XVclWindowPeer > xWindowPeer; + xWindowPeer.set( xDrawPeer, UNO_QUERY ); + if ( xWindowPeer.is() ) + xWindowPeer->setDesignMode( mbDesignMode ); xDrawPeerView->draw( x, y ); + } if ( bDisposeDrawPeer ) xDrawPeer->dispose(); @@ -1420,7 +1426,6 @@ void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException) // remember this mbDesignMode = bOn; xWindow = xWindow.query( getPeer() ); - // dispose our current AccessibleContext, if we have one // (changing the design mode implies having a new implementation for this context, // so the old one must be declared DEFUNC) diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 0f54a204a010..cc5faa27eec8 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/awt/FontWidth.hpp> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/awt/FontSlant.hpp> +#include <com/sun/star/awt/MouseWheelBehavior.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/io/XMarkableStream.hpp> @@ -294,6 +295,7 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) case BASEPROPERTY_IMAGEALIGN: aDefault <<= (sal_Int16) 1 /*ImageAlign::TOP*/; break; case BASEPROPERTY_IMAGEPOSITION: aDefault <<= (sal_Int16) 12 /*ImagePosition::Centered*/; break; case BASEPROPERTY_PUSHBUTTONTYPE: aDefault <<= (sal_Int16) 0 /*PushButtonType::STANDARD*/; break; + case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:aDefault <<= (sal_Int16) awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY; break; case BASEPROPERTY_DATEMAX: aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break; case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break; @@ -338,13 +340,13 @@ void UnoControlModel::ImplPropertyChanged( sal_uInt16 ) case BASEPROPERTY_HARDLINEBREAKS: case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break; - case BASEPROPERTY_WHEELWITHOUTFOCUS: case BASEPROPERTY_HIDEINACTIVESELECTION: case BASEPROPERTY_ENFORCE_FORMAT: case BASEPROPERTY_AUTOCOMPLETE: case BASEPROPERTY_SCALEIMAGE: case BASEPROPERTY_ENABLED: case BASEPROPERTY_PRINTABLE: + case BASEPROPERTY_ENABLEVISIBLE: case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break; case BASEPROPERTY_HELPTEXT: diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index 771a69c532b9..3abacef7b67f 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -481,6 +481,7 @@ UnoControlFileControlModel::UnoControlFileControlModel() ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); @@ -1778,6 +1779,7 @@ UnoControlGroupBoxModel::UnoControlGroupBoxModel() { ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); @@ -3594,6 +3596,7 @@ UnoControlProgressBarModel::UnoControlProgressBarModel() ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR ); ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_FILLCOLOR ); ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); @@ -3723,6 +3726,7 @@ UnoControlFixedLineModel::UnoControlFixedLineModel() ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR ); ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL ); ImplRegisterProperty( BASEPROPERTY_ENABLED ); + ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE ); ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR ); ImplRegisterProperty( BASEPROPERTY_HELPTEXT ); ImplRegisterProperty( BASEPROPERTY_HELPURL ); diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index bace3ff94771..e71c03bae47d 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -48,6 +48,9 @@ #include <com/sun/star/awt/FontStrikeout.hpp> #include <com/sun/star/awt/FontPitch.hpp> #include <com/sun/star/awt/tree/XTreeDataModel.hpp> +#include <com/sun/star/awt/grid/XGridDataModel.hpp> +#include <com/sun/star/awt/grid/XGridColumnModel.hpp> +#include <com/sun/star/awt/grid/ScrollBarMode.hpp> #include <com/sun/star/view/SelectionType.hpp> #include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> @@ -252,12 +255,11 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_DEP_PROP_3 ( "VisibleSize", VISIBLESIZE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_2 ( "Activated", ACTIVATED, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Complete", COMPLETE, sal_Bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "CurrentItemID", CURRENTITEMID, sal_Int16, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "WheelWithoutFocus", WHEELWITHOUTFOCUS, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "MouseWheelBehavior", MOUSE_WHEEL_BEHAVIOUR, sal_Int16, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "StepTime", STEP_TIME, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Decoration", DECORATION, sal_Bool, BOUND, MAYBEDEFAULT ), @@ -272,7 +274,13 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ), - DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ) + DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ), + DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ), + DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ), + DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ) }; pPropertyInfos = aImplPropertyInfos; nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo ); diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx index d9264f22cb51..ea29c9810beb 100644 --- a/toolkit/source/helper/registerservices.cxx +++ b/toolkit/source/helper/registerservices.cxx @@ -202,6 +202,12 @@ IMPL_CREATEINSTANCE( UnoThrobberControlModel ) extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ); + extern sal_Bool SAL_CALL comp_AsyncCallback_component_writeInfo( void * serviceManager, void * registryKey ); extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey ); @@ -287,6 +293,11 @@ TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl ); registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink ); registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel ); + registerServices( xRegistryKey, "GridControl", szServiceName_GridControl ); + registerServices( xRegistryKey, "GridControlModel", szServiceName_GridControlModel ); + registerServices( xRegistryKey, "DefaultGridDataModel", szServiceName_DefaultGridDataModel ); + registerServices( xRegistryKey, "DefaultGridColumnModel", szServiceName_DefaultGridColumnModel ); + registerServices( xRegistryKey, "GridColumn", szServiceName_GridColumn ); comp_AsyncCallback_component_writeInfo( _pServiceManager, _pRegistryKey ); comp_Layout_component_writeInfo( _pServiceManager, _pRegistryKey ); @@ -369,6 +380,12 @@ TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplemen CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL ) CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL ) CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL ) + CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL ); + CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL ); + CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL ); + CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL ); + CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL ); + if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 ) return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey ); diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx index 903f18f95eae..f00e7a2b09fa 100644 --- a/toolkit/source/helper/servicenames.cxx +++ b/toolkit/source/helper/servicenames.cxx @@ -101,4 +101,8 @@ const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.sta const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl"; const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink"; const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel"; - +const sal_Char __FAR_DATA szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid"; +const sal_Char __FAR_DATA szServiceName_GridControlModel[] = "com.sun.star.awt.grid.UnoControlGridModel"; +const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel"; +const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel"; +const sal_Char __FAR_DATA szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn"; diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index a652d493e653..96b8908558a7 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -65,6 +65,13 @@ using namespace ::com::sun::star; case WINDOW_OKBUTTON: case WINDOW_CANCELBUTTON: return new VCLXButton; case WINDOW_CHECKBOX: return new VCLXCheckBox; + // --> OD 2009-06-29 #i95042# + // A Window of type <MetricBox> is inherited from type <ComboBox>. + // Thus, it does make more sense to return a <VCLXComboBox> instance + // instead of only a <VCLXWindow> instance, especially regarding its + // corresponding accessibility API. + case WINDOW_METRICBOX: + // <-- case WINDOW_COMBOBOX: return new VCLXComboBox; case WINDOW_SPINFIELD: case WINDOW_NUMERICFIELD: @@ -109,7 +116,6 @@ using namespace ::com::sun::star; // case WINDOW_DATEBOX: // case WINDOW_GROUPBOX: // case WINDOW_LONGCURRENCYBOX: - // case WINDOW_METRICBOX: // case WINDOW_SPLITTER: // case WINDOW_STATUSBAR: // case WINDOW_TABCONTROL: diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index d76b56a6a37d..029e520baca6 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -736,4 +736,12 @@ com::sun::star::awt::Point VCLUnoHelper::ConvertToAWTPoint(::Point /* VCLPoint * return aAWTPoint; } +::Rectangle VCLUnoHelper::ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect ) +{ + return ::Rectangle( _rRect.X, _rRect.Y, _rRect.X + _rRect.Width - 1, _rRect.Y + _rRect.Height - 1 ); +} +::com::sun::star::awt::Rectangle VCLUnoHelper::ConvertToAWTRect( ::Rectangle const & _rRect ) +{ + return ::com::sun::star::awt::Rectangle( _rRect.Left(), _rRect.Top(), _rRect.GetWidth(), _rRect.GetHeight() ); +} diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk index d6a1e5f15c65..a04bdcbdf801 100644 --- a/toolkit/util/makefile.mk +++ b/toolkit/util/makefile.mk @@ -52,6 +52,7 @@ USE_DEFFILE=TRUE LIB1TARGET= $(SLB)$/$(TARGET).lib LIB1FILES= $(SLB)$/awt.lib \ $(SLB)$/tree.lib \ + $(SLB)$/grid.lib \ $(SLB)$/controls.lib \ $(SLB)$/helper.lib\ $(SLB)$/layout-core.lib \ diff --git a/toolkit/util/toolkit.xml b/toolkit/util/toolkit.xml index 8ec1a48d440d..2fb4588550bc 100644 --- a/toolkit/util/toolkit.xml +++ b/toolkit/util/toolkit.xml @@ -701,4 +701,50 @@ <status value="beta" /> <supported-service>com.sun.star.awt.tree.MutableTreeNode</supported-service> </component-description> + <component-description> + <author>Tobias Krause</author> + <name>stardiv.Toolkit.UnoGridModel</name> + <description>specifies the model of a grid control</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta" /> + <supported-service>com.sun.star.awt.grid.UnoControlGridModel</supported-service> + </component-description> + <component-description> + <author>Tobias Krause</author> + <name>stardiv.Toolkit.UnoGridControl</name> + <description>specifies a grid control</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta" /> + <supported-service>com.sun.star.awt.grid.UnoControlGrid</supported-service> + </component-description> + <component-description> + <author>Tobias Krause</author> + <name>stardiv.Toolkit.DefaultGridDataModel</name> + <description>specifies the grid control default data model</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta" /> + <supported-service>com.sun.star.awt.grid.DefaultGridDataModel</supported-service> + </component-description> + <component-description> + <author>Tobias Krause</author> + <name>stardiv.Toolkit.DefaultGridColumnModel</name> + <description>specifies the grid control default column model</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta" /> + <supported-service>com.sun.star.awt.grid.DefaultGridColumnModel</supported-service> + </component-description> + <component-description> + <author>Tobias Krause</author> + <name>stardiv.Toolkit.GridColumn</name> + <description>specifies the grid coloumn model</description> + <loader-name>com.sun.star.loader.SharedLibrary</loader-name> + <language>c++</language> + <status value="beta" /> + <supported-service>com.sun.star.awt.grid.GridColumn</supported-service> + </component-description> + </module-description>
\ No newline at end of file |