summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorJürgen Schmidt <jsc@apache.org>2013-12-20 05:47:11 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-20 09:23:57 +0000
commit5f7d39a07e108385b34c00e95dfdf734ad8f1f56 (patch)
treeec88a559685ac5b740ee9d032a5fa468b8fe41f6 /svtools
parentb8a1af35cc565248f6d103f526488fa7cc44ac38 (diff)
Resolves: #i120065# apply patch for Enabled property in grid model
Patch By: hanya Review By: jsc (cherry picked from commit 0164d67071d06aa42213c4a66765b5d032ca84d3) Change-Id: Iad363b75dd30722b10139b31c90b3d598deaaf30
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/table/gridtablerenderer.cxx16
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx4
-rw-r--r--svtools/source/uno/svtxgridcontrol.cxx15
-rw-r--r--svtools/source/uno/svtxgridcontrol.hxx3
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx17
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx2
6 files changed, 52 insertions, 5 deletions
diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx
index ca99192f9fcd..585d97e7bc50 100644
--- a/svtools/source/table/gridtablerenderer.cxx
+++ b/svtools/source/table/gridtablerenderer.cxx
@@ -260,7 +260,9 @@ namespace svt { namespace table
_rDevice.SetTextColor( textColor );
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 );
::boost::optional< ::Color > const aLineColor( m_pImpl->rModel.getLineColor() );
@@ -396,7 +398,9 @@ namespace svt { namespace table
_rDevice.SetTextColor( textColor );
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 ..
_rDevice.DrawText( aTextRect, rowTitle, nDrawTextFlags );
}
@@ -500,8 +504,8 @@ namespace svt { namespace table
}
else
imageSize.Height() = i_context.aContentArea.GetHeight() - 1;
-
- i_context.rDevice.DrawImage( imagePos, imageSize, i_image, 0 );
+ sal_uInt16 const nStyle = m_pImpl->rModel.isEnabled() ? 0 : IMAGE_DRAW_DISABLE;
+ i_context.rDevice.DrawImage( imagePos, imageSize, i_image, nStyle );
}
//------------------------------------------------------------------------------------------------------------------
@@ -546,7 +550,9 @@ namespace svt { namespace table
}
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 );
}
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index f4238c9da616..7a849beff7c6 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -210,6 +210,10 @@ namespace svt { namespace table
{
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 )
{
(void)i_row;
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
index 5397dc7450f2..6fadfcc9f50a 100644
--- a/svtools/source/uno/svtxgridcontrol.cxx
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -853,6 +853,21 @@ void SVTXGridControl::ProcessWindowEvent( const VclWindowEvent& 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()
{
TableControl* pTable = dynamic_cast< TableControl* >( GetWindow() );
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
index 0d8fd1b2e428..19e03c3b8353 100644
--- a/svtools/source/uno/svtxgridcontrol.hxx
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -101,6 +101,9 @@ public:
// ::com::sun::star::lang::XComponent
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:
// VCLXWindow
virtual void SetWindow( Window* pWindow );
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index 3c135ebc2e1d..bf0836254f08 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -91,6 +91,7 @@ namespace svt { namespace table
::boost::optional< ::Color > m_aTextLineColor;
::boost::optional< ::std::vector< ::Color > > m_aRowColors;
VerticalAlignment m_eVerticalAlign;
+ bool bEnabled;
ModellListeners m_aListeners;
WeakReference< XGridDataModel > m_aDataModel;
WeakReference< XGridColumnModel > m_aColumnModel;
@@ -117,6 +118,7 @@ namespace svt { namespace table
,m_aTextLineColor ( )
,m_aRowColors ( )
,m_eVerticalAlign ( VerticalAlignment_TOP )
+ ,bEnabled ( true )
{
}
};
@@ -155,6 +157,7 @@ namespace svt { namespace table
DBG_CTOR( UnoControlTableModel, UnoControlTableModel_checkInvariants );
m_pImpl->bHasColumnHeaders = true;
m_pImpl->bHasRowHeaders = false;
+ m_pImpl->bEnabled = true;
m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) );
m_pImpl->pInputHandler.reset( new DefaultInputHandler );
}
@@ -809,6 +812,20 @@ namespace svt { namespace table
}
//------------------------------------------------------------------------------------------------------------------
+ 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 )
{
DBG_CHECK_ME();
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index 848ff525be0e..4ecfac7170f4 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -90,6 +90,7 @@ namespace svt { namespace table
virtual ::com::sun::star::style::VerticalAlignment
getVerticalAlign() const;
virtual ITableDataSort* getSortAdapter();
+ virtual bool isEnabled() const;
// ITableDataSort overridables
virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection );
@@ -133,6 +134,7 @@ namespace svt { namespace table
void setRowBackgroundColors( ::com::sun::star::uno::Any const & i_APIValue );
void setVerticalAlign(::com::sun::star::style::VerticalAlignment _rAlign);
+ void setEnabled( bool _bEnabled );
// multiplexing of XGridDataListener events
void notifyRowsInserted( ::com::sun::star::awt::grid::GridDataEvent const & i_event ) const;