diff options
author | Noel Power <noel.power@suse.com> | 2012-09-05 17:59:46 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2012-09-11 16:04:10 +0100 |
commit | 7d69c50413884d5cba1498b5af3298820fb4621b (patch) | |
tree | 7ca333ed444140c00146069ef034084c7ec9abc4 /toolkit | |
parent | 595f467ec8de68f3faeacd02005f613bcf61f42c (diff) |
misc fixes and improvements
hook in new properties into the property controller
allow new values to be passed to control
Change-Id: Ibbf1c1de4bfc7cb15e46d0d6704a025e5f0d048c
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx | 2 | ||||
-rw-r--r-- | toolkit/inc/toolkit/helper/property.hxx | 6 | ||||
-rw-r--r-- | toolkit/source/awt/scrollabledialog.cxx | 46 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 40 | ||||
-rw-r--r-- | toolkit/source/controls/dialogcontrol.cxx | 10 | ||||
-rw-r--r-- | toolkit/source/helper/property.cxx | 6 |
6 files changed, 70 insertions, 40 deletions
diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx index d307c2aca3bb..1135138e863b 100644 --- a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx +++ b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx @@ -48,6 +48,7 @@ #include <com/sun/star/awt/tab/XTabPageModel.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <tools/gen.hxx> // ---------------------------------------------------- // class ControlModelContainerBase // ---------------------------------------------------- @@ -223,6 +224,7 @@ typedef ::cppu::AggImplInheritanceHelper2 < UnoControlContainer class ControlContainerBase : public ContainerControl_IBase { + ::Size ImplGetSizePixel( const ::Size& inSize ); protected: bool mbSizeModified; bool mbPosModified; diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx index 4a1c07bb102f..f496026a47df 100644 --- a/toolkit/inc/toolkit/helper/property.hxx +++ b/toolkit/inc/toolkit/helper/property.hxx @@ -211,8 +211,10 @@ namespace rtl { #define BASEPROPERTY_ROW_HEADER_WIDTH 158 #define BASEPROPERTY_COLUMN_HEADER_HEIGHT 159 #define BASEPROPERTY_USE_GRID_LINES 160 -#define BASEPROPERTY_HORISCROLL 161 -#define BASEPROPERTY_VERTSCROLL 162 +#define BASEPROPERTY_SCROLLWIDTH 161 +#define BASEPROPERTY_SCROLLHEIGHT 162 +#define BASEPROPERTY_SCROLLTOP 163 +#define BASEPROPERTY_SCROLLLEFT 164 // These properties are not bound, they are always extracted from the BASEPROPERTY_FONTDESCRIPTOR property diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx index 53388bf0b2e9..dc3d3ab2dba2 100644 --- a/toolkit/source/awt/scrollabledialog.cxx +++ b/toolkit/source/awt/scrollabledialog.cxx @@ -82,52 +82,26 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB ) lcl_Scroll(mnScrollPos.X(), nPos ); else if( pSB == &maHScrollBar ) lcl_Scroll(nPos, mnScrollPos.Y() ); -#if 0 - sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos(); - Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() ); - Point aScroll; - if( pSB == &maVScrollBar ) - { - printf("vertical scroll %d\n", nPos ); - Size aTmpScroll( nPos, nPos ); - long nScroll = mnScrollPos.Y() - aTmpScroll.Width(); - // I'm guessing I need to call scroll for ( stuff ) to happen - Scroll(0, nScroll, aScrollableArea ); - mnScrollPos.Y() = nPos; - aScroll.Y() = nScroll; - } - else if( pSB == &maHScrollBar ) - { - printf("horizontal scroll %d\n", nPos ); - Size aTmpScroll( nPos, nPos ); - long nScroll = mnScrollPos.X() - aTmpScroll.Width(); - Scroll( nScroll, 0, aScrollableArea); - mnScrollPos.X() = nPos; - aScroll.X() = nScroll; - } - - // Manually scroll all children ( except the scrollbars ) - for ( int index = 0; index < GetChildCount(); ++index ) - { - Window* pChild = GetChild( index ); - if ( pChild && pChild != &maVScrollBar && pChild != &maHScrollBar ) - { - Point aPos = pChild->GetPosPixel(); - aPos += Point( aScroll.X(), aScroll.Y() ); - pChild->SetPosPixel( aPos ); - } - } -#endif return 1; } +void ScrollableDialog::SetScrollTop( long nTop ) +{ + printf("ScrollableDialog::SetScrollTop(%d)\n", nTop ); +} +void ScrollableDialog::SetScrollLeft( long nLeft ) +{ + printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft ); +} void ScrollableDialog::SetScrollWidth( long nWidth ) { + printf("ScrollableDialog::SetScrollWidth(%d)\n", nWidth ); maScrollArea.Width() = nWidth; } void ScrollableDialog::SetScrollHeight( long nHeight ) { + printf("ScrollableDialog::SetScrollHeight(%d)\n", nHeight ); maScrollArea.Height() = nHeight; } diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index d5a313dc5117..a70d5acd7337 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <toolkit/awt/vclxwindows.hxx> +#include "toolkit/awt/scrollabledialog.hxx" #include <com/sun/star/awt/ScrollBarOrientation.hpp> #include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/graphic/XGraphicProvider.hpp> @@ -2450,8 +2451,47 @@ throw(::com::sun::star::uno::RuntimeException) sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID; sal_uInt16 nPropType = GetPropertyId( PropertyName ); + printf("XDialog setProperty... %s\n", rtl::OUStringToOString( PropertyName, RTL_TEXTENCODING_UTF8 ).getStr() ); switch ( nPropType ) { + case BASEPROPERTY_SCROLLHEIGHT: + case BASEPROPERTY_SCROLLWIDTH: + case BASEPROPERTY_SCROLLTOP: + case BASEPROPERTY_SCROLLLEFT: + { + sal_Int32 nVal =0; + Value >>= nVal; + Size aSize( nVal, nVal ); + Window* pWindow = GetWindow(); + MapMode aMode( MAP_APPFONT ); + if ( pWindow ) + { + OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() ); + if ( !pDev ) + pDev = pWindow->GetParent(); + + aSize = pDev->LogicToPixel( aSize, aMode ); + toolkit::ScrollableDialog* pScrollable = static_cast< toolkit::ScrollableDialog* >( pWindow ); + switch ( nPropType ) + { + case BASEPROPERTY_SCROLLHEIGHT: + pScrollable->SetScrollHeight( aSize.Height() ); + break; + case BASEPROPERTY_SCROLLWIDTH: + pScrollable->SetScrollWidth( aSize.Width() ); + break; + case BASEPROPERTY_SCROLLTOP: + pScrollable->SetScrollTop( aSize.Height() ); + break; + case BASEPROPERTY_SCROLLLEFT: + pScrollable->SetScrollLeft( aSize.Width() ); + break; + default: + break; + } + } + break; + } case BASEPROPERTY_GRAPHIC: { Reference< XGraphic > xGraphic; diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 630f64aa232f..67d794fbcb2b 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -175,6 +175,10 @@ UnoControlDialogModel::UnoControlDialogModel( const Reference< XMultiServiceFact ImplRegisterProperty( BASEPROPERTY_IMAGEURL ); ImplRegisterProperty( BASEPROPERTY_HSCROLL ); ImplRegisterProperty( BASEPROPERTY_VSCROLL ); + ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH ); + ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT ); + ImplRegisterProperty( BASEPROPERTY_SCROLLTOP ); + ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT ); Any aBool; aBool <<= (sal_Bool) sal_True; @@ -232,6 +236,12 @@ Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const case BASEPROPERTY_DEFAULTCONTROL: aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog ); break; + case BASEPROPERTY_SCROLLWIDTH: + case BASEPROPERTY_SCROLLHEIGHT: + case BASEPROPERTY_SCROLLTOP: + case BASEPROPERTY_SCROLLLEFT: + aAny <<= sal_Int32(0); + break; default: aAny = UnoControlModel::ImplGetDefaultValue( nPropId ); } diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index 5e13d2a94bed..14331ab69c10 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -185,7 +185,6 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HighContrastMode", HIGHCONTRASTMODE, bool, BOUND, MAYBEDEFAULT ), - DECL_PROP_2 ( "HoriScroll", HORISCROLL, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HScroll", HSCROLL, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "HardLineBreaks", HARDLINEBREAKS, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT), @@ -225,6 +224,10 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ), DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ScrollWidth", SCROLLWIDTH, sal_Int32, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ScrollHeight", SCROLLHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ScrollTop", SCROLLTOP, sal_Int32, BOUND, MAYBEDEFAULT ), + DECL_PROP_2 ( "ScrollLeft", SCROLLLEFT, sal_Int32, BOUND, MAYBEDEFAULT ), DECL_DEP_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ), @@ -257,7 +260,6 @@ ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) DECL_PROP_2 ( "ValueMin", VALUEMIN_DOUBLE, double, BOUND, MAYBEDEFAULT ), DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ), DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ), - DECL_PROP_2 ( "VertScroll", VERTSCROLL, bool, BOUND, MAYBEDEFAULT ), 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 ), |