summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx1
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx7
-rw-r--r--svtools/inc/svtools/table/tabledatawindow.hxx7
-rw-r--r--svtools/inc/svtools/table/tablemodel.hxx1
-rw-r--r--svtools/source/table/defaultinputhandler.cxx18
-rw-r--r--svtools/source/table/gridtablerenderer.cxx186
-rw-r--r--svtools/source/table/tablecontrol.cxx14
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx325
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx3
-rw-r--r--svtools/source/table/tabledatawindow.cxx20
-rw-r--r--svtools/source/uno/svtxgridcontrol.cxx15
11 files changed, 316 insertions, 281 deletions
diff --git a/svtools/inc/svtools/table/abstracttablecontrol.hxx b/svtools/inc/svtools/table/abstracttablecontrol.hxx
index 95ac7b6bdd94..849c2cd23905 100644
--- a/svtools/inc/svtools/table/abstracttablecontrol.hxx
+++ b/svtools/inc/svtools/table/abstracttablecontrol.hxx
@@ -121,6 +121,7 @@ namespace svt { namespace table
virtual void resizeColumn(const Point& rPoint ) = 0;
virtual bool startResizeColumn(const Point& rPoint) = 0;
virtual bool endResizeColumn(const Point& rPoint) = 0;
+ virtual bool isRowSelected(RowPos _nRow);
virtual ~IAbstractTableControl() {};
};
diff --git a/svtools/inc/svtools/table/tablecontrol.hxx b/svtools/inc/svtools/table/tablecontrol.hxx
index cfb4357eb5ac..313b2b7b7735 100644
--- a/svtools/inc/svtools/table/tablecontrol.hxx
+++ b/svtools/inc/svtools/table/tablecontrol.hxx
@@ -69,7 +69,10 @@ namespace svt { namespace table
class SVT_DLLPUBLIC TableControl : public Control, public IAccessibleTable
{
private:
- DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonDownHdl, MouseEvent* );
+ DECL_DLLPRIVATE_LINK( ImplMouseButtonUpHdl, MouseEvent* );
+
+ DECL_DLLPRIVATE_LINK( ImplSelectHdl, void* );
TableControl_Impl* m_pImpl;
::com::sun::star::uno::Sequence< sal_Int32 > m_nCols;
@@ -185,7 +188,6 @@ namespace svt { namespace table
virtual void FillAccessibleStateSet(
::utl::AccessibleStateSetHelper& rStateSet,
AccessibleTableControlObjType eObjType ) const;
-
//// Window
virtual Rectangle GetWindowExtentsRelative( Window *pRelativeWindow );
virtual void GrabFocus();
@@ -221,6 +223,7 @@ namespace svt { namespace table
void setTooltip(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aText, const ::com::sun::star::uno::Sequence< sal_Int32 >& nCols);
void selectionChanged(bool _bChanged);
+
protected:
/// retrieves the XAccessible implementation associated with the GridControl instance
::svt::IAccessibleFactory& getAccessibleFactory();
diff --git a/svtools/inc/svtools/table/tabledatawindow.hxx b/svtools/inc/svtools/table/tabledatawindow.hxx
index 00630be35ae4..0e65f9847816 100644
--- a/svtools/inc/svtools/table/tabledatawindow.hxx
+++ b/svtools/inc/svtools/table/tabledatawindow.hxx
@@ -52,9 +52,16 @@ namespace svt { namespace table
friend class TableFunctionSet;
private:
TableControl_Impl& m_rTableControl;
+ Link m_aMouseButtonDownHdl;
+ Link m_aMouseButtonUpHdl;
Link m_aSelectHdl;
+ RowPos m_nRowAlreadySelected;
public:
TableDataWindow( TableControl_Impl& _rTableControl );
+ inline void SetMouseButtonDownHdl( const Link& rLink ) { m_aMouseButtonDownHdl = rLink; }
+ inline const Link& GetMouseButtonDownHdl() const { return m_aMouseButtonDownHdl; }
+ inline void SetMouseButtonUpHdl( const Link& rLink ) { m_aMouseButtonUpHdl = rLink; }
+ inline const Link& GetMouseButtonUpHdl() const { return m_aMouseButtonUpHdl; }
inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; }
inline const Link& GetSelectHdl() const { return m_aSelectHdl; }
diff --git a/svtools/inc/svtools/table/tablemodel.hxx b/svtools/inc/svtools/table/tablemodel.hxx
index fbc60fb7bc0e..3da396d9d86c 100644
--- a/svtools/inc/svtools/table/tablemodel.hxx
+++ b/svtools/inc/svtools/table/tablemodel.hxx
@@ -444,7 +444,6 @@ namespace svt { namespace table
@param actWidth the given width of the table
*/
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const = 0;
-
virtual bool hasVerticalScrollbar() =0;
virtual bool hasHorizontalScrollbar() = 0;
/** fills cells with content
diff --git a/svtools/source/table/defaultinputhandler.cxx b/svtools/source/table/defaultinputhandler.cxx
index 6a33b96b2742..ad8f7a7562d3 100644
--- a/svtools/source/table/defaultinputhandler.cxx
+++ b/svtools/source/table/defaultinputhandler.cxx
@@ -77,21 +77,26 @@ namespace svt { namespace table
{
bool bHandled = false;
Point aPoint = _rMEvt.GetPosPixel();
- if(_rControl.getCurrentRow(aPoint) == -1)
+ RowPos nRow = _rControl.getCurrentRow(aPoint);
+ if(nRow == -1)
{
m_bResize = _rControl.startResizeColumn(aPoint);
bHandled = true;
}
- else if(_rControl.getCurrentRow(aPoint) >= 0)
+ else if(nRow >= 0)
{
if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- LoseFocus(_rControl);
_rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
- bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ {
+ if(!_rControl.isRowSelected(nRow))
+ bHandled = _rControl.getSelEngine()->SelMouseButtonDown(_rMEvt);
+ else
+ bHandled = true;
+ }
}
return bHandled;
}
@@ -109,12 +114,12 @@ namespace svt { namespace table
}
else if(_rControl.getSelEngine()->GetSelectionMode() == NO_SELECTION)
{
- GetFocus(_rControl);
- _rControl.setCursorAtCurrentCell(aPoint);
bHandled = true;
}
else
+ {
bHandled = _rControl.getSelEngine()->SelMouseButtonUp(_rMEvt);
+ }
}
else
{
@@ -224,7 +229,6 @@ namespace svt { namespace table
// TODO
return false;
}
-
//........................................................................
} } // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index 5c7a8dbd6832..77db8fc30904 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -79,34 +79,21 @@ namespace svt { namespace table
OSL_PRECOND( _bIsColHeaderArea || _bIsRowHeaderArea,
"GridTableRenderer::PaintHeaderArea: invalid area flags!" );
- // fill the rows with alternating background colors
_rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
- Color background = m_pImpl->rModel.getHeaderBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- //default background and line color is white
- //background and lines should have same color, that's means lines aren't visible
- //in case line color isn't set and background color is set, this should be changed
- if( background != 0xFFFFFF && line == 0xFFFFFF)
- {
- _rDevice.SetLineColor(background);
- _rDevice.SetFillColor(background);
- }
- 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(line);
- _rDevice.SetFillColor(background);
- }
+ Color background = m_pImpl->rModel.getHeaderBackgroundColor();
+ if( background != 0xFFFFFF)
+ _rDevice.SetFillColor(background);
+ else
+ _rDevice.SetFillColor(_rStyle.GetDialogColor());
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawRect( _rArea );
// delimiter lines at bottom/right
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight() );
_rDevice.Pop();
- (void)_rStyle;
- (void)_bIsColHeaderArea;
- (void)_bIsRowHeaderArea;
+ (void)_bIsColHeaderArea;
+ (void)_bIsRowHeaderArea;
}
//--------------------------------------------------------------------
@@ -114,41 +101,30 @@ namespace svt { namespace table
OutputDevice& _rDevice, const Rectangle& _rArea, const StyleSettings& _rStyle )
{
_rDevice.Push( PUSH_LINECOLOR);
- //default background and line color is white
- //background and lines should have same color, that's means lines aren't visible
- //in case line color isn't set and background color is set, this should be changed
- Color background = m_pImpl->rModel.getHeaderBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(_rStyle.GetShadowColor());
- 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(line);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawLine( _rArea.BottomRight(), _rArea.TopRight());
String sHeaderText;
-
PColumnModel pColumn = m_pImpl->rModel.getColumnModel( _nCol );
DBG_ASSERT( !!pColumn, "GridTableRenderer::PaintColumnHeader: invalid column model object!" );
if ( !!pColumn )
sHeaderText = pColumn->getName();
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
- ULONG nHorFlag = TEXT_DRAW_LEFT;
- ULONG nVerFlag = TEXT_DRAW_TOP;
- if(m_pImpl->rModel.getVerticalAlign() == 1)
- nVerFlag = TEXT_DRAW_VCENTER;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
- nVerFlag = TEXT_DRAW_BOTTOM;
- if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1)
- nHorFlag = TEXT_DRAW_CENTER;
- else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2)
- nHorFlag = TEXT_DRAW_RIGHT;
- Rectangle aRect(_rArea);
- aRect.Left()+=4; aRect.Right()-=4;
- aRect.Top()+=4; aRect.Bottom()-=4;
- _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
- _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(_nCol)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle aRect(_rArea);
+ aRect.Left()+=4; aRect.Right()-=4;
+ aRect.Top()+=2; aRect.Bottom()-=2;
+ _rDevice.DrawText( aRect, sHeaderText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
+ _rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
_rDevice.Pop();
(void)_bActive;
@@ -168,95 +144,75 @@ namespace svt { namespace table
_rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
Color aRowBackground = m_pImpl->rModel.getOddRowBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
- //if row is selected background color becomes blue, and lines should be also blue
- //if they aren't user defined
- if(_bSelected)
- {
- Color aSelected(_rStyle.GetHighlightColor());
- aRowBackground = aSelected;
- if(line == 0xFFFFFF)
- _rDevice.SetLineColor(aRowBackground);
- else
- _rDevice.SetLineColor(line);
- }
- //if row not selected, check the cases whether user defined backgrounds are set
- //and set line color to be the same
- else
- {
- if(aRowBackground2 != 0xFFFFFF && _nRow%2)
+ Color line = m_pImpl->rModel.getLineColor();
+ Color aRowBackground2 = m_pImpl->rModel.getEvenRowBackgroundColor();
+ //if row is selected background color becomes blue, and lines should be also blue
+ //if they aren't user defined
+ if(_bSelected)
{
- aRowBackground = aRowBackground2;
+ Color aSelected(_rStyle.GetHighlightColor());
+ aRowBackground = aSelected;
if(line == 0xFFFFFF)
_rDevice.SetLineColor(aRowBackground);
else
_rDevice.SetLineColor(line);
}
- //fill the rows with alternating background colors if second background color is specified
- else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF)
- _rDevice.SetLineColor(aRowBackground);
+ //if row not selected, check the cases whether user defined backgrounds are set
+ //and set line color to be the same
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(line);
+ if(aRowBackground2 != 0xFFFFFF && _nRow%2)
+ {
+ aRowBackground = aRowBackground2;
+ if(line == 0xFFFFFF)
+ _rDevice.SetLineColor(aRowBackground);
+ else
+ _rDevice.SetLineColor(line);
+ }
+ //fill the rows with alternating background colors if second background color is specified
+ else if(aRowBackground != 0xFFFFFF && line == 0xFFFFFF)
+ _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(line);
+ }
}
- }
- Rectangle aRect(_rRowArea);
- if(m_pImpl->rModel.hasColumnHeaders() || _nRow != 0)
- --aRect.Top();
- if(m_pImpl->rModel.hasRowHeaders())
- --aRect.Left();
_rDevice.SetFillColor( aRowBackground );
- _rDevice.DrawRect( aRect );
+ _rDevice.DrawRect( _rRowArea );
// TODO: active?
_rDevice.Pop();
- (void)_bActive;
+ (void)_bActive;
}
//--------------------------------------------------------------------
void GridTableRenderer::PaintRowHeader( bool _bActive, bool _bSelected, OutputDevice& _rDevice, const Rectangle& _rArea,
const StyleSettings& _rStyle, rtl::OUString& _rText )
{
- _rDevice.Push( PUSH_FILLCOLOR | PUSH_LINECOLOR);
- //default background and line color is white
- //background and lines should have same color, that's means lines aren't visible
- //in case line color isn't set and background color is set, this should be changed
- Color background = m_pImpl->rModel.getHeaderBackgroundColor();
- Color line = m_pImpl->rModel.getLineColor();
- if(background != 0xFFFFFF && line == 0xFFFFFF)
- {
- _rDevice.SetLineColor(background);
- }
- 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(line);
- }
+ _rDevice.Push( PUSH_LINECOLOR);
+ _rDevice.SetLineColor(_rStyle.GetSeparatorColor());
_rDevice.DrawLine( _rArea.BottomLeft(), _rArea.BottomRight() );
- _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
- ULONG nHorFlag = TEXT_DRAW_LEFT;
- ULONG nVerFlag = TEXT_DRAW_TOP;
- if(m_pImpl->rModel.getVerticalAlign() == 1)
- nVerFlag = TEXT_DRAW_VCENTER;
- else if(m_pImpl->rModel.getVerticalAlign() == 2)
- nVerFlag = TEXT_DRAW_BOTTOM;
- if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1)
- nHorFlag = TEXT_DRAW_CENTER;
- else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2)
- nHorFlag = TEXT_DRAW_RIGHT;
- Rectangle aRect(_rArea);
- aRect.Left()+=4; aRect.Right()-=4;
- aRect.Top()+=4; aRect.Bottom()-=4;
+ _rDevice.SetTextColor(m_pImpl->rModel.getTextColor());
+ ULONG nHorFlag = TEXT_DRAW_LEFT;
+ ULONG nVerFlag = TEXT_DRAW_TOP;
+ if(m_pImpl->rModel.getVerticalAlign() == 1)
+ nVerFlag = TEXT_DRAW_VCENTER;
+ else if(m_pImpl->rModel.getVerticalAlign() == 2)
+ nVerFlag = TEXT_DRAW_BOTTOM;
+ if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 1)
+ nHorFlag = TEXT_DRAW_CENTER;
+ else if(m_pImpl->rModel.getColumnModel(0)->getHorizontalAlign() == 2)
+ nHorFlag = TEXT_DRAW_RIGHT;
+ Rectangle aRect(_rArea);
+ aRect.Left()+=4; aRect.Right()-=4;
+ aRect.Top()+=2; aRect.Bottom()-=2;
_rDevice.DrawText( aRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
// TODO: active? selected?
(void)_bActive;
(void)_bSelected;
- (void)_rStyle;
//at the moment no special paint for selected row header
_rDevice.Pop();
}
@@ -330,7 +286,6 @@ namespace svt { namespace table
(void)_bActive;
// no special painting for the active cell at the moment
- (void)_rStyle;
}
//--------------------------------------------------------------------
@@ -392,13 +347,12 @@ namespace svt { namespace table
nHorFlag = TEXT_DRAW_RIGHT;
Rectangle textRect(_rArea);
textRect.Left()+=4; textRect.Right()-=4;
- textRect.Top()+=4; textRect.Bottom()-=4;
+ textRect.Top()+=2; textRect.Bottom()-=2;
_rDevice.DrawText( textRect, _rText, nHorFlag | nVerFlag | TEXT_DRAW_CLIP);
}
_rDevice.Pop();
(void)_bActive;
// no special painting for the active cell at the moment
- (void)_rStyle;
}
//--------------------------------------------------------------------
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index 7452bda6d02a..12def82d3ecf 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -71,6 +71,8 @@ namespace svt { namespace table
,m_pImpl( new TableControl_Impl( *this ) )
,m_bSelectionChanged(false)
{
+ m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
+ m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
m_pImpl->getDataWindow()->SetSelectHdl( LINK( this, TableControl, ImplSelectHdl ) );
m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
}
@@ -335,7 +337,7 @@ namespace svt { namespace table
::com::sun::star::uno::Any TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
{
- ::com::sun::star::uno::Any cellContent = ::com::sun::star::uno::Any(::rtl::OUString::createFromAscii(""));
+ ::com::sun::star::uno::Any cellContent(::com::sun::star::uno::Any(::rtl::OUString::createFromAscii("")));
std::vector<std::vector< ::com::sun::star::uno::Any > >& aTableContent = GetModel()->getCellContent();
if(&aTableContent)
cellContent = aTableContent[_nRowPos][_nColPos];
@@ -555,6 +557,16 @@ IMPL_LINK( TableControl, ImplSelectHdl, void*, EMPTYARG )
Select();
return 1;
}
+IMPL_LINK( TableControl, ImplMouseButtonDownHdl, MouseEvent*, pData )
+{
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pData );
+ return 1;
+}
+IMPL_LINK( TableControl, ImplMouseButtonUpHdl, MouseEvent*, pData )
+{
+ CallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, pData );
+ return 1;
+}
// -----------------------------------------------------------------------
void TableControl::Select()
{
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index 9ef171bf6c8c..4057be745097 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -580,88 +580,89 @@ namespace svt { namespace table
m_aColumnWidthsPixel.reserve( colCount );
m_aAccColumnWidthsPixel.reserve( colCount );
long accumulatedPixelWidth = 0;
- double gridWidth = m_rAntiImpl.GetSizePixel().Width()-4;
- if(m_pModel->hasRowHeaders())
- {
- TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth();
- gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width();
- }
- if(m_pModel->hasVerticalScrollbar())
- {
- sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
- gridWidth-=scrollbarWidth;
- }
- double colWidthsSum = 0.0;
- double colWithoutFixedWidthsSum = 0.0;
- double minColWithoutFixedSum = 0.0;
- for ( ColPos col = 0; col < colCount; ++col )
+ double gridWidth = m_rAntiImpl.GetOutputSizePixel().Width();
+ if(m_pModel->hasRowHeaders())
{
- PColumnModel pColumn = m_pModel->getColumnModel( col );
- DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
- if ( !pColumn )
- continue;
- TableMetrics colWidth = 0;
- TableMetrics colPrefWidth = pColumn->getPreferredWidth();
- bool bResizable = pColumn->isResizable();
- if(pColumn->getMinWidth() == 0 && bResizable)
+ TableMetrics rowHeaderWidth = m_pModel->getRowHeaderWidth();
+ gridWidth-= m_rAntiImpl.LogicToPixel( Size( rowHeaderWidth, 0 ), MAP_APPFONT ).Width();
+ }
+ if(m_pModel->hasVerticalScrollbar())
{
- pColumn->setMinWidth(1);
- minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width();
+ sal_Int32 scrollbarWidth = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize();
+ gridWidth-=scrollbarWidth;
}
- if(pColumn->getMaxWidth() == 0 && bResizable)
- pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
- if( colPrefWidth != 0)
+ double colWidthsSum = 0.0;
+ double colWithoutFixedWidthsSum = 0.0;
+ double minColWithoutFixedSum = 0.0;
+ for ( ColPos col = 0; col < colCount; ++col )
{
- if(m_bResizingGrid)
+ PColumnModel pColumn = m_pModel->getColumnModel( col );
+ DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
+ if ( !pColumn )
+ continue;
+ TableMetrics colWidth = 0;
+ TableMetrics colPrefWidth = pColumn->getPreferredWidth();
+ bool bResizable = pColumn->isResizable();
+ if(pColumn->getMinWidth() == 0 && bResizable)
{
- colWidth = pColumn->getWidth();
- pColumn->setPreferredWidth(0);
+ pColumn->setMinWidth(1);
+ minColWithoutFixedSum+=m_rAntiImpl.LogicToPixel( Size( 1, 0 ), MAP_APPFONT ).Width();
}
- else
+ if(pColumn->getMaxWidth() == 0 && bResizable)
+ pColumn->setMaxWidth(m_rAntiImpl.LogicToPixel( Size( (int)gridWidth, 0 ), MAP_APPFONT ).Width());
+ if( colPrefWidth != 0)
{
- colWidth = colPrefWidth;
- pColumn->setWidth(colPrefWidth);
+ if(m_bResizingGrid)
+ {
+ colWidth = pColumn->getWidth();
+ pColumn->setPreferredWidth(0);
+ }
+ else
+ {
+ colWidth = colPrefWidth;
+ pColumn->setWidth(colPrefWidth);
+ }
}
+ else
+ colWidth = pColumn->getWidth();
+ long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
+ if(bResizable && colPrefWidth == 0)
+ colWithoutFixedWidthsSum+=pixelWidth;
+ colWidthsSum+=pixelWidth;
}
- else
- colWidth = pColumn->getWidth();
- long pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
- if(bResizable && colPrefWidth == 0)
- colWithoutFixedWidthsSum+=pixelWidth;
- colWidthsSum+=pixelWidth;
- }
- gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum;
- double scalingFactor = 1.0;
- if(m_bResizingGrid)
- {
- if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum))
- scalingFactor = gridWidth/colWithoutFixedWidthsSum;
- }
- else
- {
- if(colWidthsSum < gridWidth)
+ gridWidth = gridWidth - colWidthsSum + colWithoutFixedWidthsSum;
+ double scalingFactor = 1.0;
+ if(m_bResizingGrid)
{
- if(colWithoutFixedWidthsSum>0)
+ if(gridWidth > (minColWithoutFixedSum+colWidthsSum - colWithoutFixedWidthsSum))
scalingFactor = gridWidth/colWithoutFixedWidthsSum;
}
- }
- long pixelWidth = 0;
- for ( ColPos col = 0; col < colCount; ++col )
- {
- PColumnModel pColumn = m_pModel->getColumnModel( col );
- DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
- if ( !pColumn )
- continue;
- TableMetrics colWidth = pColumn->getWidth();
- if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0)
+ else
{
- colWidth*=scalingFactor;
- pColumn->setWidth(colWidth);
+ if(colWidthsSum < gridWidth)
+ {
+ if(colWithoutFixedWidthsSum>0)
+ scalingFactor = gridWidth/colWithoutFixedWidthsSum;
+ }
+ }
+ long pixelWidth = 0;
+ for ( ColPos i = 0; i < colCount; ++i )
+ {
+ PColumnModel pColumn = m_pModel->getColumnModel( i );
+ DBG_ASSERT( !!pColumn, "TableControl_Impl::impl_ni_updateColumnWidths: invalid column returned by the model!" );
+ if ( !pColumn )
+ continue;
+ TableMetrics colWidth = pColumn->getWidth();
+ if(pColumn->isResizable() && pColumn->getPreferredWidth() == 0)
+ {
+ colWidth*=scalingFactor;
+ //colWidth+=1;
+ pColumn->setWidth(colWidth);
+ }
+ pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
+ m_aColumnWidthsPixel.push_back( pixelWidth );
+ m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth );
}
- pixelWidth = m_rAntiImpl.LogicToPixel( Size( colWidth, 0 ), MAP_APPFONT ).Width();
- m_aColumnWidthsPixel.push_back( pixelWidth );
- m_aAccColumnWidthsPixel.push_back( accumulatedPixelWidth += pixelWidth );
- }
}
//--------------------------------------------------------------------
@@ -882,6 +883,11 @@ namespace svt { namespace table
m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
m_pScrollCorner->Show();
}
+ else if(bHaveScrollCorner && bNeedScrollCorner)
+ {
+ m_pScrollCorner->SetPosPixel( Point( aDataCellPlayground.Right() + 1, aDataCellPlayground.Bottom() + 1 ) );
+ m_pScrollCorner->Show();
+ }
// resize the data window
m_pDataWindow->SetSizePixel( Size(
@@ -894,16 +900,22 @@ namespace svt { namespace table
void TableControl_Impl::onResize()
{
DBG_CHECK_ME();
- if(m_nRowCount != 0)
- {
- if(m_nColumnCount != 0)
+ if(m_nRowCount != 0)
{
- if(m_bResizingGrid)
- impl_ni_updateColumnWidths();
- invalidateRows();
- m_bResizingGrid = true;
+ if(m_nColumnCount != 0)
+ {
+ if(m_bResizingGrid)
+ impl_ni_updateColumnWidths();
+ invalidateRows();
+ m_bResizingGrid = true;
+ }
}
- }
+ else
+ //In the case that column headers are defined but data hasn't yet been set,
+ //only column headers will be shown
+ if(m_pModel->hasColumnHeaders())
+ if(m_nColHeaderHeightPixel>1)
+ m_pDataWindow->SetSizePixel( m_rAntiImpl.GetOutputSizePixel());
}
//--------------------------------------------------------------------
@@ -920,23 +932,28 @@ namespace svt { namespace table
// our current style settings, to be passed to the renderer
const StyleSettings& rStyle = m_rAntiImpl.GetSettings().GetStyleSettings();
- m_nRowCount = m_pModel->getRowCount();
- TableSize nVisibleRows = impl_getVisibleRows(true);
- TableSize nActualRows = m_nRowCount;
- if(m_nRowCount>nVisibleRows)
- nActualRows = nVisibleRows;
+ m_nRowCount = m_pModel->getRowCount();
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nActualRows = m_nRowCount;
+ if(m_nRowCount>nVisibleRows)
+ nActualRows = nVisibleRows;
// the area occupied by all (at least partially) visible cells, including
// headers
Rectangle aAllCellsWithHeaders;
impl_getAllVisibleCellsArea( aAllCellsWithHeaders );
+
// ............................
// draw the header column area
- if ( getModel()->hasColumnHeaders() )
+ if ( m_pModel->hasColumnHeaders() )
{
TableRowGeometry aHeaderRow( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), ROW_COL_HEADERS );
+ Rectangle aColRect(aHeaderRow.getRect());
+ //to avoid double lines when scrolling horizontally
+ if(m_nLeftColumn != 0)
+ --aColRect.Left();
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aHeaderRow.getRect(), true, false, rStyle
+ *m_pDataWindow, aColRect, true, false, rStyle
);
// Note that strictly, aHeaderRow.getRect() also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
@@ -963,11 +980,14 @@ namespace svt { namespace table
{
aRowHeaderArea = aAllCellsWithHeaders;
aRowHeaderArea.Right() = m_nRowHeaderWidthPixel - 1;
- if(m_nTopRow+nActualRows>m_nRowCount)
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1;
- else
- aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1;
- pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle);
+ if(m_nTopRow+nActualRows>m_nRowCount)
+ aRowHeaderArea.Bottom() = m_nRowHeightPixel * (nActualRows -1)+ m_nColHeaderHeightPixel - 1;
+ else
+ aRowHeaderArea.Bottom() = m_nRowHeightPixel * nActualRows + m_nColHeaderHeightPixel - 1;
+ //to avoid double lines when scrolling vertically
+ if(m_nTopRow != 0)
+ --aRowHeaderArea.Top();
+ pRenderer->PaintHeaderArea(*m_pDataWindow, aRowHeaderArea, false, true, rStyle);
// Note that strictly, aRowHeaderArea also contains the intersection between column
// and row header area. However, below we go to paint this intersection, again,
// so this hopefully doesn't hurt if we already paint it here.
@@ -976,8 +996,15 @@ namespace svt { namespace table
{
TableCellGeometry aIntersection( *this, Rectangle( Point( 0, 0 ),
aAllCellsWithHeaders.BottomRight() ), COL_ROW_HEADERS, ROW_COL_HEADERS );
+ Rectangle aInters(aIntersection.getRect());
+ //to avoid double line when scrolling vertically
+ if( m_nTopRow != 0 )
+ {
+ --aInters.Top();
+ --aInters.Bottom();
+ }
pRenderer->PaintHeaderArea(
- *m_pDataWindow, aIntersection.getRect(), true, true, rStyle
+ *m_pDataWindow, aInters, true, true, rStyle
);
}
}
@@ -990,34 +1017,46 @@ namespace svt { namespace table
// paint all rows
Rectangle aAllDataCellsArea;
impl_getAllVisibleDataCellArea( aAllDataCellsArea );
- ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent();
+ ::std::vector< std::vector< ::com::sun::star::uno::Any > >& aCellContent = m_pModel->getCellContent();
for ( TableRowGeometry aRowIterator( *this, aAllCellsWithHeaders, getTopRow() );
aRowIterator.isValid();
aRowIterator.moveDown() )
{
if ( _rUpdateRect.GetIntersection( aRowIterator.getRect() ).IsEmpty() )
- continue;
+ continue;
bool isActiveRow = ( aRowIterator.getRow() == getCurRow() );
- bool isSelectedRow = false;
- if(!m_nRowSelected.empty())
- {
- for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin();
- itSel!=m_nRowSelected.end();++itSel)
+ bool isSelectedRow = false;
+ if(!m_nRowSelected.empty())
{
- if(*itSel == aRowIterator.getRow())
- isSelectedRow = true;
+ for(std::vector<RowPos>::iterator itSel=m_nRowSelected.begin();
+ itSel!=m_nRowSelected.end();++itSel)
+ {
+ if(*itSel == aRowIterator.getRow())
+ isSelectedRow = true;
+ }
}
- }
+ Rectangle aRect = aRowIterator.getRect().GetIntersection( aAllDataCellsArea );
+ //to avoid double lines
+ if( aRowIterator.getRow() != 0 )
+ --aRect.Top();
+ else
+ if(m_nColHeaderHeightPixel>1)
+ --aRect.Top();
+ if(m_nLeftColumn != 0)
+ --aRect.Left();
+ else
+ if(m_pModel->hasRowHeaders())
+ --aRect.Left();
// give the redenderer a chance to prepare the row
pRenderer->PrepareRow( aRowIterator.getRow(), isActiveRow, isSelectedRow,
- *m_pDataWindow, aRowIterator.getRect().GetIntersection( aAllDataCellsArea ), rStyle );
+ *m_pDataWindow, aRect, rStyle );
// paint the row header
if ( m_pModel->hasRowHeaders() )
{
- Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
- rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()];
- pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
+ Rectangle aCurrentRowHeader( aRowHeaderArea.GetIntersection( aRowIterator.getRect() ) );
+ rtl::OUString rowHeaderName = m_pModel->getRowHeaderName()[aRowIterator.getRow()];
+ pRenderer->PaintRowHeader( isActiveRow, isSelectedRow, *m_pDataWindow, aCurrentRowHeader,
rStyle, rowHeaderName );
}
if ( !colCount )
@@ -1028,25 +1067,25 @@ namespace svt { namespace table
aCell.moveRight()
)
{
- bool isSelectedColumn = false;
- Size siz = m_rAntiImpl.GetSizePixel();
- ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
- ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()];
- if(rCellData>>=xGraphic)
- {
- Image* pImage = new Image(xGraphic);
- if(pImage!=NULL)
- pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ bool isSelectedColumn = false;
+ // Size siz = m_rAntiImpl.GetSizePixel();
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >xGraphic;
+ ::com::sun::star::uno::Any rCellData = aCellContent[aRowIterator.getRow()][aCell.getColumn()];
+ if(rCellData>>=xGraphic)
+ {
+ Image* pImage = new Image(xGraphic);
+ if(pImage!=NULL)
+ pRenderer->PaintCellImage( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
*m_pDataWindow, aCell.getRect(), rStyle, pImage );
- }
- else
- {
- ::rtl::OUString sContent = convertToString(rCellData);
- pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
+ }
+ else
+ {
+ ::rtl::OUString sContent = convertToString(rCellData);
+ pRenderer->PaintCellString( aCell.getColumn(), isSelectedRow || isSelectedColumn, isActiveRow,
*m_pDataWindow, aCell.getRect(), rStyle, sContent );
+ }
}
}
- }
}
//--------------------------------------------------------------------
void TableControl_Impl::hideCursor()
@@ -1454,10 +1493,12 @@ namespace svt { namespace table
{
Rectangle aCellRect;
impl_getCellRect( m_nCurColumn, m_nCurRow, aCellRect );
- if ( _bShow )
- pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect);
- else
- pRenderer->HideCellCursor( *m_pDataWindow, aCellRect);
+ if(!m_pModel->hasRowHeaders() && m_nCurColumn == 0)
+ aCellRect.Left()++;
+ if ( _bShow )
+ pRenderer->ShowCellCursor( *m_pDataWindow, aCellRect);
+ else
+ pRenderer->HideCellCursor( *m_pDataWindow, aCellRect);
}
}
@@ -1480,6 +1521,7 @@ namespace svt { namespace table
TableCellGeometry aCell( *this, aAllCells, _nColumn, _nRow );
_rCellRect = aCell.getRect();
+ _rCellRect.Top()--;_rCellRect.Left()--;
}
//-------------------------------------------------------------------------------
RowPos TableControl_Impl::getCurrentRow(const Point& rPoint)
@@ -1497,9 +1539,7 @@ namespace svt { namespace table
{
newRowPos = i;
newColPos = j;
- if(newColPos == -1)
- m_nCurColumn = 0;
- else
+ if(newColPos != -1)
m_nCurColumn = newColPos;
return newRowPos;
}
@@ -1617,13 +1657,18 @@ namespace svt { namespace table
//------------------------------------------------------------------------------
void TableControl_Impl::invalidateRows()
{
- impl_ni_updateScrollbars();
- TableSize nVisibleRows = impl_getVisibleRows(true);
- if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows)
- m_nTopRow--;
- else
- m_nTopRow = 0;
- m_pDataWindow->Invalidate();
+ impl_ni_updateScrollbars();
+ TableSize nVisibleRows = impl_getVisibleRows(true);
+ TableSize nVisibleCols = impl_getVisibleColumns(true);
+ if(m_nTopRow+nVisibleRows>m_nRowCount && m_nRowCount>=nVisibleRows)
+ m_nTopRow--;
+ else
+ m_nTopRow = 0;
+ if(m_nLeftColumn+nVisibleCols>m_nColumnCount && m_nColumnCount>=nVisibleCols)
+ m_nLeftColumn--;
+ else
+ m_nLeftColumn = 0;
+ m_pDataWindow->Invalidate();
}
//--------------------------------------------------------------------
@@ -1799,18 +1844,23 @@ namespace svt { namespace table
//-------------------------------------------------------------------------------
SelectionEngine* TableControl_Impl::getSelEngine()
{
- return m_pSelEngine;
+ return m_pSelEngine;
}
//-------------------------------------------------------------------------------
TableDataWindow* TableControl_Impl::getDataWindow()
{
- return m_pDataWindow;
+ return m_pDataWindow;
}
//-------------------------------------------------------------------------------
BOOL TableControl_Impl::isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
return ::std::find(selectedRows.begin(),selectedRows.end(),current) != selectedRows.end();
}
+ //-------------------------------------------------------------------------------
+ bool TableControl_Impl::isRowSelected(RowPos current)
+ {
+ return ::std::find(m_nRowSelected.begin(),m_nRowSelected.end(),current) != m_nRowSelected.end();
+ }
//-------------------------------------------------------------------------------
int TableControl_Impl::getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current)
{
@@ -1906,7 +1956,7 @@ namespace svt { namespace table
//MouseButton was pressed but not yet released, mouse is moving
if(m_bResizing)
{
- if(rPoint.X() > m_pDataWindow->GetSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth)
+ if(rPoint.X() > m_pDataWindow->GetOutputSizePixel().Width() || rPoint.X() < m_aVisibleColumnWidthsPixel[resizingColumn]-newColWidth)
aNewPointer = Pointer( POINTER_NOTALLOWED);
else
aNewPointer = Pointer( POINTER_HSPLIT );
@@ -1915,7 +1965,7 @@ namespace svt { namespace table
if(m_pModel->hasColumnHeaders())
lineHeight+= m_nColHeaderHeightPixel;
lineHeight+=m_nRowHeightPixel*m_nRowCount;
- int gridHeight = m_pDataWindow->GetSizePixel().Height();
+ int gridHeight = m_pDataWindow->GetOutputSizePixel().Height();
if(lineHeight >= gridHeight)
lineHeight = gridHeight;
m_pDataWindow->ShowTracking(Rectangle(Point(rPoint.X(),0), Size(1, lineHeight )),
@@ -2046,7 +2096,7 @@ namespace svt { namespace table
}
//when the sum of all visible columns and the next to the left column is smaller than
//window width, then update m_nLeftColumn
- if(widthsPixel<m_pDataWindow->GetSizePixel().Width())
+ if(widthsPixel<m_pDataWindow->GetOutputSizePixel().Width())
m_nLeftColumn--;
}
//--------------------------------------------------------------------
@@ -2085,6 +2135,7 @@ namespace svt { namespace table
impl_getAllVisibleDataCellArea(aRect);
return aRect;
}
+
//--------------------------------------------------------------------
IMPL_LINK( TableControl_Impl, OnScroll, ScrollBar*, _pScrollbar )
{
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 61fcda7ceb71..da4108e3af09 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -190,6 +190,8 @@ namespace svt { namespace table
void setCursorAtCurrentCell(const Point& rPoint);
/** checks whether the vector with the selected rows contains the current row*/
BOOL isRowSelected(const ::std::vector<RowPos>& selectedRows, RowPos current);
+
+ bool isRowSelected(RowPos current);
/** returns the position of the current row in the selection vector */
int getRowSelectedNumber(const ::std::vector<RowPos>& selectedRows, RowPos current);
/** _rCellRect contains the region, which should be invalidate after some action e.g. selecting row*/
@@ -201,7 +203,6 @@ namespace svt { namespace table
/** updates the vector, which contains the selected rows after removing the row nRowPos*/
void removeSelectedRow(RowPos _nRowPos);
void invalidateRows();
-
// IAbstractTableControl
virtual void hideCursor();
virtual void showCursor();
diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx
index 1a1696a6ea58..e602f0418cfe 100644
--- a/svtools/source/table/tabledatawindow.cxx
+++ b/svtools/source/table/tabledatawindow.cxx
@@ -44,6 +44,7 @@ namespace svt { namespace table
TableDataWindow::TableDataWindow( TableControl_Impl& _rTableControl )
:Window( &_rTableControl.getAntiImpl() )
,m_rTableControl ( _rTableControl )
+ ,m_nRowAlreadySelected( -1 )
{
}
@@ -75,13 +76,24 @@ namespace svt { namespace table
//--------------------------------------------------------------------
void TableDataWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
+ Point aPoint = rMEvt.GetPosPixel();
+ RowPos nCurRow = m_rTableControl.getCurrentRow(aPoint);
if ( !m_rTableControl.getInputHandler()->MouseButtonDown( m_rTableControl, rMEvt ) )
Window::MouseButtonDown( rMEvt );
else
{
- Point aPoint = rMEvt.GetPosPixel();
- if(m_rTableControl.getCurrentRow(aPoint) >= 0)
- m_aSelectHdl.Call( NULL );
+ if(nCurRow >= 0 && m_rTableControl.getSelEngine()->GetSelectionMode() != NO_SELECTION)
+ {
+ if( m_nRowAlreadySelected != nCurRow )
+ {
+ m_nRowAlreadySelected = nCurRow;
+ m_aSelectHdl.Call( NULL );
+ }
+ else
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
+ }
+ else
+ m_aMouseButtonDownHdl.Call((MouseEvent*) &rMEvt);
}
m_rTableControl.getAntiImpl().LoseFocus();
}
@@ -90,6 +102,8 @@ namespace svt { namespace table
{
if ( !m_rTableControl.getInputHandler()->MouseButtonUp( m_rTableControl, rMEvt ) )
Window::MouseButtonUp( rMEvt );
+ else
+ m_aMouseButtonUpHdl.Call((MouseEvent*) &rMEvt);
m_rTableControl.getAntiImpl().GetFocus();
}
//--------------------------------------------------------------------
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 404caadd9fb7..8d3edad11be5 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -127,9 +127,7 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
::vos::OGuard aGuard( GetMutex() );
TableControl* pTable = (TableControl*)GetWindow();
- const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
- const com::sun::star::awt::FontDescriptor& aFont = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
-
+ sal_Int32 fontHeight = GetWindow()->GetTextHeight();
switch( GetPropertyId( PropertyName ) )
{
case BASEPROPERTY_GRID_SELECTIONMODE:
@@ -293,7 +291,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
}
else
throw GridInvalidDataException(rtl::OUString::createFromAscii("The data model isn't set!"), m_xDataModel);
- sal_Int32 fontHeight = aFont.Height+8;
if(m_xDataModel->getRowHeight() == 0)
m_pTableModel->setRowHeight(fontHeight);
else
@@ -312,7 +309,6 @@ void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const An
Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
std::vector<Reference< XGridColumn > > aNewColumns(
comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- sal_Int32 fontHeight = aFont.Height+8;
if(m_xColumnModel->getColumnHeaderHeight() == 0)
m_pTableModel->setColumnHeaderHeight(fontHeight);
else
@@ -671,14 +667,7 @@ void SAL_CALL SVTXGridControl::deselectAllRows() throw (::com::sun::star::uno::R
{
TableControl* pTable = (TableControl*)GetWindow();
std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
- ::std::vector<RowPos>::iterator iter = selectedRows.begin();
- sal_Bool bSelected = sal_False;
- for(;iter!=selectedRows.end();iter++)
- {
- if(*iter == index)
- bSelected = sal_True;
- }
- return bSelected;
+ return std::find(selectedRows.begin(),selectedRows.end(), index) != selectedRows.end();
}
void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)