diff options
author | Mihaela Kedikova <misheto@openoffice.org> | 2009-10-30 12:37:25 +0000 |
---|---|---|
committer | Mihaela Kedikova <misheto@openoffice.org> | 2009-10-30 12:37:25 +0000 |
commit | 34c697928962e1b8f6cd4c657d83a62c11fffadb (patch) | |
tree | 444ddae19f5a7403c9ec2e24bbbfc3a656cad7d8 /svtools/source/uno/unocontroltablemodel.cxx | |
parent | 728c8eb458b5613eb5b8bbe8201dfc33a8a9cd78 (diff) |
fixes for i106470
Diffstat (limited to 'svtools/source/uno/unocontroltablemodel.cxx')
-rw-r--r-- | svtools/source/uno/unocontroltablemodel.cxx | 849 |
1 files changed, 409 insertions, 440 deletions
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index e322dbb8f96e..566848f19023 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -47,38 +47,6 @@ using namespace ::svt::table; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt::grid; -using namespace ::svt::table; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::view; -using namespace ::toolkit; - -class UnoControlTableColumn : public IColumnModel - { - private: - ColumnID m_nID; - String m_sName; - bool m_bIsResizable; - TableMetrics m_nWidth; - TableMetrics m_nMinWidth; - TableMetrics m_nMaxWidth; - - public: - UnoControlTableColumn(Reference<XGridColumn>); - - // IColumnModel overridables - virtual ColumnID getID() const; - virtual bool setID( const ColumnID _nID ); - virtual String getName() const; - virtual void setName( const String& _rName ); - virtual bool isResizable() const; - virtual void setResizable( bool _bResizable ); - virtual TableMetrics getWidth() const; - virtual void setWidth( TableMetrics _nWidth ); - virtual TableMetrics getMinWidth() const; - virtual void setMinWidth( TableMetrics _nMinWidth ); - virtual TableMetrics getMaxWidth() const; - virtual void setMaxWidth( TableMetrics _nMaxWidth ); - }; //-------------------------------------------------------------------- UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn) @@ -181,7 +149,7 @@ class UnoControlTableColumn : public IColumnModel //==================================================================== struct UnoControlTableModel_Impl { - ::std::vector< PColumnModel > aColumns; + ::std::vector< PColumnModel >& aColumns; TableSize nRowCount; bool bHasColumnHeaders; bool bHasRowHeaders; @@ -190,8 +158,8 @@ class UnoControlTableColumn : public IColumnModel TableMetrics nRowHeight; TableMetrics nColumnHeaderHeight; TableMetrics nRowHeaderWidth; - std::vector<rtl::OUString> aRowHeadersTitle; - std::vector<std::vector<rtl::OUString> > aCellContent; + std::vector<rtl::OUString>& aRowHeadersTitle; + std::vector<std::vector<rtl::OUString> >& aCellContent; UnoControlTableModel_Impl() :nRowCount ( 0 ) @@ -202,8 +170,9 @@ class UnoControlTableColumn : public IColumnModel ,nRowHeight ( 4 * 100 ) // 40 mm ,nColumnHeaderHeight( 5 * 100 ) // 50 mm ,nRowHeaderWidth ( 10 * 100 ) // 50 mm - ,aRowHeadersTitle ( 0 ) - ,aCellContent ( 0 ) + ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0))) + ,aCellContent ( *(new std::vector<std::vector<OUString> >(0))) + ,aColumns ( *(new std::vector< PColumnModel> (0))) { } }; @@ -213,16 +182,10 @@ class UnoControlTableColumn : public IColumnModel //==================================================================== //-------------------------------------------------------------------- UnoControlTableModel::UnoControlTableModel() - :m_pImpl( new UnoControlTableModel_Impl ), - m_xDataModel(0), - m_xColumnModel(0), - m_bHasColumnHeaders(false), - m_bHasRowHeaders(false), - m_bVScroll(false), - m_bHScroll(false) - { - m_pImpl->bHasColumnHeaders = m_bHasColumnHeaders; - m_pImpl->bHasRowHeaders = m_bHasRowHeaders; + :m_pImpl( new UnoControlTableModel_Impl ) + { + m_pImpl->bHasColumnHeaders = false; + m_pImpl->bHasRowHeaders = false; m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) ); m_pImpl->pInputHandler.reset( new DefaultInputHandler ); } @@ -236,7 +199,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- TableSize UnoControlTableModel::getColumnCount() const { - m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); + //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount()); return (TableSize)m_pImpl->aColumns.size(); } @@ -312,6 +275,11 @@ class UnoControlTableColumn : public IColumnModel } //-------------------------------------------------------------------- + std::vector<PColumnModel>& UnoControlTableModel::getColumnModel() + { + return m_pImpl->aColumns; + } + //-------------------------------------------------------------------- PColumnModel UnoControlTableModel::getColumnModelByID( ColumnID id ) { (void)id; @@ -376,7 +344,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const { - if(overAllHeight>=actHeight && !m_bVScroll) + if(overAllHeight>=actHeight)// && !m_bVScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -385,7 +353,7 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const { - if(overAllWidth>=actWidth && !m_bHScroll) + if(overAllWidth>=actWidth)// && !m_bHScroll) return ScrollbarShowNever; else return ScrollbarShowAlways; @@ -393,25 +361,26 @@ class UnoControlTableColumn : public IColumnModel //-------------------------------------------------------------------- void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent) { - if(cellContent.empty()) - { - unsigned int i = m_pImpl->aColumns.size(); - std::vector<rtl::OUString> emptyCells; - while(i!=0) - { - cellContent.push_back(emptyCells); - --i; - } - } - std::vector<rtl::OUString> cCC; - for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) - { - cCC = *iter; - m_pImpl->aCellContent.push_back(cCC); - } - } - - std::vector<std::vector<rtl::OUString> > UnoControlTableModel::getCellContent() + //if(cellContent.empty()) + //{ + // unsigned int i = m_pImpl->aColumns.size(); + // std::vector<rtl::OUString>& emptyCells; + // while(i!=0) + // { + // cellContent.push_back(emptyCells); + // --i; + // } + //} + //std::vector<rtl::OUString> cCC; + //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter) + //{ + // cCC = *iter; + // m_pImpl->aCellContent.push_back(cCC); + //} + m_pImpl->aCellContent.swap( cellContent ); + } + + std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent() { return m_pImpl->aCellContent; } @@ -435,378 +404,378 @@ class UnoControlTableColumn : public IColumnModel } } - std::vector<rtl::OUString> UnoControlTableModel::getRowHeaderName() + std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName() { return m_pImpl->aRowHeadersTitle; } -::com::sun::star::uno::Any UnoControlTableModel::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), - //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ), - //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ), - SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); - return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); -} - -// ::com::sun::star::lang::XTypeProvider -IMPL_XTYPEPROVIDER_START( UnoControlTableModel ) - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), - getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), - VCLXWindow::getTypes() -IMPL_XTYPEPROVIDER_END - -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) -{ - return NULL; -} -void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) -{ - (void)model; -} -sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTableControl = (TableControl*)GetWindow(); - return pTableControl->GetCurrentRow( Point(x,y) ); -} - -/* -void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXWindow::addMouseListener( listener ); -} - -void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) -{ - VCLXWindow::removeMouseListener( listener ); -} -*/ -/* -void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void)rEvent; -} -void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void)rEvent; -} -void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void) rEvent; -} -void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) -{ - (void) rEvent; -} -*/ -void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - (void)listener; -} - -void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) -{ - (void) listener; -} - -void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - TableControl* pTableControl = (TableControl*)GetWindow(); - - switch( GetPropertyId( PropertyName ) ) - { - case BASEPROPERTY_GRID_SELECTIONMODE: - { - SelectionType eSelectionType; - if( aValue >>= eSelectionType ) - { - SelectionMode eSelMode; - switch( eSelectionType ) - { - case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; - case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; - case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; - // case SelectionType_NONE: - default: eSelMode = NO_SELECTION; break; - } - if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode ) - pTableControl->getSelEngine()->SetSelectionMode( eSelMode ); - } - break; - } - case BASEPROPERTY_HSCROLL: - { - sal_Bool bHScroll = true; - if( aValue >>= bHScroll ) - { - m_bHScroll = bHScroll; - } - break; - } - case BASEPROPERTY_VSCROLL: - { - sal_Bool bVScroll = true; - if( aValue >>= bVScroll ) - { - m_bVScroll = bVScroll; - } - break; - } - case BASEPROPERTY_GRID_SHOWROWHEADER: - { - sal_Bool rowHeader = true; - if( aValue >>= rowHeader ) - { - setRowHeaders(rowHeader); - } - break; - } - - case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: - { - sal_Bool colHeader = true; - if( aValue >>= colHeader ) - { - setColumnHeaders(colHeader); - } - break; - } - case BASEPROPERTY_GRID_DATAMODEL: - { - m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); - Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData(); - Sequence<rtl::OUString> rowData(0); - for(int i = 0; i< m_xDataModel->getRowCount();++i) - { - rowData = cellData[i]; - std::vector<rtl::OUString> newRow( - comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData)); - if(newRow.size()<m_pImpl->aColumns.size()) - newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); - m_pImpl->aCellContent.push_back(newRow); - } - Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); - std::vector< rtl::OUString > newRow( - comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders)); - m_pImpl->nRowCount = m_xDataModel->getRowCount(); - setRowHeaderName(newRow); - break; - } - case BASEPROPERTY_GRID_COLUMNMODEL: - { - m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); - Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns(); - std::vector<Reference< XGridColumn > > aNewColumns( - comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns)); - if(!m_pImpl->aColumns.empty()) - m_pImpl->aColumns.clear(); - for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) - { - UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); - m_pImpl->aColumns.push_back((PColumnModel)tableColumn); - } - break; - } - default: - VCLXWindow::setProperty( PropertyName, aValue ); - break; - } -} - -Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - - const sal_uInt16 nPropId = GetPropertyId( PropertyName ); - TableControl* pTableControl = (TableControl*)GetWindow(); - if(pTableControl) - { - switch(nPropId) - { - case BASEPROPERTY_GRID_SELECTIONMODE: - { - SelectionType eSelectionType; - - SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode(); - switch( eSelMode ) - { - case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; - case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; - case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; -// case NO_SELECTION: - default: eSelectionType = SelectionType_NONE; break; - } - return Any( eSelectionType ); - } - case BASEPROPERTY_GRID_SHOWROWHEADER: - { - return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders()); - } - case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: - return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders()); - case BASEPROPERTY_GRID_DATAMODEL: - return Any ( m_xDataModel ); - case BASEPROPERTY_GRID_COLUMNMODEL: - return Any ( m_xColumnModel); - case BASEPROPERTY_HSCROLL: - return Any ( m_bHScroll); - case BASEPROPERTY_VSCROLL: - return Any ( m_bVScroll); - } - } - return VCLXWindow::getProperty( PropertyName ); -} - -void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) -{ - PushPropertyIds( rIds, - BASEPROPERTY_GRID_SHOWROWHEADER, - BASEPROPERTY_GRID_SHOWCOLUMNHEADER, - BASEPROPERTY_GRID_DATAMODEL, - BASEPROPERTY_GRID_COLUMNMODEL, - BASEPROPERTY_GRID_SELECTIONMODE, - 0); - VCLXWindow::ImplGetPropertyIds( rIds, true ); -} -void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - if ( pTable ) - { - pTable->SetModel(PTableModel(this)); - pTable->Show( bVisible ); - } -} -void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException) -{ - ::vos::OGuard aGuard( GetMutex() ); - if ( GetWindow()) - GetWindow()->GrabFocus(); -} -void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - std::vector<OUString> aNewRow( - comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData)); - if(aNewRow.size()<m_pImpl->aColumns.size()) - aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); - m_pImpl->aCellContent.push_back(aNewRow); - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.push_back(Event.headerName); - m_pImpl->nRowCount=m_pImpl->aCellContent.size(); - TableControl* pTable = (TableControl*)GetWindow(); - pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false); - //pTable->GrabFocus(); -} - -void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - //unsigned int rows =m_pImpl->aCellContent.size()-1; - if(Event.index == -1) - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.clear(); - m_pImpl->aCellContent.clear(); - } - else - { - pTable->removeSelectedRow(Event.index); - if(m_pImpl->aCellContent.size()>1) - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index); - m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index); - - } - else - { - if(hasRowHeaders()) - m_pImpl->aRowHeadersTitle.clear(); - m_pImpl->aCellContent.clear(); - //m_pImpl->nRowCount=0; - } - } - //pTable->InvalidateDataWindow(Event.index, true); - setRowCount(m_pImpl->aCellContent.size()); - pTable->InvalidateDataWindow(Event.index, true); - //pTable->Invalidate(); -} - -void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) -{ - (void) Event; -} - - void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) - { - VCLXWindow::disposing( Source ); - } - -::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} - -::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) -{ - return 0; -} - -void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) -{ - (void)length; - (void)start; -} - -void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) -{ - (void)end; - (void)start; -} - -::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException) -{ - TableControl* pTable = (TableControl*)GetWindow(); - std::vector<RowPos> selectedRows = pTable->getSelectedRows(); - Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); - return selectedRowsToSequence; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) -{ - return sal_False; -} - -::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) -{ - (void)index; - return sal_False; -} - -void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) -{ - (void)y; -} - -void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) -{ - (void)x; -} +//::com::sun::star::uno::Any UnoControlTableModel::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) +//{ +// ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, +// SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ), +// SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ), +// //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ), +// //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ), +// SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) ); +// return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType )); +//} +// +//// ::com::sun::star::lang::XTypeProvider +//IMPL_XTYPEPROVIDER_START( UnoControlTableModel ) +// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ), +// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ), +// getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ), +// VCLXWindow::getTypes() +//IMPL_XTYPEPROVIDER_END +// +//::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException) +//{ +// return NULL; +//} +//void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)model; +//} +//::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException) +//{ +// return NULL; +//} +//void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)model; +//} +//sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTableControl = (TableControl*)GetWindow(); +// return pTableControl->GetCurrentRow( Point(x,y) ); +//} +// +///* +//void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) +//{ +// VCLXWindow::addMouseListener( listener ); +//} +// +//void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException) +//{ +// VCLXWindow::removeMouseListener( listener ); +//} +//*/ +///* +//void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void)rEvent; +//} +//void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void)rEvent; +//} +//void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void) rEvent; +//} +//void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException) +//{ +// (void) rEvent; +//} +//*/ +//void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)listener; +//} +// +//void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void) listener; +//} +// +//void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException) +//{ +// ::vos::OGuard aGuard( GetMutex() ); +// +// TableControl* pTableControl = (TableControl*)GetWindow(); +// +// switch( GetPropertyId( PropertyName ) ) +// { +// case BASEPROPERTY_GRID_SELECTIONMODE: +// { +// SelectionType eSelectionType; +// if( aValue >>= eSelectionType ) +// { +// SelectionMode eSelMode; +// switch( eSelectionType ) +// { +// case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break; +// case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break; +// case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break; +// // case SelectionType_NONE: +// default: eSelMode = NO_SELECTION; break; +// } +// if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode ) +// pTableControl->getSelEngine()->SetSelectionMode( eSelMode ); +// } +// break; +// } +// case BASEPROPERTY_HSCROLL: +// { +// sal_Bool bHScroll = true; +// if( aValue >>= bHScroll ) +// { +// m_bHScroll = bHScroll; +// } +// break; +// } +// case BASEPROPERTY_VSCROLL: +// { +// sal_Bool bVScroll = true; +// if( aValue >>= bVScroll ) +// { +// m_bVScroll = bVScroll; +// } +// break; +// } +// case BASEPROPERTY_GRID_SHOWROWHEADER: +// { +// sal_Bool rowHeader = true; +// if( aValue >>= rowHeader ) +// { +// setRowHeaders(rowHeader); +// } +// break; +// } +// +// case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: +// { +// sal_Bool colHeader = true; +// if( aValue >>= colHeader ) +// { +// setColumnHeaders(colHeader); +// } +// break; +// } +// case BASEPROPERTY_GRID_DATAMODEL: +// { +// m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY ); +// Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData(); +// Sequence<rtl::OUString> rowData(0); +// for(int i = 0; i< m_xDataModel->getRowCount();++i) +// { +// rowData = cellData[i]; +// std::vector<rtl::OUString> newRow( +// comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData)); +// if(newRow.size()<m_pImpl->aColumns.size()) +// newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); +// m_pImpl->aCellContent.push_back(newRow); +// } +// Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders(); +// std::vector< rtl::OUString > newRow( +// comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders)); +// m_pImpl->nRowCount = m_xDataModel->getRowCount(); +// setRowHeaderName(newRow); +// break; +// } +// case BASEPROPERTY_GRID_COLUMNMODEL: +// { +// m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY ); +// Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns(); +// std::vector<Reference< XGridColumn > > aNewColumns( +// comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns)); +// if(!m_pImpl->aColumns.empty()) +// m_pImpl->aColumns.clear(); +// for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col ) +// { +// UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]); +// m_pImpl->aColumns.push_back((PColumnModel)tableColumn); +// } +// break; +// } +// default: +// VCLXWindow::setProperty( PropertyName, aValue ); +// break; +// } +//} +// +//Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException) +//{ +// ::vos::OGuard aGuard( GetMutex() ); +// +// const sal_uInt16 nPropId = GetPropertyId( PropertyName ); +// TableControl* pTableControl = (TableControl*)GetWindow(); +// if(pTableControl) +// { +// switch(nPropId) +// { +// case BASEPROPERTY_GRID_SELECTIONMODE: +// { +// SelectionType eSelectionType; +// +// SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode(); +// switch( eSelMode ) +// { +// case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break; +// case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break; +// case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break; +//// case NO_SELECTION: +// default: eSelectionType = SelectionType_NONE; break; +// } +// return Any( eSelectionType ); +// } +// case BASEPROPERTY_GRID_SHOWROWHEADER: +// { +// return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders()); +// } +// case BASEPROPERTY_GRID_SHOWCOLUMNHEADER: +// return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders()); +// case BASEPROPERTY_GRID_DATAMODEL: +// return Any ( m_xDataModel ); +// case BASEPROPERTY_GRID_COLUMNMODEL: +// return Any ( m_xColumnModel); +// case BASEPROPERTY_HSCROLL: +// return Any ( m_bHScroll); +// case BASEPROPERTY_VSCROLL: +// return Any ( m_bVScroll); +// } +// } +// return VCLXWindow::getProperty( PropertyName ); +//} +// +//void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds ) +//{ +// PushPropertyIds( rIds, +// BASEPROPERTY_GRID_SHOWROWHEADER, +// BASEPROPERTY_GRID_SHOWCOLUMNHEADER, +// BASEPROPERTY_GRID_DATAMODEL, +// BASEPROPERTY_GRID_COLUMNMODEL, +// BASEPROPERTY_GRID_SELECTIONMODE, +// 0); +// VCLXWindow::ImplGetPropertyIds( rIds, true ); +//} +//void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTable = (TableControl*)GetWindow(); +// if ( pTable ) +// { +// pTable->SetModel(PTableModel(this)); +// pTable->Show( bVisible ); +// } +//} +//void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException) +//{ +// ::vos::OGuard aGuard( GetMutex() ); +// if ( GetWindow()) +// GetWindow()->GrabFocus(); +//} +//void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +//{ +// std::vector<OUString> aNewRow( +// comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData)); +// if(aNewRow.size()<m_pImpl->aColumns.size()) +// aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii("")); +// m_pImpl->aCellContent.push_back(aNewRow); +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.push_back(Event.headerName); +// m_pImpl->nRowCount=m_pImpl->aCellContent.size(); +// TableControl* pTable = (TableControl*)GetWindow(); +// pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false); +// //pTable->GrabFocus(); +//} +// +//void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTable = (TableControl*)GetWindow(); +// //unsigned int rows =m_pImpl->aCellContent.size()-1; +// if(Event.index == -1) +// { +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.clear(); +// m_pImpl->aCellContent.clear(); +// } +// else +// { +// pTable->removeSelectedRow(Event.index); +// if(m_pImpl->aCellContent.size()>1) +// { +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index); +// m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index); +// +// } +// else +// { +// if(hasRowHeaders()) +// m_pImpl->aRowHeadersTitle.clear(); +// m_pImpl->aCellContent.clear(); +// //m_pImpl->nRowCount=0; +// } +// } +// //pTable->InvalidateDataWindow(Event.index, true); +// setRowCount(m_pImpl->aCellContent.size()); +// pTable->InvalidateDataWindow(Event.index, true); +// //pTable->Invalidate(); +//} +// +//void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void) Event; +//} +// +// void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) +// { +// VCLXWindow::disposing( Source ); +// } +// +//::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +//{ +// return 0; +//} +// +//::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException) +//{ +// return 0; +//} +// +//void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)length; +// (void)start; +//} +// +//void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)end; +// (void)start; +//} +// +//::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException) +//{ +// TableControl* pTable = (TableControl*)GetWindow(); +// std::vector<RowPos>& selectedRows = pTable->GetSelectedRows(); +// Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows)); +// return selectedRowsToSequence; +//} +// +//::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException) +//{ +// return sal_False; +//} +// +//::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException) +//{ +// return sal_False; +//} +// +//::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)index; +// return sal_False; +//} +// +//void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)y; +//} +// +//void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException) +//{ +// (void)x; +//} |