From e2080e70fe8b085f18e868e46340454720fa94ca Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 18 Jun 2014 12:14:29 +0200 Subject: new compilerplugin returnbyref Find places where we are returning a pointer to something, where we can be returning a reference. e.g. class A { struct X x; public X* getX() { return &x; } } which can be: public X& getX() { return x; } Change-Id: I796fd23fd36a18aedf6e36bc28f8fab4f518c6c7 --- dbaccess/source/ui/control/RelationControl.cxx | 38 ++-- dbaccess/source/ui/dlg/RelationDlg.cxx | 2 +- dbaccess/source/ui/inc/JoinController.hxx | 4 +- dbaccess/source/ui/inc/JoinTableView.hxx | 14 +- dbaccess/source/ui/inc/TableConnection.hxx | 2 +- dbaccess/source/ui/inc/TableConnectionData.hxx | 4 +- dbaccess/source/ui/inc/TableController.hxx | 4 +- dbaccess/source/ui/inc/TableWindow.hxx | 4 +- dbaccess/source/ui/inc/WCopyTable.hxx | 12 +- dbaccess/source/ui/misc/WCPage.cxx | 12 +- dbaccess/source/ui/misc/WColumnSelect.cxx | 42 ++-- dbaccess/source/ui/misc/WCopyTable.cxx | 6 +- dbaccess/source/ui/misc/WExtendPages.cxx | 8 +- dbaccess/source/ui/misc/WNameMatch.cxx | 24 +-- dbaccess/source/ui/misc/WTypeSelect.cxx | 8 +- .../source/ui/querydesign/ConnectionLineAccess.cxx | 8 +- dbaccess/source/ui/querydesign/JAccess.cxx | 8 +- dbaccess/source/ui/querydesign/JoinDesignView.cxx | 2 +- dbaccess/source/ui/querydesign/JoinTableView.cxx | 152 +++++++------- dbaccess/source/ui/querydesign/QueryDesignView.cxx | 54 ++--- .../ui/querydesign/QueryMoveTabWinUndoAct.cxx | 2 +- .../source/ui/querydesign/QueryTabWinUndoAct.hxx | 2 +- dbaccess/source/ui/querydesign/QueryTableView.cxx | 224 ++++++++++----------- .../source/ui/querydesign/SelectionBrowseBox.cxx | 85 ++++---- dbaccess/source/ui/querydesign/TableConnection.cxx | 18 +- .../source/ui/querydesign/TableConnectionData.cxx | 6 +- .../source/ui/querydesign/TableWindowAccess.cxx | 27 +-- .../source/ui/querydesign/TableWindowTitle.cxx | 6 +- .../source/ui/relationdesign/RTableConnection.cxx | 6 +- .../ui/relationdesign/RelationDesignView.cxx | 2 +- .../source/ui/relationdesign/RelationTableView.cxx | 34 ++-- dbaccess/source/ui/tabledesign/TEditControl.cxx | 24 +-- .../source/ui/tabledesign/TableFieldControl.cxx | 2 +- 33 files changed, 408 insertions(+), 438 deletions(-) (limited to 'dbaccess/source/ui') diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx index c11deeeeaca7..9082511dded4 100644 --- a/dbaccess/source/ui/control/RelationControl.cxx +++ b/dbaccess/source/ui/control/RelationControl.cxx @@ -184,7 +184,7 @@ namespace dbaui // not the first call RowRemoved(0, GetRowCount()); - RowInserted(0, m_pConnData->GetConnLineDataList()->size() + 1, true); // add one extra row + RowInserted(0, m_pConnData->GetConnLineDataList().size() + 1, true); // add one extra row } void ORelationControl::Resize() @@ -234,16 +234,16 @@ namespace dbaui if ( nRow != BROWSER_ENDOFSELECTION ) { OUString sFieldName(m_pListCell->GetSelectEntry()); - OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); - if ( pLines->size() <= static_cast(nRow) ) + OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList(); + if ( rLines.size() <= static_cast(nRow) ) { - pLines->push_back(new OConnectionLineData()); - nRow = pLines->size() - 1; - // add new past-pLines row + rLines.push_back(new OConnectionLineData()); + nRow = rLines.size() - 1; + // add new past-rLines row m_ops.push_back(make_pair(INSERT, make_pair(nRow+1, nRow+2))); } - OConnectionLineDataRef pConnLineData = (*pLines)[nRow]; + OConnectionLineDataRef pConnLineData = rLines[nRow]; switch( getColumnIdent( GetCurColumnId() ) ) { @@ -259,9 +259,9 @@ namespace dbaui //m_ops.push_back(make_pair(MODIFY, make_pair(nRow, nRow+1))); } - const OConnectionLineDataVec::size_type oldSize = m_pConnData->GetConnLineDataList()->size(); + const OConnectionLineDataVec::size_type oldSize = m_pConnData->GetConnLineDataList().size(); OConnectionLineDataVec::size_type line = m_pConnData->normalizeLines(); - const OConnectionLineDataVec::size_type newSize = m_pConnData->GetConnLineDataList()->size(); + const OConnectionLineDataVec::size_type newSize = m_pConnData->GetConnLineDataList().size(); assert(newSize <= oldSize); m_ops.push_back(make_pair(MODIFY, make_pair(line, newSize))); m_ops.push_back(make_pair(DELETE, make_pair(newSize, oldSize))); @@ -280,9 +280,9 @@ namespace dbaui OUString ORelationControl::GetCellText( long nRow, sal_uInt16 nColId ) const { OUString sText; - if ( m_pConnData->GetConnLineDataList()->size() > static_cast(nRow) ) + if ( m_pConnData->GetConnLineDataList().size() > static_cast(nRow) ) { - OConnectionLineDataRef pConnLineData = (*m_pConnData->GetConnLineDataList())[nRow]; + OConnectionLineDataRef pConnLineData = m_pConnData->GetConnLineDataList()[nRow]; switch( getColumnIdent( nColId ) ) { case SOURCE_COLUMN: @@ -403,7 +403,7 @@ namespace dbaui const OJoinTableView* pView = _pSource->getTableView(); OTableConnection* pConn = pView->GetTabConn(_pSource,_pDest); - if ( pConn && !m_pConnData->GetConnLineDataList()->empty() ) + if ( pConn && !m_pConnData->GetConnLineDataList().empty() ) { m_pConnData->CopyFrom(*pConn->GetData()); m_pBoxControl->getContainer()->notifyConnectionChange(); @@ -411,9 +411,9 @@ namespace dbaui else { // no connection found so we clear our data - OConnectionLineDataVec* pLines = m_pConnData->GetConnLineDataList(); - ::std::for_each(pLines->begin(), - pLines->end(), + OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList(); + ::std::for_each(rLines.begin(), + rLines.end(), OUnaryRefFunctor( ::std::mem_fun(&OConnectionLineData::Reset)) ); @@ -608,12 +608,12 @@ namespace dbaui { // Enable/disable the OK button, depending on having a valid situation TTableConnectionData::value_type pConnData = m_pRC_Tables->getData(); - const OConnectionLineDataVec* pLines = pConnData->GetConnLineDataList(); - bool bValid = !pLines->empty(); + const OConnectionLineDataVec& rLines = pConnData->GetConnLineDataList(); + bool bValid = !rLines.empty(); if (bValid) { - OConnectionLineDataVec::const_iterator l(pLines->begin()); - const OConnectionLineDataVec::const_iterator le(pLines->end()); + OConnectionLineDataVec::const_iterator l(rLines.begin()); + const OConnectionLineDataVec::const_iterator le(rLines.end()); for (; bValid && l!=le; ++l) { bValid = ! ((*l)->GetSourceFieldName().isEmpty() || (*l)->GetDestFieldName().isEmpty()); diff --git a/dbaccess/source/ui/dlg/RelationDlg.cxx b/dbaccess/source/ui/dlg/RelationDlg.cxx index ee482d578f77..63d5351ee0e2 100644 --- a/dbaccess/source/ui/dlg/RelationDlg.cxx +++ b/dbaccess/source/ui/dlg/RelationDlg.cxx @@ -52,7 +52,7 @@ ORelationDialog::ORelationDialog( OJoinTableView* pParent, bool bAllowTableSelect ) : ModalDialog(pParent, "RelationDialog", "dbaccess/ui/relationdialog.ui") - , m_pTableMap(pParent->GetTabWinMap()) + , m_pTableMap(&pParent->GetTabWinMap()) , m_pOrigConnData(pConnectionData) , m_bTriedOneUpdate(false) { diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx index a2ec2418dc99..01ff6fd39af5 100644 --- a/dbaccess/source/ui/inc/JoinController.hxx +++ b/dbaccess/source/ui/inc/JoinController.hxx @@ -82,8 +82,8 @@ namespace dbaui OJoinController(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rM); // attribute access - inline TTableWindowData* getTableWindowData() { return &m_vTableData; } - inline TTableConnectionData* getTableConnectionData() { return &m_vTableConnectionData;} + inline TTableWindowData& getTableWindowData() { return m_vTableData; } + inline TTableConnectionData& getTableConnectionData() { return m_vTableConnectionData;} inline OAddTableDlg* getAddTableDialog()const { return m_pAddTableDialog; } // OSingleDocumentController overridables diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx index 61b0147bf134..aa266ab9f8ca 100644 --- a/dbaccess/source/ui/inc/JoinTableView.hxx +++ b/dbaccess/source/ui/inc/JoinTableView.hxx @@ -67,8 +67,8 @@ namespace dbaui void resetRange(const Point& _aSize); // own methods - ScrollBar* GetHScrollBar() { return &m_aHScrollBar; } - ScrollBar* GetVScrollBar() { return &m_aVScrollBar; } + ScrollBar& GetHScrollBar() { return m_aHScrollBar; } + ScrollBar& GetVScrollBar() { return m_aVScrollBar; } }; @@ -121,8 +121,8 @@ namespace dbaui virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; // own methods - ScrollBar* GetHScrollBar() { return static_cast(GetParent())->GetHScrollBar(); } - ScrollBar* GetVScrollBar() { return static_cast(GetParent())->GetVScrollBar(); } + ScrollBar& GetHScrollBar() { return static_cast(GetParent())->GetHScrollBar(); } + ScrollBar& GetVScrollBar() { return static_cast(GetParent())->GetVScrollBar(); } DECL_LINK( ScrollHdl, ScrollBar* ); void DrawConnections( const Rectangle& rRect ); @@ -174,12 +174,12 @@ namespace dbaui void DeselectConn(OTableConnection* pConn); void SelectConn(OTableConnection* pConn); - OTableWindowMap* GetTabWinMap() { return &m_aTableMap; } - const OTableWindowMap* GetTabWinMap() const { return &m_aTableMap; } + OTableWindowMap& GetTabWinMap() { return m_aTableMap; } + const OTableWindowMap& GetTabWinMap() const { return m_aTableMap; } /** gives a read only access to the connection vector */ - const ::std::vector* getTableConnections() const { return &m_vTableConnection; } + const ::std::vector& getTableConnections() const { return m_vTableConnection; } bool ExistsAConn(const OTableWindow* pFromWin) const; diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx index a48e54f47951..95f60752ae65 100644 --- a/dbaccess/source/ui/inc/TableConnection.hxx +++ b/dbaccess/source/ui/inc/TableConnection.hxx @@ -92,7 +92,7 @@ namespace dbaui Rectangle GetBoundingRect() const; inline TTableConnectionData::value_type GetData() const { return m_pData; } - const ::std::vector* GetConnLineList() const { return &m_vConnLine; } + const ::std::vector& GetConnLineList() const { return m_vConnLine; } inline OJoinTableView* GetParent() const { return m_pParent; } virtual void Draw( const Rectangle& rRect ); using Window::Draw; diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx index 187377b5c4bc..36ca8d11a731 100644 --- a/dbaccess/source/ui/inc/TableConnectionData.hxx +++ b/dbaccess/source/ui/inc/TableConnectionData.hxx @@ -84,8 +84,8 @@ namespace dbaui */ OConnectionLineDataVec::size_type normalizeLines(); - const OConnectionLineDataVec* GetConnLineDataList() const { return &m_vConnLineData; } - OConnectionLineDataVec* GetConnLineDataList() { return &m_vConnLineData; } + const OConnectionLineDataVec& GetConnLineDataList() const { return m_vConnLineData; } + OConnectionLineDataVec& GetConnLineDataList() { return m_vConnLineData; } inline TTableWindowData::value_type getReferencingTable() const { return m_pReferencingTable; } inline TTableWindowData::value_type getReferencedTable() const { return m_pReferencedTable; } diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx index a6d84385df3b..d0f6b4d8f543 100644 --- a/dbaccess/source/ui/inc/TableController.hxx +++ b/dbaccess/source/ui/inc/TableController.hxx @@ -101,12 +101,12 @@ namespace dbaui virtual void impl_onModifyChanged() SAL_OVERRIDE; - inline ::std::vector< ::boost::shared_ptr >* getRows() { return &m_vRowList; } + inline ::std::vector< ::boost::shared_ptr >& getRows() { return m_vRowList; } /// returns the position of the first empty row sal_Int32 getFirstEmptyRowPosition(); - inline const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo; } + inline const OTypeInfoMap& getTypeInfo() const { return m_aTypeInfo; } inline TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) const { return m_aTypeInfoIndex[_nPos]->second; } TOTypeInfoSP getTypeInfoByType(sal_Int32 _nDataType) const; diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx index ed11ef6b0748..82028e1607be 100644 --- a/dbaccess/source/ui/inc/TableWindow.hxx +++ b/dbaccess/source/ui/inc/TableWindow.hxx @@ -146,9 +146,9 @@ namespace dbaui OUString GetTableName() const { return m_pData->GetTableName(); } OUString GetWinName() const { return m_pData->GetWinName(); } OUString GetComposedName() const { return m_pData->GetComposedName(); } - OTableWindowListBox* GetListBox() const { return m_pListBox; } + OTableWindowListBox* GetListBox() const { return m_pListBox; } TTableWindowData::value_type GetData() const { return m_pData; } - OTableWindowTitle* GetTitleCtrl() { return &m_aTitle; } + OTableWindowTitle& GetTitleCtrl() { return m_aTitle; } /** returns the name which should be used when displaying join or relations @return diff --git a/dbaccess/source/ui/inc/WCopyTable.hxx b/dbaccess/source/ui/inc/WCopyTable.hxx index 2cfb67fda79f..c8b6831f72c3 100644 --- a/dbaccess/source/ui/inc/WCopyTable.hxx +++ b/dbaccess/source/ui/inc/WCopyTable.hxx @@ -369,19 +369,19 @@ namespace dbaui OUString getPrimaryKeyName() const { return m_aKeyName; } TOTypeInfoSP getTypeInfo(sal_Int32 _nPos) const { return m_aTypeInfoIndex[_nPos]->second; } - const OTypeInfoMap* getTypeInfo() const { return &m_aTypeInfo; } + const OTypeInfoMap& getTypeInfo() const { return m_aTypeInfo; } TOTypeInfoSP getDestTypeInfo(sal_Int32 _nPos) const { return m_aDestTypeInfoIndex[_nPos]->second; } - const OTypeInfoMap* getDestTypeInfo() const { return &m_aDestTypeInfo; } + const OTypeInfoMap& getDestTypeInfo() const { return m_aDestTypeInfo; } ::com::sun::star::lang::Locale GetLocale() const { return m_aLocale; } ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > GetFormatter() const { return m_xFormatter; } ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> GetComponentContext() const { return m_xContext; } - const ODatabaseExport::TColumns* getSourceColumns() const{ return &m_vSourceColumns; } - const ODatabaseExport::TColumnVector* getSrcVector() const { return &m_vSourceVec; } - ODatabaseExport::TColumns* getDestColumns() { return &m_vDestColumns; } - const ODatabaseExport::TColumnVector* getDestVector() const { return &m_aDestVec; } + const ODatabaseExport::TColumns& getSourceColumns() const{ return m_vSourceColumns; } + const ODatabaseExport::TColumnVector& getSrcVector() const { return m_vSourceVec; } + ODatabaseExport::TColumns& getDestColumns() { return m_vDestColumns; } + const ODatabaseExport::TColumnVector& getDestVector() const { return m_aDestVec; } OUString getName() const { return m_sName; } /** clears the dest vectors diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx index e849e91984ed..7cfb2b9b5ebd 100644 --- a/dbaccess/source/ui/misc/WCPage.cxx +++ b/dbaccess/source/ui/misc/WCPage.cxx @@ -265,8 +265,8 @@ bool OCopyTable::checkAppendData() xTables = xSup->getTables(); if(xTables.is() && xTables->hasByName(m_pEdTableName->GetText())) { - const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector(); - const sal_uInt32 nSrcSize = pSrcColumns->size(); + const ODatabaseExport::TColumnVector& rSrcColumns = m_pParent->getSrcVector(); + const sal_uInt32 nSrcSize = rSrcColumns.size(); m_pParent->m_vColumnPos.resize( nSrcSize, ODatabaseExport::TPositions::value_type( COLUMN_POSITION_NOT_FOUND, COLUMN_POSITION_NOT_FOUND ) ); m_pParent->m_vColumnTypes.resize( nSrcSize , COLUMN_POSITION_NOT_FOUND ); @@ -274,10 +274,10 @@ bool OCopyTable::checkAppendData() xTables->getByName( m_pEdTableName->GetText() ) >>= xTable; ObjectCopySource aTableCopySource( m_pParent->m_xDestConnection, xTable ); m_pParent->loadData( aTableCopySource, m_pParent->m_vDestColumns, m_pParent->m_aDestVec ); - const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector(); - ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin(); - ODatabaseExport::TColumnVector::const_iterator aDestEnd = pDestColumns->end(); - const sal_uInt32 nDestSize = pDestColumns->size(); + const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector(); + ODatabaseExport::TColumnVector::const_iterator aDestIter = rDestColumns.begin(); + ODatabaseExport::TColumnVector::const_iterator aDestEnd = rDestColumns.end(); + const sal_uInt32 nDestSize = rDestColumns.size(); bool bNotConvert; sal_uInt32 i = 0; for(sal_Int32 nPos = 1;aDestIter != aDestEnd && i < nDestSize && i < nSrcSize;++aDestIter,++nPos,++i) diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx index 26cccda6131c..fab9f5e7f6bf 100644 --- a/dbaccess/source/ui/misc/WColumnSelect.cxx +++ b/dbaccess/source/ui/misc/WColumnSelect.cxx @@ -108,9 +108,9 @@ void OWizColumnSelect::Reset() m_pParent->m_mNameMapping.clear(); // insert the source columns in the left listbox - const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector(); - ODatabaseExport::TColumnVector::const_iterator aIter = pSrcColumns->begin(); - ODatabaseExport::TColumnVector::const_iterator aEnd = pSrcColumns->end(); + const ODatabaseExport::TColumnVector& rSrcColumns = m_pParent->getSrcVector(); + ODatabaseExport::TColumnVector::const_iterator aIter = rSrcColumns.begin(); + ODatabaseExport::TColumnVector::const_iterator aEnd = rSrcColumns.end(); for(;aIter != aEnd;++aIter) { @@ -127,15 +127,15 @@ void OWizColumnSelect::Reset() void OWizColumnSelect::ActivatePage( ) { // if there are no dest columns reset the left side with the origibnal columns - if(m_pParent->getDestColumns()->empty()) + if(m_pParent->getDestColumns().empty()) Reset(); clearListBox(*m_pNewColumnNames); - const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector(); + const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector(); - ODatabaseExport::TColumnVector::const_iterator aIter = pDestColumns->begin(); - ODatabaseExport::TColumnVector::const_iterator aEnd = pDestColumns->end(); + ODatabaseExport::TColumnVector::const_iterator aIter = rDestColumns.begin(); + ODatabaseExport::TColumnVector::const_iterator aEnd = rDestColumns.end(); for(;aIter != aEnd;++aIter) { sal_uInt16 nPos = m_pNewColumnNames->InsertEntry((*aIter)->first); @@ -164,7 +164,7 @@ bool OWizColumnSelect::LeavePage() if ( m_pParent->GetPressedButton() == OCopyTableWizard::WIZARD_NEXT || m_pParent->GetPressedButton() == OCopyTableWizard::WIZARD_FINISH ) - return m_pParent->getDestColumns()->size() != 0; + return m_pParent->getDestColumns().size() != 0; else return true; } @@ -331,15 +331,15 @@ void OWizColumnSelect::moveColumn( ListBox* _pRight, OSL_ENSURE(aIter != m_pParent->m_mNameMapping.end(),"Column must be defined"); if ( aIter == m_pParent->m_mNameMapping.end() ) return; // do nothing - const ODatabaseExport::TColumns* pSrcColumns = m_pParent->getSourceColumns(); - ODatabaseExport::TColumns::const_iterator aSrcIter = pSrcColumns->find((*aIter).first); - if ( aSrcIter != pSrcColumns->end() ) + const ODatabaseExport::TColumns& rSrcColumns = m_pParent->getSourceColumns(); + ODatabaseExport::TColumns::const_iterator aSrcIter = rSrcColumns.find((*aIter).first); + if ( aSrcIter != rSrcColumns.end() ) { // we need also the old position of this column to insert it back on that position again - const ODatabaseExport::TColumnVector* pSrcVector = m_pParent->getSrcVector(); - ODatabaseExport::TColumnVector::const_iterator aPos = ::std::find(pSrcVector->begin(),pSrcVector->end(),aSrcIter); - OSL_ENSURE( aPos != pSrcVector->end(),"Invalid position for the iterator here!"); - ODatabaseExport::TColumnVector::size_type nPos = (aPos - pSrcVector->begin()) - adjustColumnPosition(_pLeft, _sColumnName, (aPos - pSrcVector->begin()), _aCase); + const ODatabaseExport::TColumnVector& rSrcVector = m_pParent->getSrcVector(); + ODatabaseExport::TColumnVector::const_iterator aPos = ::std::find(rSrcVector.begin(), rSrcVector.end(), aSrcIter); + OSL_ENSURE( aPos != rSrcVector.end(),"Invalid position for the iterator here!"); + ODatabaseExport::TColumnVector::size_type nPos = (aPos - rSrcVector.begin()) - adjustColumnPosition(_pLeft, _sColumnName, (aPos - rSrcVector.begin()), _aCase); _pRight->SetEntryData( _pRight->InsertEntry( (*aIter).first, sal::static_int_cast< sal_uInt16 >(nPos)),aSrcIter->second ); _rRightColumns.push_back((*aIter).first); @@ -379,14 +379,14 @@ sal_uInt16 OWizColumnSelect::adjustColumnPosition( ListBox* _pLeft, ); OSL_ENSURE(aIter != m_pParent->m_mNameMapping.end(),"Column must be defined"); - const ODatabaseExport::TColumns* pSrcColumns = m_pParent->getSourceColumns(); - ODatabaseExport::TColumns::const_iterator aSrcIter = pSrcColumns->find((*aIter).first); - if ( aSrcIter != pSrcColumns->end() ) + const ODatabaseExport::TColumns& rSrcColumns = m_pParent->getSourceColumns(); + ODatabaseExport::TColumns::const_iterator aSrcIter = rSrcColumns.find((*aIter).first); + if ( aSrcIter != rSrcColumns.end() ) { // we need also the old position of this column to insert it back on that position again - const ODatabaseExport::TColumnVector* pSrcVector = m_pParent->getSrcVector(); - ODatabaseExport::TColumnVector::const_iterator aPos = ::std::find(pSrcVector->begin(),pSrcVector->end(),aSrcIter); - ODatabaseExport::TColumnVector::size_type nPos = aPos - pSrcVector->begin(); + const ODatabaseExport::TColumnVector& rSrcVector = m_pParent->getSrcVector(); + ODatabaseExport::TColumnVector::const_iterator aPos = ::std::find(rSrcVector.begin(), rSrcVector.end(), aSrcIter); + ODatabaseExport::TColumnVector::size_type nPos = aPos - rSrcVector.begin(); if( nPos < nCurrentPos) { nAdjustedPos++; diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index d293ea777ded..6e6fcd299fed 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -1225,11 +1225,11 @@ Reference< XPropertySet > OCopyTableWizard::createTable() Reference< XColumnsSupplier > xSuppDestinationColumns( xTable, UNO_QUERY ); // now append the columns - const ODatabaseExport::TColumnVector* pVec = getDestVector(); - appendColumns( xSuppDestinationColumns, pVec ); + const ODatabaseExport::TColumnVector& rVec = getDestVector(); + appendColumns( xSuppDestinationColumns, &rVec ); // now append the primary key Reference xKeySup(xTable,UNO_QUERY); - appendKey(xKeySup,pVec); + appendKey(xKeySup, &rVec); Reference xAppend(xTables,UNO_QUERY); if(xAppend.is()) diff --git a/dbaccess/source/ui/misc/WExtendPages.cxx b/dbaccess/source/ui/misc/WExtendPages.cxx index 9f6839b1e819..7d1646fcf682 100644 --- a/dbaccess/source/ui/misc/WExtendPages.cxx +++ b/dbaccess/source/ui/misc/WExtendPages.cxx @@ -31,8 +31,8 @@ SvParser* OWizHTMLExtend::createReader(sal_Int32 _nRows) m_pParent->GetColumnPositions(), m_pParent->GetFormatter(), m_pParent->GetComponentContext(), - m_pParent->getDestVector(), - m_pParent->getTypeInfo(), + &m_pParent->getDestVector(), + &m_pParent->getTypeInfo(), m_pParent->shouldCreatePrimaryKey()); } @@ -43,8 +43,8 @@ SvParser* OWizRTFExtend::createReader(sal_Int32 _nRows) m_pParent->GetColumnPositions(), m_pParent->GetFormatter(), m_pParent->GetComponentContext(), - m_pParent->getDestVector(), - m_pParent->getTypeInfo(), + &m_pParent->getDestVector(), + &m_pParent->getTypeInfo(), m_pParent->shouldCreatePrimaryKey()); } diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx index 088a850bf173..b274ba277401 100644 --- a/dbaccess/source/ui/misc/WNameMatch.cxx +++ b/dbaccess/source/ui/misc/WNameMatch.cxx @@ -104,8 +104,8 @@ void OWizNameMatching::ActivatePage( ) aName += m_pParent->m_sName; m_FT_TABLE_RIGHT.SetText(aName); - m_CTRL_LEFT.FillListBox(*m_pParent->getSrcVector()); - m_CTRL_RIGHT.FillListBox(*m_pParent->getDestVector()); + m_CTRL_LEFT.FillListBox(m_pParent->getSrcVector()); + m_CTRL_RIGHT.FillListBox(m_pParent->getDestVector()); m_ibColumn_up.Enable( m_CTRL_LEFT.GetEntryCount() > 1 ); m_ibColumn_down.Enable( m_CTRL_LEFT.GetEntryCount() > 1 ); @@ -120,12 +120,12 @@ void OWizNameMatching::ActivatePage( ) bool OWizNameMatching::LeavePage() { - const ODatabaseExport::TColumnVector* pSrcColumns = m_pParent->getSrcVector(); + const ODatabaseExport::TColumnVector& rSrcColumns = m_pParent->getSrcVector(); m_pParent->m_vColumnPos.clear(); m_pParent->m_vColumnTypes.clear(); - m_pParent->m_vColumnPos.resize( pSrcColumns->size(), ODatabaseExport::TPositions::value_type( COLUMN_POSITION_NOT_FOUND, COLUMN_POSITION_NOT_FOUND ) ); - m_pParent->m_vColumnTypes.resize( pSrcColumns->size(), COLUMN_POSITION_NOT_FOUND ); + m_pParent->m_vColumnPos.resize( rSrcColumns.size(), ODatabaseExport::TPositions::value_type( COLUMN_POSITION_NOT_FOUND, COLUMN_POSITION_NOT_FOUND ) ); + m_pParent->m_vColumnTypes.resize( rSrcColumns.size(), COLUMN_POSITION_NOT_FOUND ); sal_Int32 nParamPos = 0; SvTreeListEntry* pLeftEntry = m_CTRL_LEFT.GetModel()->First(); @@ -135,26 +135,26 @@ bool OWizNameMatching::LeavePage() OFieldDescription* pSrcField = static_cast(pLeftEntry->GetUserData()); OSL_ENSURE(pSrcField,"OWizNameMatching: OColumn can not be null!"); - ODatabaseExport::TColumnVector::const_iterator aSrcIter = pSrcColumns->begin(); - ODatabaseExport::TColumnVector::const_iterator aSrcEnd = pSrcColumns->end(); + ODatabaseExport::TColumnVector::const_iterator aSrcIter = rSrcColumns.begin(); + ODatabaseExport::TColumnVector::const_iterator aSrcEnd = rSrcColumns.end(); for(;aSrcIter != aSrcEnd && (*aSrcIter)->second != pSrcField;++aSrcIter) ; - const sal_Int32 nPos = ::std::distance(pSrcColumns->begin(),aSrcIter); + const sal_Int32 nPos = ::std::distance(rSrcColumns.begin(),aSrcIter); if(m_CTRL_LEFT.GetCheckButtonState(pLeftEntry) == SV_BUTTON_CHECKED) { OFieldDescription* pDestField = static_cast(pRightEntry->GetUserData()); OSL_ENSURE(pDestField,"OWizNameMatching: OColumn can not be null!"); - const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector(); - ODatabaseExport::TColumnVector::const_iterator aDestIter = pDestColumns->begin(); - ODatabaseExport::TColumnVector::const_iterator aDestEnd = pDestColumns->end(); + const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector(); + ODatabaseExport::TColumnVector::const_iterator aDestIter = rDestColumns.begin(); + ODatabaseExport::TColumnVector::const_iterator aDestEnd = rDestColumns.end(); for(;aDestIter != aDestEnd && (*aDestIter)->second != pDestField;++aDestIter) ; OSL_ENSURE((nPos) < static_cast(m_pParent->m_vColumnPos.size()),"m_pParent->m_vColumnPos: Illegal index for vector"); m_pParent->m_vColumnPos[nPos].first = ++nParamPos; - m_pParent->m_vColumnPos[nPos].second = ::std::distance(pDestColumns->begin(),aDestIter) + 1; + m_pParent->m_vColumnPos[nPos].second = ::std::distance(rDestColumns.begin(),aDestIter) + 1; bool bNotConvert = true; TOTypeInfoSP pTypeInfo; diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx index 6c3180dc641d..018e797123be 100644 --- a/dbaccess/source/ui/misc/WTypeSelect.cxx +++ b/dbaccess/source/ui/misc/WTypeSelect.cxx @@ -186,7 +186,7 @@ TOTypeInfoSP OWizTypeSelectControl::getTypeInfo(sal_Int32 _nPos) const OTypeInfoMap* OWizTypeSelectControl::getTypeInfo() const { - return static_cast(GetParent())->m_pParent->getDestTypeInfo(); + return &static_cast(GetParent())->m_pParent->getDestTypeInfo(); } ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> OWizTypeSelectControl::getMetaData() @@ -285,9 +285,9 @@ void OWizTypeSelect::Reset() sal_Int32 nBreakPos; m_pParent->CheckColumns(nBreakPos); - const ODatabaseExport::TColumnVector* pDestColumns = m_pParent->getDestVector(); - ODatabaseExport::TColumnVector::const_iterator aIter = pDestColumns->begin(); - ODatabaseExport::TColumnVector::const_iterator aEnd = pDestColumns->end(); + const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector(); + ODatabaseExport::TColumnVector::const_iterator aIter = rDestColumns.begin(); + ODatabaseExport::TColumnVector::const_iterator aEnd = rDestColumns.end(); for(;aIter != aEnd;++aIter) { sal_uInt16 nPos; diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx index 5506c7fc0fd4..02d1759dceda 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx @@ -81,10 +81,10 @@ namespace dbaui if( m_pLine ) { // search the position of our table window in the table window map - nIndex = m_pLine->GetParent()->GetTabWinMap()->size(); - const ::std::vector* pVec = m_pLine->GetParent()->getTableConnections(); - ::std::vector::const_iterator aIter = pVec->begin(); - ::std::vector::const_iterator aEnd = pVec->end(); + nIndex = m_pLine->GetParent()->GetTabWinMap().size(); + const ::std::vector& rVec = m_pLine->GetParent()->getTableConnections(); + ::std::vector::const_iterator aIter = rVec.begin(); + ::std::vector::const_iterator aEnd = rVec.end(); for (; aIter != aEnd && (*aIter) != m_pLine; ++nIndex,++aIter) ; nIndex = ( aIter != aEnd ) ? nIndex : -1; diff --git a/dbaccess/source/ui/querydesign/JAccess.cxx b/dbaccess/source/ui/querydesign/JAccess.cxx index 7d0b8adbc10d..717128eb4aeb 100644 --- a/dbaccess/source/ui/querydesign/JAccess.cxx +++ b/dbaccess/source/ui/querydesign/JAccess.cxx @@ -58,7 +58,7 @@ namespace dbaui ::osl::MutexGuard aGuard( m_aMutex ); sal_Int32 nChildCount = 0; if ( m_pTableView ) - nChildCount = m_pTableView->GetTabWinCount() + m_pTableView->getTableConnections()->size(); + nChildCount = m_pTableView->GetTabWinCount() + m_pTableView->getTableConnections().size(); return nChildCount; } Reference< XAccessible > SAL_CALL OJoinDesignViewAccess::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException, std::exception) @@ -71,13 +71,13 @@ namespace dbaui sal_Int32 nTableWindowCount = m_pTableView->GetTabWinCount(); if( i < nTableWindowCount ) { - OJoinTableView::OTableWindowMap::iterator aIter = m_pTableView->GetTabWinMap()->begin(); + OJoinTableView::OTableWindowMap::iterator aIter = m_pTableView->GetTabWinMap().begin(); for (sal_Int32 j=i; j; ++aIter,--j) ; aRet = aIter->second->GetAccessible(); } - else if( size_t(i - nTableWindowCount) < m_pTableView->getTableConnections()->size() ) - aRet = (*m_pTableView->getTableConnections())[i - nTableWindowCount]->GetAccessible(); + else if( size_t(i - nTableWindowCount) < m_pTableView->getTableConnections().size() ) + aRet = m_pTableView->getTableConnections()[i - nTableWindowCount]->GetAccessible(); } else throw IndexOutOfBoundsException(); diff --git a/dbaccess/source/ui/querydesign/JoinDesignView.cxx b/dbaccess/source/ui/querydesign/JoinDesignView.cxx index cfe2d696d8e4..6372e154038c 100644 --- a/dbaccess/source/ui/querydesign/JoinDesignView.cxx +++ b/dbaccess/source/ui/querydesign/JoinDesignView.cxx @@ -97,7 +97,7 @@ void OJoinDesignView::setReadOnly(sal_Bool /*_bReadOnly*/) void OJoinDesignView::SaveTabWinUIConfig(OTableWindow* pWin) { - getController().SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos()); + getController().SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar().GetThumbPos(), m_pScrollWindow->GetVScrollBar().GetThumbPos()); } void OJoinDesignView::KeyInput( const KeyEvent& rEvt ) diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index c29d55a393d8..e9d7dc8b392d 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -73,14 +73,14 @@ OScrollWindowHelper::OScrollWindowHelper( Window* pParent) : Window( pParent) // ScrollBars - GetHScrollBar()->SetRange( Range(0, 1000) ); - GetVScrollBar()->SetRange( Range(0, 1000) ); + GetHScrollBar().SetRange( Range(0, 1000) ); + GetVScrollBar().SetRange( Range(0, 1000) ); - GetHScrollBar()->SetLineSize( LINE_SIZE ); - GetVScrollBar()->SetLineSize( LINE_SIZE ); + GetHScrollBar().SetLineSize( LINE_SIZE ); + GetVScrollBar().SetLineSize( LINE_SIZE ); - GetHScrollBar()->Show(); - GetVScrollBar()->Show(); + GetHScrollBar().Show(); + GetVScrollBar().Show(); m_pCornerWindow->Show(); // normally we should be SCROLL_PANE @@ -98,15 +98,15 @@ void OScrollWindowHelper::setTableView(OJoinTableView* _pTableView) { m_pTableView = _pTableView; // ScrollBars - GetHScrollBar()->SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) ); - GetVScrollBar()->SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) ); + GetHScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) ); + GetVScrollBar().SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) ); } void OScrollWindowHelper::resetRange(const Point& _aSize) { Point aPos = PixelToLogic(_aSize); - GetHScrollBar()->SetRange( Range(0, aPos.X() + TABWIN_SPACING_X) ); - GetVScrollBar()->SetRange( Range(0, aPos.Y() + TABWIN_SPACING_Y) ); + GetHScrollBar().SetRange( Range(0, aPos.X() + TABWIN_SPACING_X) ); + GetVScrollBar().SetRange( Range(0, aPos.Y() + TABWIN_SPACING_Y) ); } void OScrollWindowHelper::Resize() @@ -114,15 +114,15 @@ void OScrollWindowHelper::Resize() Window::Resize(); Size aTotalOutputSize = GetOutputSizePixel(); - long nHScrollHeight = GetHScrollBar()->GetSizePixel().Height(); - long nVScrollWidth = GetVScrollBar()->GetSizePixel().Width(); + long nHScrollHeight = GetHScrollBar().GetSizePixel().Height(); + long nVScrollWidth = GetVScrollBar().GetSizePixel().Width(); - GetHScrollBar()->SetPosSizePixel( + GetHScrollBar().SetPosSizePixel( Point( 0, aTotalOutputSize.Height()-nHScrollHeight ), Size( aTotalOutputSize.Width()-nVScrollWidth, nHScrollHeight ) ); - GetVScrollBar()->SetPosSizePixel( + GetVScrollBar().SetPosSizePixel( Point( aTotalOutputSize.Width()-nVScrollWidth, 0 ), Size( nVScrollWidth, aTotalOutputSize.Height()-nHScrollHeight ) ); @@ -132,20 +132,20 @@ void OScrollWindowHelper::Resize() Size( nVScrollWidth, nHScrollHeight ) ); - GetHScrollBar()->SetPageSize( aTotalOutputSize.Width() ); - GetHScrollBar()->SetVisibleSize( aTotalOutputSize.Width() ); + GetHScrollBar().SetPageSize( aTotalOutputSize.Width() ); + GetHScrollBar().SetVisibleSize( aTotalOutputSize.Width() ); - GetVScrollBar()->SetPageSize( aTotalOutputSize.Height() ); - GetVScrollBar()->SetVisibleSize( aTotalOutputSize.Height() ); + GetVScrollBar().SetPageSize( aTotalOutputSize.Height() ); + GetVScrollBar().SetVisibleSize( aTotalOutputSize.Height() ); // adjust the ranges of the scrollbars if necessary - long lRange = GetHScrollBar()->GetRange().Max() - GetHScrollBar()->GetRange().Min(); + long lRange = GetHScrollBar().GetRange().Max() - GetHScrollBar().GetRange().Min(); if (m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() > lRange) - GetHScrollBar()->SetRangeMax(m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() + GetHScrollBar()->GetRange().Min()); + GetHScrollBar().SetRangeMax(m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() + GetHScrollBar().GetRange().Min()); - lRange = GetVScrollBar()->GetRange().Max() - GetVScrollBar()->GetRange().Min(); + lRange = GetVScrollBar().GetRange().Max() - GetVScrollBar().GetRange().Min(); if (m_pTableView->GetScrollOffset().Y() + aTotalOutputSize.Height() > lRange) - GetVScrollBar()->SetRangeMax(m_pTableView->GetScrollOffset().Y() + aTotalOutputSize.Height() + GetVScrollBar()->GetRange().Min()); + GetVScrollBar().SetRangeMax(m_pTableView->GetScrollOffset().Y() + aTotalOutputSize.Height() + GetVScrollBar().GetRange().Min()); m_pTableView->SetPosSizePixel(Point( 0, 0 ),Size( aTotalOutputSize.Width()-nVScrollWidth, aTotalOutputSize.Height()-nHScrollHeight )); } @@ -186,7 +186,7 @@ OJoinTableView::~OJoinTableView() IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar ) { // move all windows - ScrollPane( pScrollBar->GetDelta(), (pScrollBar == GetHScrollBar()), false ); + ScrollPane( pScrollBar->GetDelta(), (pScrollBar == &GetHScrollBar()), false ); return 0; } @@ -202,8 +202,8 @@ void OJoinTableView::Resize() return; // we have at least one table so resize it - m_aScrollOffset.X() = GetHScrollBar()->GetThumbPos(); - m_aScrollOffset.Y() = GetVScrollBar()->GetThumbPos(); + m_aScrollOffset.X() = GetHScrollBar().GetThumbPos(); + m_aScrollOffset.Y() = GetVScrollBar().GetThumbPos(); OTableWindow* pCheck = m_aTableMap.begin()->second; Point aRealPos = pCheck->GetPosPixel(); @@ -311,7 +311,7 @@ void OJoinTableView::AddTabWin(const OUString& _rComposedName, const OUString& r OTableWindow* pNewTabWin = createWindow( pNewTabWinData ); if ( pNewTabWin->Init() ) { - m_pView->getController().getTableWindowData()->push_back( pNewTabWinData); + m_pView->getController().getTableWindowData().push_back( pNewTabWinData); // when we already have a table with this name insert the full qualified one instead if(m_aTableMap.find(rWinName) != m_aTableMap.end()) m_aTableMap[_rComposedName] = pNewTabWin; @@ -366,10 +366,10 @@ void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin ) pTabWin->Hide(); OJoinController& rController = m_pView->getController(); - TTableWindowData::iterator aFind = ::std::find(rController.getTableWindowData()->begin(),rController.getTableWindowData()->end(),pData); - if(aFind != rController.getTableWindowData()->end()) + TTableWindowData::iterator aFind = ::std::find(rController.getTableWindowData().begin(), rController.getTableWindowData().end(), pData); + if(aFind != rController.getTableWindowData().end()) { - rController.getTableWindowData()->erase(aFind); + rController.getTableWindowData().erase(aFind); rController.setModified(sal_True); } @@ -395,16 +395,14 @@ namespace bool isScrollAllowed( OJoinTableView* _pView,long nDelta, bool bHoriz) { // adjust ScrollBar-Positions - ScrollBar* pBar = _pView->GetVScrollBar(); - if( bHoriz ) - pBar = _pView->GetHScrollBar(); + ScrollBar& rBar = bHoriz ? _pView->GetHScrollBar() : _pView->GetVScrollBar() ; - long nOldThumbPos = pBar->GetThumbPos(); + long nOldThumbPos = rBar.GetThumbPos(); long nNewThumbPos = nOldThumbPos + nDelta; if( nNewThumbPos < 0 ) nNewThumbPos = 0; - else if( nNewThumbPos > pBar->GetRangeMax() ) - nNewThumbPos = pBar->GetRangeMax(); + else if( nNewThumbPos > rBar.GetRangeMax() ) + nNewThumbPos = rBar.GetRangeMax(); if ( bHoriz ) { @@ -462,12 +460,12 @@ namespace if ( bVisbile ) { - sal_Int32 nHRangeMax = _pView->GetHScrollBar()->GetRangeMax(); - sal_Int32 nVRangeMax = _pView->GetVScrollBar()->GetRangeMax(); + sal_Int32 nHRangeMax = _pView->GetHScrollBar().GetRangeMax(); + sal_Int32 nVRangeMax = _pView->GetVScrollBar().GetRangeMax(); - if ( aSize.Width() + _pView->GetHScrollBar()->GetThumbPos() + _nScrollX > nHRangeMax ) + if ( aSize.Width() + _pView->GetHScrollBar().GetThumbPos() + _nScrollX > nHRangeMax ) bVisbile = false; - if ( bVisbile && aSize.Height() + _pView->GetVScrollBar()->GetThumbPos() + _nScrollY > nVRangeMax ) + if ( bVisbile && aSize.Height() + _pView->GetVScrollBar().GetThumbPos() + _nScrollY > nVRangeMax ) bVisbile = false; } } @@ -576,10 +574,10 @@ void OJoinTableView::SetDefaultTabWinPosSize( OTableWindow* pTabWin ) aBottom.X() += aNewSize.Width(); aBottom.Y() += aNewSize.Height(); - if(!GetHScrollBar()->GetRange().IsInside(aBottom.X())) - GetHScrollBar()->SetRange( Range(0, aBottom.X()) ); - if(!GetVScrollBar()->GetRange().IsInside(aBottom.Y())) - GetVScrollBar()->SetRange( Range(0, aBottom.Y()) ); + if(!GetHScrollBar().GetRange().IsInside(aBottom.X())) + GetHScrollBar().SetRange( Range(0, aBottom.X()) ); + if(!GetVScrollBar().GetRange().IsInside(aBottom.Y())) + GetVScrollBar().SetRange( Range(0, aBottom.Y()) ); pTabWin->SetPosSizePixel( aNewPos, aNewSize ); } @@ -643,50 +641,50 @@ bool OJoinTableView::ScrollPane( long nDelta, bool bHoriz, bool bPaintScrollBars { if( bHoriz ) { - long nOldThumbPos = GetHScrollBar()->GetThumbPos(); + long nOldThumbPos = GetHScrollBar().GetThumbPos(); long nNewThumbPos = nOldThumbPos + nDelta; if( nNewThumbPos < 0 ) { nNewThumbPos = 0; bRet = false; } - if( nNewThumbPos > GetHScrollBar()->GetRange().Max() ) + if( nNewThumbPos > GetHScrollBar().GetRange().Max() ) { - nNewThumbPos = GetHScrollBar()->GetRange().Max(); + nNewThumbPos = GetHScrollBar().GetRange().Max(); bRet = false; } - GetHScrollBar()->SetThumbPos( nNewThumbPos ); - nDelta = GetHScrollBar()->GetThumbPos() - nOldThumbPos; + GetHScrollBar().SetThumbPos( nNewThumbPos ); + nDelta = GetHScrollBar().GetThumbPos() - nOldThumbPos; } else { - long nOldThumbPos = GetVScrollBar()->GetThumbPos(); + long nOldThumbPos = GetVScrollBar().GetThumbPos(); long nNewThumbPos = nOldThumbPos+nDelta; if( nNewThumbPos < 0 ) { nNewThumbPos = 0; bRet = false; } - if( nNewThumbPos > GetVScrollBar()->GetRange().Max() ) + if( nNewThumbPos > GetVScrollBar().GetRange().Max() ) { - nNewThumbPos = GetVScrollBar()->GetRange().Max(); + nNewThumbPos = GetVScrollBar().GetRange().Max(); bRet = false; } - GetVScrollBar()->SetThumbPos( nNewThumbPos ); - nDelta = GetVScrollBar()->GetThumbPos() - nOldThumbPos; + GetVScrollBar().SetThumbPos( nNewThumbPos ); + nDelta = GetVScrollBar().GetThumbPos() - nOldThumbPos; } } // If ScrollOffset hitting borders, no redrawing. - if( (GetHScrollBar()->GetThumbPos()==m_aScrollOffset.X()) && - (GetVScrollBar()->GetThumbPos()==m_aScrollOffset.Y()) ) + if( (GetHScrollBar().GetThumbPos()==m_aScrollOffset.X()) && + (GetVScrollBar().GetThumbPos()==m_aScrollOffset.Y()) ) return false; // set ScrollOffset anew if (bHoriz) - m_aScrollOffset.X() = GetHScrollBar()->GetThumbPos(); + m_aScrollOffset.X() = GetHScrollBar().GetThumbPos(); else - m_aScrollOffset.Y() = GetVScrollBar()->GetThumbPos(); + m_aScrollOffset.Y() = GetVScrollBar().GetThumbPos(); // move all windows OTableWindow* pTabWin; @@ -749,7 +747,7 @@ void OJoinTableView::Tracking( const TrackingEvent& rTEvt ) if ( ! (pData && pData->HasPosition() && (pData->GetPosition() == aDragWinPos))) { // old logic coordinates - Point ptOldPos = m_pDragWin->GetPosPixel() + Point(GetHScrollBar()->GetThumbPos(), GetVScrollBar()->GetThumbPos()); + Point ptOldPos = m_pDragWin->GetPosPixel() + Point(GetHScrollBar().GetThumbPos(), GetVScrollBar().GetThumbPos()); // new positioning m_pDragWin->SetPosPixel(aDragWinPos); TabWinMoved(m_pDragWin, ptOldPos); @@ -894,9 +892,9 @@ void OJoinTableView::SelectConn(OTableConnection* pConn) SvTreeListEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView(); SvTreeListEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView(); - const ::std::vector* pLines = pConn->GetConnLineList(); - ::std::vector::const_reverse_iterator aIter = pLines->rbegin(); - for(;aIter != pLines->rend();++aIter) + const ::std::vector& rLines = pConn->GetConnLineList(); + ::std::vector::const_reverse_iterator aIter = rLines.rbegin(); + for(;aIter != rLines.rend();++aIter) { if ((*aIter)->IsValid()) { @@ -1077,7 +1075,7 @@ void OJoinTableView::invalidateAndModify(SfxUndoAction *_pAction) void OJoinTableView::TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPosition) { - Point ptThumbPos(GetHScrollBar()->GetThumbPos(), GetVScrollBar()->GetThumbPos()); + Point ptThumbPos(GetHScrollBar().GetThumbPos(), GetVScrollBar().GetThumbPos()); ptWhich->GetData()->SetPosition(ptWhich->GetPosPixel() + ptThumbPos); invalidateAndModify(new OJoinMoveTabWinUndoAct(this, ptOldPosition, ptWhich)); @@ -1150,9 +1148,9 @@ void OJoinTableView::Command(const CommandEvent& rEvt) { if( pSelConnection ) { - const ::std::vector* pLines = pSelConnection->GetConnLineList(); - ::std::vector::const_iterator aIter = ::std::find_if(pLines->begin(),pLines->end(),::std::mem_fun(&OConnectionLine::IsValid)); - if( aIter != pLines->end() ) + const ::std::vector& rLines = pSelConnection->GetConnLineList(); + ::std::vector::const_iterator aIter = ::std::find_if(rLines.begin(), rLines.end(),::std::mem_fun(&OConnectionLine::IsValid)); + if( aIter != rLines.end() ) executePopup((*aIter)->getMidPoint(),pSelConnection); } } @@ -1475,16 +1473,14 @@ void OJoinTableView::HideTabWins() { SetUpdateMode(false); - OTableWindowMap* pTabWins = GetTabWinMap(); - if ( pTabWins ) - { - // working on a copy because the real list will be cleared in inner calls - OTableWindowMap aCopy(*pTabWins); - OTableWindowMap::iterator aIter = aCopy.begin(); - OTableWindowMap::iterator aEnd = aCopy.end(); - for(;aIter != aEnd;++aIter) - RemoveTabWin(aIter->second); - } + OTableWindowMap& rTabWins = GetTabWinMap(); + + // working on a copy because the real list will be cleared in inner calls + OTableWindowMap aCopy(rTabWins); + OTableWindowMap::iterator aIter = aCopy.begin(); + OTableWindowMap::iterator aEnd = aCopy.end(); + for(;aIter != aEnd;++aIter) + RemoveTabWin(aIter->second); m_pView->getController().setModified(sal_True); @@ -1571,10 +1567,10 @@ void OJoinTableView::addConnection(OTableConnection* _pConnection,bool _bAddData if ( _bAddData ) { #if OSL_DEBUG_LEVEL > 0 - TTableConnectionData* pTabConnDataList = m_pView->getController().getTableConnectionData(); - OSL_ENSURE( ::std::find(pTabConnDataList->begin(),pTabConnDataList->end(),_pConnection->GetData()) == pTabConnDataList->end(),"Data already in vector!"); + TTableConnectionData& rTabConnDataList = m_pView->getController().getTableConnectionData(); + OSL_ENSURE( ::std::find(rTabConnDataList.begin(), rTabConnDataList.end(),_pConnection->GetData()) == rTabConnDataList.end(),"Data already in vector!"); #endif - m_pView->getController().getTableConnectionData()->push_back(_pConnection->GetData()); + m_pView->getController().getTableConnectionData().push_back(_pConnection->GetData()); } m_vTableConnection.push_back(_pConnection); _pConnection->RecalcLines(); diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index c515159faaa3..213fc3e4710d 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -339,7 +339,7 @@ namespace bBrace = true; _rJoin = _rJoin.replaceAt(_rJoin.getLength()-1,1,OUString(' ')); } - (_rJoin += C_AND) += BuildJoinCriteria(_xConnection,pData->GetConnLineDataList(),pData); + (_rJoin += C_AND) += BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData); if(bBrace) _rJoin += ")"; _pEntryConn->SetVisited(true); @@ -413,7 +413,7 @@ namespace if ( CROSS_JOIN != pData->GetJoinType() && !pData->isNatural() ) { aErg += " ON "; - aErg += BuildJoinCriteria(_xConnection,pData->GetConnLineDataList(),pData); + aErg += BuildJoinCriteria(_xConnection,&pData->GetConnLineDataList(),pData); } return aErg; @@ -508,9 +508,9 @@ namespace pEntryConn->SetVisited(true); // first search for the "to" window - const ::std::vector* pConnections = pEntryConn->GetParent()->getTableConnections(); - ::std::vector::const_iterator aIter = pConnections->begin(); - ::std::vector::const_iterator aEnd = pConnections->end(); + const ::std::vector& rConnections = pEntryConn->GetParent()->getTableConnections(); + ::std::vector::const_iterator aIter = rConnections.begin(); + ::std::vector::const_iterator aEnd = rConnections.end(); for(;aIter != aEnd;++aIter) { OQueryTableConnection* pNext = static_cast(*aIter); @@ -528,7 +528,7 @@ namespace if(aIter == aEnd) { OQueryTableWindow* pEntryTabFrom = static_cast(pEntryConn->GetSourceWin()); - aIter = pConnections->begin(); + aIter = rConnections.begin(); for(;aIter != aEnd;++aIter) { OQueryTableConnection* pNext = static_cast(*aIter); @@ -636,7 +636,7 @@ namespace const Reference< XDatabaseMetaData > xMetaData = xConnection->getMetaData(); const OUString aQuote = xMetaData->getIdentifierQuoteString(); - OJoinTableView::OTableWindowMap* pTabList = _pView->getTableView()->GetTabWinMap(); + OJoinTableView::OTableWindowMap& rTabList = _pView->getTableView()->GetTabWinMap(); const static OUString sFieldSeparator(", "); const static OUString s_sAs(" AS "); @@ -660,8 +660,8 @@ namespace { // we have to look if we have alias.* here but before we have to check if the column doesn't already exist OTableFieldDescRef aInfo = new OTableFieldDesc(); - OJoinTableView::OTableWindowMap::iterator tableIter = pTabList->begin(); - OJoinTableView::OTableWindowMap::iterator tableEnd = pTabList->end(); + OJoinTableView::OTableWindowMap::iterator tableIter = rTabList.begin(); + OJoinTableView::OTableWindowMap::iterator tableEnd = rTabList.end(); bool bFound = false; for(;!bFound && tableIter != tableEnd ;++tableIter) { @@ -995,7 +995,7 @@ namespace { if(!_rJoinCrit.isEmpty()) _rJoinCrit += C_AND; - _rJoinCrit += BuildJoinCriteria(_xConnection,pEntryConnData->GetConnLineDataList(),pEntryConnData); + _rJoinCrit += BuildJoinCriteria(_xConnection,&pEntryConnData->GetConnLineDataList(),pEntryConnData); } } } @@ -1532,9 +1532,9 @@ namespace OSQLParseNode* pParamNode = pFunction->getChild(pFunction->count()-2); if ( pParamNode && pParamNode->getTokenValue().toChar() == '*' ) { - OJoinTableView::OTableWindowMap* pTabList = _pView->getTableView()->GetTabWinMap(); - OJoinTableView::OTableWindowMap::iterator aIter = pTabList->begin(); - OJoinTableView::OTableWindowMap::iterator aTabEnd = pTabList->end(); + OJoinTableView::OTableWindowMap& rTabList = _pView->getTableView()->GetTabWinMap(); + OJoinTableView::OTableWindowMap::iterator aIter = rTabList.begin(); + OJoinTableView::OTableWindowMap::iterator aTabEnd = rTabList.end(); for(;aIter != aTabEnd;++aIter) { OQueryTableWindow* pTabWin = static_cast(aIter->second); @@ -1606,9 +1606,9 @@ namespace true)); if ( pConn ) { - OConnectionLineDataVec* pLineDataList = pConn->GetData()->GetConnLineDataList(); - OConnectionLineDataVec::iterator aIter = pLineDataList->begin(); - OConnectionLineDataVec::iterator aEnd = pLineDataList->end(); + OConnectionLineDataVec& rLineDataList = pConn->GetData()->GetConnLineDataList(); + OConnectionLineDataVec::iterator aIter = rLineDataList.begin(); + OConnectionLineDataVec::iterator aEnd = rLineDataList.end(); for(;aIter != aEnd;++aIter) { if((*aIter)->GetSourceFieldName() == aDragLeft->GetField() || @@ -2022,7 +2022,7 @@ namespace } // now delete the data for which we haven't any tablewindow - OJoinTableView::OTableWindowMap aTableMap(*pTableView->GetTabWinMap()); + OJoinTableView::OTableWindowMap aTableMap(pTableView->GetTabWinMap()); OJoinTableView::OTableWindowMap::iterator aIterTableMap = aTableMap.begin(); OJoinTableView::OTableWindowMap::iterator aIterTableEnd = aTableMap.end(); for(;aIterTableMap != aIterTableEnd;++aIterTableMap) @@ -2056,7 +2056,7 @@ namespace rController.setLimit(-1); } - if ( (eErrorCode = InstallFields(_pView,pParseTree, pTableView->GetTabWinMap())) == eOk ) + if ( (eErrorCode = InstallFields(_pView, pParseTree, &pTableView->GetTabWinMap())) == eOk ) { // GetSelectionCriteria must be called before GetHavingCriteria sal_uInt16 nLevel=0; @@ -2735,11 +2735,11 @@ void OQueryDesignView::fillValidFields(const OUString& sAliasName, ComboBox* pFi bool bAllTables = sAliasName.isEmpty(); - OJoinTableView::OTableWindowMap* pTabWins = m_pTableView->GetTabWinMap(); + OJoinTableView::OTableWindowMap& rTabWins = m_pTableView->GetTabWinMap(); OUString strCurrentPrefix; ::std::vector< OUString> aFields; - OJoinTableView::OTableWindowMap::iterator aIter = pTabWins->begin(); - OJoinTableView::OTableWindowMap::iterator aEnd = pTabWins->end(); + OJoinTableView::OTableWindowMap::iterator aIter = rTabWins.begin(); + OJoinTableView::OTableWindowMap::iterator aEnd = rTabWins.end(); for(;aIter != aEnd;++aIter) { OQueryTableWindow* pCurrentWin = static_cast(aIter->second); @@ -2831,8 +2831,8 @@ OUString OQueryDesignView::getStatement() return OUString(); } - OQueryTableView::OTableWindowMap* pTabList = m_pTableView->GetTabWinMap(); - sal_uInt32 nTabcount = pTabList->size(); + OQueryTableView::OTableWindowMap& rTabList = m_pTableView->GetTabWinMap(); + sal_uInt32 nTabcount = rTabList.size(); OUString aFieldListStr(GenerateSelectList(this,rFieldList,nTabcount>1)); if( aFieldListStr.isEmpty() ) @@ -2844,9 +2844,9 @@ OUString OQueryDesignView::getStatement() // and trigger a error message // ----------------- Build table list ---------------------- - const ::std::vector* pConnList = m_pTableView->getTableConnections(); + const ::std::vector& rConnList = m_pTableView->getTableConnections(); Reference< XConnection> xConnection = rController.getConnection(); - OUString aTableListStr(GenerateFromClause(xConnection,pTabList,pConnList)); + OUString aTableListStr(GenerateFromClause(xConnection,&rTabList,&rConnList)); OSL_ENSURE(!aTableListStr.isEmpty(), "OQueryDesignView::getStatement() : unexpected : have Fields, but no Tables !"); // if fields exist now, these only can be created by inserting from an already existing table; if on the other hand // a table is deleted, also the belonging fields will be deleted -> therefore it CANNOT occur that fields @@ -2858,7 +2858,7 @@ OUString OQueryDesignView::getStatement() return OUString(); OUString aJoinCrit; - GenerateInnerJoinCriterias(xConnection,aJoinCrit,pConnList); + GenerateInnerJoinCriterias(xConnection,aJoinCrit,&rConnList); if(!aJoinCrit.isEmpty()) { OUString aTmp = "( " + aJoinCrit + " )"; @@ -2990,7 +2990,7 @@ bool OQueryDesignView::isSlotEnabled(sal_Int32 _nSlotId) void OQueryDesignView::SaveUIConfig() { OQueryController& rCtrl = static_cast(getController()); - rCtrl.SaveTabWinsPosSize( m_pTableView->GetTabWinMap(), m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos() ); + rCtrl.SaveTabWinsPosSize( &m_pTableView->GetTabWinMap(), m_pScrollWindow->GetHScrollBar().GetThumbPos(), m_pScrollWindow->GetVScrollBar().GetThumbPos() ); rCtrl.setVisibleRows( m_pSelectionBox->GetNoneVisibleRows() ); if ( m_aSplitter.GetSplitPosPixel() != 0 ) rCtrl.setSplitPos( m_aSplitter.GetSplitPosPixel() ); diff --git a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx index 7b0eaed7aff9..e7a0a59a4efe 100644 --- a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx +++ b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx @@ -23,7 +23,7 @@ using namespace dbaui; void OJoinMoveTabWinUndoAct::TogglePosition() { - Point ptFrameScrollPos(m_pOwner->GetHScrollBar()->GetThumbPos(), m_pOwner->GetVScrollBar()->GetThumbPos()); + Point ptFrameScrollPos(m_pOwner->GetHScrollBar().GetThumbPos(), m_pOwner->GetVScrollBar().GetThumbPos()); Point ptNext = m_pTabWin->GetPosPixel() + ptFrameScrollPos; m_pTabWin->SetPosPixel(m_ptNextPosition - ptFrameScrollPos); diff --git a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx index 33df8ffb49c2..22c9921330a6 100644 --- a/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx +++ b/dbaccess/source/ui/querydesign/QueryTabWinUndoAct.hxx @@ -54,7 +54,7 @@ namespace dbaui // access to the managed connections sal_uInt16 ConnCount() { return (sal_uInt16)m_vTableConnection.size(); } - ::std::vector* GetTabConnList() { return &m_vTableConnection; } + ::std::vector& GetTabConnList() { return m_vTableConnection; } void InsertConnection( OTableConnection* pConnection ) { m_vTableConnection.push_back(pConnection); } void RemoveConnection( OTableConnection* pConnection ) diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index 68b05500691d..4626706c5cc5 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -118,7 +118,7 @@ namespace { OQueryTableConnectionData* pData = static_cast< OQueryTableConnectionData*>(_pConnectionData.get()); - DlgQryJoin aDlg(_pView,_pConnectionData,_pView->GetTabWinMap(),_pView->getDesignView()->getController().getConnection(),_bSelectableTables); + DlgQryJoin aDlg(_pView,_pConnectionData,&_pView->GetTabWinMap(),_pView->getDesignView()->getController().getConnection(),_bSelectableTables); bool bOk = aDlg.Execute() == RET_OK; if( bOk ) { @@ -236,11 +236,11 @@ sal_Int32 OQueryTableView::CountTableAlias(const OUString& rName, sal_Int32& rMa { sal_Int32 nRet = 0; - OTableWindowMap::iterator aIter = GetTabWinMap()->find(rName); - while(aIter != GetTabWinMap()->end()) + OTableWindowMap::iterator aIter = GetTabWinMap().find(rName); + while(aIter != GetTabWinMap().end()) { - OUString aNewName = OUString(rName) + "_" + OUString::number(++nRet); - aIter = GetTabWinMap()->find(aNewName); + OUString aNewName = rName + "_" + OUString::number(++nRet); + aIter = GetTabWinMap().find(aNewName); } rMax = nRet; @@ -250,17 +250,17 @@ sal_Int32 OQueryTableView::CountTableAlias(const OUString& rName, sal_Int32& rMa void OQueryTableView::ReSync() { - TTableWindowData* pTabWinDataList = m_pView->getController().getTableWindowData(); - OSL_ENSURE((getTableConnections()->size()==0) && (GetTabWinMap()->size()==0), + TTableWindowData& rTabWinDataList = m_pView->getController().getTableWindowData(); + OSL_ENSURE((getTableConnections().size()==0) && (GetTabWinMap().size()==0), "before calling OQueryTableView::ReSync() please call ClearAll !"); // I need a collection of all window names that cannot be created so that I do not initialize connections for them. ::std::vector arrInvalidTables; - TTableWindowData::reverse_iterator aIter = pTabWinDataList->rbegin(); + TTableWindowData::reverse_iterator aIter = rTabWinDataList.rbegin(); // Create the window and add it - for(;aIter != pTabWinDataList->rend();++aIter) + for(;aIter != rTabWinDataList.rend();++aIter) { OQueryTableWindowData* pData = static_cast(aIter->get()); OTableWindow* pTabWin = createWindow(*aIter); @@ -276,11 +276,11 @@ void OQueryTableView::ReSync() delete pTabWin; arrInvalidTables.push_back(pData->GetAliasName()); - pTabWinDataList->erase( ::std::remove(pTabWinDataList->begin(),pTabWinDataList->end(),*aIter) ,pTabWinDataList->end()); + rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end()); continue; } - (*GetTabWinMap())[pData->GetAliasName()] = pTabWin; // add at the beginning as I am going backwards through the DataList + GetTabWinMap()[pData->GetAliasName()] = pTabWin; // add at the beginning as I am going backwards through the DataList // Use the default if there is no position or size if (!pData->HasPosition() && !pData->HasSize()) SetDefaultTabWinPosSize(pTabWin); @@ -289,10 +289,10 @@ void OQueryTableView::ReSync() } // Add the connections - TTableConnectionData* pTabConnDataList = m_pView->getController().getTableConnectionData(); - TTableConnectionData::reverse_iterator aConIter = pTabConnDataList->rbegin(); + TTableConnectionData& rTabConnDataList = m_pView->getController().getTableConnectionData(); + TTableConnectionData::reverse_iterator aConIter = rTabConnDataList.rbegin(); - for(;aConIter != pTabConnDataList->rend();++aConIter) + for(;aConIter != rTabConnDataList.rend();++aConIter) { OQueryTableConnectionData* pTabConnData = static_cast(aConIter->get()); @@ -305,7 +305,7 @@ void OQueryTableView::ReSync() if (bInvalid) { // no -> bad luck, no connection - pTabConnDataList->erase( ::std::remove(pTabConnDataList->begin(),pTabConnDataList->end(),*aConIter) ,pTabConnDataList->end()); + rTabConnDataList.erase( ::std::remove(rTabConnDataList.begin(), rTabConnDataList.end(), *aConIter), rTabConnDataList.end()); continue; } @@ -331,15 +331,15 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn, { // let's first check if I have the connection already OQueryTableConnection* pTabConn = NULL; - const ::std::vector* pConnections = getTableConnections(); - ::std::vector::const_iterator aEnd = pConnections->end(); - ::std::vector::const_iterator aIter = ::std::find( pConnections->begin(), + const ::std::vector& rConnections = getTableConnections(); + ::std::vector::const_iterator aEnd = rConnections.end(); + ::std::vector::const_iterator aIter = ::std::find( rConnections.begin(), aEnd, static_cast(&rNewConn) ); if(aIter == aEnd ) { - aIter = pConnections->begin(); + aIter = rConnections.begin(); for(;aIter != aEnd;++aIter) { if(*static_cast(*aIter) == rNewConn) @@ -445,9 +445,9 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& // first check if this already has its data bool bAppend = bNewTable; TTableWindowData::value_type pNewTabWinData; - TTableWindowData* pWindowData = getDesignView()->getController().getTableWindowData(); - TTableWindowData::iterator aWinIter = pWindowData->begin(); - TTableWindowData::iterator aWinEnd = pWindowData->end(); + TTableWindowData& rWindowData = getDesignView()->getController().getTableWindowData(); + TTableWindowData::iterator aWinIter = rWindowData.begin(); + TTableWindowData::iterator aWinEnd = rWindowData.end(); for(;aWinIter != aWinEnd;++aWinIter) { pNewTabWinData = *aWinIter; @@ -479,8 +479,8 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& } // Show the relations between the individual tables - OTableWindowMap* pTabWins = GetTabWinMap(); - if(bNewTable && !pTabWins->empty() && !_rTableName.isEmpty()) + OTableWindowMap& rTabWins = GetTabWinMap(); + if(bNewTable && !rTabWins.empty() && !_rTableName.isEmpty()) { modified(); if ( m_pAccessible ) @@ -523,11 +523,11 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& xProp->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= aReferencedTable; OSL_ENSURE(!aReferencedTable.isEmpty(),"Foreign key without referencedTableName"); - OTableWindowMap::const_iterator aIter = pTabWins->find(aReferencedTable); - OTableWindowMap::const_iterator aEnd = pTabWins->end(); + OTableWindowMap::const_iterator aIter = rTabWins.find(aReferencedTable); + OTableWindowMap::const_iterator aEnd = rTabWins.end(); if(aIter == aEnd) { - for(aIter = pTabWins->begin();aIter != aEnd;++aIter) + for(aIter = rTabWins.begin();aIter != aEnd;++aIter) { OQueryTableWindow* pTabWinTmp = static_cast(aIter->second); OSL_ENSURE( pTabWinTmp,"TableWindow is null!" ); @@ -543,8 +543,8 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString& case KeyType::PRIMARY: { // we have a primary key so look in our list if there exists a key which this is referred to - OTableWindowMap::const_iterator aIter = pTabWins->begin(); - OTableWindowMap::const_iterator aEnd = pTabWins->end(); + OTableWindowMap::const_iterator aIter = rTabWins.begin(); + OTableWindowMap::const_iterator aEnd = rTabWins.end(); for(;aIter != aEnd;++aIter) { OQueryTableWindow* pTabWinTmp = static_cast(aIter->second); @@ -659,9 +659,9 @@ void OQueryTableView::createNewConnection() TTableConnectionData::value_type pData(new OQueryTableConnectionData()); if( openJoinDialog(this,pData,true) ) { - OTableWindowMap* pMap = GetTabWinMap(); - OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>((*pMap)[pData->getReferencingTable()->GetWinName()]); - OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>((*pMap)[pData->getReferencedTable()->GetWinName()]); + OTableWindowMap& rMap = GetTabWinMap(); + OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencingTable()->GetWinName()]); + OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(rMap[pData->getReferencedTable()->GetWinName()]); // first we have to look if the this connection already exists OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin,true); bool bNew = true; @@ -706,8 +706,8 @@ OQueryTableWindow* OQueryTableView::FindTable(const OUString& rAliasName) { OSL_ENSURE(!rAliasName.isEmpty(), "OQueryTableView::FindTable : the AliasName should not be empty !"); // (it is harmless but does not make sense and indicates that there is probably an error in the caller) - OTableWindowMap::const_iterator aIter = GetTabWinMap()->find(rAliasName); - if(aIter != GetTabWinMap()->end()) + OTableWindowMap::const_iterator aIter = GetTabWinMap().find(rAliasName); + if(aIter != GetTabWinMap().end()) return static_cast(aIter->second); return NULL; } @@ -715,8 +715,8 @@ OQueryTableWindow* OQueryTableView::FindTable(const OUString& rAliasName) bool OQueryTableView::FindTableFromField(const OUString& rFieldName, OTableFieldDescRef& rInfo, sal_uInt16& rCnt) { rCnt = 0; - OTableWindowMap::const_iterator aIter = GetTabWinMap()->begin(); - OTableWindowMap::const_iterator aEnd = GetTabWinMap()->end(); + OTableWindowMap::const_iterator aIter = GetTabWinMap().begin(); + OTableWindowMap::const_iterator aEnd = GetTabWinMap().end(); for(;aIter != aEnd;++aIter) { if(static_cast(aIter->second)->ExistsField(rFieldName, rInfo)) @@ -728,11 +728,10 @@ bool OQueryTableView::FindTableFromField(const OUString& rFieldName, OTableField bool OQueryTableView::ContainsTabWin(const OTableWindow& rTabWin) { - OTableWindowMap* pTabWins = GetTabWinMap(); - OSL_ENSURE(pTabWins != NULL, "OQueryTableView::RemoveTabWin : Window should not be NULL !"); + OTableWindowMap& rTabWins = GetTabWinMap(); - OTableWindowMap::iterator aIter = pTabWins->begin(); - OTableWindowMap::iterator aEnd = pTabWins->end(); + OTableWindowMap::iterator aIter = rTabWins.begin(); + OTableWindowMap::iterator aEnd = rTabWins.end(); for ( ;aIter != aEnd ; ++aIter ) { @@ -808,74 +807,70 @@ void OQueryTableView::DropConnection(OQueryTableConnection* pConn) void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction ) { - OTableWindowMap* pTabWins = GetTabWinMap(); - OSL_ENSURE(pTabWins != NULL, "OQueryTableView::HideTabWin : have no TabWins !"); - - if (pTabWin) - { - // Window - // save the position in its data - getDesignView()->SaveTabWinUIConfig(pTabWin); - // (I need to go via the parent, as only the parent knows the position of the scrollbars) - // and then out of the TabWins list and hide - OTableWindowMap::iterator aIter = pTabWins->begin(); - OTableWindowMap::iterator aEnd = pTabWins->end(); - for ( ;aIter != aEnd ; ++aIter ) - if ( aIter->second == pTabWin ) - { - pTabWins->erase( aIter ); - break; - } + OTableWindowMap& rTabWins = GetTabWinMap(); + + // Window + // save the position in its data + getDesignView()->SaveTabWinUIConfig(pTabWin); + // (I need to go via the parent, as only the parent knows the position of the scrollbars) + // and then out of the TabWins list and hide + OTableWindowMap::iterator aIter = rTabWins.begin(); + OTableWindowMap::iterator aEnd = rTabWins.end(); + for ( ;aIter != aEnd ; ++aIter ) + if ( aIter->second == pTabWin ) + { + rTabWins.erase( aIter ); + break; + } - pTabWin->Hide(); // do not destroy it, as it is still in the undo list!! + pTabWin->Hide(); // do not destroy it, as it is still in the undo list!! - // the TabWin data must also be passed out of my responsibility - TTableWindowData* pTabWinDataList = m_pView->getController().getTableWindowData(); - pTabWinDataList->erase( ::std::remove(pTabWinDataList->begin(),pTabWinDataList->end(),pTabWin->GetData()),pTabWinDataList->end()); - // The data should not be destroyed as TabWin itself - which is still alive - needs them - // Either it goes back into my responsibility, (via ShowTabWin), then I add the data back, - // or the Undo-Action, which currently has full responsibility for the window - // and its data, gets destroyed and destroys both the window and its data + // the TabWin data must also be passed out of my responsibility + TTableWindowData& rTabWinDataList = m_pView->getController().getTableWindowData(); + rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), pTabWin->GetData()), rTabWinDataList.end()); + // The data should not be destroyed as TabWin itself - which is still alive - needs them + // Either it goes back into my responsibility, (via ShowTabWin), then I add the data back, + // or the Undo-Action, which currently has full responsibility for the window + // and its data, gets destroyed and destroys both the window and its data - if (m_pLastFocusTabWin == pTabWin) - m_pLastFocusTabWin = NULL; + if (m_pLastFocusTabWin == pTabWin) + m_pLastFocusTabWin = NULL; - // collect connections belonging to the window and pass to UndoAction - sal_Int16 nCnt = 0; - const ::std::vector* pTabConList = getTableConnections(); - ::std::vector::const_iterator aIter2 = pTabConList->begin(); - for(;aIter2 != pTabConList->end();)// the end may change + // collect connections belonging to the window and pass to UndoAction + sal_Int16 nCnt = 0; + const ::std::vector& rTabConList = getTableConnections(); + ::std::vector::const_iterator aIter2 = rTabConList.begin(); + for(;aIter2 != rTabConList.end();)// the end may change + { + OQueryTableConnection* pTmpEntry = static_cast(*aIter2); + OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!"); + if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() || + pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() ) { - OQueryTableConnection* pTmpEntry = static_cast(*aIter2); - OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!"); - if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() || - pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() ) - { - // add to undo list - pUndoAction->InsertConnection(pTmpEntry); - - // call base class because we append an undo action - // but this time we are in a undo action list - OJoinTableView::RemoveConnection(pTmpEntry,sal_False); - aIter2 = pTabConList->begin(); - ++nCnt; - } - else - ++aIter2; + // add to undo list + pUndoAction->InsertConnection(pTmpEntry); + + // call base class because we append an undo action + // but this time we are in a undo action list + OJoinTableView::RemoveConnection(pTmpEntry,sal_False); + aIter2 = rTabConList.begin(); + ++nCnt; } + else + ++aIter2; + } - if (nCnt) - InvalidateConnections(); + if (nCnt) + InvalidateConnections(); - m_pView->getController().InvalidateFeature(ID_BROWSER_ADDTABLE); + m_pView->getController().InvalidateFeature(ID_BROWSER_ADDTABLE); - // inform the UndoAction that the window and connections belong to it - pUndoAction->SetOwnership(true); + // inform the UndoAction that the window and connections belong to it + pUndoAction->SetOwnership(true); - // by doing so, we have modified the document - m_pView->getController().setModified( sal_True ); - m_pView->getController().InvalidateFeature(SID_BROWSER_CLEAR_QUERY); - } + // by doing so, we have modified the document + m_pView->getController().setModified( sal_True ); + m_pView->getController().InvalidateFeature(SID_BROWSER_CLEAR_QUERY); } bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction, bool _bAppend ) @@ -901,8 +896,8 @@ bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc // Show the window and add to the list OUString sName = static_cast< OQueryTableWindowData*>(pData.get())->GetAliasName(); - OSL_ENSURE(GetTabWinMap()->find(sName) == GetTabWinMap()->end(),"Alias name already in list!"); - GetTabWinMap()->insert(OTableWindowMap::value_type(sName,pTabWin)); + OSL_ENSURE(GetTabWinMap().find(sName) == GetTabWinMap().end(),"Alias name already in list!"); + GetTabWinMap().insert(OTableWindowMap::value_type(sName,pTabWin)); pTabWin->Show(); @@ -913,18 +908,18 @@ bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAc // GetEntryPos, and then in turn by the Connection, when its starting point to the window must be determined. // the Connections - ::std::vector* pTableCon = pUndoAction->GetTabConnList(); - ::std::vector::iterator aIter = pTableCon->begin(); - ::std::vector::iterator aEnd = pTableCon->end(); + ::std::vector& rTableCon = pUndoAction->GetTabConnList(); + ::std::vector::iterator aIter = rTableCon.begin(); + ::std::vector::iterator aEnd = rTableCon.end(); for(;aIter != aEnd;++aIter) addConnection(*aIter); // add all connections from the undo action - pTableCon->clear(); + rTableCon.clear(); // and add the window's data to the list (of the document) if(_bAppend) - m_pView->getController().getTableWindowData()->push_back(pTabWin->GetData()); + m_pView->getController().getTableWindowData().push_back(pTabWin->GetData()); m_pView->getController().InvalidateFeature(ID_BROWSER_ADDTABLE); @@ -959,18 +954,15 @@ void OQueryTableView::InsertField(const OTableFieldDescRef& rInfo) bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) const { - const ::std::vector* pList = getTableConnections(); - if (pList) + const ::std::vector& rList = getTableConnections(); + ::std::vector::const_iterator aIter = rList.begin(); + ::std::vector::const_iterator aEnd = rList.end(); + for(;aIter != aEnd;++aIter) { - ::std::vector::const_iterator aIter = pList->begin(); - ::std::vector::const_iterator aEnd = pList->end(); - for(;aIter != aEnd;++aIter) - { - OQueryTableConnection* pTemp = static_cast(*aIter); - if (pTemp->IsVisited() && - (pFrom == static_cast< OQueryTableWindow*>(pTemp->GetSourceWin()) || pFrom == static_cast< OQueryTableWindow*>(pTemp->GetDestWin()))) - return true; - } + OQueryTableConnection* pTemp = static_cast(*aIter); + if (pTemp->IsVisited() && + (pFrom == static_cast< OQueryTableWindow*>(pTemp->GetSourceWin()) || pFrom == static_cast< OQueryTableWindow*>(pTemp->GetDestWin()))) + return true; } return false; diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 5d76c2110925..195af536eabd 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -488,21 +488,18 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon enableControl(pEntry,m_pTableCell); if ( !pEntry->isCondition() ) { - OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); - if (pTabWinList) - { - OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin(); - OJoinTableView::OTableWindowMap::iterator aEnd = pTabWinList->end(); + OJoinTableView::OTableWindowMap& rTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.begin(); + OJoinTableView::OTableWindowMap::iterator aEnd = rTabWinList.end(); - for(;aIter != aEnd;++aIter) - m_pTableCell->InsertEntry(static_cast(aIter->second)->GetAliasName()); + for(;aIter != aEnd;++aIter) + m_pTableCell->InsertEntry(static_cast(aIter->second)->GetAliasName()); - m_pTableCell->InsertEntry(OUString(ModuleRes(STR_QUERY_NOTABLE)), 0); - if (!pEntry->GetAlias().isEmpty()) - m_pTableCell->SelectEntry(pEntry->GetAlias()); - else - m_pTableCell->SelectEntry(OUString(ModuleRes(STR_QUERY_NOTABLE))); - } + m_pTableCell->InsertEntry(OUString(ModuleRes(STR_QUERY_NOTABLE)), 0); + if (!pEntry->GetAlias().isEmpty()) + m_pTableCell->SelectEntry(pEntry->GetAlias()); + else + m_pTableCell->SelectEntry(OUString(ModuleRes(STR_QUERY_NOTABLE))); } } break; case BROW_VIS_ROW: @@ -607,22 +604,18 @@ bool OSelectionBrowseBox::fillColumnRef(const OUString& _sColumnName, const OUSt OQueryTableWindow* pEntryTab = static_cast(_pEntry->GetTabWindow()); if ( !pEntryTab ) // no table found with this name so we have to travel through all tables { - OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); - if ( pTabWinList ) + sal_uInt16 nTabCount = 0; + if ( !static_cast(getDesignView()->getTableView())->FindTableFromField(_sColumnName,_pEntry,nTabCount) ) // error occurred: column not in table window { - sal_uInt16 nTabCount = 0; - if ( !static_cast(getDesignView()->getTableView())->FindTableFromField(_sColumnName,_pEntry,nTabCount) ) // error occurred: column not in table window - { - OUString sErrorMsg(ModuleRes(RID_STR_FIELD_DOESNT_EXIST)); - sErrorMsg = sErrorMsg.replaceFirst("$name$",_sColumnName); - OSQLErrorBox( this, sErrorMsg ).Execute(); - bError = true; - } - else - { - pEntryTab = static_cast(_pEntry->GetTabWindow()); - notifyTableFieldChanged(OUString(),_pEntry->GetAlias(),_bListAction,GetCurColumnId()); - } + OUString sErrorMsg(ModuleRes(RID_STR_FIELD_DOESNT_EXIST)); + sErrorMsg = sErrorMsg.replaceFirst("$name$",_sColumnName); + OSQLErrorBox( this, sErrorMsg ).Execute(); + bError = true; + } + else + { + pEntryTab = static_cast(_pEntry->GetTabWindow()); + notifyTableFieldChanged(OUString(),_pEntry->GetAlias(),_bListAction,GetCurColumnId()); } } if ( pEntryTab ) // here we got a valid table @@ -991,18 +984,15 @@ bool OSelectionBrowseBox::SaveModified() { pEntry->SetAlias(aAliasName); // we have to set the table name as well as the table window - OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); - if (pTabWinList) + OJoinTableView::OTableWindowMap& rTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.find(aAliasName); + if(aIter != rTabWinList.end()) { - OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->find(aAliasName); - if(aIter != pTabWinList->end()) + OQueryTableWindow* pEntryTab = static_cast(aIter->second); + if (pEntryTab) { - OQueryTableWindow* pEntryTab = static_cast(aIter->second); - if (pEntryTab) - { - pEntry->SetTable(pEntryTab->GetTableName()); - pEntry->SetTabWindow(pEntryTab); - } + pEntry->SetTable(pEntryTab->GetTableName()); + pEntry->SetTabWindow(pEntryTab); } } } @@ -2618,19 +2608,16 @@ OUString OSelectionBrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBo bool OSelectionBrowseBox::fillEntryTable(OTableFieldDescRef& _pEntry,const OUString& _sTableName) { bool bRet = false; - OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); - if (pTabWinList) + OJoinTableView::OTableWindowMap& rTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + OJoinTableView::OTableWindowMap::iterator aIter = rTabWinList.find(_sTableName); + if(aIter != rTabWinList.end()) { - OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->find(_sTableName); - if(aIter != pTabWinList->end()) + OQueryTableWindow* pEntryTab = static_cast(aIter->second); + if (pEntryTab) { - OQueryTableWindow* pEntryTab = static_cast(aIter->second); - if (pEntryTab) - { - _pEntry->SetTable(pEntryTab->GetTableName()); - _pEntry->SetTabWindow(pEntryTab); - bRet = true; - } + _pEntry->SetTable(pEntryTab->GetTableName()); + _pEntry->SetTabWindow(pEntryTab); + bRet = true; } } return bRet; diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx index 9ced392a9e0e..6d7864e06db7 100644 --- a/dbaccess/source/ui/querydesign/TableConnection.cxx +++ b/dbaccess/source/ui/querydesign/TableConnection.cxx @@ -53,10 +53,10 @@ namespace dbaui void OTableConnection::Init() { // initialise linelist with defaults - OConnectionLineDataVec* pLineData = GetData()->GetConnLineDataList(); - OConnectionLineDataVec::const_iterator aIter = pLineData->begin(); - OConnectionLineDataVec::const_iterator aEnd = pLineData->end(); - m_vConnLine.reserve(pLineData->size()); + OConnectionLineDataVec& rLineData = GetData()->GetConnLineDataList(); + OConnectionLineDataVec::const_iterator aIter = rLineData.begin(); + OConnectionLineDataVec::const_iterator aEnd = rLineData.end(); + m_vConnLine.reserve(rLineData.size()); for(;aIter != aEnd;++aIter) m_vConnLine.push_back( new OConnectionLine(this, *aIter) ); } @@ -89,12 +89,12 @@ namespace dbaui clearLineData(); // copy linelist - if(! rConn.GetConnLineList()->empty() ) + if(! rConn.GetConnLineList().empty() ) { - const ::std::vector* pLine = rConn.GetConnLineList(); - ::std::vector::const_iterator aIter = pLine->begin(); - ::std::vector::const_iterator aEnd = pLine->end(); - m_vConnLine.reserve(pLine->size()); + const ::std::vector& rLine = rConn.GetConnLineList(); + ::std::vector::const_iterator aIter = rLine.begin(); + ::std::vector::const_iterator aEnd = rLine.end(); + m_vConnLine.reserve(rLine.size()); for(;aIter != aEnd;++aIter) m_vConnLine.push_back( CreateConnLine( **aIter )); } diff --git a/dbaccess/source/ui/querydesign/TableConnectionData.cxx b/dbaccess/source/ui/querydesign/TableConnectionData.cxx index fe9a3a8e040f..43fc4eed8880 100644 --- a/dbaccess/source/ui/querydesign/TableConnectionData.cxx +++ b/dbaccess/source/ui/querydesign/TableConnectionData.cxx @@ -77,10 +77,10 @@ OTableConnectionData& OTableConnectionData::operator=( const OTableConnectionDat ResetConnLines(); // and copy - OConnectionLineDataVec* pLineData = const_cast(&rConnData)->GetConnLineDataList(); + const OConnectionLineDataVec& rLineData = rConnData.GetConnLineDataList(); - OConnectionLineDataVec::const_iterator aIter = pLineData->begin(); - OConnectionLineDataVec::const_iterator aEnd = pLineData->end(); + OConnectionLineDataVec::const_iterator aIter = rLineData.begin(); + OConnectionLineDataVec::const_iterator aEnd = rLineData.end(); for(;aIter != aEnd;++aIter) m_vConnLineData.push_back(new OConnectionLineData(**aIter)); diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx index 0585bdb52a04..f4ed8116345f 100644 --- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx @@ -95,8 +95,7 @@ namespace dbaui sal_Int32 nCount = 0; if(m_pTable) { - if(m_pTable->GetTitleCtrl()) - ++nCount; + ++nCount; if(m_pTable->GetListBox()) ++nCount; } @@ -111,14 +110,10 @@ namespace dbaui switch(i) { case 0: - if(m_pTable->GetTitleCtrl()) - { - aRet = m_pTable->GetTitleCtrl()->GetAccessible(); - break; - } // fall through if title control does not exist + aRet = m_pTable->GetTitleCtrl().GetAccessible(); + break; case 1: - if(m_pTable->GetListBox()) - aRet = m_pTable->GetListBox()->GetAccessible(); + aRet = m_pTable->GetListBox()->GetAccessible(); break; default: throw IndexOutOfBoundsException(); @@ -133,9 +128,9 @@ namespace dbaui if( m_pTable ) { // search the position of our table window in the table window map - OJoinTableView::OTableWindowMap* pMap = m_pTable->getTableView()->GetTabWinMap(); - OJoinTableView::OTableWindowMap::iterator aIter = pMap->begin(); - OJoinTableView::OTableWindowMap::iterator aEnd = pMap->end(); + OJoinTableView::OTableWindowMap& rMap = m_pTable->getTableView()->GetTabWinMap(); + OJoinTableView::OTableWindowMap::iterator aIter = rMap.begin(); + OJoinTableView::OTableWindowMap::iterator aEnd = rMap.end(); for (nIndex = 0; aIter != aEnd && aIter->second != m_pTable; ++nIndex,++aIter) ; nIndex = aIter != aEnd ? nIndex : -1; @@ -199,7 +194,7 @@ namespace dbaui OJoinTableView* pView = m_pTable->getTableView(); ::std::vector::const_iterator aIter = pView->getTableConnections(m_pTable) + nIndex; aRet.TargetSet.realloc(1); - aRet.TargetSet[0] = getParentChild(aIter - pView->getTableConnections()->begin()); + aRet.TargetSet[0] = getParentChild(aIter - pView->getTableConnections().begin()); aRet.RelationType = AccessibleRelationType::CONTROLLER_FOR; } return aRet; @@ -216,16 +211,16 @@ namespace dbaui if( AccessibleRelationType::CONTROLLER_FOR == aRelationType && m_pTable) { OJoinTableView* pView = m_pTable->getTableView(); - const ::std::vector* pConnectionList = pView->getTableConnections(); + const ::std::vector& rConnectionList = pView->getTableConnections(); ::std::vector::const_iterator aIter = pView->getTableConnections(m_pTable); - ::std::vector::const_iterator aEnd = pConnectionList->end(); + ::std::vector::const_iterator aEnd = rConnectionList.end(); ::std::vector< Reference > aRelations; aRelations.reserve(5); // just guessing for (; aIter != aEnd ; ++aIter ) { uno::Reference xInterface( - getParentChild(aIter - pConnectionList->begin())); + getParentChild(aIter - rConnectionList.begin())); aRelations.push_back(xInterface); } diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx index 207f2fe484e8..46e25c03c209 100644 --- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx @@ -130,9 +130,9 @@ void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt ) OJoinTableView* pView = static_cast(m_pTabWin->getTableView()); OSL_ENSURE(pView,"No OJoinTableView!"); - const ::std::vector* pConns = pView->getTableConnections(); - ::std::for_each(pConns->begin(), - pConns->end(), + const ::std::vector& rConns = pView->getTableConnections(); + ::std::for_each(rConns.begin(), + rConns.end(), ::std::mem_fun(&OTableConnection::RecalcLines)); pView->InvalidateConnections(); diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx index c05f561c2515..03a9b56c8826 100644 --- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx +++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx @@ -65,9 +65,9 @@ void ORelationTableConnection::Draw( const Rectangle& rRect ) long nTemp; const OConnectionLine* pTopLine = NULL; - const ::std::vector* pConnLineList = GetConnLineList(); - ::std::vector::const_iterator aIter = pConnLineList->begin(); - ::std::vector::const_iterator aEnd = pConnLineList->end(); + const ::std::vector& rConnLineList = GetConnLineList(); + ::std::vector::const_iterator aIter = rConnLineList.begin(); + ::std::vector::const_iterator aEnd = rConnLineList.end(); for(;aIter != aEnd;++aIter) { if( (*aIter)->IsValid() ) diff --git a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx index 469f4e27b3d9..02a826e88dd5 100644 --- a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx +++ b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx @@ -87,7 +87,7 @@ bool ORelationDesignView::PreNotify( NotifyEvent& rNEvt ) void ORelationDesignView::GetFocus() { OJoinDesignView::GetFocus(); - if ( m_pTableView && m_pTableView->IsVisible() && !m_pTableView->GetTabWinMap()->empty() ) + if ( m_pTableView && m_pTableView->IsVisible() && !m_pTableView->GetTabWinMap().empty() ) m_pTableView->GrabTabWinFocus(); } diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx index 477e9e9dbcef..e54dcc6add61 100644 --- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx +++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx @@ -94,9 +94,9 @@ void ORelationTableView::ReSync() ::std::vector< OUString> arrInvalidTables; // create and insert windows - TTableWindowData* pTabWinDataList = m_pView->getController().getTableWindowData(); - TTableWindowData::reverse_iterator aIter = pTabWinDataList->rbegin(); - for(;aIter != pTabWinDataList->rend();++aIter) + TTableWindowData& rTabWinDataList = m_pView->getController().getTableWindowData(); + TTableWindowData::reverse_iterator aIter = rTabWinDataList.rbegin(); + for(;aIter != rTabWinDataList.rend();++aIter) { TTableWindowData::value_type pData = *aIter; OTableWindow* pTabWin = createWindow(pData); @@ -109,11 +109,11 @@ void ORelationTableView::ReSync() delete pTabWin; arrInvalidTables.push_back(pData->GetTableName()); - pTabWinDataList->erase( ::std::remove(pTabWinDataList->begin(),pTabWinDataList->end(),*aIter) ,pTabWinDataList->end()); + rTabWinDataList.erase( ::std::remove(rTabWinDataList.begin(), rTabWinDataList.end(), *aIter), rTabWinDataList.end()); continue; } - (*GetTabWinMap())[pData->GetComposedName()] = pTabWin; // insert at the beginning, as the Datalist is walked through backward + GetTabWinMap()[pData->GetComposedName()] = pTabWin; // insert at the beginning, as the Datalist is walked through backward // if there's no position or size contained in the data -> Default if (!pData->HasPosition() && !pData->HasSize()) SetDefaultTabWinPosSize(pTabWin); @@ -122,10 +122,10 @@ void ORelationTableView::ReSync() } // insert connection - TTableConnectionData* pTabConnDataList = m_pView->getController().getTableConnectionData(); - TTableConnectionData::reverse_iterator aConIter = pTabConnDataList->rbegin(); + TTableConnectionData& rTabConnDataList = m_pView->getController().getTableConnectionData(); + TTableConnectionData::reverse_iterator aConIter = rTabConnDataList.rbegin(); - for(;aConIter != pTabConnDataList->rend();++aConIter) + for(;aConIter != rTabConnDataList.rend();++aConIter) { ORelationTableConnectionData* pTabConnData = static_cast(aConIter->get()); if ( !arrInvalidTables.empty() ) @@ -139,7 +139,7 @@ void ORelationTableView::ReSync() if (bInvalid) { // no -> bad luck, the connection is gone - pTabConnDataList->erase( ::std::remove(pTabConnDataList->begin(),pTabConnDataList->end(),*aConIter),pTabConnDataList->end() ); + rTabConnDataList.erase( ::std::remove(rTabConnDataList.begin(), rTabConnDataList.end(), *aConIter), rTabConnDataList.end() ); continue; } } @@ -147,8 +147,8 @@ void ORelationTableView::ReSync() addConnection( new ORelationTableConnection(this, *aConIter), false ); // don't add the data again } - if ( !GetTabWinMap()->empty() ) - GetTabWinMap()->begin()->second->GrabFocus(); + if ( !GetTabWinMap().empty() ) + GetTabWinMap().begin()->second->GrabFocus(); } bool ORelationTableView::IsAddAllowed() @@ -164,8 +164,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const OTableWindow* pSourceWin = jxdSource.pListBox->GetTabWin(); OTableWindow* pDestWin = jxdDest.pListBox->GetTabWin(); - ::std::vector::const_iterator aIter = getTableConnections()->begin(); - ::std::vector::const_iterator aEnd = getTableConnections()->end(); + ::std::vector::const_iterator aIter = getTableConnections().begin(); + ::std::vector::const_iterator aEnd = getTableConnections().end(); for(;aIter != aEnd;++aIter) { OTableConnection* pFirst = *aIter; @@ -277,9 +277,9 @@ bool ORelationTableView::RemoveConnection( OTableConnection* pConn ,sal_Bool /*_ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUString& rWinName, bool /*bNewTable*/) { OSL_ENSURE(!_rComposedName.isEmpty(),"There must be a table name supplied!"); - OJoinTableView::OTableWindowMap::iterator aIter = GetTabWinMap()->find(_rComposedName); + OJoinTableView::OTableWindowMap::iterator aIter = GetTabWinMap().find(_rComposedName); - if(aIter != GetTabWinMap()->end()) + if(aIter != GetTabWinMap().end()) { aIter->second->SetZOrder(NULL, WINDOW_ZORDER_FIRST); aIter->second->GrabFocus(); @@ -296,9 +296,9 @@ void ORelationTableView::AddTabWin(const OUString& _rComposedName, const OUStrin OTableWindow* pNewTabWin = createWindow( pNewTabWinData ); if(pNewTabWin->Init()) { - m_pView->getController().getTableWindowData()->push_back( pNewTabWinData); + m_pView->getController().getTableWindowData().push_back( pNewTabWinData); // when we already have a table with this name insert the full qualified one instead - (*GetTabWinMap())[_rComposedName] = pNewTabWin; + GetTabWinMap()[_rComposedName] = pNewTabWin; SetDefaultTabWinPosSize( pNewTabWin ); pNewTabWin->Show(); diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 4d71f7a039ea..2f0a4572377e 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -160,7 +160,7 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow) SetHelpId(HID_TABDESIGN_BACKGROUND); GetDataWindow().SetHelpId(HID_CTL_TABLEEDIT); - m_pRowList = GetView()->getController().getRows(); + m_pRowList = &GetView()->getController().getRows(); m_nDataPos = 0; } @@ -378,9 +378,9 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16 if( !pActFieldDescr ) break; - const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo(); - OTypeInfoMap::const_iterator aIter = pTypeInfo->begin(); - OTypeInfoMap::const_iterator aEnd = pTypeInfo->end(); + const OTypeInfoMap& rTypeInfo = GetView()->getController().getTypeInfo(); + OTypeInfoMap::const_iterator aIter = rTypeInfo.begin(); + OTypeInfoMap::const_iterator aEnd = rTypeInfo.end(); for(;aIter != aEnd;++aIter) pTypeCell->InsertEntry( aIter->second->aUIName ); pTypeCell->SelectEntry( aInitString ); @@ -658,12 +658,12 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId ) GetUndoManager().EnterListAction( sActionDescription, OUString() ); if (!pActFieldDescr) { - const OTypeInfoMap* pTypeInfoMap = GetView()->getController().getTypeInfo(); - if ( !pTypeInfoMap->empty() ) + const OTypeInfoMap& rTypeInfoMap = GetView()->getController().getTypeInfo(); + if ( !rTypeInfoMap.empty() ) { - OTypeInfoMap::const_iterator aTypeIter = pTypeInfoMap->find(DataType::VARCHAR); - if ( aTypeIter == pTypeInfoMap->end() ) - aTypeIter = pTypeInfoMap->begin(); + OTypeInfoMap::const_iterator aTypeIter = rTypeInfoMap.find(DataType::VARCHAR); + if ( aTypeIter == rTypeInfoMap.end() ) + aTypeIter = rTypeInfoMap.begin(); pActRow->SetFieldType( aTypeIter->second ); } else @@ -1640,9 +1640,9 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType ) ) { sal_Int32 nEntryPos = 0; - const OTypeInfoMap* pTypeInfo = GetView()->getController().getTypeInfo(); - OTypeInfoMap::const_iterator aIter = pTypeInfo->begin(); - OTypeInfoMap::const_iterator aEnd = pTypeInfo->end(); + const OTypeInfoMap& rTypeInfo = GetView()->getController().getTypeInfo(); + OTypeInfoMap::const_iterator aIter = rTypeInfo.begin(); + OTypeInfoMap::const_iterator aEnd = rTypeInfo.end(); for(;aIter != aEnd;++aIter,++nEntryPos) { if(aIter->second == _pType) diff --git a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx index 8c6815507390..11e313bfea23 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldControl.cxx +++ b/dbaccess/source/ui/tabledesign/TableFieldControl.cxx @@ -124,7 +124,7 @@ TOTypeInfoSP OTableFieldControl::getTypeInfo(sal_Int32 _nPos) const OTypeInfoMap* OTableFieldControl::getTypeInfo() const { - return const_cast(this)->GetCtrl()->GetView()->getController().getTypeInfo(); + return &const_cast(this)->GetCtrl()->GetView()->getController().getTypeInfo(); } Locale OTableFieldControl::GetLocale() const -- cgit v1.2.3