summaryrefslogtreecommitdiff
path: root/toolkit/source
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-24 11:44:36 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-24 11:44:36 +0100
commit7406b40991a58899180e5dd20572d078d878881d (patch)
tree7549e603b35f170175c5389ef24ef5a3197c1ea9 /toolkit/source
parentb6ac7ef63c50895d04d314491b26b3b371d5fc93 (diff)
gridsort: re-did the column resizing
- introduced XGridColumn.Flexibility, determining to which degree the column is resized during auto-column-resizing - removed XGridColumn.PreferredWidth - there really is no need for this anymore now - documented the relationship between XGridColumn.Flexibility and XGridColumn.Resizeable - re-implemented TableControl_Impl::impl_ni_updateColumnWidths, with (hopefully) less magic
Diffstat (limited to 'toolkit/source')
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx4
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx32
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx6
3 files changed, 23 insertions, 19 deletions
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index 8c50a7e62ef7..a9d808103821 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -233,7 +233,9 @@ namespace toolkit
colTitle.appendAscii( "Column " );
colTitle.append( i + 1 );
pGridColumn->setTitle( colTitle.makeStringAndClear() );
- pGridColumn->setPreferredWidth( 80 /* APPFONT */ );
+ pGridColumn->setColumnWidth( 80 /* APPFONT */ );
+ pGridColumn->setFlexibility( 1 );
+ pGridColumn->setResizeable( sal_True );
pGridColumn->setDataColumnIndex( i );
ContainerEvent aEvent;
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
index 60873cc1802f..9899b517d259 100644
--- a/toolkit/source/controls/grid/gridcolumn.cxx
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -52,9 +52,9 @@ namespace toolkit
,m_nIndex(-1)
,m_nDataColumnIndex(-1)
,m_nColumnWidth(4)
- ,m_nPreferredWidth(0)
,m_nMaxWidth(0)
,m_nMinWidth(0)
+ ,m_nFlexibility(1)
,m_bResizeable(true)
,m_eHorizontalAlign( HorizontalAlignment_LEFT )
{
@@ -68,8 +68,8 @@ namespace toolkit
,m_nIndex( -1 )
,m_nDataColumnIndex( i_copySource.m_nDataColumnIndex )
,m_nColumnWidth( i_copySource.m_nColumnWidth )
- ,m_nPreferredWidth( i_copySource.m_nPreferredWidth )
,m_nMaxWidth( i_copySource.m_nMaxWidth )
+ ,m_nFlexibility( i_copySource.m_nFlexibility )
,m_nMinWidth( i_copySource.m_nMinWidth )
,m_bResizeable( i_copySource.m_bResizeable )
,m_eHorizontalAlign( i_copySource.m_eHorizontalAlign )
@@ -126,19 +126,6 @@ namespace toolkit
}
//------------------------------------------------------------------------------------------------------------------
- ::sal_Int32 SAL_CALL GridColumn::getPreferredWidth() throw (::com::sun::star::uno::RuntimeException)
- {
- ::comphelper::ComponentGuard aGuard( *this, rBHelper );
- return m_nPreferredWidth;
- }
-
- //------------------------------------------------------------------------------------------------------------------
- void SAL_CALL GridColumn::setPreferredWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
- {
- impl_set( m_nPreferredWidth, value, "PreferredWidth" );
- }
-
- //------------------------------------------------------------------------------------------------------------------
::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
{
::comphelper::ComponentGuard aGuard( *this, rBHelper );
@@ -204,6 +191,21 @@ namespace toolkit
}
//------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getFlexibility() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nFlexibility;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setFlexibility( ::sal_Int32 i_value ) throw (IllegalArgumentException, RuntimeException)
+ {
+ if ( i_value < 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ impl_set( m_nFlexibility, i_value, "Flexibility" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
{
::comphelper::ComponentGuard aGuard( *this, rBHelper );
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
index a28fd5824160..b1be836a3862 100644
--- a/toolkit/source/controls/grid/gridcolumn.hxx
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -60,14 +60,14 @@ public:
virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getPreferredWidth() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPreferredWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException);
@@ -123,9 +123,9 @@ private:
sal_Int32 m_nIndex;
sal_Int32 m_nDataColumnIndex;
sal_Int32 m_nColumnWidth;
- sal_Int32 m_nPreferredWidth;
sal_Int32 m_nMaxWidth;
sal_Int32 m_nMinWidth;
+ sal_Int32 m_nFlexibility;
sal_Bool m_bResizeable;
::rtl::OUString m_sTitle;
::rtl::OUString m_sHelpText;