summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extensions/source/propctrlr/formres.src16
-rw-r--r--extensions/source/propctrlr/formresid.hrc4
-rw-r--r--extensions/source/propctrlr/formstrings.hxx4
-rw-r--r--toolkit/inc/toolkit/awt/scrollabledialog.hxx21
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx2
-rw-r--r--toolkit/source/awt/scrollabledialog.cxx154
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx5
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx2
-rw-r--r--toolkit/source/helper/property.cxx2
9 files changed, 178 insertions, 32 deletions
diff --git a/extensions/source/propctrlr/formres.src b/extensions/source/propctrlr/formres.src
index f12e66e0240e..ed5aa31d438b 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 874409d2dcac..7fff8522de59 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 19bffe32e30c..4c4c8cb496e4 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 19cd1e150f9c..968771b56e6c 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 a44db628a346..4a1c07bb102f 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 1c64ab61846e..2732e6077ac5 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 )
+ aVis = Hori;
+ if ( nStyle & WB_VSCROLL )
+ {
+ if ( aVis == Hori )
+ aVis = Both;
+ else
+ aVis = Vert;
+ }
+ }
+ setScrollVisibility( aVis );
+ mnScrWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
+}
+
+void ScrollableDialog::setScrollVisibility( ScrollBarVisibility rVisState )
+{
+ maScrollVis = rVisState;
+ if ( maScrollVis == Hori || maScrollVis == Both )
+ mbHasHoriBar = true;
+ if ( maScrollVis == Vert || maScrollVis == Both )
+ mbHasVertBar = true;
+ if ( mbHasVertBar )
+ maVScrollBar.Show();
+ if ( mbHasHoriBar )
+ maHScrollBar.Show();
+ if ( mbHasHoriBar || mbHasVertBar )
+ SetStyle( GetStyle() | WB_CLIPCHILDREN | SCROLL_UPDATE );
}
ScrollableDialog::~ScrollableDialog()
@@ -19,42 +49,109 @@ ScrollableDialog::~ScrollableDialog()
Window* ScrollableDialog::getContentWindow()
{
- return &maContents;
+ return this;
+}
+
+void ScrollableDialog::lcl_Scroll( long nX, long nY )
+{
+ long nXScroll = mnScrollPos.Y() - nX;
+ long nYScroll = mnScrollPos.X() - nY;
+
+ 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 )
+ {
+ Window* pChild = GetChild( index );
+ if ( pChild && pChild != &maVScrollBar && pChild != &maHScrollBar )
+ {
+ Point aPos = pChild->GetPosPixel();
+ aPos += Point( nXScroll, nYScroll );
+ pChild->SetPosPixel( aPos );
+ }
+ }
}
IMPL_LINK( ScrollableDialog, ScrollBarHdl, ScrollBar*, pSB )
{
sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos();
- Rectangle aScrollableArea( 0, 0, maContents.GetSizePixel().Width(), maContents.GetSizePixel().Height() );
-
+ if( pSB == &maVScrollBar )
+ Scroll(0, nPos );
+ else if( pSB == &maHScrollBar )
+ lcl_Scroll(nPos, 0 );
+#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 );
- printf("vertical scroll %d\n", nPos );
- long nScroll = mnScrollPos.Y() - nPos;
- maContents.Scroll(0, nScroll, aScrollableArea );
+ 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 );
- long nScroll = mnScrollPos.X() - nPos;
- maContents.Scroll( nScroll, 0, aScrollableArea);
+ 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::SetScrollWidth( long nWidth )
+{
+ maScrollArea.Width() = nWidth;
+}
+
+void ScrollableDialog::SetScrollHeight( long nHeight )
+{
+ maScrollArea.Height() = 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() );
+ 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() );
+ Dialog::Draw( pDev, rPos, rSize, nFlags );
+}
+
void ScrollableDialog::Resize()
{
+ Size aOutSz = GetOutputSizePixel();
printf("ScrollableDialog::Resize() - size is width %d height %d\n", GetSizePixel().Width(), GetSizePixel().Height() );
- maContents.SetSizePixel( GetSizePixel() );
// find the output area for the window
long nMaxX = GetSizePixel().Width();
long nMaxY = GetSizePixel().Height();
- for ( int index = 0, count = maContents.GetChildCount(); index < count; ++index )
+ for ( int index = 0, count = GetChildCount(); index < count; ++index )
{
- Window* pChild = maContents.GetChild( index );
+ Window* pChild = GetChild( index );
if ( pChild )
{
Point aPos = pChild->GetPosPixel();
@@ -68,34 +165,33 @@ void ScrollableDialog::Resize()
}
}
- Size aOutSz = GetOutputSizePixel();
- long nScrWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
-
+#if 0
// assume for the moment that we have both hori & vert scroll bars
Size aContentsSize( aOutSz );
if ( mbHasVertBar )
{
- aContentsSize.Width() -= nScrWidth;
+ aContentsSize.Width() -= mnScrWidth;
nMaxX += nScrWidth;
}
if ( mbHasHoriBar )
{
- aContentsSize.Height() -= nScrWidth;
- nMaxY += nScrWidth;
+ aContentsSize.Height() -= mnScrWidth;
+ nMaxY += mnScrWidth;
}
maContents.SetSizePixel( aContentsSize );
+#endif
- Point aVPos( aOutSz.Width() - nScrWidth, 0 );
- Point aHPos( 0, aOutSz.Height() - nScrWidth );
+ Point aVPos( aOutSz.Width() - mnScrWidth, 0 );
+ Point aHPos( 0, aOutSz.Height() - mnScrWidth );
- maVScrollBar.SetPosSizePixel( aVPos, Size( nScrWidth, aContentsSize.Height() ) );
- maHScrollBar.SetPosSizePixel( aHPos, Size( aContentsSize.Width(), nScrWidth ) );
- maHScrollBar.SetRangeMax( nMaxX );
+ maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, GetSizePixel().Height() - mnScrWidth ) );
+ maHScrollBar.SetPosSizePixel( aHPos, Size( GetSizePixel().Width() - mnScrWidth, mnScrWidth ) );
+ maHScrollBar.SetRangeMax( maScrollArea.Width() );
maHScrollBar.SetVisibleSize( GetSizePixel().Width() );
- maHScrollBar.SetPageSize( GetSizePixel().Width() );
- maVScrollBar.SetRangeMax( nMaxY );
+ maHScrollBar.SetPageSize( maScrollArea.Width() );
+ maVScrollBar.SetRangeMax( maScrollArea.Height() );
maVScrollBar.SetVisibleSize( GetSizePixel().Height() );
- maVScrollBar.SetPageSize( GetSizePixel().Height() );
+ maVScrollBar.SetPageSize( maScrollArea.Height() );
}
} // toolkit
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index c2bb0a1352ef..55ca00c4acf9 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -787,7 +787,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 | WB_AUTOHSCROLL | WB_AUTOVSCROLL );
+ pNewWindow = new toolkit::ScrollableDialog( 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,6 +1062,7 @@ 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 );
@@ -1070,7 +1071,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
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/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
index 51c05108b041..630f64aa232f 100644
--- a/toolkit/source/controls/dialogcontrol.cxx
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -173,6 +173,8 @@ UnoControlDialogModel::UnoControlDialogModel( const Reference< XMultiServiceFact
ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_HSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_VSCROLL );
Any aBool;
aBool <<= (sal_Bool) sal_True;
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
index a3d4b373e71c..5e13d2a94bed 100644
--- a/toolkit/source/helper/property.cxx
+++ b/toolkit/source/helper/property.cxx
@@ -185,6 +185,7 @@ 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),
@@ -256,6 +257,7 @@ 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 ),