Kaydet (Commit) 5f7d39a0 authored tarafından Jürgen Schmidt's avatar Jürgen Schmidt Kaydeden (comit) Caolán McNamara

Resolves: #i120065# apply patch for Enabled property in grid model

Patch By: hanya
Review By: jsc

(cherry picked from commit 0164d670)

Change-Id: Iad363b75dd30722b10139b31c90b3d598deaaf30
üst b8a1af35
...@@ -525,6 +525,10 @@ namespace svt { namespace table ...@@ -525,6 +525,10 @@ namespace svt { namespace table
*/ */
virtual ITableDataSort* getSortAdapter() = 0; virtual ITableDataSort* getSortAdapter() = 0;
/** returns enabled state.
*/
virtual bool isEnabled() const = 0;
/// destroys the table model instance /// destroys the table model instance
virtual ~ITableModel() { } virtual ~ITableModel() { }
}; };
......
...@@ -260,7 +260,9 @@ namespace svt { namespace table ...@@ -260,7 +260,9 @@ namespace svt { namespace table
_rDevice.SetTextColor( textColor ); _rDevice.SetTextColor( textColor );
Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) ); Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
sal_uLong const nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, _nCol ) | TEXT_DRAW_CLIP; sal_uLong nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, _nCol ) | TEXT_DRAW_CLIP;
if ( !m_pImpl->rModel.isEnabled() )
nDrawTextFlags |= TEXT_DRAW_DISABLE;
_rDevice.DrawText( aTextRect, sHeaderText, nDrawTextFlags ); _rDevice.DrawText( aTextRect, sHeaderText, nDrawTextFlags );
::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() ); ::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
...@@ -396,7 +398,9 @@ namespace svt { namespace table ...@@ -396,7 +398,9 @@ namespace svt { namespace table
_rDevice.SetTextColor( textColor ); _rDevice.SetTextColor( textColor );
Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) ); Rectangle const aTextRect( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, _rArea ) ) );
sal_uLong const nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, 0 ) | TEXT_DRAW_CLIP; sal_uLong nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, 0 ) | TEXT_DRAW_CLIP;
if ( !m_pImpl->rModel.isEnabled() )
nDrawTextFlags |= TEXT_DRAW_DISABLE;
// TODO: is using the horizontal alignment of the 0'th column a good idea here? This is pretty ... arbitray .. // TODO: is using the horizontal alignment of the 0'th column a good idea here? This is pretty ... arbitray ..
_rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags ); _rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags );
} }
...@@ -500,8 +504,8 @@ namespace svt { namespace table ...@@ -500,8 +504,8 @@ namespace svt { namespace table
} }
else else
imageSize.Height() = i_context.aContentArea.GetHeight() - 1; imageSize.Height() = i_context.aContentArea.GetHeight() - 1;
sal_uInt16 const nStyle = m_pImpl->rModel.isEnabled() ? 0 : IMAGE_DRAW_DISABLE;
i_context.rDevice.DrawImage( imagePos, imageSize, i_image, 0 ); i_context.rDevice.DrawImage( imagePos, imageSize, i_image, nStyle );
} }
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
...@@ -546,7 +550,9 @@ namespace svt { namespace table ...@@ -546,7 +550,9 @@ namespace svt { namespace table
} }
Rectangle const textRect( lcl_getTextRenderingArea( i_context.aContentArea ) ); Rectangle const textRect( lcl_getTextRenderingArea( i_context.aContentArea ) );
sal_uLong const nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, i_context.nColumn ) | TEXT_DRAW_CLIP; sal_uLong nDrawTextFlags = lcl_getAlignmentTextDrawFlags( *m_pImpl, i_context.nColumn ) | TEXT_DRAW_CLIP;
if ( !m_pImpl->rModel.isEnabled() )
nDrawTextFlags |= TEXT_DRAW_DISABLE;
i_context.rDevice.DrawText( textRect, i_text, nDrawTextFlags ); i_context.rDevice.DrawText( textRect, i_text, nDrawTextFlags );
} }
......
...@@ -210,6 +210,10 @@ namespace svt { namespace table ...@@ -210,6 +210,10 @@ namespace svt { namespace table
{ {
return NULL; return NULL;
} }
virtual bool isEnabled() const
{
return true;
}
virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent ) virtual void getCellContent( ColPos const i_col, RowPos const i_row, ::com::sun::star::uno::Any& o_cellContent )
{ {
(void)i_row; (void)i_row;
......
...@@ -852,6 +852,21 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ...@@ -852,6 +852,21 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent
VCLXWindow::ProcessWindowEvent( rVclWindowEvent ); VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
} }
//----------------------------------------------------------------------------------------------------------------------
void SVTXGridControl::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
m_pTableModel->setEnabled( bEnable );
Window * pWindow = GetWindow();
if ( pWindow )
{
pWindow->Enable( bEnable, sal_True );
pWindow->EnableInput( bEnable );
pWindow->Invalidate();
}
}
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
void SVTXGridControl::ImplCallItemListeners() void SVTXGridControl::ImplCallItemListeners()
{ {
......
...@@ -101,6 +101,9 @@ public: ...@@ -101,6 +101,9 @@ public:
// ::com::sun::star::lang::XComponent // ::com::sun::star::lang::XComponent
void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
// XWindow
void SAL_CALL setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
protected: protected:
// VCLXWindow // VCLXWindow
virtual void SetWindow( Window* pWindow ); virtual void SetWindow( Window* pWindow );
......
...@@ -91,6 +91,7 @@ namespace svt { namespace table ...@@ -91,6 +91,7 @@ namespace svt { namespace table
::boost::optional< ::Color > m_aTextLineColor; ::boost::optional< ::Color > m_aTextLineColor;
::boost::optional< ::std::vector< ::Color > > m_aRowColors; ::boost::optional< ::std::vector< ::Color > > m_aRowColors;
VerticalAlignment m_eVerticalAlign; VerticalAlignment m_eVerticalAlign;
bool bEnabled;
ModellListeners m_aListeners; ModellListeners m_aListeners;
WeakReference< XGridDataModel > m_aDataModel; WeakReference< XGridDataModel > m_aDataModel;
WeakReference< XGridColumnModel > m_aColumnModel; WeakReference< XGridColumnModel > m_aColumnModel;
...@@ -117,6 +118,7 @@ namespace svt { namespace table ...@@ -117,6 +118,7 @@ namespace svt { namespace table
,m_aTextLineColor ( ) ,m_aTextLineColor ( )
,m_aRowColors ( ) ,m_aRowColors ( )
,m_eVerticalAlign ( VerticalAlignment_TOP ) ,m_eVerticalAlign ( VerticalAlignment_TOP )
,bEnabled ( true )
{ {
} }
}; };
...@@ -155,6 +157,7 @@ namespace svt { namespace table ...@@ -155,6 +157,7 @@ namespace svt { namespace table
DBG_CTOR( UnoControlTableModel, UnoControlTableModel_checkInvariants ); DBG_CTOR( UnoControlTableModel, UnoControlTableModel_checkInvariants );
m_pImpl->bHasColumnHeaders = true; m_pImpl->bHasColumnHeaders = true;
m_pImpl->bHasRowHeaders = false; m_pImpl->bHasRowHeaders = false;
m_pImpl->bEnabled = true;
m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) ); m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) );
m_pImpl->pInputHandler.reset( new DefaultInputHandler ); m_pImpl->pInputHandler.reset( new DefaultInputHandler );
} }
...@@ -808,6 +811,20 @@ namespace svt { namespace table ...@@ -808,6 +811,20 @@ namespace svt { namespace table
return NULL; return NULL;
} }
//------------------------------------------------------------------------------------------------------------------
bool UnoControlTableModel::isEnabled() const
{
DBG_CHECK_ME();
return m_pImpl->bEnabled;
}
//------------------------------------------------------------------------------------------------------------------
void UnoControlTableModel::setEnabled( bool _bEnabled )
{
DBG_CHECK_ME();
m_pImpl->bEnabled = _bEnabled;
}
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
void UnoControlTableModel::sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) void UnoControlTableModel::sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection )
{ {
......
...@@ -90,6 +90,7 @@ namespace svt { namespace table ...@@ -90,6 +90,7 @@ namespace svt { namespace table
virtual ::com::sun::star::style::VerticalAlignment virtual ::com::sun::star::style::VerticalAlignment
getVerticalAlign() const; getVerticalAlign() const;
virtual ITableDataSort* getSortAdapter(); virtual ITableDataSort* getSortAdapter();
virtual bool isEnabled() const;
// ITableDataSort overridables // ITableDataSort overridables
virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ); virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection );
...@@ -133,6 +134,7 @@ namespace svt { namespace table ...@@ -133,6 +134,7 @@ namespace svt { namespace table
void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue ); void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue );
void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign); void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
void setEnabled( bool _bEnabled );
// multiplexing of XGridDataListener events // multiplexing of XGridDataListener events
void notifyRowsInserted( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const; void notifyRowsInserted( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment