[Libreoffice-commits] .: 12 commits - extensions/inc extensions/source oox/inc oox/source toolkit/inc toolkit/Library_tk.mk toolkit/source xmlscript/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Sep 11 08:04:43 PDT 2012
extensions/inc/propctrlr.hrc | 4
extensions/source/propctrlr/formmetadata.cxx | 4
extensions/source/propctrlr/formmetadata.hxx | 4
extensions/source/propctrlr/formres.src | 16 +
extensions/source/propctrlr/formresid.hrc | 4
extensions/source/propctrlr/formstrings.hxx | 4
oox/inc/oox/ole/axcontrol.hxx | 6
oox/source/ole/axcontrol.cxx | 18 +
oox/source/token/properties.txt | 4
toolkit/Library_tk.mk | 2
toolkit/inc/toolkit/awt/scrollabledialog.hxx | 91 +++++++
toolkit/inc/toolkit/awt/vclxcontainer.hxx | 3
toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx | 2
toolkit/inc/toolkit/controls/unocontrolcontainer.hxx | 1
toolkit/inc/toolkit/helper/property.hxx | 4
toolkit/source/awt/scrollabledialog.cxx | 165 +++++++++++++
toolkit/source/awt/vclxcontainer.cxx | 58 ++++
toolkit/source/awt/vclxtoolkit.cxx | 17 -
toolkit/source/awt/vclxwindows.cxx | 5
toolkit/source/controls/dialogcontrol.cxx | 49 +++
toolkit/source/controls/unocontrol.cxx | 1
toolkit/source/controls/unocontrolcontainer.cxx | 26 +-
toolkit/source/helper/property.cxx | 4
xmlscript/source/xmldlg_imexp/exp_share.hxx | 1
xmlscript/source/xmldlg_imexp/imp_share.hxx | 1
xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx | 5
xmlscript/source/xmldlg_imexp/xmldlg_export.cxx | 16 +
xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx | 5
xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 23 +
29 files changed, 529 insertions(+), 14 deletions(-)
New commits:
commit e27fc9b6c2f3d7c01a2d1477f740cbc548aa874a
Author: Noel Power <noel.power at suse.com>
Date: Tue Sep 11 16:03:31 2012 +0100
disable scrollable Frame ( not working well )
Change-Id: I09dc7b656c7ff19b937936e0b8436022d287cc87
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index affd9d7..3ec46c8 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -2445,8 +2445,9 @@ void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConver
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
- printf("Frame, converting scroll bits\n");
+#if SCROLLABLEFRAME
rConv.convertScrollabilitySettings( rPropMap, maScrollPos, maLogicalSize, mnScrollBars );
+#endif
AxContainerModelBase::convertProperties( rPropMap, rConv );
}
@@ -2509,7 +2510,6 @@ void AxUserFormModel::convertProperties( PropertyMap& rPropMap, const ControlCon
rPropMap.setProperty( PROP_Title, maCaption );
rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
rConv.convertAxPicture( rPropMap, maPictureData, AX_PICPOS_CENTER );
- printf("UserForm, converting scroll bits\n");
rConv.convertScrollabilitySettings( rPropMap, maScrollPos, maLogicalSize, mnScrollBars );
AxContainerModelBase::convertProperties( rPropMap, rConv );
}
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 76f8315..bea6a74 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -724,11 +724,13 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_GROUPBOX:
{
+#if SCROLLABLEFRAME
if ( bFrameControl )
{
pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits | WB_VSCROLL );
}
else
+#endif
pNewWindow = new GroupBox( pParent, nWinBits );
if ( bFrameControl )
{
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index d29f0ec..ba6c751 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -361,9 +361,6 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons
// there must be a better way than doing this, we can't
// process the scrolltop & scrollleft in XDialog because
// the children haven't been added when those props are applied
- Reference< XPropertySet > xDlgProps( getModel(), UNO_QUERY );
- Reference< XPropertySet > xPeerProps( getPeer(), uno::UNO_QUERY );
-
ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP ) ) );
ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT ) ) );
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index 4f63805..c8279a0 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -124,7 +124,9 @@ void ElementDescriptor::readFrameModel( StyleBag * all_styles )
title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
addSubElement( title );
}
+#if SCROLLABLEFRAME
readScrollableSettings();
+#endif
uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index b448d18..3b90225 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -97,7 +97,9 @@ void Frame::endElement()
{
xControlModel->setPropertyValue( "Label" , makeAny( _label ) );
}
+#if SCROLLABLEFRAME
ctx.importScollableSettings( _xAttributes );
+#endif
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
commit 7c7267e88691ce354ed0cf116315952ceae555ad
Author: Noel Power <noel.power at suse.com>
Date: Fri Sep 7 17:44:22 2012 +0100
get scrollbar details actually read for groupbox
<sigh> the display with groupbox is disappointing, there are many artifacts and the size of the area you actually need to scroll wrong, perhaps we actuall really need a proper groupbox
Change-Id: Iba6ff62718728324a461806cef61ee6a6a438ddf
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index cba97f5..affd9d7 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -328,7 +328,6 @@ void ControlConverter::convertScrollabilitySettings( PropertyMap& rPropMap,
rPropMap.setProperty( PROP_ScrollLeft, tmpPos.X );
rPropMap.setProperty( PROP_HScroll, ( nScrollBars & 0x1 ) == 0x1 );
rPropMap.setProperty( PROP_VScroll, ( nScrollBars & 0x2 ) == 0x2 );
- printf("** imported hscroll %d vscroll %d\n", ( nScrollBars & 0x1 ) == 0x1, ( nScrollBars & 0x2 ) == 0x2);
}
void ControlConverter::convertScrollBar( PropertyMap& rPropMap,
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
index e29fab5..71df40a 100644
--- a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
@@ -118,6 +118,7 @@ public:
DECLIMPL_SERVICEINFO_DERIVED( UnoControlContainer, UnoControlBase, szServiceName2_UnoControlContainer )
protected:
+ virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 225134d..76f8315 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -243,7 +243,7 @@ TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt
if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO )
nWinBits |= WB_DEF_NO;
}
- if ( nCompType == WINDOW_MULTILINEEDIT || nCompType == WINDOW_DIALOG )
+ if ( nCompType == WINDOW_MULTILINEEDIT || nCompType == WINDOW_DIALOG || WINDOW_GROUPBOX )
{
if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL )
nWinBits |= WB_AUTOHSCROLL;
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 106c7aa..d29f0ec 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -60,7 +60,6 @@
#include <vcl/tabctrl.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include "toolkit/controls/unocontrols.hxx"
-#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -373,24 +372,7 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons
void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
{
- // HACK due to the fact that we can't really use VSCROLL & HSCROLL
- // for Dialog ( ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL
- // has the same value as
- // ::com::sun::star::awt::WindowAttribute::NODECORATION )
- // For convenience in the PropBrowse using HSCROLL and VSCROLL ensures
- // the Correct text. We exchange them here and the control knows
- // about this hack ( it sucks badly I know )
- if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL )
- {
- rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL;
- rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL;
- }
- if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL )
- {
- rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL;
- rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL;
- }
-
+ UnoControlContainer::PrepareWindowDescriptor( rDesc );
sal_Bool bDecoration( sal_True );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( !bDecoration )
@@ -1192,11 +1174,25 @@ UnoFrameModel::Clone() const
uno::Any UnoFrameModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
{
- if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ uno::Any aAny;
+ switch ( nPropId )
{
- uno::Any aAny;
- aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
- return aAny;
+ case BASEPROPERTY_DEFAULTCONTROL:
+ {
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoFrameControl );
+ return aAny;
+ }
+ case BASEPROPERTY_SCROLLWIDTH:
+ case BASEPROPERTY_SCROLLHEIGHT:
+ case BASEPROPERTY_SCROLLTOP:
+ case BASEPROPERTY_SCROLLLEFT:
+ aAny <<= sal_Int32(0);
+ return aAny;
+ case BASEPROPERTY_USERFORMCONTAINEES:
+ {
+ uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
+ return makeAny( xNameCont );
+ }
}
return ControlModelContainerBase::ImplGetDefaultValue( nPropId );
}
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 2f2c7c9..7d5a6ac 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -1117,7 +1117,6 @@ void UnoControl::peerCreated()
void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Reference< XWindowPeer >& rParentPeer ) throw(RuntimeException)
{
::osl::ClearableMutexGuard aGuard( GetMutex() );
-
if ( !mxModel.is() )
{
RuntimeException aException;
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index e5b656a..0bdf24c 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -46,6 +46,7 @@
#include <limits>
#include <map>
#include <boost/shared_ptr.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
using namespace ::com::sun::star;
@@ -771,6 +772,10 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
sal_Bool bVis = maComponentInfos.bVisible;
if( bVis )
UnoControl::setVisible( sal_False );
+
+ uno::Reference< beans::XPropertySet > xTmpPropSet
+ ( getModel(), uno::UNO_QUERY );
+
// Create a new peer
UnoControl::createPeer( rxToolkit, rParent );
@@ -827,6 +832,25 @@ void UnoControlContainer::setVisible( sal_Bool bVisible ) throw(uno::RuntimeExce
createPeer( uno::Reference< awt::XToolkit > (), uno::Reference< awt::XWindowPeer > () );
}
-
+void UnoControlContainer::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
+{
+ // HACK due to the fact that we can't really use VSCROLL & HSCROLL
+ // for Dialog ( ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL
+ // has the same value as
+ // ::com::sun::star::awt::WindowAttribute::NODECORATION )
+ // For convenience in the PropBrowse using HSCROLL and VSCROLL ensures
+ // the Correct text. We exchange them here and the control knows
+ // about this hack ( it sucks badly I know )
+ if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL )
+ {
+ rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL;
+ rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL;
+ }
+ if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL )
+ {
+ rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL;
+ rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL;
+ }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index c8daaaf..4f63805 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -124,7 +124,7 @@ void ElementDescriptor::readFrameModel( StyleBag * all_styles )
title->addAttribute( XMLNS_DIALOGS_PREFIX ":value", aTitle );
addSubElement( title );
}
-
+ readScrollableSettings();
uno::Reference< container::XNameContainer > xControlContainer( _xProps, uno::UNO_QUERY );
if ( xControlContainer.is() && xControlContainer->getElementNames().getLength() )
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index e8e3b53..b448d18 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -97,6 +97,7 @@ void Frame::endElement()
{
xControlModel->setPropertyValue( "Label" , makeAny( _label ) );
}
+ ctx.importScollableSettings( _xAttributes );
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -1625,6 +1626,7 @@ void CheckBoxElement::endElement()
}
ctx.importEvents( _events );
+ ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
_events.clear();
commit 67adc642765862c6609914a0131a18967538b81c
Author: Noel Power <noel.power at suse.com>
Date: Fri Sep 7 12:17:31 2012 +0100
fixed the unable to close dialog when vert scrollbars set
Change-Id: If15a2b7312577a8285dc1ab1dea1ccb7c4824ed6
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index 89570b9..cba97f5 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -328,6 +328,7 @@ void ControlConverter::convertScrollabilitySettings( PropertyMap& rPropMap,
rPropMap.setProperty( PROP_ScrollLeft, tmpPos.X );
rPropMap.setProperty( PROP_HScroll, ( nScrollBars & 0x1 ) == 0x1 );
rPropMap.setProperty( PROP_VScroll, ( nScrollBars & 0x2 ) == 0x2 );
+ printf("** imported hscroll %d vscroll %d\n", ( nScrollBars & 0x1 ) == 0x1, ( nScrollBars & 0x2 ) == 0x2);
}
void ControlConverter::convertScrollBar( PropertyMap& rPropMap,
@@ -2445,6 +2446,7 @@ void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConver
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
+ printf("Frame, converting scroll bits\n");
rConv.convertScrollabilitySettings( rPropMap, maScrollPos, maLogicalSize, mnScrollBars );
AxContainerModelBase::convertProperties( rPropMap, rConv );
}
@@ -2508,6 +2510,7 @@ void AxUserFormModel::convertProperties( PropertyMap& rPropMap, const ControlCon
rPropMap.setProperty( PROP_Title, maCaption );
rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
rConv.convertAxPicture( rPropMap, maPictureData, AX_PICPOS_CENTER );
+ printf("UserForm, converting scroll bits\n");
rConv.convertScrollabilitySettings( rPropMap, maScrollPos, maLogicalSize, mnScrollBars );
AxContainerModelBase::convertProperties( rPropMap, rConv );
}
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index 74cabce..1b35e8e 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -5,8 +5,14 @@
namespace toolkit
{
+// Using WB_AUTOHSCROLL, WB_AUTOVSCROLL here sucks big time, there is a
+// problem in the toolkit class where there are some clashing IDs
+// ( ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL has the same value
+// as ::com::sun::star::awt::WindowAttribute::NODECORATION and they are used
+// in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for
+// child classes ( whole thing is a mess if you ask me )
template< class T>
-ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
+ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
{
Link aLink( LINK( this, ScrollableWrapper, ScrollBarHdl ) );
maVScrollBar.SetScrollHdl( aLink );
@@ -15,11 +21,11 @@ ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T(
Size aOutSz = T::GetOutputSizePixel();
ScrollBarVisibility aVis = None;
- if ( nStyle & ( WB_HSCROLL | WB_VSCROLL ) )
+ if ( nStyle & ( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) )
{
- if ( nStyle & WB_HSCROLL )
+ if ( nStyle & WB_AUTOHSCROLL )
aVis = Hori;
- if ( nStyle & WB_VSCROLL )
+ if ( nStyle & WB_AUTOVSCROLL )
{
if ( aVis == Hori )
aVis = Both;
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 64bffaa..225134d 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -243,7 +243,7 @@ TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt
if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO )
nWinBits |= WB_DEF_NO;
}
- if ( nCompType == WINDOW_MULTILINEEDIT )
+ if ( nCompType == WINDOW_MULTILINEEDIT || nCompType == WINDOW_DIALOG )
{
if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL )
nWinBits |= WB_AUTOHSCROLL;
@@ -725,7 +725,9 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_GROUPBOX:
{
if ( bFrameControl )
- pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits );
+ {
+ pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits | WB_VSCROLL );
+ }
else
pNewWindow = new GroupBox( pParent, nWinBits );
if ( bFrameControl )
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 99c9d46..106c7aa 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -60,6 +60,7 @@
#include <vcl/tabctrl.hxx>
#include <toolkit/awt/vclxwindows.hxx>
#include "toolkit/controls/unocontrols.hxx"
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -372,6 +373,24 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons
void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
{
+ // HACK due to the fact that we can't really use VSCROLL & HSCROLL
+ // for Dialog ( ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL
+ // has the same value as
+ // ::com::sun::star::awt::WindowAttribute::NODECORATION )
+ // For convenience in the PropBrowse using HSCROLL and VSCROLL ensures
+ // the Correct text. We exchange them here and the control knows
+ // about this hack ( it sucks badly I know )
+ if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL )
+ {
+ rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL;
+ rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL;
+ }
+ if ( rDesc.WindowAttributes & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL )
+ {
+ rDesc.WindowAttributes &= ~::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL;
+ rDesc.WindowAttributes |= ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL;
+ }
+
sal_Bool bDecoration( sal_True );
ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
if ( !bDecoration )
commit b241005c51a6705425937218e6893b4be2165128
Author: Noel Power <noel.power at suse.com>
Date: Thu Sep 6 19:25:12 2012 +0100
make interface for scrollablity properties to allow more code sharing
Change-Id: I0e03360808e73426848820d807f741c13c76abf8
diff --git a/toolkit/inc/toolkit/awt/scrollabledialog.hxx b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
index 01ba525..19b0ab0 100644
--- a/toolkit/inc/toolkit/awt/scrollabledialog.hxx
+++ b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
@@ -34,8 +34,21 @@
//........................................................................
namespace toolkit
{
+ class ScrollableInterface
+ {
+ public:
+ virtual void SetScrollWidth( long nWidth ) = 0;
+ virtual long GetScrollWidth() = 0;
+ virtual void SetScrollHeight( long nHeight ) = 0;
+ virtual long GetScrollHeight() = 0;
+ virtual void SetScrollLeft( long nLeft ) = 0;
+ virtual long GetScrollLeft() = 0;
+ virtual void SetScrollTop( long Top ) = 0;
+ virtual long GetScrollTop() = 0;
+ };
+
template < class T >
- class ScrollableDialog : public T
+ class ScrollableWrapper : public T, public ScrollableInterface
{
ScrollBar maHScrollBar;
ScrollBar maVScrollBar;
@@ -51,17 +64,17 @@ namespace toolkit
ScrollBarVisibility maScrollVis;
void lcl_Scroll( long nX, long nY );
public:
- ScrollableDialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
- virtual ~ScrollableDialog();
- void SetScrollWidth( long nWidth );
- long GetScrollWidth() { return maScrollArea.Width(); }
- void SetScrollHeight( long nHeight );
- long GetScrollHeight() { return maScrollArea.Height(); }
- void SetScrollLeft( long nLeft );
- long GetScrollLeft() { return mnScrollPos.X(); }
- void SetScrollTop( long Top );
- long GetScrollTop() { return mnScrollPos.Y() ; }
- Window* getContentWindow();
+ ScrollableWrapper( Window* pParent, WinBits nStyle = WB_STDDIALOG );
+ virtual ~ScrollableWrapper();
+ virtual void SetScrollWidth( long nWidth );
+ virtual long GetScrollWidth() { return maScrollArea.Width(); }
+ virtual void SetScrollHeight( long nHeight );
+ virtual long GetScrollHeight() { return maScrollArea.Height(); }
+ virtual void SetScrollLeft( long nLeft );
+ virtual long GetScrollLeft() { return mnScrollPos.X(); }
+ virtual void SetScrollTop( long Top );
+ virtual long GetScrollTop() { return mnScrollPos.Y() ; }
+
ScrollBarVisibility getScrollVisibility() { return maScrollVis; }
void setScrollVisibility( ScrollBarVisibility rState );
DECL_LINK( ScrollBarHdl, ScrollBar* );
diff --git a/toolkit/inc/toolkit/awt/vclxcontainer.hxx b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
index 8a94682..eda2531 100644
--- a/toolkit/inc/toolkit/awt/vclxcontainer.hxx
+++ b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
@@ -61,6 +61,9 @@ public:
void SAL_CALL setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& WindowOrder, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Windows ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
};
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index fbea906..74cabce 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -6,9 +6,9 @@ namespace toolkit
{
template< class T>
-ScrollableDialog<T>::ScrollableDialog( Window* pParent, WinBits nStyle ) : T( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
+ScrollableWrapper<T>::ScrollableWrapper( Window* pParent, WinBits nStyle ) : T( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
{
- Link aLink( LINK( this, ScrollableDialog, ScrollBarHdl ) );
+ Link aLink( LINK( this, ScrollableWrapper, ScrollBarHdl ) );
maVScrollBar.SetScrollHdl( aLink );
maHScrollBar.SetScrollHdl( aLink );
@@ -32,7 +32,7 @@ ScrollableDialog<T>::ScrollableDialog( Window* pParent, WinBits nStyle ) : T( pP
}
template< class T>
-void ScrollableDialog<T>::setScrollVisibility( ScrollBarVisibility rVisState )
+void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState )
{
maScrollVis = rVisState;
if ( maScrollVis == Hori || maScrollVis == Both )
@@ -50,18 +50,12 @@ void ScrollableDialog<T>::setScrollVisibility( ScrollBarVisibility rVisState )
}
template< class T>
-ScrollableDialog<T>::~ScrollableDialog()
+ScrollableWrapper<T>::~ScrollableWrapper()
{
}
template< class T>
-Window* ScrollableDialog<T>::getContentWindow()
-{
- return this;
-}
-
-template< class T>
-void ScrollableDialog<T>::lcl_Scroll( long nX, long nY )
+void ScrollableWrapper<T>::lcl_Scroll( long nX, long nY )
{
long nXScroll = mnScrollPos.X() - nX;
long nYScroll = mnScrollPos.Y() - nY;
@@ -83,16 +77,16 @@ void ScrollableDialog<T>::lcl_Scroll( long nX, long nY )
}
//Can't use IMPL_LINK with the template
-//IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
+//IMPL_LINK( ScrollableWrapper, ScrollBarHdl, ScrollBar*, pSB )
template< class T>
-long ScrollableDialog<T>::LinkStubScrollBarHdl( void* pThis, void* pCaller)
+long ScrollableWrapper<T>::LinkStubScrollBarHdl( void* pThis, void* pCaller)
{
- return ((ScrollableDialog<T>*)pThis )->ScrollBarHdl( (ScrollBar*)pCaller );
+ return ((ScrollableWrapper<T>*)pThis )->ScrollBarHdl( (ScrollBar*)pCaller );
}
template< class T>
-long ScrollableDialog<T>::ScrollBarHdl( ScrollBar* pSB )
+long ScrollableWrapper<T>::ScrollBarHdl( ScrollBar* pSB )
{
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
if( pSB == &maVScrollBar )
@@ -103,7 +97,7 @@ long ScrollableDialog<T>::ScrollBarHdl( ScrollBar* pSB )
}
template< class T>
-void ScrollableDialog<T>::SetScrollTop( long nTop )
+void ScrollableWrapper<T>::SetScrollTop( long nTop )
{
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop );
@@ -112,7 +106,7 @@ void ScrollableDialog<T>::SetScrollTop( long nTop )
mnScrollPos = aOld;
}
template< class T>
-void ScrollableDialog<T>::SetScrollLeft( long nLeft )
+void ScrollableWrapper<T>::SetScrollLeft( long nLeft )
{
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() );
@@ -121,27 +115,27 @@ void ScrollableDialog<T>::SetScrollLeft( long nLeft )
mnScrollPos = aOld;
}
template< class T>
-void ScrollableDialog<T>::SetScrollWidth( long nWidth )
+void ScrollableWrapper<T>::SetScrollWidth( long nWidth )
{
maScrollArea.Width() = nWidth;
ResetScrollBars();
}
template< class T>
-void ScrollableDialog<T>::SetScrollHeight( long nHeight )
+void ScrollableWrapper<T>::SetScrollHeight( long nHeight )
{
maScrollArea.Height() = nHeight;
ResetScrollBars();
}
template< class T>
-void ScrollableDialog<T>::Resize()
+void ScrollableWrapper<T>::Resize()
{
ResetScrollBars();
}
template< class T>
-void ScrollableDialog<T>::ResetScrollBars()
+void ScrollableWrapper<T>::ResetScrollBars()
{
Size aOutSz = T::GetOutputSizePixel();
@@ -158,8 +152,8 @@ void ScrollableDialog<T>::ResetScrollBars()
maVScrollBar.SetVisibleSize( T::GetSizePixel().Height() );
}
-template class ScrollableDialog< Dialog >;
-template class ScrollableDialog< GroupBox >;
+template class ScrollableWrapper< Dialog >;
+template class ScrollableWrapper< GroupBox >;
} // toolkit
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx
index fd52b3d..a15fef2 100644
--- a/toolkit/source/awt/vclxcontainer.cxx
+++ b/toolkit/source/awt/vclxcontainer.cxx
@@ -36,6 +36,8 @@
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <tools/debug.hxx>
+#include "toolkit/awt/scrollabledialog.hxx"
+#include <toolkit/helper/property.hxx>
// ----------------------------------------------------
// class VCLXContainer
@@ -232,4 +234,60 @@ void VCLXContainer::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun:
}
}
+void SAL_CALL VCLXContainer::setProperty(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Any& Value )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ 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 );
+ toolkit::ScrollableInterface* pScrollable = dynamic_cast< toolkit::ScrollableInterface* >( pWindow );
+ if ( pWindow && pScrollable )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ aSize = pDev->LogicToPixel( aSize, aMode );
+ 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;
+ }
+ break;
+ }
+
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 1f17f38..64bffaa 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -725,7 +725,7 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
case WINDOW_GROUPBOX:
{
if ( bFrameControl )
- pNewWindow = new toolkit::ScrollableDialog< GroupBox >( pParent, nWinBits );
+ pNewWindow = new toolkit::ScrollableWrapper< GroupBox >( pParent, nWinBits );
else
pNewWindow = new GroupBox( pParent, nWinBits );
if ( bFrameControl )
@@ -790,7 +790,7 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
// Modal/Modeless nur durch Show/Execute
if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) )
pParent = DIALOG_NO_PARENT;
- pNewWindow = new toolkit::ScrollableDialog<Dialog>( pParent, nWinBits );
+ pNewWindow = new toolkit::ScrollableWrapper<Dialog>( pParent, nWinBits );
// #i70217# Don't always create a new component object. It's possible that VCL has called
// GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() )
// which creates a component object.
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index 0908500..0fd3cf0 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2454,44 +2454,6 @@ throw(::com::sun::star::uno::RuntimeException)
sal_uInt16 nPropType = GetPropertyId( PropertyName );
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 );
- toolkit::ScrollableDialog<Dialog>* pScrollable = dynamic_cast< toolkit::ScrollableDialog<Dialog>* >( pWindow );
- if ( pWindow && pScrollable )
- {
- OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
- if ( !pDev )
- pDev = pWindow->GetParent();
-
- aSize = pDev->LogicToPixel( aSize, aMode );
- 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;
@@ -2517,7 +2479,7 @@ throw(::com::sun::star::uno::RuntimeException)
default:
{
- VCLXWindow::setProperty( PropertyName, Value );
+ VCLXContainer::setProperty( PropertyName, Value );
}
}
}
@@ -6694,50 +6656,6 @@ throw(::com::sun::star::uno::RuntimeException)
sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
(void)bVoid;
#endif
- // #TODO needs to be in common container base class,
- // we need a common Scrollable interface then too
- sal_uInt16 nPropType = GetPropertyId( PropertyName );
- 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 );
- toolkit::ScrollableDialog<GroupBox>* pScrollable = dynamic_cast< toolkit::ScrollableDialog<GroupBox>* >( pWindow );
- if ( pWindow && pScrollable )
- {
- OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
- if ( !pDev )
- pDev = pWindow->GetParent();
-
- aSize = pDev->LogicToPixel( aSize, aMode );
- 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;
- }
- }
VCLXContainer::setProperty( PropertyName, Value );
}
commit 27a19817c6271b76013aa6bda5c3353c8a9dd35b
Author: Noel Power <noel.power at suse.com>
Date: Thu Sep 6 18:36:00 2012 +0100
some more tweaking to import scrollbar data for mso Frame & Userform
also removed printf(s)
Change-Id: If83565dcd97b276e1f6a8488a9f1d23066c2a9ff
diff --git a/oox/inc/oox/ole/axcontrol.hxx b/oox/inc/oox/ole/axcontrol.hxx
index c41e764..285cb74 100644
--- a/oox/inc/oox/ole/axcontrol.hxx
+++ b/oox/inc/oox/ole/axcontrol.hxx
@@ -249,6 +249,12 @@ public:
sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const;
+ /** Converts scrollability settings to UNO properties. */
+ void convertScrollabilitySettings(
+ PropertyMap& rPropMap,
+ const AxPairData& rScrollPos, const AxPairData& rScrollArea,
+ sal_Int32 nScrollBars ) const;
+
/** Binds the passed control model to the passed data sources. The
implementation will check which source types are supported. */
void bindToSources(
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index d776893..89570b9 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -316,6 +316,20 @@ void ControlConverter::convertVerticalAlign( PropertyMap& rPropMap, sal_Int32 nV
rPropMap.setProperty( PROP_VerticalAlign, eAlign );
}
+void ControlConverter::convertScrollabilitySettings( PropertyMap& rPropMap,
+ const AxPairData& rScrollPos, const AxPairData& rScrollArea,
+ sal_Int32 nScrollBars ) const
+{
+ Size tmpSize = mrGraphicHelper.convertHmmToAppFont( Size( rScrollArea.first, rScrollArea.second ) );
+ Point tmpPos = mrGraphicHelper.convertHmmToAppFont( Point( rScrollPos.first, rScrollPos.second ) );
+ rPropMap.setProperty( PROP_ScrollHeight, tmpSize.Height );
+ rPropMap.setProperty( PROP_ScrollWidth, tmpSize.Width );
+ rPropMap.setProperty( PROP_ScrollTop, tmpPos.Y );
+ rPropMap.setProperty( PROP_ScrollLeft, tmpPos.X );
+ rPropMap.setProperty( PROP_HScroll, ( nScrollBars & 0x1 ) == 0x1 );
+ rPropMap.setProperty( PROP_VScroll, ( nScrollBars & 0x2 ) == 0x2 );
+}
+
void ControlConverter::convertScrollBar( PropertyMap& rPropMap,
sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nPosition,
sal_Int32 nSmallChange, sal_Int32 nLargeChange, bool bAwtModel ) const
@@ -2431,6 +2445,7 @@ void AxFrameModel::convertProperties( PropertyMap& rPropMap, const ControlConver
{
rPropMap.setProperty( PROP_Label, maCaption );
rPropMap.setProperty( PROP_Enabled, getFlag( mnFlags, AX_CONTAINER_ENABLED ) );
+ rConv.convertScrollabilitySettings( rPropMap, maScrollPos, maLogicalSize, mnScrollBars );
AxContainerModelBase::convertProperties( rPropMap, rConv );
}
@@ -2493,6 +2508,7 @@ void AxUserFormModel::convertProperties( PropertyMap& rPropMap, const ControlCon
rPropMap.setProperty( PROP_Title, maCaption );
rConv.convertColor( rPropMap, PROP_BackgroundColor, mnBackColor );
rConv.convertAxPicture( rPropMap, maPictureData, AX_PICPOS_CENTER );
+ rConv.convertScrollabilitySettings( rPropMap, maScrollPos, maLogicalSize, mnScrollBars );
AxContainerModelBase::convertProperties( rPropMap, rConv );
}
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 596bf82..5c917e9 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -394,9 +394,13 @@ ScaleMode
ScaleToPages
ScaleToPagesX
ScaleToPagesY
+ScrollHeight
+ScrollLeft
+ScrollTop
ScrollValue
ScrollValueMax
ScrollValueMin
+ScrollWidth
Segments
SelectedItems
SelectedPage
diff --git a/toolkit/inc/toolkit/awt/scrollabledialog.hxx b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
index 41ae32f..01ba525 100644
--- a/toolkit/inc/toolkit/awt/scrollabledialog.hxx
+++ b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
@@ -34,7 +34,8 @@
//........................................................................
namespace toolkit
{
- class ScrollableDialog : public Dialog
+ template < class T >
+ class ScrollableDialog : public T
{
ScrollBar maHScrollBar;
ScrollBar maVScrollBar;
@@ -64,7 +65,6 @@ namespace toolkit
ScrollBarVisibility getScrollVisibility() { return maScrollVis; }
void setScrollVisibility( ScrollBarVisibility rState );
DECL_LINK( ScrollBarHdl, ScrollBar* );
- DECL_LINK( ContainerScrolled, void* );
virtual void ResetScrollBars();
// Window
virtual void Resize();
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index 202a561..fbea906 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -1,15 +1,18 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <toolkit/awt/scrollabledialog.hxx>
+#include <vcl/group.hxx>
+
namespace toolkit
{
-ScrollableDialog::ScrollableDialog( Window* pParent, WinBits nStyle ) : Dialog( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
+template< class T>
+ScrollableDialog<T>::ScrollableDialog( Window* pParent, WinBits nStyle ) : T( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
{
Link aLink( LINK( this, ScrollableDialog, ScrollBarHdl ) );
maVScrollBar.SetScrollHdl( aLink );
maHScrollBar.SetScrollHdl( aLink );
- Size aOutSz = GetOutputSizePixel();
+ Size aOutSz = T::GetOutputSizePixel();
ScrollBarVisibility aVis = None;
if ( nStyle & ( WB_HSCROLL | WB_VSCROLL ) )
@@ -25,46 +28,51 @@ ScrollableDialog::ScrollableDialog( Window* pParent, WinBits nStyle ) : Dialog(
}
}
setScrollVisibility( aVis );
- mnScrWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+ mnScrWidth = T::GetSettings().GetStyleSettings().GetScrollBarSize();
}
-void ScrollableDialog::setScrollVisibility( ScrollBarVisibility rVisState )
+template< class T>
+void ScrollableDialog<T>::setScrollVisibility( ScrollBarVisibility rVisState )
{
maScrollVis = rVisState;
if ( maScrollVis == Hori || maScrollVis == Both )
+ {
mbHasHoriBar = true;
+ maHScrollBar.Show();
+ }
if ( maScrollVis == Vert || maScrollVis == Both )
+ {
mbHasVertBar = true;
- if ( mbHasVertBar )
maVScrollBar.Show();
- if ( mbHasHoriBar )
- maHScrollBar.Show();
+ }
if ( mbHasHoriBar || mbHasVertBar )
- SetStyle( GetStyle() | WB_CLIPCHILDREN | SCROLL_UPDATE );
+ SetStyle( T::GetStyle() | WB_CLIPCHILDREN | SCROLL_UPDATE );
}
-ScrollableDialog::~ScrollableDialog()
+template< class T>
+ScrollableDialog<T>::~ScrollableDialog()
{
}
-Window* ScrollableDialog::getContentWindow()
+template< class T>
+Window* ScrollableDialog<T>::getContentWindow()
{
return this;
}
-void ScrollableDialog::lcl_Scroll( long nX, long nY )
+template< class T>
+void ScrollableDialog<T>::lcl_Scroll( long nX, long nY )
{
long nXScroll = mnScrollPos.X() - nX;
long nYScroll = mnScrollPos.Y() - nY;
- printf( "ScrollableDialog::lcl_Scroll %d, %d resulting in delta nXScroll %d, nYScroll %d for ( %d ) children\n", nX, nY, nXScroll, nYScroll, GetChildCount() -2 );
mnScrollPos = Point( nX, nY );
Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() );
- Window::Scroll(nXScroll, nYScroll, aScrollableArea );
+ T::Scroll(nXScroll, nYScroll, aScrollableArea );
// Manually scroll all children ( except the scrollbars )
- for ( int index = 0; index < GetChildCount(); ++index )
+ for ( int index = 0; index < T::GetChildCount(); ++index )
{
- Window* pChild = GetChild( index );
+ Window* pChild = T::GetChild( index );
if ( pChild && pChild != &maVScrollBar && pChild != &maHScrollBar )
{
Point aPos = pChild->GetPosPixel();
@@ -74,7 +82,17 @@ void ScrollableDialog::lcl_Scroll( long nX, long nY )
}
}
-IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
+//Can't use IMPL_LINK with the template
+//IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
+
+template< class T>
+long ScrollableDialog<T>::LinkStubScrollBarHdl( void* pThis, void* pCaller)
+{
+ return ((ScrollableDialog<T>*)pThis )->ScrollBarHdl( (ScrollBar*)pCaller );
+}
+
+template< class T>
+long ScrollableDialog<T>::ScrollBarHdl( ScrollBar* pSB )
{
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
if( pSB == &maVScrollBar )
@@ -84,64 +102,64 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
return 1;
}
-void ScrollableDialog::SetScrollTop( long nTop )
+template< class T>
+void ScrollableDialog<T>::SetScrollTop( long nTop )
{
- printf("ScrollableDialog::SetScrollTop(%d)\n", nTop );
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop );
- printf("about to set thumb\n");
maHScrollBar.SetThumbPos( 0 );
// new pos is 0,0
mnScrollPos = aOld;
}
-void ScrollableDialog::SetScrollLeft( long nLeft )
+template< class T>
+void ScrollableDialog<T>::SetScrollLeft( long nLeft )
{
- printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft );
Point aOld = mnScrollPos;
lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() );
- printf("about to set thumb\n");
maVScrollBar.SetThumbPos( 0 );
// new pos is 0,0
mnScrollPos = aOld;
}
-void ScrollableDialog::SetScrollWidth( long nWidth )
+template< class T>
+void ScrollableDialog<T>::SetScrollWidth( long nWidth )
{
- printf("ScrollableDialog::SetScrollWidth(%d)\n", nWidth );
maScrollArea.Width() = nWidth;
ResetScrollBars();
}
-void ScrollableDialog::SetScrollHeight( long nHeight )
+template< class T>
+void ScrollableDialog<T>::SetScrollHeight( long nHeight )
{
- printf("ScrollableDialog::SetScrollHeight(%d)\n", nHeight );
maScrollArea.Height() = nHeight;
ResetScrollBars();
}
-void ScrollableDialog::Resize()
+template< class T>
+void ScrollableDialog<T>::Resize()
{
ResetScrollBars();
}
-void ScrollableDialog::ResetScrollBars()
+template< class T>
+void ScrollableDialog<T>::ResetScrollBars()
{
- Size aOutSz = GetOutputSizePixel();
- printf("ScrollableDialog::ResetScrollbars() - size is width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height() );
+ Size aOutSz = T::GetOutputSizePixel();
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
Point aHPos( 0, aOutSz.Height() - mnScrWidth );
- maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
- maHScrollBar.SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
+ maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, T::GetSizePixel().Height() - mnScrWidth ) );
+ maHScrollBar.SetPosSizePixel( aHPos, Size( T::GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
maHScrollBar.SetRangeMax( maScrollArea.Width() + mnScrWidth );
- maHScrollBar.SetVisibleSize( GetSizePixel().Width() );
-// maHScrollBar.SetPageSize( maScrollArea.Height() );
+ maHScrollBar.SetVisibleSize( T::GetSizePixel().Width() );
maVScrollBar.SetRangeMax( maScrollArea.Height() + mnScrWidth );
- maVScrollBar.SetVisibleSize( GetSizePixel().Height() );
-// maVScrollBar.SetPageSize( maScrollArea.Width() );
+ maVScrollBar.SetVisibleSize( T::GetSizePixel().Height() );
}
+template class ScrollableDialog< Dialog >;
+template class ScrollableDialog< GroupBox >;
+
} // toolkit
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 55ca00c..1f17f38 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -724,7 +724,10 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
break;
case WINDOW_GROUPBOX:
{
- pNewWindow = new GroupBox( pParent, nWinBits );
+ if ( bFrameControl )
+ pNewWindow = new toolkit::ScrollableDialog< GroupBox >( pParent, nWinBits );
+ else
+ pNewWindow = new GroupBox( pParent, nWinBits );
if ( bFrameControl )
{
GroupBox* pGroupBox = static_cast< GroupBox* >( pNewWindow );
@@ -787,7 +790,7 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
// Modal/Modeless nur durch Show/Execute
if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) )
pParent = DIALOG_NO_PARENT;
- pNewWindow = new toolkit::ScrollableDialog( pParent, nWinBits );
+ pNewWindow = new toolkit::ScrollableDialog<Dialog>( pParent, nWinBits );
// #i70217# Don't always create a new component object. It's possible that VCL has called
// GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() )
// which creates a component object.
@@ -1062,16 +1065,6 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
if ( pParentComponent )
pParent = pParentComponent->GetWindow();
}
-#if 0
- // #FIXME inglorious HACK we possibly need to interface at XContainerWindowPeer ?
- // to allow access to the 'real' parent that we pass to children
- toolkit::ScrollableDialog* pSrcDialog = dynamic_cast< toolkit::ScrollableDialog* > ( pParent );
- if ( pSrcDialog )
- {
- printf( "found a parent that is a scrollable dialog\n");
- pParent = pSrcDialog->getContentWindow();
- }
-#endif
WinBits nWinBits = ImplGetWinBits( rDescriptor.WindowAttributes,
ImplGetComponentType( rDescriptor.WindowServiceName ) );
nWinBits |= nForceWinBits;
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index a70d5ac..0908500 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -68,6 +68,7 @@
#include <boost/bind.hpp>
#include <boost/function.hpp>
+#include <vcl/group.hxx>
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::makeAny;
@@ -2451,7 +2452,6 @@ 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:
@@ -2464,14 +2464,14 @@ throw(::com::sun::star::uno::RuntimeException)
Size aSize( nVal, nVal );
Window* pWindow = GetWindow();
MapMode aMode( MAP_APPFONT );
- if ( pWindow )
+ toolkit::ScrollableDialog<Dialog>* pScrollable = dynamic_cast< toolkit::ScrollableDialog<Dialog>* >( pWindow );
+ if ( pWindow && pScrollable )
{
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:
@@ -6694,7 +6694,50 @@ throw(::com::sun::star::uno::RuntimeException)
sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
(void)bVoid;
#endif
+ // #TODO needs to be in common container base class,
+ // we need a common Scrollable interface then too
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ 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 );
+ toolkit::ScrollableDialog<GroupBox>* pScrollable = dynamic_cast< toolkit::ScrollableDialog<GroupBox>* >( pWindow );
+ if ( pWindow && pScrollable )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+ aSize = pDev->LogicToPixel( aSize, aMode );
+ 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;
+ }
+ }
VCLXContainer::setProperty( PropertyName, Value );
}
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index d8efe4f..99c9d46 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -1136,6 +1136,13 @@ UnoFrameModel::UnoFrameModel( const Reference< XMultiServiceFactory >& i_factor
ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES );
+ ImplRegisterProperty( BASEPROPERTY_HSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_SCROLLWIDTH );
+ ImplRegisterProperty( BASEPROPERTY_SCROLLHEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_SCROLLTOP );
+ ImplRegisterProperty( BASEPROPERTY_SCROLLLEFT );
+
uno::Reference< XNameContainer > xNameCont = new SimpleNamedThingContainer< XControlModel >();
ImplRegisterProperty( BASEPROPERTY_USERFORMCONTAINEES, uno::makeAny( xNameCont ) );
commit 5dc19680cd27d4eaea5f2f7fdc48969f704e696a
Author: Noel Power <noel.power at suse.com>
Date: Thu Sep 6 10:21:11 2012 +0100
add persistence support for the scrollable attributes
Change-Id: I6fc196233f997e540301cac2cdf1b99d48aa2bde
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index f2cbd45..a03d42b 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -109,6 +109,7 @@ public:
template<typename T>
inline bool readProp( T * ret, OUString const & rPropName );
css::uno::Any readProp( OUString const & rPropName );
+ void readScrollableSettings();
void readDefaults( bool supportPrintable = true, bool supportVisible = true );
void readStringAttr(
OUString const & rPropName, OUString const & rAttrName );
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 3f306b7..5ea50d3 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -401,6 +401,7 @@ public:
inline css::uno::Reference< css::beans::XPropertySet > getControlModel() const
{ return _xControlModel; }
+ void importScollableSettings( css::uno::Reference< css::xml::input::XAttributes > const & xAttributes );
void importDefaults(
sal_Int32 nBaseX, sal_Int32 nBaseY,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index a8c026e..c8daaaf 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -1063,6 +1063,7 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
readBoolAttr( "Sizeable", XMLNS_DIALOGS_PREFIX ":resizeable" );
readStringAttr( "Title", XMLNS_DIALOGS_PREFIX ":title" );
+ readScrollableSettings();
Any aDecorationAny( _xProps->getPropertyValue( "Decoration" ) );
bool bDecoration = sal_False;
if ( (aDecorationAny >>= bDecoration) && !bDecoration )
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index daaf6a2..b0004ed 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -970,6 +970,22 @@ void ElementDescriptor::readSelectionTypeAttr( OUString const & rPropName, OUStr
}
}
//__________________________________________________________________________________________________
+void ElementDescriptor::readScrollableSettings()
+{
+ readLongAttr( "ScrollHeight",
+ XMLNS_DIALOGS_PREFIX ":scrollheight" );
+ readLongAttr( "ScrollWidth",
+ XMLNS_DIALOGS_PREFIX ":scrollwidth" );
+ readLongAttr( "ScrollTop",
+ XMLNS_DIALOGS_PREFIX ":scrolltop" );
+ readLongAttr( "ScrollLeft",
+ XMLNS_DIALOGS_PREFIX ":scrollleft" );
+ readBoolAttr( "HScroll",
+ XMLNS_DIALOGS_PREFIX ":hscroll" );
+ readBoolAttr( "VScroll",
+ XMLNS_DIALOGS_PREFIX ":vscroll" );
+}
+
void ElementDescriptor::readDefaults( bool supportPrintable, bool supportVisible )
{
Any a( _xProps->getPropertyValue( "Name" ) );
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 8bd9edb..e8e3b53 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -1970,6 +1970,7 @@ void WindowElement::endElement()
ctx.importStringProperty("Title", "title", _xAttributes );
ctx.importBooleanProperty("Decoration", "withtitlebar", _xAttributes );
ctx.importImageURLProperty( "ImageURL" , "image-src" , _xAttributes );
+ ctx.importScollableSettings( _xAttributes );
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index 6fec94b..d1dad5f 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -1514,6 +1514,29 @@ void ImportContext::importEvents(
}
}
//__________________________________________________________________________________________________
+void ImportContext::importScollableSettings(
+ Reference< xml::input::XAttributes > const & _xAttributes )
+{
+ importLongProperty( OUString( "ScrollHeight" ),
+ OUString( "scrollheight" ),
+ _xAttributes );
+ importLongProperty( OUString( "ScrollWidth" ),
+ OUString( "scrollwidth" ),
+ _xAttributes );
+ importLongProperty( OUString( "ScrollTop" ),
+ OUString( "scrolltop" ),
+ _xAttributes );
+ importLongProperty( OUString( "ScrollLeft" ),
+ OUString( "scrollleft" ),
+ _xAttributes );
+ importBooleanProperty( OUString( "HScroll" ),
+ OUString( "hscroll" ),
+ _xAttributes );
+ importBooleanProperty( OUString( "VScroll" ),
+ OUString( "vscroll" ),
+ _xAttributes );
+}
+
void ImportContext::importDefaults(
sal_Int32 nBaseX, sal_Int32 nBaseY,
Reference< xml::input::XAttributes > const & xAttributes,
commit 7f5ca4c9e1061a626039d1042e71c34fc3f61005
Author: Noel Power <noel.power at suse.com>
Date: Wed Sep 5 20:19:03 2012 +0100
fix scroll top & scroll left
Change-Id: If333932a0f3cfde6e8459ca3506a609207982f96
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index 2ffc793..202a561 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -56,12 +56,11 @@ void ScrollableDialog::lcl_Scroll( long nX, long nY )
{
long nXScroll = mnScrollPos.X() - nX;
long nYScroll = mnScrollPos.Y() - nY;
- printf( "ScrollableDialog::lcl_Scroll %d, %d nXScroll %d, nYScroll %d\n", nX, nY, nXScroll, nYScroll );
+ printf( "ScrollableDialog::lcl_Scroll %d, %d resulting in delta nXScroll %d, nYScroll %d for ( %d ) children\n", nX, nY, nXScroll, nYScroll, GetChildCount() -2 );
mnScrollPos = Point( nX, nY );
Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() );
Window::Scroll(nXScroll, nYScroll, aScrollableArea );
-
// Manually scroll all children ( except the scrollbars )
for ( int index = 0; index < GetChildCount(); ++index )
{
@@ -89,18 +88,20 @@ void ScrollableDialog::SetScrollTop( long nTop )
{
printf("ScrollableDialog::SetScrollTop(%d)\n", nTop );
Point aOld = mnScrollPos;
- lcl_Scroll( mnScrollPos.X() , nTop );
+ lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop );
printf("about to set thumb\n");
maHScrollBar.SetThumbPos( 0 );
+ // new pos is 0,0
mnScrollPos = aOld;
}
void ScrollableDialog::SetScrollLeft( long nLeft )
{
printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft );
Point aOld = mnScrollPos;
- lcl_Scroll( nLeft , mnScrollPos.Y() );
+ lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() );
printf("about to set thumb\n");
maVScrollBar.SetThumbPos( 0 );
+ // new pos is 0,0
mnScrollPos = aOld;
}
void ScrollableDialog::SetScrollWidth( long nWidth )
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 67d794f..d8efe4f 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -358,6 +358,15 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons
if ( maTopWindowListeners.getLength() )
xTW->addTopWindowListener( &maTopWindowListeners );
+ // there must be a better way than doing this, we can't
+ // process the scrolltop & scrollleft in XDialog because
+ // the children haven't been added when those props are applied
+ Reference< XPropertySet > xDlgProps( getModel(), UNO_QUERY );
+ Reference< XPropertySet > xPeerProps( getPeer(), uno::UNO_QUERY );
+
+ ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLTOP ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLTOP ) ) );
+ ImplSetPeerProperty( GetPropertyName( BASEPROPERTY_SCROLLLEFT ), ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLLEFT ) ) );
+
}
}
@@ -1089,6 +1098,7 @@ void UnoFrameControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
SimpleFontMetric aFM;
FontDescriptor aFD;
Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
+
aVal >>= aFD;
if ( !aFD.StyleName.isEmpty() )
{
commit be045f69d1746a287c48389785a0eaa91785d452
Author: Noel Power <noel.power at suse.com>
Date: Wed Sep 5 19:49:10 2012 +0100
better scrolling, support for scroll width and scroll height
scroll top & scroll left not working that successfully
Change-Id: I61e49c15798a1754822fb0802cbd17bab07327cd
diff --git a/toolkit/inc/toolkit/awt/scrollabledialog.hxx b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
index 968771b..41ae32f 100644
--- a/toolkit/inc/toolkit/awt/scrollabledialog.hxx
+++ b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
@@ -63,10 +63,9 @@ namespace toolkit
Window* getContentWindow();
ScrollBarVisibility getScrollVisibility() { return maScrollVis; }
void setScrollVisibility( ScrollBarVisibility rState );
- virtual void Paint( const Rectangle& rRect );
- virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
DECL_LINK( ScrollBarHdl, ScrollBar* );
DECL_LINK( ContainerScrolled, void* );
+ virtual void ResetScrollBars();
// Window
virtual void Resize();
};
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index dc3d3ab..2ffc793 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -88,74 +88,44 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
void ScrollableDialog::SetScrollTop( long nTop )
{
printf("ScrollableDialog::SetScrollTop(%d)\n", nTop );
+ Point aOld = mnScrollPos;
+ lcl_Scroll( mnScrollPos.X() , nTop );
+ printf("about to set thumb\n");
+ maHScrollBar.SetThumbPos( 0 );
+ mnScrollPos = aOld;
}
void ScrollableDialog::SetScrollLeft( long nLeft )
{
printf("ScrollableDialog::SetScrollLeft(%d)\n", nLeft );
+ Point aOld = mnScrollPos;
+ lcl_Scroll( nLeft , mnScrollPos.Y() );
+ printf("about to set thumb\n");
+ maVScrollBar.SetThumbPos( 0 );
+ mnScrollPos = aOld;
}
void ScrollableDialog::SetScrollWidth( long nWidth )
{
printf("ScrollableDialog::SetScrollWidth(%d)\n", nWidth );
maScrollArea.Width() = nWidth;
+ ResetScrollBars();
}
void ScrollableDialog::SetScrollHeight( long nHeight )
{
printf("ScrollableDialog::SetScrollHeight(%d)\n", nHeight );
maScrollArea.Height() = nHeight;
+ ResetScrollBars();
}
-void ScrollableDialog::Paint( const Rectangle& rRect )
-{
-// printf("ScrollableDialog::Paint( %d, %d, %d, %d width %d height %d\n", rRect.Top(), rRect.Left(), rRect.Right(), rRect.Bottom(),GetSizePixel().Width(), GetSizePixel().Height() );
- Dialog::Paint( rRect );
-}
-
-void ScrollableDialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
+void ScrollableDialog::Resize()
{
-// printf("ScrollableDialog::Draw( ( %d, %d ) h %d, w %d \n", rPos.X(), rPos.Y(), rSize.Height(), rSize.Width() );
- Dialog::Draw( pDev, rPos, rSize, nFlags );
+ ResetScrollBars();
}
-void ScrollableDialog::Resize()
+void ScrollableDialog::ResetScrollBars()
{
Size aOutSz = GetOutputSizePixel();
- printf("ScrollableDialog::Resize() - size is width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height() );
- // find the output area for the window
- long nMaxX = GetSizePixel().Width();
- long nMaxY = GetSizePixel().Height();
- for ( int index = 0, count = GetChildCount(); index < count; ++index )
- {
- Window* pChild = GetChild( index );
- if ( pChild )
- {
- Point aPos = pChild->GetPosPixel();
- Size aSize = pChild->GetSizePixel();
- long nX = aPos.X() + aSize.Width();
- long nY = aPos.Y() + aSize.Height();
- if ( nX > nMaxX )
- nMaxX = nX;
- if ( nY > nMaxY )
- nMaxY = nY;
- printf("%s child[%d] pos (%d,%d) height %d, width %d\n", rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr(), index, aPos.X(), aPos.Y(), aSize.Height(), aSize.Width() );
- }
- }
-
-#if 1
- // assume for the moment that we have both hori & vert scroll bars
- Size aContentsSize( aOutSz );
- if ( mbHasVertBar )
- {
- aContentsSize.Width() -= mnScrWidth;
- nMaxX += mnScrWidth;
- }
- if ( mbHasHoriBar )
- {
- aContentsSize.Height() -= mnScrWidth;
- nMaxY += mnScrWidth;
- }
- maScrollArea = aContentsSize;
-#endif
+ printf("ScrollableDialog::ResetScrollbars() - size is width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height() );
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
Point aHPos( 0, aOutSz.Height() - mnScrWidth );
@@ -163,13 +133,11 @@ void ScrollableDialog::Resize()
maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
maHScrollBar.SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
- printf("nMaxX is %d nMaxY is %d, scrollarea height %d, width %d\n", nMaxX, nMaxY, maScrollArea.Height(), maScrollArea.Width() );
- printf("Width %d Height %d outsize width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height(), aOutSz.Width(), aOutSz.Height() );
- maHScrollBar.SetRangeMax( nMaxX );
+ maHScrollBar.SetRangeMax( maScrollArea.Width() + mnScrWidth );
maHScrollBar.SetVisibleSize( GetSizePixel().Width() );
// maHScrollBar.SetPageSize( maScrollArea.Height() );
- maVScrollBar.SetRangeMax( nMaxY );
+ maVScrollBar.SetRangeMax( maScrollArea.Height() + mnScrWidth );
maVScrollBar.SetVisibleSize( GetSizePixel().Height() );
// maVScrollBar.SetPageSize( maScrollArea.Width() );
}
commit 7d69c50413884d5cba1498b5af3298820fb4621b
Author: Noel Power <noel.power at suse.com>
Date: Wed Sep 5 17:59:46 2012 +0100
misc fixes and improvements
hook in new properties into the property controller
allow new values to be passed to control
Change-Id: Ibbf1c1de4bfc7cb15e46d0d6704a025e5f0d048c
diff --git a/extensions/inc/propctrlr.hrc b/extensions/inc/propctrlr.hrc
index 1e2f9f1..4d52032 100644
--- a/extensions/inc/propctrlr.hrc
+++ b/extensions/inc/propctrlr.hrc
@@ -196,6 +196,10 @@
#define HID_PROP_PROGRESSVALUE_MAX "EXTENSIONS_HID_PROP_PROGRESSVALUE_MAX"
#define HID_PROP_SCROLLVALUE "EXTENSIONS_HID_PROP_SCROLLVALUE"
#define HID_PROP_SCROLLVALUE_MAX "EXTENSIONS_HID_PROP_SCROLLVALUE_MAX"
+#define HID_PROP_SCROLL_WIDTH "EXTENSIONS_HID_PROP_SCROLL_WIDTH"
+#define HID_PROP_SCROLL_HEIGHT "EXTENSIONS_HID_PROP_SCROLL_HEIGHT"
+#define HID_PROP_SCROLL_TOP "EXTENSIONS_HID_PROP_SCROLL_TOP"
+#define HID_PROP_SCROLL_LEFT "EXTENSIONS_HID_PROP_SCROLL_LEFT"
#define HID_PROP_LINEINCREMENT "EXTENSIONS_HID_PROP_LINEINCREMENT"
#define HID_PROP_BLOCKINCREMENT "EXTENSIONS_HID_PROP_BLOCKINCREMENT"
#define HID_PROP_VISIBLESIZE "EXTENSIONS_HID_PROP_VISIBLESIZE"
diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx
index 509b19e..8d5cadc 100644
--- a/extensions/source/propctrlr/formmetadata.cxx
+++ b/extensions/source/propctrlr/formmetadata.cxx
@@ -263,6 +263,10 @@ namespace pcr
DEF_INFO_2( SCROLLVALUE, SCROLLVALUE, SCROLLVALUE, DIALOG_VISIBLE, COMPOSEABLE ),
DEF_INFO_3( SCROLLVALUE_MIN, SCROLLVALUE_MIN, SCROLLVALUE_MIN, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
DEF_INFO_3( SCROLLVALUE_MAX, SCROLLVALUE_MAX, SCROLLVALUE_MAX, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
+ DEF_INFO_3( SCROLL_WIDTH, SCROLL_WIDTH, SCROLL_WIDTH, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
+ DEF_INFO_2( SCROLL_HEIGHT, SCROLL_HEIGHT, SCROLL_HEIGHT, DIALOG_VISIBLE, COMPOSEABLE ),
+ DEF_INFO_2( SCROLL_TOP, SCROLL_TOP, SCROLL_TOP, DIALOG_VISIBLE, COMPOSEABLE ),
+ DEF_INFO_2( SCROLL_LEFT, SCROLL_LEFT, SCROLL_LEFT, DIALOG_VISIBLE, COMPOSEABLE ),
DEF_INFO_2( DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,DEFAULT_SCROLLVALUE,FORM_VISIBLE, COMPOSEABLE ),
DEF_INFO_3( LINEINCREMENT, LINEINCREMENT, LINEINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
DEF_INFO_3( BLOCKINCREMENT, BLOCKINCREMENT, BLOCKINCREMENT, FORM_VISIBLE, DIALOG_VISIBLE, COMPOSEABLE ),
diff --git a/extensions/source/propctrlr/formmetadata.hxx b/extensions/source/propctrlr/formmetadata.hxx
index 6a7f48e..ef8c440 100644
--- a/extensions/source/propctrlr/formmetadata.hxx
+++ b/extensions/source/propctrlr/formmetadata.hxx
@@ -338,6 +338,10 @@ namespace pcr
#define PROPERTY_ID_WHEEL_BEHAVIOR 200
#define PROPERTY_ID_TEXT_ANCHOR_TYPE 201
#define PROPERTY_ID_SHEET_ANCHOR_TYPE 202
+ #define PROPERTY_ID_SCROLL_WIDTH 203
+ #define PROPERTY_ID_SCROLL_HEIGHT 204
+ #define PROPERTY_ID_SCROLL_TOP 205
+ #define PROPERTY_ID_SCROLL_LEFT 206
//............................................................................
} // namespace pcr
diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
index d307c2a..1135138 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 4a1c07b..f496026 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 53388bf..dc3d3ab 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 d5a313d..a70d5ac 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 630f64a..67d794f 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 5e13d2a..14331ab 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 ),
commit 595f467ec8de68f3faeacd02005f613bcf61f42c
Author: Noel Power <noel.power at suse.com>
Date: Tue Sep 4 21:55:23 2012 +0100
mpre debug, fix more obvious fobars
Change-Id: I88664f7dd09c8d6cdc1c18e87b3cd40b7e3bb246
diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx
index 2732e60..53388bf 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -54,13 +54,14 @@ Window* ScrollableDialog::getContentWindow()
void ScrollableDialog::lcl_Scroll( long nX, long nY )
{
- long nXScroll = mnScrollPos.Y() - nX;
- long nYScroll = mnScrollPos.X() - nY;
-
+ long nXScroll = mnScrollPos.X() - nX;
+ long nYScroll = mnScrollPos.Y() - nY;
+ printf( "ScrollableDialog::lcl_Scroll %d, %d nXScroll %d, nYScroll %d\n", nX, nY, nXScroll, nYScroll );
mnScrollPos = Point( nX, nY );
Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() );
Window::Scroll(nXScroll, nYScroll, aScrollableArea );
+
// Manually scroll all children ( except the scrollbars )
for ( int index = 0; index < GetChildCount(); ++index )
{
@@ -78,9 +79,9 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
{
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
if( pSB == &maVScrollBar )
- Scroll(0, nPos );
+ lcl_Scroll(mnScrollPos.X(), nPos );
else if( pSB == &maHScrollBar )
- lcl_Scroll(nPos, 0 );
+ lcl_Scroll(nPos, mnScrollPos.Y() );
#if 0
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
Rectangle aScrollableArea( 0, 0, maScrollArea.Width(), maScrollArea.Height() );
@@ -100,7 +101,7 @@ IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
printf("horizontal scroll %d\n", nPos );
Size aTmpScroll( nPos, nPos );
long nScroll = mnScrollPos.X() - aTmpScroll.Width();
- Scroll( nScroll, 0, aScrollableArea);
+ Scroll( nScroll, 0, aScrollableArea);
mnScrollPos.X() = nPos;
aScroll.X() = nScroll;
}
@@ -132,13 +133,13 @@ void ScrollableDialog::SetScrollHeight( long nHeight )
void ScrollableDialog::Paint( const Rectangle& rRect )
{
- printf("ScrollableDialog::Paint( %d, %d, %d, %d width %d height %d\n", rRect.Top(), rRect.Left(), rRect.Right(), rRect.Bottom(),GetSizePixel().Width(), GetSizePixel().Height() );
+// printf("ScrollableDialog::Paint( %d, %d, %d, %d width %d height %d\n", rRect.Top(), rRect.Left(), rRect.Right(), rRect.Bottom(),GetSizePixel().Width(), GetSizePixel().Height() );
Dialog::Paint( rRect );
}
void ScrollableDialog::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags )
{
- printf("ScrollableDialog::Draw( ( %d, %d ) h %d, w %d \n", rPos.X(), rPos.Y(), rSize.Height(), rSize.Width() );
+// printf("ScrollableDialog::Draw( ( %d, %d ) h %d, w %d \n", rPos.X(), rPos.Y(), rSize.Height(), rSize.Width() );
Dialog::Draw( pDev, rPos, rSize, nFlags );
}
@@ -162,23 +163,24 @@ void ScrollableDialog::Resize()
nMaxX = nX;
if ( nY > nMaxY )
nMaxY = nY;
+ printf("%s child[%d] pos (%d,%d) height %d, width %d\n", rtl::OUStringToOString( pChild->GetText(), RTL_TEXTENCODING_UTF8 ).getStr(), index, aPos.X(), aPos.Y(), aSize.Height(), aSize.Width() );
}
}
-#if 0
+#if 1
// assume for the moment that we have both hori & vert scroll bars
Size aContentsSize( aOutSz );
if ( mbHasVertBar )
{
aContentsSize.Width() -= mnScrWidth;
- nMaxX += nScrWidth;
+ nMaxX += mnScrWidth;
}
if ( mbHasHoriBar )
{
aContentsSize.Height() -= mnScrWidth;
nMaxY += mnScrWidth;
}
- maContents.SetSizePixel( aContentsSize );
+ maScrollArea = aContentsSize;
#endif
Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
@@ -186,12 +188,16 @@ void ScrollableDialog::Resize()
maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
maHScrollBar.SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
- maHScrollBar.SetRangeMax( maScrollArea.Width() );
+
+ printf("nMaxX is %d nMaxY is %d, scrollarea height %d, width %d\n", nMaxX, nMaxY, maScrollArea.Height(), maScrollArea.Width() );
+ printf("Width %d Height %d outsize width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height(), aOutSz.Width(), aOutSz.Height() );
+ maHScrollBar.SetRangeMax( nMaxX );
maHScrollBar.SetVisibleSize( GetSizePixel().Width() );
- maHScrollBar.SetPageSize( maScrollArea.Width() );
- maVScrollBar.SetRangeMax( maScrollArea.Height() );
+// maHScrollBar.SetPageSize( maScrollArea.Height() );
+
+ maVScrollBar.SetRangeMax( nMaxY );
maVScrollBar.SetVisibleSize( GetSizePixel().Height() );
- maVScrollBar.SetPageSize( maScrollArea.Height() );
+// maVScrollBar.SetPageSize( maScrollArea.Width() );
}
} // toolkit
commit 613f8a3137e0af2e97214b4b1c2da8c87b3f8889
Author: Noel Power <noel.power at suse.com>
Date: Tue Sep 4 20:12:45 2012 +0100
attempt own scroll
Change-Id: I4abc00bf4fcebb098b63cc2c3638e0d573381ca5
diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src
index f12e66e..ed5aa31 100644
--- a/extensions/source/propctrlr/formres.src
+++ b/extensions/source/propctrlr/formres.src
@@ -919,6 +919,22 @@ String RID_STR_SCROLLVALUE_MIN
{
Text [ en-US ] = "Scroll value min.";
};
+String RID_STR_SCROLL_WIDTH
+{
+ Text [ en-US ] = "Scroll width";
+};
+String RID_STR_SCROLL_HEIGHT
+{
+ Text [ en-US ] = "Scroll height";
+};
+String RID_STR_SCROLL_TOP
+{
+ Text [ en-US ] = "Scroll top";
+};
+String RID_STR_SCROLL_LEFT
+{
+ Text [ en-US ] = "Scroll left";
+};
String RID_STR_DEFAULT_SCROLLVALUE
{
Text [ en-US ] = "Default scroll value";
diff --git a/extensions/source/propctrlr/formresid.hrc b/extensions/source/propctrlr/formresid.hrc
index 874409d..7fff852 100644
--- a/extensions/source/propctrlr/formresid.hrc
+++ b/extensions/source/propctrlr/formresid.hrc
@@ -262,6 +262,10 @@
#define RID_STR_FONTSTYLE_ITALIC ( RID_FORMBROWSER_START + 253 )
#define RID_STR_FONTSTYLE_BOLD ( RID_FORMBROWSER_START + 254 )
#define RID_STR_FONT_DEFAULT ( RID_FORMBROWSER_START + 255 )
+#define RID_STR_SCROLL_WIDTH ( RID_FORMBROWSER_START + 256 )
+#define RID_STR_SCROLL_HEIGHT ( RID_FORMBROWSER_START + 257 )
+#define RID_STR_SCROLL_TOP ( RID_FORMBROWSER_START + 258 )
+#define RID_STR_SCROLL_LEFT ( RID_FORMBROWSER_START + 259 )
// -----------------------------------------------------------------------
diff --git a/extensions/source/propctrlr/formstrings.hxx b/extensions/source/propctrlr/formstrings.hxx
index 19bffe3..4c4c8cb 100644
--- a/extensions/source/propctrlr/formstrings.hxx
+++ b/extensions/source/propctrlr/formstrings.hxx
@@ -174,6 +174,10 @@ namespace pcr
PCR_CONSTASCII_STRING( PROPERTY_DEFAULT_SCROLLVALUE, "DefaultScrollValue");
PCR_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_MIN, "ScrollValueMin");
PCR_CONSTASCII_STRING( PROPERTY_SCROLLVALUE_MAX, "ScrollValueMax");
+ PCR_CONSTASCII_STRING( PROPERTY_SCROLL_WIDTH, "ScrollWidth");
+ PCR_CONSTASCII_STRING( PROPERTY_SCROLL_HEIGHT, "ScrollHeight");
+ PCR_CONSTASCII_STRING( PROPERTY_SCROLL_TOP, "ScrollTop");
+ PCR_CONSTASCII_STRING( PROPERTY_SCROLL_LEFT, "ScrollLeft");
PCR_CONSTASCII_STRING( PROPERTY_LINEINCREMENT, "LineIncrement");
PCR_CONSTASCII_STRING( PROPERTY_BLOCKINCREMENT, "BlockIncrement");
PCR_CONSTASCII_STRING( PROPERTY_VISIBLESIZE, "VisibleSize");
diff --git a/toolkit/inc/toolkit/awt/scrollabledialog.hxx b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
index 19cd1e1..968771b 100644
--- a/toolkit/inc/toolkit/awt/scrollabledialog.hxx
+++ b/toolkit/inc/toolkit/awt/scrollabledialog.hxx
@@ -36,16 +36,35 @@ namespace toolkit
{
class ScrollableDialog : public Dialog
{
- Window maContents;
ScrollBar maHScrollBar;
ScrollBar maVScrollBar;
+ Size maScrollArea;
bool mbHasHoriBar;
bool mbHasVertBar;
Point mnScrollPos;
+ long mnScrWidth;
+
+ public:
+ enum ScrollBarVisibility { None, Vert, Hori, Both };
+ private:
+ ScrollBarVisibility maScrollVis;
+ void lcl_Scroll( long nX, long nY );
public:
ScrollableDialog( Window* pParent, WinBits nStyle = WB_STDDIALOG );
virtual ~ScrollableDialog();
+ void SetScrollWidth( long nWidth );
+ long GetScrollWidth() { return maScrollArea.Width(); }
+ void SetScrollHeight( long nHeight );
+ long GetScrollHeight() { return maScrollArea.Height(); }
+ void SetScrollLeft( long nLeft );
+ long GetScrollLeft() { return mnScrollPos.X(); }
+ void SetScrollTop( long Top );
+ long GetScrollTop() { return mnScrollPos.Y() ; }
Window* getContentWindow();
+ ScrollBarVisibility getScrollVisibility() { return maScrollVis; }
+ void setScrollVisibility( ScrollBarVisibility rState );
+ virtual void Paint( const Rectangle& rRect );
+ virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
DECL_LINK( ScrollBarHdl, ScrollBar* );
DECL_LINK( ContainerScrolled, void* );
// Window
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
index a44db62..4a1c07b 100644
--- a/toolkit/inc/toolkit/helper/property.hxx
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -211,6 +211,8 @@ 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
// 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 1c64ab6..2732e60 100644
--- a/toolkit/source/awt/scrollabledialog.cxx
+++ b/toolkit/source/awt/scrollabledialog.cxx
@@ -3,14 +3,44 @@
namespace toolkit
{
-ScrollableDialog::ScrollableDialog( Window* pParent, WinBits nStyle ) : Dialog( pParent, nStyle ), maContents( this, nStyle ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( true ), mbHasVertBar( true )
+ScrollableDialog::ScrollableDialog( Window* pParent, WinBits nStyle ) : Dialog( pParent, nStyle | ~( WB_HSCROLL | WB_VSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None )
{
Link aLink( LINK( this, ScrollableDialog, ScrollBarHdl ) );
maVScrollBar.SetScrollHdl( aLink );
maHScrollBar.SetScrollHdl( aLink );
- maContents.Show();
- maVScrollBar.Show();
- maHScrollBar.Show();
+
+ Size aOutSz = GetOutputSizePixel();
+ ScrollBarVisibility aVis = None;
+
+ if ( nStyle & ( WB_HSCROLL | WB_VSCROLL ) )
+ {
+ if ( nStyle & WB_HSCROLL )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list