summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-12 12:34:24 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2011-01-12 12:34:24 +0100
commit6c8d7babb69985bf3f676b59cf767952c971ebc5 (patch)
treef8eee940fabd76bb2e80c9b95806dd98722b9aac /svtools
parent76365bac02b0ee3ffc3755699034b8d790d2c97a (diff)
gridsort: reworked the color model for grid controls. Now supporting more than two alternating colors,
having more reasonable defaults for the colors (VOID instead of some hard-coded values, which thus are unusable). Also, introduced new property UseGridLines controlling whether or not to paint the table grid.
Diffstat (limited to 'svtools')
-rw-r--r--svtools/inc/svtools/table/gridtablerenderer.hxx14
-rwxr-xr-xsvtools/inc/svtools/table/tablemodel.hxx52
-rw-r--r--svtools/source/table/gridtablerenderer.cxx235
-rwxr-xr-xsvtools/source/table/tablecontrol_impl.cxx28
-rw-r--r--svtools/source/uno/svtxgridcontrol.cxx169
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx161
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx66
7 files changed, 464 insertions, 261 deletions
diff --git a/svtools/inc/svtools/table/gridtablerenderer.hxx b/svtools/inc/svtools/table/gridtablerenderer.hxx
index 3b4160b1fd6a..c472fa408574 100644
--- a/svtools/inc/svtools/table/gridtablerenderer.hxx
+++ b/svtools/inc/svtools/table/gridtablerenderer.hxx
@@ -29,6 +29,8 @@
#include <svtools/table/tablemodel.hxx>
+#include <boost/scoped_ptr.hpp>
+
//........................................................................
namespace svt { namespace table
{
@@ -47,7 +49,7 @@ namespace svt { namespace table
class GridTableRenderer : public ITableRenderer
{
private:
- GridTableRenderer_Impl* m_pImpl;
+ ::boost::scoped_ptr< GridTableRenderer_Impl > m_pImpl;
public:
/** creates a table renderer associated with the given model
@@ -69,7 +71,15 @@ namespace svt { namespace table
This method returns the index of the last row which has been prepared
*/
- RowPos getCurrentRow();
+ RowPos getCurrentRow() const;
+
+ /** determines whether or not to paint grid lines
+ */
+ bool useGridLines() const;
+
+ /** controls whether or not to paint grid lines
+ */
+ void useGridLines( bool const i_use );
public:
// ITableRenderer overridables
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index 3eb87f1eb40e..50030de7a31d 100755
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -40,6 +40,7 @@
#include <sal/types.h>
#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
#include <boost/enable_shared_from_this.hpp>
//........................................................................
@@ -461,12 +462,51 @@ namespace svt { namespace table
*/
virtual ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const = 0;
- virtual ::com::sun::star::util::Color getLineColor() = 0;
- virtual ::com::sun::star::util::Color getHeaderBackgroundColor() = 0;
- virtual ::com::sun::star::util::Color getTextColor() = 0;
- virtual ::com::sun::star::util::Color getOddRowBackgroundColor() = 0;
- virtual ::com::sun::star::util::Color getEvenRowBackgroundColor() = 0;
- virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() = 0;
+ /** returns the color to be used for rendering the grid lines.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getLineColor() const = 0;
+
+ /** returns the color to be used for rendering the header background.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const = 0;
+
+ /** returns the color to be used for rendering the header text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const = 0;
+
+ /** returns the color to be used for rendering cell texts.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getTextColor() const = 0;
+
+ /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text.
+
+ If this value is not set, a default color from the style settings will be used.
+ */
+ virtual ::boost::optional< ::Color > getTextLineColor() const = 0;
+
+ /** returns the colors to be used for the row backgrounds.
+
+ If this value is not set, every second row will have a background color derived from the style settings's
+ selection color, the other rows will not have a special background at all.
+
+ If this value is an empty sequence, the rows will not have a special background at all, instead the
+ normal background of the complete control will be used.
+
+ If value is a non-empty sequence, then rows will have the background colors as specified in the sequence,
+ in alternating order.
+ */
+ virtual ::boost::optional< ::std::vector< ::Color > >
+ getRowBackgroundColors() const = 0;
+
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const = 0;
/// destroys the table model instance
virtual ~ITableModel() { }
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index 60628ffba95d..3163cc54174c 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -29,19 +29,23 @@
#include "cellvalueconversion.hxx"
#include "svtools/table/gridtablerenderer.hxx"
+#include "svtools/colorcfg.hxx"
+/** === begin UNO includes === **/
#include <com/sun/star/graphic/XGraphic.hpp>
+/** === end UNO includes === **/
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/window.hxx>
#include <vcl/image.hxx>
-//........................................................................
+//......................................................................................................................
namespace svt { namespace table
{
-//........................................................................
+//......................................................................................................................
+ /** === begin UNO using === **/
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
@@ -54,41 +58,70 @@ namespace svt { namespace table
using ::com::sun::star::style::VerticalAlignment_TOP;
using ::com::sun::star::style::VerticalAlignment_MIDDLE;
using ::com::sun::star::style::VerticalAlignment_BOTTOM;
+ /** === end UNO using === **/
struct GridTableRenderer_Impl
{
ITableModel& rModel;
RowPos nCurrentRow;
+ bool bUseGridLines;
GridTableRenderer_Impl( ITableModel& _rModel )
:rModel( _rModel )
,nCurrentRow( ROW_INVALID )
+ ,bUseGridLines( true )
{
}
};
- //====================================================================
+ //==================================================================================================================
//= GridTableRenderer
- //====================================================================
- //--------------------------------------------------------------------
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
GridTableRenderer::GridTableRenderer( ITableModel& _rModel )
:m_pImpl( new GridTableRenderer_Impl( _rModel ) )
{
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
GridTableRenderer::~GridTableRenderer()
{
- DELETEZ( m_pImpl );
}
- //--------------------------------------------------------------------
- RowPos GridTableRenderer::getCurrentRow()
+ //------------------------------------------------------------------------------------------------------------------
+ RowPos GridTableRenderer::getCurrentRow() const
{
return m_pImpl->nCurrentRow;
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
+ bool GridTableRenderer::useGridLines() const
+ {
+ return m_pImpl->bUseGridLines;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridTableRenderer::useGridLines( bool const i_use )
+ {
+ m_pImpl->bUseGridLines = i_use;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ Color lcl_getEffectiveColor(
+ ::boost::optional< ::Color > const & i_modelColor,
+ StyleSettings const & i_styleSettings,
+ ::Color const & ( StyleSettings::*i_getDefaultColor ) () const
+ )
+ {
+ if ( !!i_modelColor )
+ return *i_modelColor;
+ return ( i_styleSettings.*i_getDefaultColor )();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintHeaderArea(
OutputDevice& _rDevice, const Rectangle& _rArea, bool _bIsColHeaderArea, bool _bIsRowHeaderArea,
const StyleSettings& _rStyle )
@@ -97,12 +130,11 @@ namespace svt { namespace table
"GridTableRenderer::PaintHeaderArea: invalid area flags!" );
_rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
- Color background = m_pImpl->rModel.getHeaderBackgroundColor();
- if ( background != COL_TRANSPARENT )
- _rDevice.SetFillColor( background );
- else
- _rDevice.SetFillColor( _rStyle.GetDialogColor() );
- _rDevice.SetLineColor( _rStyle.GetSeparatorColor() );
+
+ Color const background = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderBackgroundColor(), _rStyle, &StyleSettings::GetDialogColor );
+ _rDevice.SetFillColor( background );
+
+ m_pImpl->bUseGridLines ? _rDevice.SetLineColor( _rStyle.GetSeparatorColor() ) : _rDevice.SetLineColor();
_rDevice.DrawRect( _rArea );
// delimiter lines at bottom/right
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
@@ -113,7 +145,7 @@ namespace svt { namespace table
(void)_bIsRowHeaderArea;
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintColumnHeader( ColPos _nCol, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
@@ -126,24 +158,26 @@ namespace svt { namespace table
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- if(m_pImpl->rModel.getTextColor() != 0x000000)
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
- else
- _rDevice.SetTextColor(_rStyle.GetFieldTextColor());
+
+ ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
+ _rDevice.SetTextColor( textColor );
+
ULONG nHorFlag = TEXT_DRAW_LEFT;
ULONG nVerFlag = TEXT_DRAW_TOP;
- if(m_pImpl->rModel.getVerticalAlign() == 1)
+ if ( m_pImpl->rModel.getVerticalAlign() == 1 )
nVerFlag = TEXT_DRAW_VCENTER;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ else if ( m_pImpl->rModel.getVerticalAlign() == 2 )
nVerFlag = TEXT_DRAW_BOTTOM;
- if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1)
+ if ( m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1 )
nHorFlag = TEXT_DRAW_CENTER;
- else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2)
+ else if ( m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2 )
nHorFlag = TEXT_DRAW_RIGHT;
+
Rectangle aRect(_rArea);
aRect.Left()+=4; aRect.Right()-=4;
aRect.Bottom()-=2;
- _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
+
+ _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.Pop();
@@ -151,10 +185,10 @@ namespace svt { namespace table
// no special painting for the active column at the moment
(void)_bSelected;
- //selection for column header not yet implemented
+ // selection for column header not yet implemented
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PrepareRow( RowPos _nRow, bool _bActive, bool _bSelected,
OutputDevice& _rDevice, const Rectangle& _rRowArea, const StyleSettings& _rStyle )
{
@@ -163,69 +197,74 @@ namespace svt { namespace table
_rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
- Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor();
- const Color lineColor = m_pImpl->rModel.getLineColor();
- Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- const Color fieldColor = _rStyle.GetFieldColor();
- if ( aRowBackground == COL_TRANSPARENT )
- aRowBackground = fieldColor;
- if ( aRowBackground2 == COL_TRANSPARENT )
- aRowBackground2 = fieldColor;
- //if row is selected background color becomes blue, and lines should be also blue
- //if they aren't user defined
+ ::Color backgroundColor = _rStyle.GetFieldColor();
+
+ ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+
if ( _bSelected )
{
- const Color aSelected( _rStyle.GetHighlightColor() );
- aRowBackground = aSelected;
- if ( lineColor == COL_TRANSPARENT )
- _rDevice.SetLineColor( aRowBackground );
- else
- _rDevice.SetLineColor( lineColor );
+ // selected rows use the background color from the style
+ backgroundColor = _rStyle.GetHighlightColor();
+ if ( !aLineColor )
+ lineColor = backgroundColor;
}
- // if row not selected, check the cases whether user defined backgrounds are set
- // and set line color to be the same
else
{
- if ( ( aRowBackground2 != fieldColor ) && ( _nRow % 2 ) )
+ ::boost::optional< ::std::vector< ::Color > > aRowColors = m_pImpl->rModel.getRowBackgroundColors();
+ if ( !aRowColors )
{
- aRowBackground = aRowBackground2;
- if ( lineColor == COL_TRANSPARENT )
- _rDevice.SetLineColor( aRowBackground );
+ // use alternating default colors
+ if ( ( m_pImpl->nCurrentRow % 2 ) == 0 )
+ {
+ backgroundColor = _rStyle.GetFieldColor();
+ }
else
- _rDevice.SetLineColor( lineColor );
+ {
+ Color hilightColor = _rStyle.GetHighlightColor();
+ USHORT const luminance = hilightColor.GetLuminance();
+ hilightColor.SetRed( 9 * ( 255 - hilightColor.GetRed() ) / 10 + hilightColor.GetRed() );
+ hilightColor.SetGreen( 9 * ( 255 - hilightColor.GetGreen() ) / 10 + hilightColor.GetGreen() );
+ hilightColor.SetBlue( 9 * ( 255 - hilightColor.GetBlue() ) / 10 + hilightColor.GetBlue() );
+ backgroundColor = hilightColor;
+ }
}
- //fill the rows with alternating background colors if second background color is specified
- else if ( aRowBackground != fieldColor && lineColor == COL_TRANSPARENT )
- _rDevice.SetLineColor( aRowBackground );
else
{
- //if Line color is set, then it was user defined and should be visible
- //if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor( lineColor );
+ if ( aRowColors->empty() )
+ {
+ // all colors have the same background color
+ backgroundColor = _rStyle.GetFieldColor();
+ }
+ else
+ {
+ backgroundColor = aRowColors->at( m_pImpl->nCurrentRow % aRowColors->size() );
+ }
}
}
- _rDevice.SetFillColor( aRowBackground );
- _rDevice.DrawRect( _rRowArea );
- // TODO: active?
+ m_pImpl->bUseGridLines ? _rDevice.SetLineColor( lineColor ) : _rDevice.SetLineColor();
+ _rDevice.SetFillColor( backgroundColor );
+ _rDevice.DrawRect( _rRowArea );
_rDevice.Pop();
+
(void)_bActive;
+ // row containing the active cell not rendered any special at the moment
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle )
{
_rDevice.Push( PUSH_LINECOLOR | PUSH_TEXTCOLOR );
- _rDevice.SetLineColor( _rStyle.GetSeparatorColor() );
+ ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color const lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- if ( m_pImpl->rModel.getTextColor() != 0x000000 )
- _rDevice.SetTextColor( m_pImpl->rModel.getTextColor() );
- else
- _rDevice.SetTextColor( _rStyle.GetFieldTextColor() );
+ ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getHeaderTextColor(), _rStyle, &StyleSettings::GetFieldTextColor );
+ _rDevice.SetTextColor( textColor );
ULONG nHorFlag = TEXT_DRAW_LEFT;
ULONG nVerFlag = TEXT_DRAW_TOP;
@@ -249,7 +288,7 @@ namespace svt { namespace table
_rDevice.Pop();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
struct GridTableRenderer::CellRenderContext
{
OutputDevice& rDevice;
@@ -269,7 +308,7 @@ namespace svt { namespace table
}
};
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
namespace
{
/** transforms a rectangle denoting a cell area so that afterwards, it denotes the area we
@@ -287,42 +326,23 @@ namespace svt { namespace table
}
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::PaintCell( ColPos const i_column, bool _bSelected, bool _bActive,
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
_rDevice.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
- Color background1 = m_pImpl->rModel.getOddRowBackgroundColor();
- Color background2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- Color lineColor = m_pImpl->rModel.getLineColor();
- // if row is selected and line color isn't user specified, use the settings' color
+ ::boost::optional< ::Color > aLineColor( m_pImpl->rModel.getLineColor() );
+ ::Color lineColor = !aLineColor ? _rStyle.GetSeparatorColor() : *aLineColor;
+
if ( _bSelected )
{
- if ( lineColor == COL_TRANSPARENT )
- _rDevice.SetLineColor( _rStyle.GetHighlightColor() );
- else
- _rDevice.SetLineColor( lineColor );
- }
- // else set line color to the color of row background
- else
- {
- if ( ( background2 != COL_TRANSPARENT ) && ( m_pImpl->nCurrentRow % 2 ) )
- {
- if ( lineColor == COL_TRANSPARENT )
- _rDevice.SetLineColor( background2 );
- else
- _rDevice.SetLineColor( lineColor );
- }
- else if ( ( background1 != COL_TRANSPARENT ) && ( lineColor == COL_TRANSPARENT ) )
- _rDevice.SetLineColor( background1 );
- else
- {
- // if line color is set, then it was user defined and should be visible
- // if it wasn't set, it'll be the same as the default background color, so lines still won't be visible
- _rDevice.SetLineColor( lineColor );
- }
+ // if no line color is specified by the model, use the usual selection color for lines
+ if ( !aLineColor )
+ lineColor = _rStyle.GetHighlightColor();
}
+
+ m_pImpl->bUseGridLines ? _rDevice.SetLineColor( lineColor ) : _rDevice.SetLineColor();
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
Rectangle aRect( _rArea );
@@ -337,7 +357,7 @@ namespace svt { namespace table
// no special painting for the active cell at the moment
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::impl_paintCellImage( CellRenderContext const & i_context, Image const & i_image )
{
Point imagePos( Point( i_context.aContentArea.Left(), i_context.aContentArea.Top() ) );
@@ -382,7 +402,7 @@ namespace svt { namespace table
i_context.rDevice.DrawImage( imagePos, imageSize, i_image, 0 );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::impl_paintCellContent( CellRenderContext const & i_context )
{
Any aCellContent;
@@ -400,15 +420,16 @@ namespace svt { namespace table
impl_paintCellText( i_context, sText );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::impl_paintCellText( CellRenderContext const & i_context, ::rtl::OUString const & i_text )
{
if ( i_context.bSelected )
i_context.rDevice.SetTextColor( i_context.rStyle.GetHighlightTextColor() );
- else if ( m_pImpl->rModel.getTextColor() != 0x000000 )
- i_context.rDevice.SetTextColor( m_pImpl->rModel.getTextColor() );
else
- i_context.rDevice.SetTextColor( i_context.rStyle.GetFieldTextColor() );
+ {
+ ::Color const textColor = lcl_getEffectiveColor( m_pImpl->rModel.getTextColor(), i_context.rStyle, &StyleSettings::GetFieldTextColor );
+ i_context.rDevice.SetTextColor( textColor );
+ }
ULONG nVerFlag = TEXT_DRAW_TOP;
@@ -437,20 +458,20 @@ namespace svt { namespace table
i_context.rDevice.DrawText( textRect, i_text, nHorFlag | nVerFlag | TEXT_DRAW_CLIP );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::ShowCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
_rView.ShowFocus( _rCursorRect );
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
void GridTableRenderer::HideCellCursor( Window& _rView, const Rectangle& _rCursorRect)
{
(void)_rCursorRect;
_rView.HideFocus();
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
bool GridTableRenderer::FitsIntoCell( Any const & i_cellContent, ColPos const i_colPos, RowPos const i_rowPos,
bool const i_active, bool const i_selected, OutputDevice& i_targetDevice, Rectangle const & i_targetArea )
{
@@ -483,7 +504,7 @@ namespace svt { namespace table
return true;
}
-//........................................................................
+//......................................................................................................................
} } // namespace svt::table
-//........................................................................
+//......................................................................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index bfa5485fdaed..feaf79c166fa 100755
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -155,29 +155,33 @@ namespace svt { namespace table
{
(void)i_listener;
}
- virtual ::com::sun::star::util::Color getLineColor()
+ virtual ::boost::optional< ::Color > getLineColor() const
{
- return 0;
+ return ::boost::optional< ::Color >();
}
- virtual ::com::sun::star::util::Color getHeaderBackgroundColor()
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const
{
- return -1;
+ return ::boost::optional< ::Color >();
}
- virtual ::com::sun::star::util::Color getTextColor()
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const
{
- return 0;
+ return ::boost::optional< ::Color >();
}
- virtual ::com::sun::star::util::Color getOddRowBackgroundColor()
+ virtual ::boost::optional< ::Color > getTextColor() const
{
- return -1;
+ return ::boost::optional< ::Color >();
}
- virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign()
+ virtual ::boost::optional< ::Color > getTextLineColor() const
{
- return com::sun::star::style::VerticalAlignment(0);
+ return ::boost::optional< ::Color >();
}
- virtual ::com::sun::star::util::Color getEvenRowBackgroundColor()
+ virtual ::boost::optional< ::std::vector< ::Color > > getRowBackgroundColors() const
{
- return -1;
+ return ::boost::optional< ::std::vector< ::Color > >();
+ }
+ virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign() const
+ {
+ return com::sun::star::style::VerticalAlignment(0);
}
virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent )
{
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 69df1c929218..ea0a41688355 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -31,6 +31,7 @@
#include "accessibletableimp.hxx"
#include <com/sun/star/view/SelectionType.hpp>
#include "svtools/table/tablecontrolinterface.hxx"
+#include "svtools/table/gridtablerenderer.hxx"
#include "svtools/table/tablecontrol.hxx"
#include "unocontroltablemodel.hxx"
#include <comphelper/sequence.hxx>
@@ -155,7 +156,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
switch( GetPropertyId( PropertyName ) )
{
- case BASEPROPERTY_ROW_HEADER_WIDTH:
+ case BASEPROPERTY_ROW_HEADER_WIDTH:
{
sal_Int32 rowHeaderWidth( -1 );
aValue >>= rowHeaderWidth;
@@ -184,6 +185,18 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
break;
+ case BASEPROPERTY_USE_GRID_LINES:
+ {
+ GridTableRenderer* pGridRenderer = dynamic_cast< GridTableRenderer* >(
+ m_pTableModel->getRenderer().get() );
+ ENSURE_OR_BREAK( pGridRenderer != NULL, "SVTXGridControl::setProperty(UseGridLines): invalid renderer!" );
+ sal_Bool bUseGridLines = sal_False;
+ OSL_VERIFY( aValue >>= bUseGridLines );
+ pGridRenderer->useGridLines( bUseGridLines );
+ pTable->Invalidate();
+ }
+ break;
+
case BASEPROPERTY_ROW_HEIGHT:
{
sal_Int32 rowHeight = 0;
@@ -239,6 +252,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
m_pTableModel->setHorizontalScrollbarVisibility( bHScroll ? ScrollbarShowAlways : ScrollbarShowSmart );
break;
}
+
case BASEPROPERTY_VSCROLL:
{
sal_Bool bVScroll = true;
@@ -258,51 +272,37 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
break;
}
- case BASEPROPERTY_GRID_HEADER_BACKGROUND:
- {
- sal_Int32 colorHeader = COL_TRANSPARENT;
- if( aValue >>= colorHeader )
- {
- m_pTableModel->setHeaderBackgroundColor(colorHeader);
- }
+
+ case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
+ m_pTableModel->setRowBackgroundColors( aValue );
+ pTable->Invalidate();
break;
- }
+
case BASEPROPERTY_GRID_LINE_COLOR:
- {
- sal_Int32 colorLine = COL_TRANSPARENT;
- if( aValue >>= colorLine )
- {
- m_pTableModel->setLineColor(colorLine);
- }
+ m_pTableModel->setLineColor( aValue );
+ pTable->Invalidate();
break;
- }
- case BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND:
- {
- sal_Int32 colorEvenRow = COL_TRANSPARENT;
- if( aValue >>= colorEvenRow )
- {
- m_pTableModel->setEvenRowBackgroundColor(colorEvenRow);
- }
+
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ m_pTableModel->setHeaderBackgroundColor( aValue );
+ pTable->Invalidate();
break;
- }
- case BASEPROPERTY_GRID_ROW_BACKGROUND:
- {
- sal_Int32 colorBackground = COL_TRANSPARENT;
- if( aValue >>= colorBackground )
- {
- m_pTableModel->setOddRowBackgroundColor(colorBackground);
- }
+
+ case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
+ m_pTableModel->setHeaderTextColor( aValue );
+ pTable->Invalidate();
break;
- }
+
case BASEPROPERTY_TEXTCOLOR:
- {
- sal_Int32 colorText = 0x000000;
- if( aValue >>= colorText )
- {
- m_pTableModel->setTextColor(colorText);
- }
+ m_pTableModel->setTextColor( aValue );
+ pTable->Invalidate();
break;
- }
+
+ case BASEPROPERTY_TEXTLINECOLOR:
+ m_pTableModel->setTextLineColor( aValue );
+ pTable->Invalidate();
+ break;
+
case BASEPROPERTY_VERTICALALIGN:
{
VerticalAlignment eAlign( VerticalAlignment_TOP );
@@ -377,6 +377,17 @@ void SVTXGridControl::impl_checkTableModelInit()
}
}
+namespace
+{
+ void lcl_convertColor( ::boost::optional< ::Color > const & i_color, Any & o_colorValue )
+ {
+ if ( !i_color )
+ o_colorValue.clear();
+ else
+ o_colorValue <<= i_color->GetColor();
+ }
+}
+
Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
{
::vos::OGuard aGuard( GetMutex() );
@@ -384,6 +395,8 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
ENSURE_OR_RETURN( pTable != NULL, "SVTXGridControl::getProperty: no control (anymore)!", Any() );
+ Any aPropertyValue;
+
const sal_uInt16 nPropId = GetPropertyId( PropertyName );
switch(nPropId)
{
@@ -399,34 +412,92 @@ Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(Ru
case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
default: eSelectionType = SelectionType_NONE; break;
}
- return Any( eSelectionType );
+ aPropertyValue <<= eSelectionType;
+ break;
}
+
case BASEPROPERTY_GRID_SHOWROWHEADER:
- return Any ((sal_Bool) m_pTableModel->hasRowHeaders());
+ aPropertyValue <<= sal_Bool( m_pTableModel->hasRowHeaders() );
+ break;
case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- return Any ((sal_Bool) m_pTableModel->hasColumnHeaders());
+ aPropertyValue <<= sal_Bool( m_pTableModel->hasColumnHeaders() );
+ break;
case BASEPROPERTY_GRID_DATAMODEL:
- return Any ( m_pTableModel->getDataModel() );
+ aPropertyValue <<= m_pTableModel->getDataModel();
+ break;
case BASEPROPERTY_GRID_COLUMNMODEL:
- return Any ( m_xColumnModel);
+ aPropertyValue <<= m_xColumnModel;
+ break;
case BASEPROPERTY_HSCROLL:
{
sal_Bool const bHasScrollbar = ( m_pTableModel->getHorizontalScrollbarVisibility() != ScrollbarShowNever );
- return makeAny( bHasScrollbar );
+ aPropertyValue <<= bHasScrollbar;
+ break;
}
case BASEPROPERTY_VSCROLL:
{
sal_Bool const bHasScrollbar = ( m_pTableModel->getVerticalScrollbarVisibility() != ScrollbarShowNever );
- return makeAny( bHasScrollbar );
+ aPropertyValue <<= bHasScrollbar;
+ break;
+ }
+
+ case BASEPROPERTY_USE_GRID_LINES:
+ {
+ GridTableRenderer* pGridRenderer = dynamic_cast< GridTableRenderer* >(
+ m_pTableModel->getRenderer().get() );
+ ENSURE_OR_BREAK( pGridRenderer != NULL, "SVTXGridControl::getProperty(UseGridLines): invalid renderer!" );
+ aPropertyValue <<= pGridRenderer->useGridLines();
+ }
+ break;
+
+ case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
+ {
+ ::boost::optional< ::std::vector< ::Color > > aColors( m_pTableModel->getRowBackgroundColors() );
+ if ( !aColors )
+ aPropertyValue.clear();
+ else
+ {
+ Sequence< ::com::sun::star::util::Color > aAPIColors( aColors->size() );
+ for ( size_t i=0; i<aColors->size(); ++i )
+ {
+ aAPIColors[i] = aColors->at(i).GetColor();
+ }
+ aPropertyValue <<= aAPIColors;
}
}
+ break;
+
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ lcl_convertColor( m_pTableModel->getLineColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ lcl_convertColor( m_pTableModel->getHeaderBackgroundColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
+ lcl_convertColor( m_pTableModel->getHeaderTextColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_TEXTCOLOR:
+ lcl_convertColor( m_pTableModel->getTextColor(), aPropertyValue );
+ break;
+
+ case BASEPROPERTY_TEXTLINECOLOR:
+ lcl_convertColor( m_pTableModel->getTextLineColor(), aPropertyValue );
+ break;
+
+ default:
+ aPropertyValue = VCLXWindow::getProperty( PropertyName );
+ break;
+ }
- return VCLXWindow::getProperty( PropertyName );
+ return aPropertyValue;
}
void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
@@ -437,10 +508,10 @@ void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
BASEPROPERTY_GRID_DATAMODEL,
BASEPROPERTY_GRID_COLUMNMODEL,
BASEPROPERTY_GRID_SELECTIONMODE,
- BASEPROPERTY_GRID_EVEN_ROW_BACKGROUND,
BASEPROPERTY_GRID_HEADER_BACKGROUND,
+ BASEPROPERTY_GRID_HEADER_TEXT_COLOR,
BASEPROPERTY_GRID_LINE_COLOR,
- BASEPROPERTY_GRID_ROW_BACKGROUND,
+ BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS,
0
);
VCLXWindow::ImplGetPropertyIds( rIds, true );
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index f7b2ca07eb22..66f7f518dab4 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -79,43 +79,45 @@ namespace svt { namespace table
typedef ::std::vector< PColumnModel > ColumnModels;
struct UnoControlTableModel_Impl
{
- ColumnModels aColumns;
- bool bHasColumnHeaders;
- bool bHasRowHeaders;
- ScrollbarVisibility eVScrollMode;
- ScrollbarVisibility eHScrollMode;
- PTableRenderer pRenderer;
- PTableInputHandler pInputHandler;
- TableMetrics nRowHeight;
- TableMetrics nColumnHeaderHeight;
- TableMetrics nRowHeaderWidth;
- ::com::sun::star::util::Color m_nLineColor;
- ::com::sun::star::util::Color m_nHeaderColor;
- ::com::sun::star::util::Color m_nTextColor;
- ::com::sun::star::util::Color m_nRowColor1;
- ::com::sun::star::util::Color m_nRowColor2;
- ::com::sun::star::style::VerticalAlignment m_eVerticalAlign;
- ModellListeners m_aListeners;
- WeakReference< XGridDataModel > m_aDataModel;
- WeakReference< XGridColumnModel > m_aColumnModel;
+ ColumnModels aColumns;
+ bool bHasColumnHeaders;
+ bool bHasRowHeaders;
+ ScrollbarVisibility eVScrollMode;
+ ScrollbarVisibility eHScrollMode;
+ PTableRenderer pRenderer;
+ PTableInputHandler pInputHandler;
+ TableMetrics nRowHeight;
+ TableMetrics nColumnHeaderHeight;
+ TableMetrics nRowHeaderWidth;
+ ::boost::optional< ::Color > m_aGridLineColor;
+ ::boost::optional< ::Color > m_aHeaderBackgroundColor;
+ ::boost::optional< ::Color > m_aHeaderTextColor;
+ ::boost::optional< ::Color > m_aTextColor;
+ ::boost::optional< ::Color > m_aTextLineColor;
+ ::boost::optional< ::std::vector< ::Color > > m_aRowColors;
+ ::com::sun::star::style::VerticalAlignment m_eVerticalAlign;
+ ModellListeners m_aListeners;
+ WeakReference< XGridDataModel > m_aDataModel;
+ WeakReference< XGridColumnModel > m_aColumnModel;
UnoControlTableModel_Impl()
- :aColumns ( )
- ,bHasColumnHeaders ( true )
- ,bHasRowHeaders ( false )
- ,eVScrollMode ( ScrollbarShowNever )
- ,eHScrollMode ( ScrollbarShowNever )
- ,pRenderer ( )
- ,pInputHandler ( )
- ,nRowHeight ( 10 )
- ,nColumnHeaderHeight( 10 )
- ,nRowHeaderWidth ( 10 )
- ,m_nLineColor ( COL_TRANSPARENT )
- ,m_nHeaderColor ( COL_TRANSPARENT )
- ,m_nTextColor ( 0 )//black as default
- ,m_nRowColor1 ( COL_TRANSPARENT )
- ,m_nRowColor2 ( COL_TRANSPARENT )
- ,m_eVerticalAlign ( com::sun::star::style::VerticalAlignment_TOP )
+ :aColumns ( )
+ ,bHasColumnHeaders ( true )
+ ,bHasRowHeaders ( false )
+ ,eVScrollMode ( ScrollbarShowNever )
+ ,eHScrollMode ( ScrollbarShowNever )
+ ,pRenderer ( )
+ ,pInputHandler ( )
+ ,nRowHeight ( 10 )
+ ,nColumnHeaderHeight ( 10 )
+ ,nRowHeaderWidth ( 10 )
+ ,m_aGridLineColor ( )
+ ,m_aHeaderBackgroundColor ( )
+ ,m_aHeaderTextColor ( )
+ ,m_aTextColor ( )
+ ,m_aTextLineColor ( )
+ ,m_aRowColors ( )
+ ,m_eVerticalAlign ( com::sun::star::style::VerticalAlignment_TOP )
{
}
};
@@ -557,77 +559,124 @@ namespace svt { namespace table
}
//------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getLineColor()
+ namespace
+ {
+ void lcl_setColor( Any const & i_color, ::boost::optional< ::Color > & o_convertedColor )
+ {
+ if ( !i_color.hasValue() )
+ o_convertedColor.reset();
+ else
+ {
+ sal_Int32 nColor = COL_TRANSPARENT;
+ if ( i_color >>= nColor )
+ {
+ o_convertedColor.reset( ::Color( nColor ) );
+ }
+ else
+ {
+ OSL_ENSURE( false, "lcl_setColor: could not extract color value!" );
+ }
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::Color > UnoControlTableModel::getLineColor() const
{
DBG_CHECK_ME();
- return m_pImpl->m_nLineColor;
+ return m_pImpl->m_aGridLineColor;
}
//------------------------------------------------------------------------------------------------------------------
- void UnoControlTableModel::setLineColor( ::com::sun::star::util::Color _rColor )
+ void UnoControlTableModel::setLineColor( Any const & i_color )
{
DBG_CHECK_ME();
- m_pImpl->m_nLineColor = _rColor;
+ lcl_setColor( i_color, m_pImpl->m_aGridLineColor );
}
//------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getHeaderBackgroundColor()
+ ::boost::optional< ::Color > UnoControlTableModel::getHeaderBackgroundColor() const
{
DBG_CHECK_ME();
- return m_pImpl->m_nHeaderColor;
+ return m_pImpl->m_aHeaderBackgroundColor;
}
//------------------------------------------------------------------------------------------------------------------
- void UnoControlTableModel::setHeaderBackgroundColor( ::com::sun::star::util::Color _rColor )
+ void UnoControlTableModel::setHeaderBackgroundColor( Any const & i_color )
{
DBG_CHECK_ME();
- m_pImpl->m_nHeaderColor = _rColor;
+ lcl_setColor( i_color, m_pImpl->m_aHeaderBackgroundColor );
}
//------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getTextColor()
+ ::boost::optional< ::Color > UnoControlTableModel::getHeaderTextColor() const
{
DBG_CHECK_ME();
- return m_pImpl->m_nTextColor;
+ return m_pImpl->m_aHeaderTextColor;
}
//------------------------------------------------------------------------------------------------------------------
- void UnoControlTableModel::setTextColor( ::com::sun::star::util::Color _rColor )
+ void UnoControlTableModel::setHeaderTextColor( Any const & i_color )
{
DBG_CHECK_ME();
- m_pImpl->m_nTextColor = _rColor;
+ lcl_setColor( i_color, m_pImpl->m_aHeaderTextColor );
}
//------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getOddRowBackgroundColor()
+ ::boost::optional< ::Color > UnoControlTableModel::getTextColor() const
{
DBG_CHECK_ME();
- return m_pImpl->m_nRowColor1;
+ return m_pImpl->m_aTextColor;
}
//------------------------------------------------------------------------------------------------------------------
- void UnoControlTableModel::setOddRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ void UnoControlTableModel::setTextColor( Any const & i_color )
{
DBG_CHECK_ME();
- m_pImpl->m_nRowColor1 = _rColor;
+ lcl_setColor( i_color, m_pImpl->m_aTextColor );
}
//------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::util::Color UnoControlTableModel::getEvenRowBackgroundColor()
+ ::boost::optional< ::Color > UnoControlTableModel::getTextLineColor() const
{
DBG_CHECK_ME();
- return m_pImpl->m_nRowColor2;
+ return m_pImpl->m_aTextColor;
}
//------------------------------------------------------------------------------------------------------------------
- void UnoControlTableModel::setEvenRowBackgroundColor( ::com::sun::star::util::Color _rColor )
+ void UnoControlTableModel::setTextLineColor( Any const & i_color )
{
DBG_CHECK_ME();
- m_pImpl->m_nRowColor2 = _rColor;
+ lcl_setColor( i_color, m_pImpl->m_aTextLineColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::boost::optional< ::std::vector< ::Color > > UnoControlTableModel::getRowBackgroundColors() const
+ {
+ DBG_CHECK_ME();
+ return m_pImpl->m_aRowColors;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UnoControlTableModel::setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue )
+ {
+ DBG_CHECK_ME();
+ Sequence< ::com::sun::star::util::Color > aAPIColors;
+ if ( !( i_APIValue >>= aAPIColors ) )
+ m_pImpl->m_aRowColors.reset();
+ else
+ {
+ ::std::vector< ::Color > aColors( aAPIColors.getLength() );
+ for ( sal_Int32 i=0; i<aAPIColors.getLength(); ++i )
+ {
+ aColors[i] = ::Color( aAPIColors[i] );
+ }
+ m_pImpl->m_aRowColors.reset( aColors );
+ }
}
//------------------------------------------------------------------------------------------------------------------
- ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign()
+ ::com::sun::star::style::VerticalAlignment UnoControlTableModel::getVerticalAlign() const
{
DBG_CHECK_ME();
return m_pImpl->m_eVerticalAlign;
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index a6cd858ed34f..c1abe2c88e3a 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -87,30 +87,33 @@ namespace svt { namespace table
public:
// ITableModel overridables
- virtual TableSize getColumnCount() const;
- virtual TableSize getRowCount() const;
- virtual bool hasColumnHeaders() const;
- virtual bool hasRowHeaders() const;
- virtual bool isCellEditable( ColPos col, RowPos row ) const;
- virtual PColumnModel getColumnModel( ColPos column );
- virtual PTableRenderer getRenderer() const;
- virtual PTableInputHandler getInputHandler() const;
- virtual TableMetrics getRowHeight() const;
- virtual TableMetrics getColumnHeaderHeight() const;
- virtual TableMetrics getRowHeaderWidth() const;
- virtual ScrollbarVisibility getVerticalScrollbarVisibility() const;
- virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const;
- virtual void addTableModelListener( const PTableModelListener& i_listener );
- virtual void removeTableModelListener( const PTableModelListener& i_listener );
- virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent );
- virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip );
- virtual ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const;
- virtual ::com::sun::star::util::Color getLineColor();
- virtual ::com::sun::star::util::Color getHeaderBackgroundColor();
- virtual ::com::sun::star::util::Color getTextColor();
- virtual ::com::sun::star::util::Color getOddRowBackgroundColor();
- virtual ::com::sun::star::util::Color getEvenRowBackgroundColor();
- virtual ::com::sun::star::style::VerticalAlignment getVerticalAlign();
+ virtual TableSize getColumnCount() const;
+ virtual TableSize getRowCount() const;
+ virtual bool hasColumnHeaders() const;
+ virtual bool hasRowHeaders() const;
+ virtual bool isCellEditable( ColPos col, RowPos row ) const;
+ virtual PColumnModel getColumnModel( ColPos column );
+ virtual PTableRenderer getRenderer() const;
+ virtual PTableInputHandler getInputHandler() const;
+ virtual TableMetrics getRowHeight() const;
+ virtual TableMetrics getColumnHeaderHeight() const;
+ virtual TableMetrics getRowHeaderWidth() const;
+ virtual ScrollbarVisibility getVerticalScrollbarVisibility() const;
+ virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const;
+ virtual void addTableModelListener( const PTableModelListener& i_listener );
+ virtual void removeTableModelListener( const PTableModelListener& i_listener );
+ virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent );
+ virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any & o_cellToolTip );
+ virtual ::rtl::OUString getRowHeader( RowPos const i_rowPos ) const;
+ virtual ::boost::optional< ::Color > getLineColor() const;
+ virtual ::boost::optional< ::Color > getHeaderBackgroundColor() const;
+ virtual ::boost::optional< ::Color > getHeaderTextColor() const;
+ virtual ::boost::optional< ::Color > getTextColor() const;
+ virtual ::boost::optional< ::Color > getTextLineColor() const;
+ virtual ::boost::optional< ::std::vector< ::Color > >
+ getRowBackgroundColors() const;
+ virtual ::com::sun::star::style::VerticalAlignment
+ getVerticalAlign() const;
// column write access
void appendColumn( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > const & i_column );
@@ -121,19 +124,24 @@ namespace svt { namespace table
// other operations
void setVerticalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const;
void setHorizontalScrollbarVisibility( ScrollbarVisibility const i_visibility ) const;
+
void setDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > const & i_gridDataModel );
bool hasDataModel() const;
::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >
getDataModel() const;
void setColumnModel( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > const & i_gridColumnModel );
bool hasColumnModel() const;
+
void setRowHeaders(bool _bRowHeaders);
void setColumnHeaders(bool _bColumnHeaders);
- void setLineColor(::com::sun::star::util::Color _rColor);
- void setHeaderBackgroundColor(::com::sun::star::util::Color _rColor);
- void setTextColor(::com::sun::star::util::Color _rColor);
- void setOddRowBackgroundColor(::com::sun::star::util::Color _rColor);
- void setEvenRowBackgroundColor(::com::sun::star::util::Color _rColor);
+
+ void setLineColor( ::com::sun::star::uno::Any const & i_color );
+ void setHeaderBackgroundColor( ::com::sun::star::uno::Any const & i_color );
+ void setHeaderTextColor( ::com::sun::star::uno::Any const & i_color );
+ void setTextColor( ::com::sun::star::uno::Any const & i_color );
+ void setTextLineColor( ::com::sun::star::uno::Any const & i_color );
+ void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue );
+
void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
/// retrieves the index of a column within the model