diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-02-28 09:18:26 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-02-28 09:18:26 +0000 |
commit | 88227222e01f55e7f7491260e7182386dbe5a62f (patch) | |
tree | 117a33dd56b821c36bb7fa71208e45c1a0f506b1 | |
parent | 31d0b6ef693dbfefe526a98356f36b6c80bbf9f4 (diff) |
relation design changes
18 files changed, 446 insertions, 509 deletions
diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx index 8f6f2d44e..ee7b61658 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLine.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ConnectionLine.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-05 09:23:23 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,6 +79,9 @@ #ifndef _INC_MATH #include <math.h> #endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif using namespace dbaui; @@ -87,7 +90,7 @@ const long HIT_SENSITIVE_RADIUS = 5; //======================================================================== // class OConnectionLine //======================================================================== - +DBG_NAME(OConnectionLine); //------------------------------------------------------------------------ OConnectionLine::OConnectionLine( OTableConnection* _pConn, OConnectionLineData* _pLineData ) : m_pTabConn( _pConn ) @@ -95,6 +98,7 @@ OConnectionLine::OConnectionLine( OTableConnection* _pConn, OConnectionLineData* ,m_pSourceEntry( NULL ) ,m_pDestEntry( NULL ) { + DBG_CTOR(OConnectionLine,NULL); } //------------------------------------------------------------------------ @@ -104,6 +108,7 @@ OConnectionLine::OConnectionLine( OTableConnection* _pConn, const String& _rSour ,m_pSourceEntry( NULL ) ,m_pDestEntry( NULL ) { + DBG_CTOR(OConnectionLine,NULL); m_pData->SetSourceFieldName( _rSourceFieldName ); m_pData->SetDestFieldName( _rDestFieldName ); } @@ -111,6 +116,7 @@ OConnectionLine::OConnectionLine( OTableConnection* _pConn, const String& _rSour //------------------------------------------------------------------------ OConnectionLine::OConnectionLine( const OConnectionLine& _rLine ) { + DBG_CTOR(OConnectionLine,NULL); m_pData = new OConnectionLineData( *_rLine.GetData() ); *this = _rLine; } @@ -118,6 +124,7 @@ OConnectionLine::OConnectionLine( const OConnectionLine& _rLine ) //------------------------------------------------------------------------ OConnectionLine::~OConnectionLine() { + DBG_DTOR(OConnectionLine,NULL); } //------------------------------------------------------------------------ @@ -330,7 +337,7 @@ BOOL OConnectionLine::RecalcLine() } //------------------------------------------------------------------------ -Rectangle OConnectionLine::GetSourceTextPos() +Rectangle OConnectionLine::GetSourceTextPos() const { const OTableWindow* pDestWin = m_pTabConn->GetDestWin(); OTableWindowListBox* pListBox = pDestWin ? pDestWin->GetListBox() : NULL; @@ -356,7 +363,7 @@ Rectangle OConnectionLine::GetSourceTextPos() } //------------------------------------------------------------------------ -Rectangle OConnectionLine::GetDestTextPos() +Rectangle OConnectionLine::GetDestTextPos() const { const OTableWindow* pSourceWin = m_pTabConn->GetSourceWin(); OTableWindowListBox* pListBox = pSourceWin ? pSourceWin->GetListBox() : NULL; @@ -450,7 +457,8 @@ double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Point& q) double l = (v.X() * w.Y() - v.Y() * w.X()) / a; double a2 = w.X()*v.X()+w.Y()*v.Y(); a = a2 / (a * a); - q.X() = (long)p1.X() + a * v.X(); q.Y() = (long)p1.Y() + a * v.Y(); + q.X() = long(p1.X() + a * v.X()); + q.Y() = long(p1.Y() + a * v.Y()); return l; } //------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/querydesign/ConnectionLineData.cxx b/dbaccess/source/ui/querydesign/ConnectionLineData.cxx index 2bf7f324a..ac3c24b5b 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLineData.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLineData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ConnectionLineData.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-05 09:19:54 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -61,14 +61,20 @@ #ifndef DBAUI_CONNECTIONLINEDATA_HXX #include "ConnectionLineData.hxx" #endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + using namespace dbaui; +DBG_NAME(OConnectionLineData); //================================================================== //class OConnectionLineData //================================================================== //------------------------------------------------------------------------ OConnectionLineData::OConnectionLineData() { + DBG_CTOR(OConnectionLineData,NULL); } //------------------------------------------------------------------------ @@ -76,17 +82,20 @@ OConnectionLineData::OConnectionLineData( const ::rtl::OUString& rSourceFieldNam :m_aSourceFieldName( rSourceFieldName ) ,m_aDestFieldName( rDestFieldName ) { + DBG_CTOR(OConnectionLineData,NULL); } //------------------------------------------------------------------------ OConnectionLineData::OConnectionLineData( const OConnectionLineData& rConnLineData ) { + DBG_CTOR(OConnectionLineData,NULL); *this = rConnLineData; } //------------------------------------------------------------------------ OConnectionLineData::~OConnectionLineData() { + DBG_DTOR(OConnectionLineData,NULL); } //------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index 094d320ba..d127fad31 100644 --- a/dbaccess/source/ui/querydesign/JoinTableView.cxx +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinTableView.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: fs $ $Date: 2001-02-13 16:44:04 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,7 +67,9 @@ #ifndef DBAUI_QUERYCONTROLLER_HXX #include "querycontroller.hxx" #endif -#include "QueryDesignView.hxx" +#ifndef DBAUI_JOINDESIGNVIEW_HXX +#include "JoinDesignView.hxx" +#endif #ifndef _DBU_RESOURCE_HRC_ #include "dbu_resource.hrc" #endif @@ -77,9 +79,9 @@ #ifndef DBAUI_TABLEWINDOW_HXX #include "TableWindow.hxx" #endif -#ifndef DBAUI_QUERY_TABLEWINDOWDATA_HXX -#include "QTableWindowData.hxx" -#endif +//#ifndef DBAUI_QUERY_TABLEWINDOWDATA_HXX +//#include "QTableWindowData.hxx" +//#endif #ifndef DBAUI_TABLEWINDOWLISTBOX_HXX #include "TableWindowListBox.hxx" #endif @@ -110,7 +112,9 @@ #ifndef _SV_SVAPP_HXX #include <vcl/svapp.hxx> #endif - +#ifndef DBAUI_TABLEWINDOWDATA_HXX +#include "TableWindowData.hxx" +#endif using namespace dbaui; using namespace ::com::sun::star::uno; @@ -204,7 +208,7 @@ TYPEINIT0(OJoinTableView); //const long WINDOW_HEIGHT = 1000; DBG_NAME(OJoinTableView); //------------------------------------------------------------------------------ -OJoinTableView::OJoinTableView( Window* pParent, OQueryDesignView* pView ) : +OJoinTableView::OJoinTableView( Window* pParent, OJoinDesignView* pView ) : Window( pParent,WB_BORDER ) ,m_pView( pView ) ,m_pDragWin( NULL ) @@ -227,6 +231,21 @@ OJoinTableView::OJoinTableView( Window* pParent, OQueryDesignView* pView ) : OJoinTableView::~OJoinTableView() { DBG_DTOR(OJoinTableView,NULL); + ////////////////////////////////////////////////////////////////////// + // Listen loeschen + OTableWindowMapIterator aIter = GetTabWinMap()->begin(); + for(;aIter != GetTabWinMap()->end();++aIter) + delete aIter->second; + + GetTabWinMap()->clear(); + + ::std::vector<OTableConnection*>::iterator aIter2 = GetTabConnList()->begin(); + for(;aIter2 != GetTabConnList()->end();++aIter2) + delete *aIter2; + + // den Undo-Manager des Dokuments leeren (da die UndoActions sich eventuell TabWins von mir halten, das gibt sonst eine + // Assertion in Window::~Window) + m_pView->getController()->getUndoMgr()->Clear(); } //------------------------------------------------------------------------------ IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar ) @@ -365,9 +384,10 @@ BOOL OJoinTableView::RemoveConnection( OTableConnection* pConn ) pConn->Invalidate(); // damit der Bereich neu gezeichntet wird - m_pView->getController()->removeConnectionData( pConn->GetData() ); - delete *(m_vTableConnection.erase( ::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),pConn) )); - + m_pView->getController()->removeConnectionData( ::std::auto_ptr<OTableConnectionData>(pConn->GetData()) ); + m_vTableConnection.erase( ::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),pConn) ); + delete pConn; + pConn = NULL; return TRUE; } @@ -377,7 +397,12 @@ OTableWindow* OJoinTableView::GetWindow( const String& rName ) DBG_CHKTHIS(OJoinTableView,NULL); return m_aTableMap[rName]; } - +// ----------------------------------------------------------------------------- +OTableWindowData* OJoinTableView::CreateImpl(const ::rtl::OUString& _rComposedName, + const ::rtl::OUString& _rWinName) +{ + return new OTableWindowData( _rComposedName, _rWinName ); +} //------------------------------------------------------------------------------ void OJoinTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rWinName, BOOL bNewTable) { @@ -386,25 +411,32 @@ void OJoinTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::rt ////////////////////////////////////////////////////////////////// // Neue Datenstruktur in DocShell eintragen - OQueryTableWindowData* pNewTabWinData = new OQueryTableWindowData( _rComposedName, rWinName,String() ); - m_pView->getController()->getTableWindowData()->push_back( pNewTabWinData); + OTableWindowData* pNewTabWinData = CreateImpl( _rComposedName, rWinName ); + ////////////////////////////////////////////////////////////////// // Neues Fenster in Fensterliste eintragen OTableWindow* pNewTabWin = new OTableWindow( this, pNewTabWinData ); - pNewTabWin->Init(); - - // 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; - else - m_aTableMap[rWinName] = pNewTabWin; + if(pNewTabWin->Init()) + { + 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; + else + m_aTableMap[rWinName] = pNewTabWin; - SetDefaultTabWinPosSize( pNewTabWin ); - pNewTabWin->Show(); + SetDefaultTabWinPosSize( pNewTabWin ); + pNewTabWin->Show(); - m_pView->getController()->setModified( sal_True ); - m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); + } + else + { + delete pNewTabWinData; + delete pNewTabWin; + } } //------------------------------------------------------------------------------ @@ -1088,7 +1120,7 @@ void OJoinTableView::ClearAll() ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); for(;aIter != m_vTableConnection.end();++aIter) { - OTableConnectionData* pData = (*aIter)->GetData(); + ::std::auto_ptr<OTableConnectionData> pData((*aIter)->GetData()); m_pView->getController()->removeConnectionData(pData); delete (*aIter); } diff --git a/dbaccess/source/ui/querydesign/QTableConnection.cxx b/dbaccess/source/ui/querydesign/QTableConnection.cxx index a807fa9ec..f8deebfea 100644 --- a/dbaccess/source/ui/querydesign/QTableConnection.cxx +++ b/dbaccess/source/ui/querydesign/QTableConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QTableConnection.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-05 09:20:08 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -64,6 +64,9 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif using namespace dbaui; diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index bc92e5975..47dd46bad 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryDesignView.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:04:37 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -169,41 +169,30 @@ OQueryDesignView::OQueryDesignView(Window* _pParent, OQueryController* _pControl { } - m_pScrollWindow = new OScrollWindowHelper(this); - m_pTableView = new OQueryTableView(m_pScrollWindow,this); - m_pScrollWindow->setTableView(m_pTableView); - m_pScrollWindow->Show(); - m_pTableView->Show(); - - m_pAddTabDlg = new OAddTableDlg(m_pTableView); m_pSelectionBox = new OSelectionBrowseBox(this); - m_pSelectionBox->SetNoneVisbleRow(getController()->getVisibleRows()); + m_pSelectionBox->SetNoneVisbleRow(static_cast<OQueryController*>(getController())->getVisibleRows()); m_pSelectionBox->Show(); // Splitter einrichten m_aSplitter.SetSplitHdl(LINK(this, OQueryDesignView,SplitHdl)); m_aSplitter.Show(); - SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor()) ); } // ----------------------------------------------------------------------------- OQueryDesignView::~OQueryDesignView() { - delete m_pAddTabDlg; - delete m_pTableView; delete m_pSelectionBox; - delete m_pScrollWindow; } //------------------------------------------------------------------------------ IMPL_LINK( OQueryDesignView, SplitHdl, void*, p ) { - if (!getController()->isReadOnly()) + if (!static_cast<OQueryController*>(getController())->isReadOnly()) { long nTest = m_aSplitter.GetPosPixel().Y(); m_aSplitter.SetPosPixel( Point( m_aSplitter.GetPosPixel().X(),m_aSplitter.GetSplitPosPixel() ) ); - if(!getController()->isReadOnly()) + if(!static_cast<OQueryController*>(getController())->isReadOnly()) { - getController()->setSplitPos(m_aSplitter.GetSplitPosPixel()); - getController()->setModified(); + static_cast<OQueryController*>(getController())->setSplitPos(m_aSplitter.GetSplitPosPixel()); + static_cast<OQueryController*>(getController())->setModified(); } Resize(); } @@ -212,19 +201,20 @@ IMPL_LINK( OQueryDesignView, SplitHdl, void*, p ) // ------------------------------------------------------------------------- void OQueryDesignView::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel) { + m_pTableView = new OQueryTableView(m_pScrollWindow,this); OQueryView::Construct(xModel); // initialize m_xMe } // ----------------------------------------------------------------------------- void OQueryDesignView::initialize() { - if(getController()->getSplitPos() != -1) + if(static_cast<OQueryController*>(getController())->getSplitPos() != -1) { - m_aSplitter.SetPosPixel( Point( m_aSplitter.GetPosPixel().X(),getController()->getSplitPos() ) ); - m_aSplitter.SetSplitPosPixel(getController()->getSplitPos()); + m_aSplitter.SetPosPixel( Point( m_aSplitter.GetPosPixel().X(),static_cast<OQueryController*>(getController())->getSplitPos() ) ); + m_aSplitter.SetSplitPosPixel(static_cast<OQueryController*>(getController())->getSplitPos()); } m_pSelectionBox->initialize(); m_pSelectionBox->ClearAll(); - m_pSelectionBox->SetReadOnly(getController()->isReadOnly()); + m_pSelectionBox->SetReadOnly(static_cast<OQueryController*>(getController())->isReadOnly()); m_pSelectionBox->Fill(); } // ------------------------------------------------------------------------- @@ -234,11 +224,11 @@ void OQueryDesignView::resizeControl(Rectangle& _rRect) Size aSize = GetOutputSizePixel(); - sal_Int32 nSplitPos = getController()->getSplitPos(); + sal_Int32 nSplitPos = static_cast<OQueryController*>(getController())->getSplitPos(); if( nSplitPos == -1 || nSplitPos >= aSize.Height()) { - nSplitPos = aSize.Height()*0.5; - getController()->setSplitPos(nSplitPos); + nSplitPos = sal_Int32(aSize.Height()*0.5); + static_cast<OQueryController*>(getController())->setSplitPos(nSplitPos); } Size aToolBoxSize; @@ -262,7 +252,7 @@ void OQueryDesignView::resizeControl(Rectangle& _rRect) if( aSplitPos.Y() <= 0) aSplitPos.Y() = LogicToPixel( Size(0,sal_Int32(aSize.Height() * 0.2) ), MAP_APPFONT ).Height(); - Size aTableView(aSize.Width(),aSplitPos.Y()); + Size aTableView(aSize.Width(),aSplitPos.Y()-aToolBoxSize.Height()); m_pScrollWindow->SetPosSizePixel(aTopLeft,aTableView); Point aPos(0,aSplitPos.Y()+aSplitSize.Height()); @@ -283,7 +273,7 @@ void OQueryDesignView::setReadOnly(sal_Bool _bReadOnly) // ----------------------------------------------------------------------------- void OQueryDesignView::clear() { - SfxUndoManager* pUndoMgr = getController()->getUndoMgr(); + SfxUndoManager* pUndoMgr = static_cast<OQueryController*>(getController())->getUndoMgr(); m_pSelectionBox->ClearAll(); // clear the whole selection m_pSelectionBox->Fill(); // fill with empty the fields m_pTableView->ClearAll(); @@ -309,19 +299,19 @@ sal_Bool OQueryDesignView::isCutAllowed() // ----------------------------------------------------------------------------- void OQueryDesignView::cut() { - getController()->setModified(sal_True); + static_cast<OQueryController*>(getController())->setModified(sal_True); } // ----------------------------------------------------------------------------- void OQueryDesignView::paste() { - getController()->setModified(sal_True); + static_cast<OQueryController*>(getController())->setModified(sal_True); } // ----------------------------------------------------------------------------- void OQueryDesignView::TableDeleted(const ::rtl::OUString& rAliasName) { // Nachricht, dass Tabelle aus dem Fenster gel"oscht wurde DeleteFields(rAliasName); - getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); // view nochmal bescheid sagen + static_cast<OQueryController*>(getController())->InvalidateFeature(ID_BROWSER_ADDTABLE); // view nochmal bescheid sagen } //------------------------------------------------------------------------------ void OQueryDesignView::DeleteFields( const ::rtl::OUString& rAliasName ) @@ -331,7 +321,7 @@ void OQueryDesignView::DeleteFields( const ::rtl::OUString& rAliasName ) // ----------------------------------------------------------------------------- void OQueryDesignView::SaveTabWinUIConfig(OQueryTableWindow* pWin) { - getController()->SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos()); + static_cast<OQueryController*>(getController())->SaveTabWinPosSize(pWin, m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos()); } // ----------------------------------------------------------------------------- sal_Bool OQueryDesignView::InsertField( const OTableFieldDesc& rInfo, sal_Bool bVis, sal_Bool bActivate) @@ -347,8 +337,8 @@ sal_Bool OQueryDesignView::InsertField( const OTableFieldDesc& rInfo, sal_Bool b // ----------------------------------------------------------------------------- sal_Bool OQueryDesignView::getColWidth( const ::rtl::OUString& rAliasName, const ::rtl::OUString& rFieldName, sal_uInt32& nWidth ) { - ::std::vector<OTableFieldDesc*>::iterator aIter = getController()->getTableFieldDesc()->begin(); - for(;aIter != getController()->getTableFieldDesc()->end();++aIter) + ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getController())->getTableFieldDesc()->begin(); + for(;aIter != static_cast<OQueryController*>(getController())->getTableFieldDesc()->end();++aIter) { if( rAliasName == (*aIter)->GetFieldAlias()) { @@ -442,7 +432,7 @@ long OQueryDesignView::PreNotify(NotifyEvent& rNEvt) // ----------------------------------------------------------------------------- sal_Bool OQueryDesignView::HasFields() { - ::std::vector<OTableFieldDesc*>* pList = getController()->getTableFieldDesc(); + ::std::vector<OTableFieldDesc*>* pList = static_cast<OQueryController*>(getController())->getTableFieldDesc(); ::std::vector<OTableFieldDesc*>::iterator aIter = pList->begin(); ::rtl::OUString aFieldName; for(;aIter != pList->end();++aIter) @@ -463,7 +453,7 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName); ::rtl::OUString aDBName(pEntryTab->GetComposedName()); - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aCatalog,aSchema,aTable,aComposedName; ::dbtools::qualifiedNameComponents(xMetaData,aDBName,aCatalog,aSchema,aTable); ::dbtools::composeTableName(xMetaData,aCatalog,aSchema,aTable,aComposedName,sal_True); @@ -522,7 +512,7 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName); { ::rtl::OUString aCondition; ::std::vector<OConnectionLineData*>::iterator aIter = pLineDataList->begin(); - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString(); for(;aIter != pLineDataList->end();++aIter) @@ -566,7 +556,7 @@ extern ::rtl::OUString ConvertAlias(const ::rtl::OUString& rName); if(nVis == 1) bAsterix = sal_False; - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString(); aIter = _pFieldList->begin(); @@ -798,7 +788,7 @@ void OQueryDesignView::GetNextJoin(OQueryTableConnection* pEntryConn,::rtl::OUSt // ----------------- Feldliste aufbauen ---------------------- // erst die Felder zaehlen sal_uInt32 nFieldcount = 0; - ::std::vector<OTableFieldDesc*>* pFieldList = getController()->getTableFieldDesc(); + ::std::vector<OTableFieldDesc*>* pFieldList = static_cast<OQueryController*>(getController())->getTableFieldDesc(); ::std::vector<OTableFieldDesc*>::iterator aIter = pFieldList->begin(); for(;aIter != pFieldList->end();++aIter) { @@ -848,7 +838,7 @@ void OQueryDesignView::GetNextJoin(OQueryTableConnection* pEntryConn,::rtl::OUSt } // ----------------- Statement aufbauen ---------------------- ::rtl::OUString aSqlCmd(::rtl::OUString::createFromAscii("SELECT ")); - if(getController()->isDistinct()) + if(static_cast<OQueryController*>(getController())->isDistinct()) aSqlCmd += ::rtl::OUString::createFromAscii(" DISTINCT "); aSqlCmd += aFieldListStr; aSqlCmd += ::rtl::OUString::createFromAscii(" FROM "); @@ -876,7 +866,7 @@ void OQueryDesignView::GetNextJoin(OQueryTableConnection* pEntryConn,::rtl::OUSt ::rtl::OUString OQueryDesignView::GenerateGroupBy(::std::vector<OTableFieldDesc*>* pFieldList, sal_Bool bMulti ) { - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString(); ::rtl::OUString aGroupByStr; @@ -923,7 +913,7 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS { nMaxCriteria = ::std::max<sal_uInt16>(nMaxCriteria,(*aIter)->GetCriteria().size()); } - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString(); for (sal_uInt16 i=0 ; i < nMaxCriteria ; i++) @@ -996,8 +986,8 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS ::cppu::extractInterface(xColumn,xColumns->getByName(aFieldName)); } ::rtl::OUString aErrorMsg; - ::connectivity::OSQLParser* pParser = getController()->getParser(); - ::connectivity::OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTmp, getController()->getNumberFormatter(), xColumn); + ::connectivity::OSQLParser* pParser = static_cast<OQueryController*>(getController())->getParser(); + ::connectivity::OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTmp, static_cast<OQueryController*>(getController())->getNumberFormatter(), xColumn); if (pParseNode) { @@ -1005,8 +995,8 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS pParseNode->replaceNodeValue(ConvertAlias(pEntryField->GetAlias()),aFieldName); ::rtl::OUString aWhere = aWhereStr; pParseNode->parseNodeToStr( aWhere, - getController()->getConnection()->getMetaData(), - &(getController()->getParser()->getContext()) + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + &(static_cast<OQueryController*>(getController())->getParser()->getContext()) ,sal_False,sal_True); aWhereStr = aWhere; delete pParseNode; @@ -1063,7 +1053,7 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS ::rtl::OUString aRetStr, aColumnName; String aWorkStr; - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString(); // * darf keine Filter enthalten : habe ich die entsprechende Warnung schon angezeigt ? sal_Bool bCritsOnAsterikWarning = sal_False; // ** TMFS ** @@ -1195,12 +1185,12 @@ sal_Bool OQueryDesignView::GenerateCriterias(::rtl::OUString& rRetStr,::rtl::OUS sal_Int32 OQueryDesignView::GetColumnFormatKey(const ::connectivity::OSQLParseNode* pColumnRef) { ::rtl::OUString aTableRange,aColumnName; - ::connectivity::OSQLParseTreeIterator& rParseIter = getController()->getParseIterator(); + ::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController*>(getController())->getParseIterator(); rParseIter.getColumnRange( pColumnRef, aColumnName, aTableRange ); OQueryTableWindow* pSTW = NULL; if (aTableRange.getLength()) - pSTW = m_pTableView->FindTable( aTableRange ); + pSTW = static_cast<OQueryTableView*>(m_pTableView)->FindTable( aTableRange ); else if(m_pTableView->GetTabWinMap()->size()) pSTW = static_cast<OQueryTableWindow*>(m_pTableView->GetTabWinMap()->begin()->second); @@ -1227,17 +1217,17 @@ sal_Bool OQueryDesignView::FillDragInfo(const ::connectivity::OSQLParseNode* pCo ::rtl::OUString aTableRange,aColumnName; sal_uInt16 nCntAccount; - ::connectivity::OSQLParseTreeIterator& rParseIter = getController()->getParseIterator(); + ::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController*>(getController())->getParseIterator(); rParseIter.getColumnRange( pColumnRef, aColumnName, aTableRange ); if (aTableRange.getLength()) { - OQueryTableWindow* pSTW = m_pTableView->FindTable( aTableRange ); + OQueryTableWindow* pSTW = static_cast<OQueryTableView*>(m_pTableView)->FindTable( aTableRange ); if(!( pSTW && pSTW->ExistsField( aColumnName, aDragInfo ) )) bErg = sal_False; } else - bErg = m_pTableView->FindTableFromField(aColumnName, aDragInfo, nCntAccount); + bErg = static_cast<OQueryTableView*>(m_pTableView)->FindTableFromField(aColumnName, aDragInfo, nCntAccount); return bErg; } @@ -1376,10 +1366,10 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon { ::rtl::OUString aColumnName; // the international doesn't matter I have a string - pCondition->parseNodeToPredicateStr(aCondition,getController()->getConnection()->getMetaData(), getController()->getNumberFormatter(), + pCondition->parseNodeToPredicateStr(aCondition,static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); - pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,getController()->getConnection()->getMetaData(), getController()->getNumberFormatter(), m_aLocale, + pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName,static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); // don't display the column name @@ -1410,8 +1400,8 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon // Bedingung parsen for(sal_uInt16 i=1;i< pCondition->count();i++) pCondition->getChild(i)->parseNodeToPredicateStr(aCondition, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); } @@ -1432,8 +1422,8 @@ int OQueryDesignView::GetANDCriteria(const ::connectivity::OSQLParseNode * pCon // Funktions-Bedingung parsen for(sal_uInt16 i=0;i< pCondition->count();i++) pCondition->getChild(i)->parseNodeToPredicateStr(aCondition, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); @@ -1498,8 +1488,8 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode * // Bedingung parsen for(;i< pCondition->count();i++) pCondition->getChild(i)->parseNodeToPredicateStr(aCondition, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); } @@ -1540,8 +1530,8 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode * // go backward for (; i >= 0; i--) pCondition->getChild(i)->parseNodeToPredicateStr(aCondition, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); } @@ -1565,13 +1555,13 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode * ::rtl::OUString aColumnName; pCondition->parseNodeToPredicateStr(aCondition, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); pCondition->getChild(0)->parseNodeToPredicateStr(aColumnName, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); @@ -1613,15 +1603,15 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode * // Feldnamen for(sal_uInt16 i=0;i< pLhs->count();i++) pCondition->getChild(i)->parseNodeToStr(aName, - getController()->getConnection()->getMetaData(), - &getController()->getParser()->getContext(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + &static_cast<OQueryController*>(getController())->getParser()->getContext(), sal_True); // Kriterium aCondition = pCondition->getChild(1)->getTokenValue(); for(i=0;i< pRhs->count();i++) pCondition->getChild(i)->parseNodeToPredicateStr(aCondition, - getController()->getConnection()->getMetaData(), - getController()->getNumberFormatter(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getController())->getNumberFormatter(), m_aLocale, m_sDecimalSep.toChar()); @@ -1648,7 +1638,7 @@ int OQueryDesignView::ComparsionPredicate(const ::connectivity::OSQLParseNode * return rValue; } - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); ::rtl::OUString aQuote = xMetaData->getIdentifierQuoteString(); switch( aType ) @@ -1737,10 +1727,10 @@ sal_Bool OQueryDesignView::InsertJoinConnection(const ::connectivity::OSQLParseN aInfoData.InitFromDrag(aDragLeft, aDragRight); aInfoData.SetJoinType(_eJoinType); - OQueryTableConnection aInfo(m_pTableView, &aInfoData); + OQueryTableConnection aInfo(static_cast<OQueryTableView*>(m_pTableView), &aInfoData); // da ein OQueryTableConnection-Objekt nie den Besitz der uebergebenen Daten uebernimmt, sondern sich nur den Zeiger merkt, // ist dieser Zeiger auf eine lokale Variable hier unkritisch, denn aInfoData und aInfo haben die selbe Lebensdauer - m_pTableView->NotifyTabConnection( aInfo ); + static_cast<OQueryTableView*>(m_pTableView)->NotifyTabConnection( aInfo ); } else { @@ -1810,13 +1800,13 @@ void OQueryDesignView::InitFromParseNode() m_pSelectionBox->ClearAll(); m_pSelectionBox->Fill(); - ::connectivity::OSQLParseTreeIterator& aIterator = getController()->getParseIterator(); + ::connectivity::OSQLParseTreeIterator& aIterator = static_cast<OQueryController*>(getController())->getParseIterator(); const ::connectivity::OSQLParseNode* pParseTree = aIterator.getParseTree(); const ::connectivity::OSQLParseNode* pTableRefCommaList = 0; if (pParseTree) { - if (!getController()->isEsacpeProcessing()) + if (!static_cast<OQueryController*>(getController())->isEsacpeProcessing()) { WarningBox( this, ModuleRes(WARN_QRY_NATIVE) ).Execute(); } @@ -1828,7 +1818,7 @@ void OQueryDesignView::InitFromParseNode() const OSQLTables& aMap = aIterator.getTables(); ::comphelper::UStringMixEqual aKeyComp(static_cast< ::comphelper::UStringMixLess*>(&aMap.key_comp())->isCaseSensitive()); - Reference< XDatabaseMetaData > xMetaData = getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getController())->getConnection()->getMetaData(); sal_Int32 nMax = xMetaData->getMaxTablesInSelect(); if(!nMax || nMax >= (sal_Int32)aMap.size()) // Anzahl der Tabellen im Select-Statement "uberpr"ufen @@ -1842,7 +1832,7 @@ void OQueryDesignView::InitFromParseNode() OSQLTable xTable = aIter->second; ::dbaui::composeTableName(xMetaData,Reference<XPropertySet>(xTable,UNO_QUERY),aComposedName,sal_False); - OQueryTableWindow* pExistentWin = m_pTableView->FindTable(aIter->first); + OQueryTableWindow* pExistentWin = static_cast<OQueryTableView*>(m_pTableView)->FindTable(aIter->first); if (!pExistentWin) { m_pTableView->AddTabWin(aComposedName, aIter->first,sal_True); @@ -1860,14 +1850,14 @@ void OQueryDesignView::InitFromParseNode() // now delete the data for which we haven't any tablewindow OJoinTableView::OTableWindowMap* pTableMap = m_pTableView->GetTabWinMap(); - ::std::vector< OTableWindowData*>::iterator aDataIter = getController()->getTableWindowData()->begin(); - for(;aDataIter != getController()->getTableWindowData()->end();) + ::std::vector< OTableWindowData*>::iterator aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->begin(); + for(;aDataIter != static_cast<OQueryController*>(getController())->getTableWindowData()->end();) { OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(*aDataIter); if(pTableMap->find(pData->GetAliasName()) == pTableMap->end()) { delete *aDataIter; - aDataIter = getController()->getTableWindowData()->erase(aDataIter); + aDataIter = static_cast<OQueryController*>(getController())->getTableWindowData()->erase(aDataIter); } else ++aDataIter; @@ -1878,8 +1868,8 @@ void OQueryDesignView::InitFromParseNode() // check if we have a distinct statement if(SQL_ISTOKEN(pParseTree->getChild(1),DISTINCT)) { - getController()->setDistinct(sal_True); - getController()->InvalidateFeature(ID_BROWSER_QUERY_DISTINCT_VALUES); + static_cast<OQueryController*>(getController())->setDistinct(sal_True); + static_cast<OQueryController*>(getController())->InvalidateFeature(ID_BROWSER_QUERY_DISTINCT_VALUES); } if (!InstallFields(pParseTree, m_pTableView->GetTabWinMap())) { @@ -1906,7 +1896,7 @@ void OQueryDesignView::InitFromParseNode() } // Durch das Neuerzeugen wurden wieder Undo-Actions in den Manager gestellt - getController()->getUndoMgr()->Clear(); + static_cast<OQueryController*>(getController())->getUndoMgr()->Clear(); } // ----------------------------------------------------------------------------- int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode, OJoinTableView::OTableWindowMap* pTabList ) @@ -1969,7 +1959,7 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode, } else if (SQL_ISRULE(pColumnRef,derived_column)) { - ::rtl::OUString aColumnAlias(getController()->getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein + ::rtl::OUString aColumnAlias(static_cast<OQueryController*>(getController())->getParseIterator().getColumnAlias(pColumnRef)); // kann leer sein pColumnRef = pColumnRef->getChild(0); if (SQL_ISRULE(pColumnRef,column_ref)) { @@ -1993,8 +1983,8 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode, ::rtl::OUString aColumns; pColumnRef->parseNodeToStr( aColumns, - getController()->getConnection()->getMetaData(), - &getController()->getParser()->getContext(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + &static_cast<OQueryController*>(getController())->getParser()->getContext(), sal_True, sal_False); @@ -2049,8 +2039,8 @@ int OQueryDesignView::InstallFields(const ::connectivity::OSQLParseNode* pNode, { ::rtl::OUString aColumns; pColumnRef->parseNodeToStr( aColumns, - getController()->getConnection()->getMetaData(), - &getController()->getParser()->getContext(), + static_cast<OQueryController*>(getController())->getConnection()->getMetaData(), + &static_cast<OQueryController*>(getController())->getParser()->getContext(), sal_True,sal_False); OTableFieldDesc aInfo; @@ -2103,10 +2093,10 @@ void OQueryDesignView::GetOrderCriteria(const ::connectivity::OSQLParseNode* pPa else // it could be a alias name for a field { ::rtl::OUString aTableRange,aColumnName; - ::connectivity::OSQLParseTreeIterator& rParseIter = getController()->getParseIterator(); + ::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController*>(getController())->getParseIterator(); rParseIter.getColumnRange( pChild->getChild(0), aColumnName, aTableRange ); - ::std::vector<OTableFieldDesc*>* pList = getController()->getTableFieldDesc(); + ::std::vector<OTableFieldDesc*>* pList = static_cast<OQueryController*>(getController())->getTableFieldDesc(); ::std::vector<OTableFieldDesc*>::iterator aIter = pList->begin(); for(;aIter != pList->end();++aIter) { @@ -2189,7 +2179,7 @@ int OQueryDesignView::InsertColumnRef(const ::connectivity::OSQLParseNode * pCol { // Tabellennamen zusammen setzen - ::connectivity::OSQLParseTreeIterator& rParseIter = getController()->getParseIterator(); + ::connectivity::OSQLParseTreeIterator& rParseIter = static_cast<OQueryController*>(getController())->getParseIterator(); rParseIter.getColumnRange( pColumnRef, aColumnName, aTableRange ); DBG_ASSERT(aColumnName.getLength(),"Columnname darf nicht leer sein"); @@ -2221,7 +2211,7 @@ int OQueryDesignView::InsertColumnRef(const ::connectivity::OSQLParseNode * pCol else { // SELECT range.column, ... - OQueryTableWindow* pTabWin = m_pTableView->FindTable(aTableRange); + OQueryTableWindow* pTabWin = static_cast<OQueryTableView*>(m_pTableView)->FindTable(aTableRange); if (pTabWin && pTabWin->ExistsField(aColumnName, aInfo)) { @@ -2320,7 +2310,7 @@ void OQueryDesignView::zoomTableView(const Fraction& _rFraction) // ----------------------------------------------------------------------------- void OQueryDesignView::SaveUIConfig() { - OQueryController* pCtrl = getController(); + OQueryController* pCtrl = static_cast<OQueryController*>(getController()); if (pCtrl) { pCtrl->SaveTabWinsPosSize( m_pTableView->GetTabWinMap(), m_pScrollWindow->GetHScrollBar()->GetThumbPos(), m_pScrollWindow->GetVScrollBar()->GetThumbPos() ); diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx index c4c78b581..786fddd7c 100644 --- a/dbaccess/source/ui/querydesign/QueryTableView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryTableView.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-14 14:54:11 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,7 +71,9 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif +#ifndef _DBA_DBACCESS_HELPID_HRC_ #include "dbaccess_helpid.hrc" +#endif #ifndef DBAUI_QUERY_TABLEWINDOW_HXX #include "QTableWindow.hxx" #endif @@ -141,6 +143,9 @@ #ifndef _CPPUHELPER_EXTRACT_HXX_ #include <cppuhelper/extract.hxx> #endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif using namespace dbaui; using namespace ::com::sun::star::uno; @@ -195,21 +200,6 @@ OQueryTableView::OQueryTableView( Window* pParent,OQueryDesignView* pView) OQueryTableView::~OQueryTableView() { DBG_DTOR(OQueryTableView,NULL); - ////////////////////////////////////////////////////////////////////// - // Listen loeschen - OTableWindowMapIterator aIter = GetTabWinMap()->begin(); - for(;aIter != GetTabWinMap()->end();++aIter) - delete aIter->second; - - GetTabWinMap()->clear(); - - ::std::vector<OTableConnection*>::iterator aIter2 = GetTabConnList()->begin(); - for(;aIter2 != GetTabConnList()->end();++aIter2) - delete *aIter2; - - // den Undo-Manager des Dokuments leeren (da die UndoActions sich eventuell TabWins von mir halten, das gibt sonst eine - // Assertion in Window::~Window) - m_pView->getController()->getUndoMgr()->Clear(); } //------------------------------------------------------------------------ @@ -387,7 +377,12 @@ void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn, pNewConn->Invalidate(); } } - +// ----------------------------------------------------------------------------- +OTableWindowData* OQueryTableView::CreateImpl(const ::rtl::OUString& _rComposedName, + const ::rtl::OUString& _rWinName) +{ + return new OQueryTableWindowData( _rComposedName, _rWinName ,String()); +} //------------------------------------------------------------------------------ void OQueryTableView::AddTabWin(const ::rtl::OUString& strDatabase, const ::rtl::OUString& strTableName, sal_Bool bNewTable) { @@ -832,7 +827,7 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin) DBG_ASSERT(pTabWin->ISA(OQueryTableWindow), "OQueryTableView::RemoveTabWin : Fenster sollte ein OQueryTableWindow sein !"); // mein Parent brauche ich, da es vom Loeschen erfahren soll - OQueryDesignView* pParent = getDesignView(); + OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView()); SfxUndoManager* pUndoMgr = m_pView->getController()->getUndoMgr(); pUndoMgr->EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() ); @@ -1082,7 +1077,7 @@ void OQueryTableView::InsertField(const OTableFieldDesc& rInfo) { DBG_CHKTHIS(OQueryTableView,NULL); DBG_ASSERT(getDesignView() != NULL, "OQueryTableView::InsertField : habe kein Parent !"); - getDesignView()->InsertField(rInfo); + static_cast<OQueryDesignView*>(getDesignView())->InsertField(rInfo); } //------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx index f1bcce649..e5c58e702 100644 --- a/dbaccess/source/ui/querydesign/QueryTextView.cxx +++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryTextView.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-05 09:25:27 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,6 +95,9 @@ #ifndef _COMPHELPER_TYPES_HXX_ #include <comphelper/types.hxx> #endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif using namespace dbaui; using namespace ::com::sun::star::uno; @@ -106,7 +109,6 @@ OQueryContainerWindow::OQueryContainerWindow(Window* pParent, OQueryController* ,m_pBeamer(NULL) { m_pView = new OQueryViewSwitch(this,_pController,_rFactory); - m_pView->Show(); m_pSplitter = new Splitter(this,WB_VSCROLL); m_pSplitter->Hide(); @@ -125,6 +127,7 @@ OQueryContainerWindow::~OQueryContainerWindow() m_xMe = NULL; delete m_pBeamer; delete m_pSplitter; + delete m_pView; } // ----------------------------------------------------------------------------- void OQueryContainerWindow::switchView() @@ -170,7 +173,6 @@ void OQueryContainerWindow::Resize() Point aPos(0,aSplitPos.Y()+aSplitSize.Height()); m_pView->SetPosSizePixel(aPos,Size( aSize.Width(), aSize.Height() - aSplitSize.Height() - aSplitPos.Y() )); - } } // ----------------------------------------------------------------------------- @@ -209,7 +211,7 @@ void OQueryContainerWindow::showBeamer(const Reference<XFrame>& _xFrame) Size aSize = GetOutputSizePixel(); - Size aBeamer(aSize.Width(),aSize.Height()*0.33); + Size aBeamer(aSize.Width(),sal_Int32(aSize.Height()*0.33)); const long nFrameHeight = LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height(); Point aPos(0,aBeamer.Height()+nFrameHeight); @@ -229,49 +231,39 @@ void OQueryContainerWindow::showBeamer(const Reference<XFrame>& _xFrame) // end of temp classes // ------------------------------------------------------------------------- -OQueryTextView::OQueryTextView(Window* _pParent, OQueryController* _pController,const Reference< XMultiServiceFactory >& _rFactory) - :OQueryView(_pParent,_pController,_rFactory) +OQueryTextView::OQueryTextView(Window* _pParent,ToolBox* _pToolBox) + :Window(_pParent) + ,m_pToolBox(_pToolBox) { m_pEdit = new OSqlEdit(this); m_pEdit->ClearModifyFlag(); m_pEdit->SaveValue(); m_pEdit->Show(); m_pEdit->GrabFocus(); - - ToolBox* pToolBox = getToolBox(); - if(pToolBox) - { - pToolBox->HideItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_ADDTABLE)-1)); // hide the separator - pToolBox->HideItem(ID_BROWSER_ADDTABLE); - pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); - pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_TABLES); - pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_ALIASES); - pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); - } } // ----------------------------------------------------------------------------- OQueryTextView::~OQueryTextView() { + m_pToolBox = NULL; delete m_pEdit; } // ------------------------------------------------------------------------- void OQueryTextView::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel) { - OQueryView::Construct(xModel); // initialize m_xMe - } // ------------------------------------------------------------------------- -void OQueryTextView::resizeControl(Rectangle& _rRect) +void OQueryTextView::Resize() { Size aToolBoxSize; - ToolBox* pToolBox = getToolBox(); + ToolBox* pToolBox = m_pToolBox; if(pToolBox) aToolBoxSize = pToolBox->GetOutputSizePixel(); - Point aTopLeft(_rRect.TopLeft()); + + Size aSize = GetOutputSizePixel(); + Point aTopLeft(0,0); aTopLeft.Y() += aToolBoxSize.Height(); - m_pEdit->SetPosSizePixel(aTopLeft,Size(_rRect.getWidth(),_rRect.GetHeight()-aTopLeft.Y())); - aToolBoxSize.Width() += _rRect.getWidth(); - _rRect.SetSize(aToolBoxSize); + m_pEdit->SetPosSizePixel(aTopLeft,Size(aSize.Width(),aSize.Height()-aTopLeft.Y())); + m_pToolBox->SetPosSizePixel(Point(0,0),Size(aSize.Width(),aToolBoxSize.Height())); } // ----------------------------------------------------------------------------- ::rtl::OUString OQueryTextView::getStatement() @@ -286,8 +278,7 @@ void OQueryTextView::setReadOnly(sal_Bool _bReadOnly) // ----------------------------------------------------------------------------- void OQueryTextView::clear() { - - SfxUndoManager* pUndoMgr = getController()->getUndoMgr(); + SfxUndoManager* pUndoMgr = static_cast<OQueryContainerWindow*>(GetParent())->getView()->getRealView()->getController()->getUndoMgr(); OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( m_pEdit ); pUndoAct->SetOriginalText( m_pEdit->GetText() ); @@ -317,13 +308,13 @@ void OQueryTextView::cut() { if(!m_pEdit->IsInAccelAct() ) m_pEdit->Cut(); - getController()->setModified(sal_True); + static_cast<OQueryContainerWindow*>(GetParent())->getView()->getRealView()->getController()->setModified(sal_True); } // ----------------------------------------------------------------------------- void OQueryTextView::paste() { if(!m_pEdit->IsInAccelAct() ) m_pEdit->Paste(); - getController()->setModified(sal_True); + static_cast<OQueryContainerWindow*>(GetParent())->getView()->getRealView()->getController()->setModified(sal_True); } // -----------------------------------------------------------------------------
\ No newline at end of file diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx index de3e04a2a..58a3dc113 100644 --- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx +++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx @@ -2,9 +2,9 @@ * * $RCSfile: QueryViewSwitch.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-06 13:19:38 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -93,14 +93,17 @@ using namespace ::com::sun::star::lang; OQueryViewSwitch::OQueryViewSwitch(Window* _pParent, OQueryController* _pController,const Reference< XMultiServiceFactory >& _rFactory) - :OQueryView(_pParent,_pController,_rFactory) + // :OQueryView(_pParent,_pController,_rFactory) { - m_pTextView = new OQueryTextView(this,_pController,_rFactory); - m_pTextView->Show(); - m_pDesignView = new OQueryDesignView(this,_pController,_rFactory); + ToolBox* pToolBox = new ToolBox(_pParent, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); + + m_pTextView = new OQueryTextView(_pParent,pToolBox); + m_pDesignView = new OQueryDesignView(_pParent,_pController,_rFactory); - ToolBox* pToolBox = new ToolBox(this, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); - setToolBox(pToolBox); + m_pDesignView->setToolBox(pToolBox); + m_pTextView->Show(); + pToolBox->SetParent(m_pTextView); // change owner ship + pToolBox->Show(); if(pToolBox && m_pTextView->IsVisible()) { @@ -118,29 +121,32 @@ OQueryViewSwitch::OQueryViewSwitch(Window* _pParent, OQueryController* _pControl // ----------------------------------------------------------------------------- OQueryViewSwitch::~OQueryViewSwitch() { + ToolBox* pToolBox = m_pDesignView->getToolBox(); + pToolBox->SetParent(m_pDesignView); // change owner ship again to real owner + delete m_pTextView; - delete m_pDesignView; + // delete m_pDesignView; // will be deleted by XFrame } // ------------------------------------------------------------------------- void OQueryViewSwitch::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel) { - OQueryView::Construct(xModel); // initialize m_xMe + m_pDesignView->Construct(xModel); // initialize the table view + // OQueryView::Construct(xModel); // initialize m_xMe // m_pTextView->Construct(xModel); - // m_pDesignView->Construct(xModel); + } // ----------------------------------------------------------------------------- void OQueryViewSwitch::initialize() { - m_pTextView->initialize(); m_pDesignView->initialize(); - if(getController()->isDesignMode()) + if(static_cast<OQueryController*>(m_pDesignView->getController())->isDesignMode()) switchView(); } // ------------------------------------------------------------------------- void OQueryViewSwitch::resizeControl(Rectangle& _rRect) { Size aToolBoxSize; - ToolBox* pToolBox = getToolBox(); + ToolBox* pToolBox = m_pDesignView->getToolBox(); if(pToolBox) aToolBoxSize = pToolBox->GetOutputSizePixel(); @@ -220,9 +226,10 @@ void OQueryViewSwitch::switchView() { m_pTextView->Show(!m_pTextView->IsVisible()); - ToolBox* pToolBox = getToolBox(); + ToolBox* pToolBox = m_pDesignView->getToolBox(); if(pToolBox && m_pTextView->IsVisible()) { + pToolBox->SetParent(m_pTextView); // change owner ship m_pDesignView->Show(FALSE); pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_ALIASES); @@ -235,10 +242,11 @@ void OQueryViewSwitch::switchView() // ToolBoxItemType eType = pToolBox->GetItemType(pToolBox->GetItemPos(ID_BROWSER_SQL)+1); // pToolBox->HideItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_SQL))+1); // hide the separator m_pTextView->clear(); - m_pTextView->setStatement(getController()->getStatement()); + m_pTextView->setStatement(static_cast<OQueryController*>(m_pDesignView->getController())->getStatement()); } else if(pToolBox) { + pToolBox->SetParent(m_pDesignView); // change owner ship // pToolBox->ShowItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_ADDTABLE)-1)); // hide the separator pToolBox->HideItem(ID_BROWSER_ESACPEPROCESSING); pToolBox->ShowItem(ID_BROWSER_ADDTABLE); @@ -293,4 +301,16 @@ void OQueryViewSwitch::SaveUIConfig() if(m_pDesignView->IsVisible()) m_pDesignView->SaveUIConfig(); } -// -----------------------------------------------------------------------------
\ No newline at end of file +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::SetPosSizePixel( Point _rPt,Size _rSize) +{ + m_pDesignView->SetPosSizePixel( _rPt,_rSize); + m_pTextView->SetPosSizePixel( _rPt,_rSize); +} +// ----------------------------------------------------------------------------- +Reference< XMultiServiceFactory > OQueryViewSwitch::getORB() const +{ + return m_pDesignView->getORB(); +} +// ----------------------------------------------------------------------------- + diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 10a80bec6..b4cbef634 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -2,9 +2,9 @@ * * $RCSfile: SelectionBrowseBox.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:04:37 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -217,7 +217,7 @@ OSelectionBrowseBox::~OSelectionBrowseBox() // ----------------------------------------------------------------------------- void OSelectionBrowseBox::initialize() { - Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(); // Diese Funktionen stehen nur unter CORE zur Verfügung if(xMetaData->supportsCoreSQLGrammar()) { @@ -277,7 +277,7 @@ void OSelectionBrowseBox::Init() m_nVisibleCount++; } RowInserted(0, m_nVisibleCount, sal_False); - Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(); m_nMaxColumns = xMetaData->getMaxColumnsInSelect(); } @@ -291,10 +291,12 @@ void OSelectionBrowseBox::ClearAll() if (GetCurRow() != 0) GoToRow(0); - ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); - for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController())); + + ::std::vector<OTableFieldDesc*>::iterator aIter = pController->getTableFieldDesc()->begin(); + for(;aIter != pController->getTableFieldDesc()->end();++aIter) delete *aIter; - getDesignView()->getController()->getTableFieldDesc()->clear(); + pController->getTableFieldDesc()->clear(); sal_uInt16 nCurCol = GetCurColumnId(); long nCurRow = GetCurRow(); @@ -332,13 +334,15 @@ void OSelectionBrowseBox::SetReadOnly(sal_Bool bRO) DbCellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController())); + + OTableFieldDesc* pEntry = (*pController->getTableFieldDesc())[nColId-1]; DBG_ASSERT(pEntry, "OSelectionBrowseBox::GetController : keine FieldDescription !"); if (!pEntry) return NULL; - if (getDesignView()->getController()->isReadOnly()) + if (static_cast<OQueryController*>(getDesignView()->getController())->isReadOnly()) return NULL; long nCellIndex = GetRealRow(nRow); @@ -363,8 +367,10 @@ DbCellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColI void OSelectionBrowseBox::InitController(DbCellControllerRef& rController, long nRow, sal_uInt16 nColId) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - OSL_ENSURE(getDesignView()->getController()->getTableFieldDesc()->size() > sal_uInt16(nColId-1),"ColID is to great!"); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController())); + + OSL_ENSURE(pController->getTableFieldDesc()->size() > sal_uInt16(nColId-1),"ColID is to great!"); + OTableFieldDesc* pEntry = (*pController->getTableFieldDesc())[nColId-1]; DBG_ASSERT(pEntry, "OSelectionBrowseBox::InitController : keine FieldDescription !"); long nCellIndex = GetRealRow(nRow); @@ -486,7 +492,7 @@ void OSelectionBrowseBox::InitController(DbCellControllerRef& rController, long break; case BROW_FUNCTION_ROW: { - Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(); // Diese Funktionen stehen nur unter CORE zur Verfügung if(xMetaData->supportsCoreSQLGrammar()) { @@ -558,8 +564,9 @@ sal_Bool OSelectionBrowseBox::SaveModified() { DBG_CHKTHIS(OSelectionBrowseBox,NULL); OTableFieldDesc* pEntry = NULL; - if(getDesignView()->getController()->getTableFieldDesc()->size() > sal_uInt16(GetCurColumnId() - 1)) - pEntry = (*getDesignView()->getController()->getTableFieldDesc())[GetCurColumnId() - 1]; + OQueryController* pController = static_cast<OQueryController*>(getDesignView()->getController()); + if(pController->getTableFieldDesc()->size() > sal_uInt16(GetCurColumnId() - 1)) + pEntry = (*pController->getTableFieldDesc())[GetCurColumnId() - 1]; sal_Bool bWasEmpty = pEntry ? pEntry->IsEmpty() : sal_False; sal_Bool bError = sal_False; @@ -621,9 +628,11 @@ sal_Bool OSelectionBrowseBox::SaveModified() { ::rtl::OUString aErrorMsg; bIsPredicate = sal_True; // #72670# - ::connectivity::OSQLParser* pParser = getDesignView()->getController()->getParser(); + OQueryController* pController = static_cast<OQueryController*>(static_cast<OQueryController*>(getDesignView()->getController())); + + ::connectivity::OSQLParser* pParser = pController->getParser(); OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTest, - getDesignView()->getController()->getNumberFormatter(), + pController->getNumberFormatter(), xColumn); if (pParseNode) { @@ -669,7 +678,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() pEntry->SetField(aFieldName); // Falls nur COUNT(*) erlaubt wird - Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(); if(xMetaData->supportsCoreSQLGrammar() && aFieldName.GetChar(0) != '*' && pEntry->GetFunction().getLength()) { @@ -762,12 +771,12 @@ sal_Bool OSelectionBrowseBox::SaveModified() if (!aFieldName.Len()) { - ::std::replace(getDesignView()->getController()->getTableFieldDesc()->begin(),getDesignView()->getController()->getTableFieldDesc()->end(),pEntry,new OTableFieldDesc); + ::std::replace(pController->getTableFieldDesc()->begin(),static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end(),pEntry,new OTableFieldDesc); sal_uInt16 nCol = GetCurColumnId(); for (int i = 0; i < m_nVisibleCount; i++) // Spalte neu zeichnen RowModified(i,nCol); } - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); + pController->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); } break; @@ -820,7 +829,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() { strOldCellContents = pEntry->GetFunction(); sal_uInt16 nPos = m_pFunctionCell->GetSelectEntryPos(); - Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + Reference< XDatabaseMetaData > xMetaData = static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(); // Diese Funktionen stehen nur unter CORE zur Verfügung sal_uInt16 nFunctionCount = xMetaData->supportsCoreSQLGrammar() @@ -863,7 +872,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() ::rtl::OUString aCrit; if(aText.Len()) { - ::connectivity::OSQLParser* pParser = getDesignView()->getController()->getParser(); + ::connectivity::OSQLParser* pParser = static_cast<OQueryController*>(getDesignView()->getController())->getParser(); OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow()); String aTest(aText); @@ -877,16 +886,16 @@ sal_Bool OSelectionBrowseBox::SaveModified() } ::rtl::OUString aErrorMsg; - OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTest, getDesignView()->getController()->getNumberFormatter(), xColumn); + OSQLParseNode* pParseNode = pParser->predicateTree(aErrorMsg, aTest, static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(), xColumn); if (pParseNode) { pParseNode->parseNodeToPredicateStr(aCrit, - getDesignView()->getController()->getConnection()->getMetaData(), - getDesignView()->getController()->getNumberFormatter(), + static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(), xColumn, getDesignView()->getLocale(), getDesignView()->getDecimalSeparator().toChar(), - &(getDesignView()->getController()->getParser()->getContext())); + &(static_cast<OQueryController*>(getDesignView()->getController())->getParser()->getContext())); delete pParseNode; } else @@ -911,16 +920,16 @@ sal_Bool OSelectionBrowseBox::SaveModified() default: ; } - pParseNode = pParser->predicateTree(aErrorMsg, aTest, getDesignView()->getController()->getNumberFormatter(), xColumn); + pParseNode = pParser->predicateTree(aErrorMsg, aTest, static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(), xColumn); if (pParseNode) { pParseNode->parseNodeToPredicateStr(aCrit, - getDesignView()->getController()->getConnection()->getMetaData(), - getDesignView()->getController()->getNumberFormatter(), + static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData(), + static_cast<OQueryController*>(getDesignView()->getController())->getNumberFormatter(), xColumn, getDesignView()->getLocale(), getDesignView()->getDecimalSeparator().toChar(), - &(getDesignView()->getController()->getParser()->getContext())); + &(static_cast<OQueryController*>(getDesignView()->getController())->getParser()->getContext())); delete pParseNode; } else @@ -958,7 +967,7 @@ sal_Bool OSelectionBrowseBox::SaveModified() pUndoAct->SetCellIndex(GetCurRow()); pUndoAct->SetColId(GetCurColumnId()); pUndoAct->SetCellContents(strOldCellContents); - getDesignView()->getController()->getUndoMgr()->AddUndoAction(pUndoAct); + static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->AddUndoAction(pUndoAct); } // habe ich Daten in einer FieldDescription gespeichert, die vorher leer war und es nach den Aenderungen nicht mehr ist ? @@ -996,8 +1005,8 @@ void OSelectionBrowseBox::PaintCell(OutputDevice& rDev, const Rectangle& rRect, rDev.SetClipRegion( rRect ); OTableFieldDesc* pEntry = NULL; - if(getDesignView()->getController()->getTableFieldDesc()->size() > sal_uInt16(nColumnId - 1)) - pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColumnId - 1]; + if(static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size() > sal_uInt16(nColumnId - 1)) + pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColumnId - 1]; if (!pEntry) return; @@ -1037,9 +1046,9 @@ sal_Bool OSelectionBrowseBox::QueryDrop(const BrowserDropEvent& rEvt) void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - DBG_ASSERT(getDesignView()->getController()->getTableFieldDesc()->size() == sal_uInt16(ColCount() - 1), "OSelectionBrowseBox::RemoveColumn : inkonsistent state !"); + DBG_ASSERT(static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size() == sal_uInt16(ColCount() - 1), "OSelectionBrowseBox::RemoveColumn : inkonsistent state !"); // das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn - DBG_ASSERT((nColId == 0) || (nColId <= getDesignView()->getController()->getTableFieldDesc()->size()), "OSelectionBrowseBox::RemoveColumn : invalid parameter nColId"); + DBG_ASSERT((nColId == 0) || (nColId <= static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size()), "OSelectionBrowseBox::RemoveColumn : invalid parameter nColId"); // ColId ist bei mir gleichbedeutend mit Position, und da sollte die Bedingung natuerlich zutreffen sal_uInt16 nCurCol = GetCurColumnId(); @@ -1047,12 +1056,12 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId) DeactivateCell(); // Spalteninfo rausnehmen und am Ende neues Info einfuegen - OTableFieldDesc* pOld = (*getDesignView()->getController()->getTableFieldDesc())[((sal_uInt32)nColId - 1)]; - getDesignView()->getController()->getTableFieldDesc()->erase( getDesignView()->getController()->getTableFieldDesc()->begin() + ((sal_uInt32)nColId - 1) ); + OTableFieldDesc* pOld = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[((sal_uInt32)nColId - 1)]; + static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->erase( static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin() + ((sal_uInt32)nColId - 1) ); // der Aufrufer ist dafuer verantwortlich, sich vorher die Description zu besorgen und die irgendwie aufzuraeumen // (im Normalfall wohl erst mal in ein Undo zu schieben) OTableFieldDesc* pNew = new OTableFieldDesc; - getDesignView()->getController()->getTableFieldDesc()->push_back(pNew); + static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->push_back(pNew); // Nachfolgende Spalten optisch verschieben sal_uInt16 nCount = (sal_uInt16)ColCount(); @@ -1070,11 +1079,11 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId) ActivateCell( nCurRow, nCurCol ); - getDesignView()->getController()->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_UNDO ); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_REDO ); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_UNDO ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_REDO ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); } @@ -1082,9 +1091,9 @@ void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId) void OSelectionBrowseBox::RemoveField(sal_uInt16 nId, sal_Bool bActivate) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - OSL_ENSURE(getDesignView()->getController()->getTableFieldDesc()->size() > sal_uInt16(nId-1),"ID is to great!"); + OSL_ENSURE(static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size() > sal_uInt16(nId-1),"ID is to great!"); - OTableFieldDesc* pDesc = (*getDesignView()->getController()->getTableFieldDesc())[(sal_uInt32)(nId - 1)] ; + OTableFieldDesc* pDesc = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[(sal_uInt32)(nId - 1)] ; pDesc->SetColWidth( (sal_uInt16)GetColumnWidth(nId) ); // hat er sich vorher leider nicht gemerkt // UndoAction erzeugen @@ -1092,15 +1101,15 @@ void OSelectionBrowseBox::RemoveField(sal_uInt16 nId, sal_Bool bActivate) pUndoAction->SetTabFieldDescr(pDesc); pUndoAction->SetOwnership(sal_True); pUndoAction->SetColId( nId ); - getDesignView()->getController()->getUndoMgr()->AddUndoAction( pUndoAction ); + static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->AddUndoAction( pUndoAction ); RemoveColumn(nId); // damit das Ganze potentiell unendlich ist, zieht ein Remove auch gleich ein Insert einer leeren Spalte nach sich // AppendNewCol(1); - getDesignView()->getController()->InvalidateFeature(ID_BROWSER_UNDO); - getDesignView()->getController()->InvalidateFeature(ID_BROWSER_REDO); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature(ID_BROWSER_UNDO); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature(ID_BROWSER_REDO); } //------------------------------------------------------------------------------ @@ -1142,7 +1151,7 @@ void OSelectionBrowseBox::MouseButtonUp(const BrowserMouseEvent& rEvt) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); DbBrowseBox::MouseButtonUp( rEvt ); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); } //------------------------------------------------------------------------------ @@ -1186,24 +1195,24 @@ OTableFieldDesc* OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt ) DBG_CHKTHIS(OSelectionBrowseBox,NULL); // es koennen mehrere angelegt werden, aber der Erste // wird returnt - sal_uInt32 nCount = getDesignView()->getController()->getTableFieldDesc()->size(); + sal_uInt32 nCount = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size(); OTableFieldDesc* pNewDesc; for (sal_uInt16 i=0 ; i<nCnt ; i++) { pNewDesc = new OTableFieldDesc; pNewDesc->SetColWidth(DEFAULT_SIZE); - getDesignView()->getController()->getTableFieldDesc()->push_back(pNewDesc); - InsertDataColumn((sal_uInt16)getDesignView()->getController()->getTableFieldDesc()->size(), String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND); + static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->push_back(pNewDesc); + InsertDataColumn((sal_uInt16)static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size(), String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND); } - return (*getDesignView()->getController()->getTableFieldDesc())[nCount]; + return (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nCount]; } //------------------------------------------------------------------------------ void OSelectionBrowseBox::DeleteFields(const String& rAliasName) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - if (getDesignView()->getController()->getTableFieldDesc()->size()) + if (static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size()) { sal_uInt16 nColId = GetCurColumnId(); sal_uInt32 nRow = GetCurRow(); @@ -1212,9 +1221,9 @@ void OSelectionBrowseBox::DeleteFields(const String& rAliasName) if (bWasEditing) DeactivateCell(); - ::std::vector<OTableFieldDesc*>::reverse_iterator aIter = getDesignView()->getController()->getTableFieldDesc()->rbegin(); + ::std::vector<OTableFieldDesc*>::reverse_iterator aIter = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->rbegin(); OTableFieldDesc* pEntry = NULL; - for(sal_Int32 nPos=getDesignView()->getController()->getTableFieldDesc()->size();aIter != getDesignView()->getController()->getTableFieldDesc()->rend();++aIter,--nPos) + for(sal_Int32 nPos=static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size();aIter != static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->rend();++aIter,--nPos) { pEntry = *aIter; if (pEntry->GetAlias() == ::rtl::OUString(rAliasName) ) @@ -1236,7 +1245,7 @@ void OSelectionBrowseBox::SetColWidth() for( sal_uInt16 nColId=1; nColId<=nColCount; nColId++ ) { - nColWidth = getDesignView()->getController()->getColWidth( nColId ); + nColWidth = static_cast<OQueryController*>(getDesignView()->getController())->getColWidth( nColId ); if( nColWidth == 0) nColWidth = DEFAULT_SIZE; @@ -1256,7 +1265,7 @@ void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth) SetColumnWidth(nColId, nNewWidth); // der FieldDescription Bescheid sagen - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId - 1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId - 1]; if (pEntry) pEntry->SetColWidth(sal_uInt16(GetColumnWidth(nColId))); @@ -1284,9 +1293,9 @@ Rectangle OSelectionBrowseBox::GetInvalidRect( sal_uInt16 nColId ) void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - DBG_ASSERT(getDesignView()->getController()->getTableFieldDesc()->size() == sal_uInt16(ColCount() - 1), "OSelectionBrowseBox::InsertColumn : inkonsistent state !"); + DBG_ASSERT(static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size() == sal_uInt16(ColCount() - 1), "OSelectionBrowseBox::InsertColumn : inkonsistent state !"); // das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn - DBG_ASSERT(sal_uInt16(nColId == -1) || (nColId <= getDesignView()->getController()->getTableFieldDesc()->size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId."); + DBG_ASSERT(sal_uInt16(nColId == -1) || (nColId <= static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId."); // -1 heisst ganz hinten, Count heisst ganz hinten, der Rest bezeichnet eine richtige Position sal_uInt16 nCurCol = GetCurColumnId(); @@ -1296,33 +1305,33 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId) // Gueltigkeit von nColId pruefen (ColId von 1 bis ...) // Wenn zu klein oder zu gross, auf Ende der Liste setzen - if ((nColId == -1) || (sal_uInt16(nColId) >= getDesignView()->getController()->getTableFieldDesc()->size())) // Anhaengen des Feldes + if ((nColId == -1) || (sal_uInt16(nColId) >= static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size())) // Anhaengen des Feldes { if (FindFirstFreeCol(nColId) == NULL) // keine freie Column mehr { AppendNewCol(1); - nColId = getDesignView()->getController()->getTableFieldDesc()->size(); + nColId = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size(); } else nColId++; // innerhalb der vorgegebenen Liste } // in Liste der Spaltenbeschreibungen neues Element - getDesignView()->getController()->getTableFieldDesc()->insert( getDesignView()->getController()->getTableFieldDesc()->begin()+(sal_uInt32)nColId-1 ,pEntry); + static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->insert( static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin()+(sal_uInt32)nColId-1 ,pEntry); // da ich meine Spaltenzahl immer auf dem selben Wert wie die Zahl der FieldDescriptions halten muss (plus 1, da es eine // HandleClumn gibt), muss ich fuer diese gerade eingefuegte Description auch eine loeschen long nFirstFreeCol = -1; CheckFreeColumns(nFirstFreeCol); // (es kann sein, dass es keine leere gab, dann erzwingt CheckFreeColumns das) - delete (*getDesignView()->getController()->getTableFieldDesc())[(sal_uInt16)nFirstFreeCol]; - getDesignView()->getController()->getTableFieldDesc()->erase(getDesignView()->getController()->getTableFieldDesc()->begin()+(sal_uInt16)nFirstFreeCol); + delete (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[(sal_uInt16)nFirstFreeCol]; + static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->erase(static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin()+(sal_uInt16)nFirstFreeCol); // jetzt kann wieder keine leere Spalte vorhanden sein (falls naemlich die soeben geloeschte die einzige war) ... CheckFreeColumns(nFirstFreeCol); // Nachfolgende Spalten optisch verschieben - sal_uInt16 nCount = (sal_uInt16)getDesignView()->getController()->getTableFieldDesc()->size(); + sal_uInt16 nCount = (sal_uInt16)static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size(); for (sal_uInt16 i = nCount-1; i > nColId; --i) SetColumnWidth(i, GetColumnWidth(i - 1)); @@ -1334,11 +1343,11 @@ void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId) Invalidate( aInvalidRect ); ActivateCell( nCurRow, nCurCol ); - getDesignView()->getController()->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_UNDO ); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_REDO ); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_UNDO ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_REDO ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); } //------------------------------------------------------------------------------ @@ -1397,7 +1406,7 @@ OTableFieldDesc* OSelectionBrowseBox::InsertField(const OTableFieldDesc& rInfo, pUndoAction->SetTabFieldDescr( pEntry ); pUndoAction->SetOwnership(sal_False); pUndoAction->SetColId( nColId ); - getDesignView()->getController()->getUndoMgr()->AddUndoAction( pUndoAction ); + static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->AddUndoAction( pUndoAction ); return pEntry; } @@ -1406,10 +1415,10 @@ OTableFieldDesc* OSelectionBrowseBox::InsertField(const OTableFieldDesc& rInfo, sal_uInt16 OSelectionBrowseBox::FieldsCount() { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin(); sal_uInt16 nCount = 0; - while (aIter != getDesignView()->getController()->getTableFieldDesc()->end()) + while (aIter != static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end()) { if ((*aIter) && !(*aIter)->IsEmpty()) nCount++; @@ -1423,9 +1432,9 @@ sal_uInt16 OSelectionBrowseBox::FieldsCount() OTableFieldDesc* OSelectionBrowseBox::FindFirstFreeCol( long& rCol ) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin(); rCol = -1; - while (aIter != getDesignView()->getController()->getTableFieldDesc()->end()) + while (aIter != static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end()) { ++rCol; if ((*aIter) && (*aIter)->IsEmpty()) @@ -1453,9 +1462,9 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDesc& rInfo ) DBG_CHKTHIS(OSelectionBrowseBox,NULL); DBG_ASSERT(!rInfo.IsEmpty(),"AddGroupBy:: OTableFieldDesc sollte nicht Empty sein!"); OTableFieldDesc* pEntry; - ::comphelper::UStringMixEqual bCase(getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); - ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); - for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + ::comphelper::UStringMixEqual bCase(static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin(); + for(;aIter != static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end();++aIter) { pEntry = *aIter; OSL_ENSURE(pEntry,"OTableFieldDesc was null!"); @@ -1479,7 +1488,7 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDesc& rInfo ) } } - if (aIter == getDesignView()->getController()->getTableFieldDesc()->end()) + if (aIter == static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end()) { OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False ); if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen @@ -1492,10 +1501,10 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDesc& rInfo, const Stri DBG_CHKTHIS(OSelectionBrowseBox,NULL); DBG_ASSERT(!rInfo.IsEmpty(),"AddCondition:: OTableFieldDesc sollte nicht Empty sein!"); OTableFieldDesc* pEntry; - ::comphelper::UStringMixEqual bCase(getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ::comphelper::UStringMixEqual bCase(static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); - ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); - for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin(); + for(;aIter != static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end();++aIter) { pEntry = *aIter; ::rtl::OUString aField = pEntry->GetField(); @@ -1527,7 +1536,7 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDesc& rInfo, const Stri } } - if (aIter == getDesignView()->getController()->getTableFieldDesc()->end()) + if (aIter == static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end()) { OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False ); if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen @@ -1553,10 +1562,10 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDesc& rInfo, const EOrderDi // nPos merkt sich die Spalte in die Sortierung eingetragen wird, // da weitere Sortierungen nur dahinter abgelegt werden duerfen OTableFieldDesc* pEntry; - ::comphelper::UStringMixEqual bCase(getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ::comphelper::UStringMixEqual bCase(static_cast<OQueryController*>(getDesignView()->getController())->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); - ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); - for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + ::std::vector<OTableFieldDesc*>::iterator aIter = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->begin(); + for(;aIter != static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end();++aIter) { pEntry = *aIter; ::rtl::OUString aField = pEntry->GetField(); @@ -1568,12 +1577,12 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDesc& rInfo, const EOrderDi if(!m_bOrderByUnRelated) pEntry->SetVisible(sal_True); pEntry->SetOrderDir( eDir ); - nPos = getDesignView()->getController()->getTableFieldDesc()->end() - aIter; + nPos = static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end() - aIter; break; } } - if (aIter == getDesignView()->getController()->getTableFieldDesc()->end()) + if (aIter == static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->end()) { OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False ); if(pTmp) @@ -1583,7 +1592,7 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDesc& rInfo, const EOrderDi pTmp->SetOrderDir( eDir ); } - nPos = (sal_uInt16)( getDesignView()->getController()->getTableFieldDesc()->size()-1 ); + nPos = (sal_uInt16)( static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size()-1 ); } } @@ -1611,7 +1620,7 @@ void OSelectionBrowseBox::CellModified() { case BROW_VIS_ROW: { - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[GetCurColumnId() - 1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[GetCurColumnId() - 1]; sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos(); if(!m_bOrderByUnRelated && nIdx > 0 && nIdx != sal_uInt16(-1)) { @@ -1623,7 +1632,7 @@ void OSelectionBrowseBox::CellModified() } break; } - getDesignView()->getController()->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); } //------------------------------------------------------------------------------ @@ -1657,7 +1666,7 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt) if (nRow < 0 && nColId > HANDLE_ID && IsColumnSelected(nColId) ) { - if (!getDesignView()->getController()->isReadOnly()) + if (!static_cast<OQueryController*>(getDesignView()->getController())->isReadOnly()) { PopupMenu aContextMenu(ModuleRes(RID_QUERYCOLPOPUPMENU)); switch (aContextMenu.Execute(this, aPoint)) @@ -1670,36 +1679,36 @@ void OSelectionBrowseBox::Command(const CommandEvent& rEvt) } else if(nRow >= 0 && nColId <= HANDLE_ID) { - if (!getDesignView()->getController()->isReadOnly()) + if (!static_cast<OQueryController*>(getDesignView()->getController())->isReadOnly()) { PopupMenu aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU)); aContextMenu.CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]); aContextMenu.CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]); aContextMenu.CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]); - aContextMenu.CheckItem( ID_QUERY_DISTINCT, getDesignView()->getController()->isDistinct()); + aContextMenu.CheckItem( ID_QUERY_DISTINCT, static_cast<OQueryController*>(getDesignView()->getController())->isDistinct()); switch (aContextMenu.Execute(this, aPoint)) { case ID_QUERY_FUNCTION: SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW)); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_VIEW_FUNCTIONS ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_VIEW_FUNCTIONS ); break; case ID_QUERY_TABLENAME: SetRowVisible(BROW_TABLE_ROW, !IsRowVisible(BROW_TABLE_ROW)); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_VIEW_TABLES ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_VIEW_TABLES ); break; case ID_QUERY_ALIASNAME: SetRowVisible(BROW_COLUMNALIAS_ROW, !IsRowVisible(BROW_COLUMNALIAS_ROW)); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_VIEW_ALIASES ); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_VIEW_ALIASES ); break; case ID_QUERY_DISTINCT: - getDesignView()->getController()->setDistinct(!getDesignView()->getController()->isDistinct()); - getDesignView()->getController()->setModified(); - getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_DISTINCT_VALUES ); + static_cast<OQueryController*>(getDesignView()->getController())->setDistinct(!static_cast<OQueryController*>(getDesignView()->getController())->isDistinct()); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->InvalidateFeature( ID_BROWSER_QUERY_DISTINCT_VALUES ); break; } - getDesignView()->getController()->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); } } else @@ -1816,7 +1825,7 @@ void OSelectionBrowseBox::SetNoneVisbleRow(long nRows) String OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId-1]; DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellText : invalid column id, prepare for GPF ... "); if(pEntry->IsEmpty()) return String(); @@ -1900,7 +1909,7 @@ String OSelectionBrowseBox::GetCellContents(sal_uInt16 nCellIndex, long nColId) DBG_ASSERT(nCellIndex < (GetRowCount()-1),"CellIndex ist zu gross"); SaveModified(); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId - 1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId - 1]; DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellContents : invalid column id, prepare for GPF ... "); @@ -1929,7 +1938,7 @@ void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const St if (bWasEditing) DeactivateCell(); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId - 1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId - 1]; DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::SetCellContents : invalid column id, prepare for GPF ... "); long nCellIndex = GetRealRow(nRow); @@ -1974,13 +1983,13 @@ void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const St if (bWasEditing) ActivateCell(nCellIndex, nColId); - getDesignView()->getController()->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); } //------------------------------------------------------------------------------ sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRow, sal_uInt16 nColId) const { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId-1]; if (!pEntry) return DEFAULT_SIZE; @@ -1994,17 +2003,17 @@ sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRow, sal_uInt16 nColId) //------------------------------------------------------------------------------ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId) { - if (getDesignView()->getController()->isReadOnly()) + if (static_cast<OQueryController*>(getDesignView()->getController())->isReadOnly()) return; // The resizing of columns can't be suppressed (BrowseBox doesn't support that) so we have to do this // fake. It's not _that_ bad : the user may change column widths while in read-only mode to see all details // but the changes aren't permanent ... DBG_CHKTHIS(OSelectionBrowseBox,NULL); - DBG_ASSERT(nColId <= getDesignView()->getController()->getTableFieldDesc()->size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!"); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + DBG_ASSERT(nColId <= static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!"); + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId-1]; DBG_ASSERT(pEntry, "OSelectionBrowseBox::ColumnResized : keine FieldDescription !"); - getDesignView()->getController()->setModified(); + static_cast<OQueryController*>(getDesignView()->getController())->setModified(); DbBrowseBox::ColumnResized(nColId); if (pEntry) @@ -2012,7 +2021,7 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId) OTabFieldSizedUndoAct* pUndo = new OTabFieldSizedUndoAct(this); pUndo->SetColId(nColId); pUndo->SetOriginalWidth(pEntry->GetColWidth()); - getDesignView()->getController()->getUndoMgr()->AddUndoAction(pUndo); + static_cast<OQueryController*>(getDesignView()->getController())->getUndoMgr()->AddUndoAction(pUndo); pEntry->SetColWidth(sal_uInt16(GetColumnWidth(nColId))); } } @@ -2021,9 +2030,9 @@ void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId) sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRowId, sal_uInt16 nColId) { DBG_CHKTHIS(OSelectionBrowseBox,NULL); - DBG_ASSERT((nColId == 0) || (nColId <= getDesignView()->getController()->getTableFieldDesc()->size()), "OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId"); + DBG_ASSERT((nColId == 0) || (nColId <= static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc()->size()), "OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId"); - OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + OTableFieldDesc* pEntry = (*static_cast<OQueryController*>(getDesignView()->getController())->getTableFieldDesc())[nColId-1]; DBG_ASSERT(pEntry!=NULL, "OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription !"); long nRow = GetRealRow(nRowId); diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx index 093c2ca3a..7f4cb0f28 100644 --- a/dbaccess/source/ui/querydesign/TableConnection.cxx +++ b/dbaccess/source/ui/querydesign/TableConnection.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableConnection.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-05 09:21:31 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,8 +70,8 @@ #ifndef _TOOLS_DEBUG_HXX #include <tools/debug.hxx> #endif -#ifndef DBAUI_QUERYTABLEVIEW_HXX -#include "QueryTableView.hxx" +#ifndef DBAUI_JOINTABLEVIEW_HXX +#include "JoinTableView.hxx" #endif #ifndef _COMPHELPER_STLTYPES_HXX_ #include <comphelper/stl_types.hxx> @@ -87,7 +87,7 @@ TYPEINIT0(OTableConnection); //======================================================================== DBG_NAME(OTableConnection); //------------------------------------------------------------------------ -OTableConnection::OTableConnection( OQueryTableView* _pContainer, OTableConnectionData* _pTabConnData ) +OTableConnection::OTableConnection( OJoinTableView* _pContainer, OTableConnectionData* _pTabConnData ) :m_bSelected( FALSE ) ,m_pParent( _pContainer ) ,m_pData( _pTabConnData ) diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx index 11ea85eb0..a6a98e284 100644 --- a/dbaccess/source/ui/querydesign/TableWindow.cxx +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindow.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:04:37 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -177,22 +177,22 @@ OTableWindow::~OTableWindow() DBG_DTOR(OTableWindow,NULL); } // ----------------------------------------------------------------------------- -const OQueryTableView* OTableWindow::getTableView() const +const OJoinTableView* OTableWindow::getTableView() const { - OSL_ENSURE(static_cast<OQueryTableView*>(GetParent()),"No OQueryTableView!"); - return static_cast<OQueryTableView*>(GetParent()); + OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!"); + return static_cast<OJoinTableView*>(GetParent()); } // ----------------------------------------------------------------------------- -OQueryTableView* OTableWindow::getTableView() +OJoinTableView* OTableWindow::getTableView() { - OSL_ENSURE(static_cast<OQueryTableView*>(GetParent()),"No OQueryTableView!"); - return static_cast<OQueryTableView*>(GetParent()); + OSL_ENSURE(static_cast<OJoinTableView*>(GetParent()),"No OJoinTableView!"); + return static_cast<OJoinTableView*>(GetParent()); } // ----------------------------------------------------------------------------- -OQueryDesignView* OTableWindow::getDesignView() +OJoinDesignView* OTableWindow::getDesignView() { - OSL_ENSURE(static_cast<OQueryDesignView*>(GetParent()->GetParent()->GetParent()),"No OQueryDesignView!"); - return static_cast<OQueryDesignView*>(GetParent()->GetParent()->GetParent()); + OSL_ENSURE(static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent()),"No OJoinDesignView!"); + return static_cast<OJoinDesignView*>(GetParent()->GetParent()->GetParent()); } //------------------------------------------------------------------------------ void OTableWindow::SetPosPixel( const Point& rNewPos ) @@ -294,13 +294,13 @@ void OTableWindow::EmptyListBox() BOOL OTableWindow::Init() { // get the from the connection - OQueryDesignView* pParent = getDesignView(); + OJoinDesignView* pParent = getDesignView(); Reference<XConnection > xConnection = pParent->getController()->getConnection(); Reference<XTablesSupplier> xSups(xConnection,UNO_QUERY); OSL_ENSURE(xSups.is(),"The connection isn't a tablessupplier!"); Reference<XNameAccess> xTables = xSups->getTables(); - ::rtl::OUString aName = GetTableName(); + ::rtl::OUString aName = GetComposedName(); if(!xTables->hasByName(aName)) return FALSE; @@ -396,7 +396,7 @@ void OTableWindow::MouseMove( const MouseEvent& rEvt ) { Window::MouseMove(rEvt); - OQueryTableView* pCont = getTableView(); + OJoinTableView* pCont = getTableView(); if (pCont->getDesignView()->getController()->isReadOnly()) return; @@ -469,7 +469,7 @@ void OTableWindow::Resize() // Modify Flag des Documents nicht beim ersten Resize setzen if( IsVisible() ) { - OQueryTableView* pTabWinCont = getTableView(); + OJoinTableView* pTabWinCont = getTableView(); // pTabWinCont->GetViewShell()->GetShell->SetModified( TRUE ); } @@ -536,7 +536,7 @@ void OTableWindow::Remove() { ////////////////////////////////////////////////////////////////// // Fenster loeschen - OQueryTableView* pTabWinCont = getTableView(); + OJoinTableView* pTabWinCont = getTableView(); pTabWinCont->RemoveTabWin( this ); pTabWinCont->Invalidate(); } diff --git a/dbaccess/source/ui/querydesign/TableWindowData.cxx b/dbaccess/source/ui/querydesign/TableWindowData.cxx index 79edc386e..2a03948d4 100644 --- a/dbaccess/source/ui/querydesign/TableWindowData.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowData.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindowData.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-02-05 16:17:40 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -135,6 +135,7 @@ void OTableWindowData::Load(const Reference<XObjectInputStream>& _rxIn) _rxIn >> m_aPosition.Y(); _rxIn >> m_aSize.Width(); _rxIn >> m_aSize.Height(); + _rxIn >> m_bShowAll; } //------------------------------------------------------------------------------ void OTableWindowData::Save(const Reference<XObjectOutputStream>& _rxOut) @@ -147,4 +148,7 @@ void OTableWindowData::Save(const Reference<XObjectOutputStream>& _rxOut) _rxOut << m_aPosition.Y(); _rxOut << m_aSize.Width(); _rxOut << m_aSize.Height(); -}
\ No newline at end of file + _rxOut << m_bShowAll; +} +// ----------------------------------------------------------------------------- + diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index 4a43afd7e..c0893358c 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindowListBox.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:04:37 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -132,8 +132,8 @@ SvLBoxEntry* OTableWindowListBox::GetEntryFromText( const String& rEntryText ) // Liste durchiterieren SvTreeList* pTreeList = GetModel(); SvLBoxEntry* pEntry = (SvLBoxEntry*)pTreeList->First(); - OQueryDesignView* pView = m_pTabWin->getDesignView(); - OQueryController* pController = pView->getController(); + OJoinDesignView* pView = m_pTabWin->getDesignView(); + OJoinController* pController = pView->getController(); Reference<XDatabaseMetaData> xMeta = pController->getConnection()->getMetaData(); BOOL bCase = xMeta->storesMixedCaseQuotedIdentifiers(); diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx index 3d4e1d7ab..c52dd30f6 100644 --- a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindowTitle.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2001-02-14 14:54:11 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -100,8 +100,8 @@ #ifndef DBAUI_QUERYDESIGNVIEW_HXX #include "QueryDesignView.hxx" #endif -#ifndef DBAUI_QUERYCONTROLLER_HXX -#include "querycontroller.hxx" +#ifndef DBAUI_JOINCONTROLLER_HXX +#include "JoinController.hxx" #endif using namespace dbaui; @@ -238,6 +238,7 @@ void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt ) (*aIter)->RecalcLines(); pView->InvalidateConnections(); + pView->getDesignView()->getController()->setModified(sal_True); } else { diff --git a/dbaccess/source/ui/querydesign/makefile.mk b/dbaccess/source/ui/querydesign/makefile.mk index 7ab4bf4a1..9bf81e1f5 100644 --- a/dbaccess/source/ui/querydesign/makefile.mk +++ b/dbaccess/source/ui/querydesign/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: oj $ $Date: 2001-02-14 14:54:11 $ +# last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -74,6 +74,8 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- SLOFILES =\ + $(SLO)$/JoinDesignView.obj \ + $(SLO)$/JoinController.obj \ $(SLO)$/ParseContext.obj \ $(SLO)$/QueryDesignView.obj \ $(SLO)$/TableFieldData.obj \ diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src index f97252047..e3a4eb203 100644 --- a/dbaccess/source/ui/querydesign/query.src +++ b/dbaccess/source/ui/querydesign/query.src @@ -2,9 +2,9 @@ * * $RCSfile: query.src,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:04:37 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1363,7 +1363,6 @@ ToolBox RID_BRW_QUERYDESIGN_TOOLBOX */ }; }; - QueryBox QUERY_DESIGN_SAVEMODIFIED { Buttons = WB_YES_NO_CANCEL ; diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index b617b10f4..b3f826941 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -2,9 +2,9 @@ * * $RCSfile: querycontroller.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-02-23 15:04:37 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -229,26 +229,21 @@ Reference< XInterface > SAL_CALL OQueryController::Create(const Reference<XMulti return *(new OQueryController(_rxFactory)); } // ----------------------------------------------------------------------------- -OQueryController::OQueryController(const Reference< XMultiServiceFactory >& _rM) : OGenericUnoController(_rM) - ,m_bEditable(sal_True) +OQueryController::OQueryController(const Reference< XMultiServiceFactory >& _rM) + : OJoinController(_rM) ,m_bDesign(sal_False) ,m_bDistinct(sal_False) ,m_bViewAlias(sal_False) ,m_bViewTable(sal_False) ,m_bViewFunction(sal_False) - ,m_bModified(sal_False) ,m_bEsacpeProcessing(sal_True) - ,m_bOwnConnection(sal_False) - ,m_pAddTabDlg(NULL) ,m_pSqlIterator(NULL) - ,m_aZoom(1,1) ,m_nSplitPos(-1) ,m_nVisibleRows(0x400) { m_pParseContext = new OQueryParseContext(); m_pSqlParser = new OSQLParser(_rM,m_pParseContext); InvalidateAll(); - } // ----------------------------------------------------------------------------- OQueryController::~OQueryController() @@ -257,10 +252,6 @@ OQueryController::~OQueryController() // ----------------------------------------------------------------------------- void OQueryController::dispose() { - OGenericUnoController::dispose(); - m_pAddTabDlg = NULL; - delete m_pView; - if(m_pSqlIterator) { delete m_pSqlIterator->getParseTree(); @@ -272,18 +263,6 @@ void OQueryController::dispose() delete m_pParseContext; { - ::std::vector< OTableConnectionData*>::iterator aIter = m_vTableConnectionData.begin(); - for(;aIter != m_vTableConnectionData.end();++aIter) - delete *aIter; - m_vTableConnectionData.clear(); - } - { - ::std::vector< OTableWindowData*>::iterator aIter = m_vTableData.begin(); - for(;aIter != m_vTableData.end();++aIter) - delete *aIter; - m_vTableData.clear(); - } - { ::std::vector< OTableFieldDesc*>::iterator aIter = m_vTableFieldDesc.begin(); for(;aIter != m_vTableFieldDesc.end();++aIter) delete *aIter; @@ -294,18 +273,7 @@ void OQueryController::dispose() m_pWindow = NULL; // don't delete this window it will be deleted by the frame ::comphelper::disposeComponent(m_xComposer); - if(m_bOwnConnection) - { - // we have to remove ourself before dispoing the connection - Reference< XComponent > xComponent(m_xConnection, UNO_QUERY); - if (xComponent.is()) - { - Reference< ::com::sun::star::lang::XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY); - xComponent->removeEventListener(xEvtL); - } - ::comphelper::disposeComponent(m_xConnection); - } - m_xConnection = NULL; + OJoinController::dispose(); } // ----------------------------------------------------------------------------- FeatureState OQueryController::GetState(sal_uInt16 _nId) @@ -343,29 +311,17 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) case ID_BROWSER_PASTE: aReturn.bEnabled = m_bEditable; break; - case ID_BROWSER_UNDO: - aReturn.bEnabled = m_bEditable && m_aUndoManager.GetUndoActionCount() != 0; - break; - case ID_BROWSER_REDO: - aReturn.bEnabled = m_bEditable && m_aUndoManager.GetRedoActionCount() != 0; - break; case ID_BROWSER_SQL: aReturn.bEnabled = m_bEsacpeProcessing; aReturn.aState = ::cppu::bool2any(m_bDesign); break; - case ID_BROWSER_ADDTABLE: - if(aReturn.bEnabled = static_cast<OQueryViewSwitch*>(getQueryView())->IsAddAllowed()) - aReturn.aState = ::cppu::bool2any(m_pAddTabDlg && m_pAddTabDlg->IsVisible()); - else - aReturn.aState = ::cppu::bool2any(sal_False); - break; case ID_BROWSER_CLEAR_QUERY: aReturn.bEnabled = m_bEditable; break; case ID_BROWSER_QUERY_VIEW_FUNCTIONS: case ID_BROWSER_QUERY_VIEW_TABLES: case ID_BROWSER_QUERY_VIEW_ALIASES: - aReturn.aState = ::cppu::bool2any(static_cast<OQueryViewSwitch*>(getQueryView())->isSlotEnabled(_nId)); + aReturn.aState = ::cppu::bool2any(m_pWindow->getView()->isSlotEnabled(_nId)); break; case ID_BROWSER_QUERY_DISTINCT_VALUES: aReturn.aState = ::cppu::bool2any(m_bDistinct); @@ -373,6 +329,9 @@ FeatureState OQueryController::GetState(sal_uInt16 _nId) case ID_BROWSER_QUERY_EXECUTE: aReturn.bEnabled = sal_True; break; + default: + aReturn = OJoinController::GetState(_nId); + break; } return aReturn; } @@ -471,7 +430,7 @@ void OQueryController::Execute(sal_uInt16 _nId) // now we save the layout information // create the output stream - static_cast<OQueryViewSwitch*>(m_pView)->SaveUIConfig(); + m_pWindow->getView()->SaveUIConfig(); Sequence< sal_Int8 > aOutputSeq; { Reference< XOutputStream> xOutStreamHelper = new OSequenceOutputStream(aOutputSeq); @@ -516,14 +475,6 @@ void OQueryController::Execute(sal_uInt16 _nId) case ID_BROWSER_PASTE: getQueryView()->paste(); break; - case ID_BROWSER_UNDO: - m_aUndoManager.Undo(); - InvalidateFeature(ID_BROWSER_REDO); - break; - case ID_BROWSER_REDO: - m_aUndoManager.Redo(); - InvalidateFeature(ID_BROWSER_UNDO); - break; case ID_BROWSER_SQL: { try @@ -553,7 +504,7 @@ void OQueryController::Execute(sal_uInt16 _nId) else { const OSQLTables& xTabs = m_pSqlIterator->getTables(); - if( m_pSqlIterator->getStatementType() != SQL_STATEMENT_SELECT && m_pSqlIterator->getStatementType() != SQL_STATEMENT_SELECT_COUNT || xTabs.begin() != xTabs.end()) + if( m_pSqlIterator->getStatementType() != SQL_STATEMENT_SELECT && m_pSqlIterator->getStatementType() != SQL_STATEMENT_SELECT_COUNT || xTabs.begin() == xTabs.end()) { ErrorBox aBox( getQueryView(), ModuleRes( ERR_QRY_NOSELECT ) ); aBox.Execute(); @@ -567,7 +518,7 @@ void OQueryController::Execute(sal_uInt16 _nId) m_xConnection->getMetaData(), &getParser()->getContext(), sal_True,sal_True); - static_cast<OQueryViewSwitch*>(m_pView)->SaveUIConfig(); + m_pWindow->getView()->SaveUIConfig(); m_pWindow->switchView(); } } @@ -591,14 +542,6 @@ void OQueryController::Execute(sal_uInt16 _nId) InvalidateFeature(ID_BROWSER_ADDTABLE); } break; - case ID_BROWSER_ADDTABLE: - if(!m_pAddTabDlg) - m_pAddTabDlg = static_cast<OQueryViewSwitch*>(m_pView)->getAddTableDialog(); - if(m_pAddTabDlg->IsVisible()) - m_pAddTabDlg->Show(!m_pAddTabDlg->IsVisible()); - else if(static_cast<OQueryViewSwitch*>(getQueryView())->IsAddAllowed()) - m_pAddTabDlg->Show(!m_pAddTabDlg->IsVisible()); - break; case ID_BROWSER_CLEAR_QUERY: getQueryView()->clear(); m_sStatement = ::rtl::OUString(); @@ -609,7 +552,7 @@ void OQueryController::Execute(sal_uInt16 _nId) case ID_BROWSER_QUERY_VIEW_FUNCTIONS: case ID_BROWSER_QUERY_VIEW_TABLES: case ID_BROWSER_QUERY_VIEW_ALIASES: - static_cast<OQueryViewSwitch*>(getQueryView())->setSlotEnabled(_nId,!static_cast<OQueryViewSwitch*>(getQueryView())->isSlotEnabled(_nId)); + m_pWindow->getView()->setSlotEnabled(_nId,!m_pWindow->getView()->isSlotEnabled(_nId)); break; case ID_BROWSER_QUERY_DISTINCT_VALUES: m_bDistinct = !m_bDistinct; @@ -728,6 +671,9 @@ void OQueryController::Execute(sal_uInt16 _nId) // static_cast<OQueryViewSwitch*>(getQueryView())->zoomTableView(m_aZoom); } break; + default: + OJoinController::Execute(_nId); + return; // else we would invalidate twice } InvalidateFeature(_nId); } @@ -861,7 +807,7 @@ void SAL_CALL OQueryController::initialize( const Sequence< Any >& aArguments ) OSL_ENSURE(m_xFormatter.is(),"No NumberFormatter!"); } } - getView()->initialize(); + m_pWindow->getView()->initialize(); getUndoMgr()->Clear(); if(m_bDesign) Execute(ID_BROWSER_ADDTABLE); @@ -912,7 +858,7 @@ sal_Bool OQueryController::Construct(Window* pParent) // OQueryTextView *pView = new OQueryTextView(pParent,this,m_xMultiServiceFacatory); m_pWindow->getView()->Construct(NULL); // m_pView = pView; - m_pView = m_pWindow->getView(); + m_pView = m_pWindow->getView()->getRealView(); OGenericUnoController::Construct(pParent); // getView()->Show(); m_pWindow->Show(); @@ -976,68 +922,43 @@ ToolBox* OQueryController::CreateToolBox(Window* _pParent) return new ToolBox(_pParent, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); } // ----------------------------------------------------------------------------- -SfxUndoManager* OQueryController::getUndoMgr() -{ - return &m_aUndoManager; -} -// ----------------------------------------------------------------------------- void OQueryController::setModified(sal_Bool _bModified) { - m_bModified = _bModified; + OJoinController::setModified(_bModified); InvalidateFeature(ID_BROWSER_CLEAR_QUERY); - InvalidateFeature(ID_BROWSER_SAVEDOC); InvalidateFeature(ID_BROWSER_SAVEASDOC); InvalidateFeature(ID_BROWSER_QUERY_EXECUTE); } // ----------------------------------------------------------------------------- void SAL_CALL OQueryController::disposing( const EventObject& Source ) throw(RuntimeException) { - if(Reference<XConnection>(Source.Source,UNO_QUERY) == m_xConnection) - { - // our connection was disposed so we need a new one - createNewConnection(sal_True); - } - else if(Reference<XFrame>(Source.Source,UNO_QUERY).is()) + if(Reference<XFrame>(Source.Source,UNO_QUERY).is()) { // the beamer was closed so resize our window m_pWindow->hideBeamer(); } -} -// ----------------------------------------------------------------------------- -void OQueryController::removeConnectionData(const OTableConnectionData* _pData) -{ - delete *(m_vTableConnectionData.erase( ::std::find(m_vTableConnectionData.begin(),m_vTableConnectionData.end(),_pData) )); + else + OJoinController::disposing(Source); } // ----------------------------------------------------------------------------- void OQueryController::createNewConnection(sal_Bool _bUI) { ::comphelper::disposeComponent(m_xComposer); - m_xConnection = NULL; - m_bOwnConnection = sal_False; - - if (!_bUI || (RET_YES == QueryBox(getView(),ModuleRes(QUERY_CONNECTION_LOST)).Execute())) + OJoinController::createNewConnection(_bUI); + if (m_xConnection.is()) { - m_xConnection = connect(m_sDataSourceName); - if (m_bOwnConnection = m_xConnection.is()) - { - // we hide the add table dialog because the tables in it are from the old connection - if(m_pAddTabDlg) - m_pAddTabDlg->Hide(); - InvalidateFeature(ID_BROWSER_ADDTABLE); - setQueryComposer(); - } + // we hide the add table dialog because the tables in it are from the old connection + if(m_pAddTabDlg) + m_pAddTabDlg->Hide(); + InvalidateFeature(ID_BROWSER_ADDTABLE); + setQueryComposer(); } } // ----------------------------------------------------------------------------- void OQueryController::Save(const Reference< XObjectOutputStream>& _rxOut) { + OJoinController::Save(_rxOut); OStreamSection aSection(_rxOut.get()); - // save all tablewindow data - _rxOut << (sal_Int32)m_vTableData.size(); - ::std::vector< OTableWindowData*>::const_iterator aIter = m_vTableData.begin(); - for(;aIter != m_vTableData.end();++aIter) - (*aIter)->Save(_rxOut); - // some data _rxOut << m_nSplitPos; _rxOut << m_nVisibleRows; @@ -1051,25 +972,10 @@ void OQueryController::Save(const Reference< XObjectOutputStream>& _rxOut) // ----------------------------------------------------------------------------- void OQueryController::Load(const Reference< XObjectInputStream>& _rxIn) { + OJoinController::Load(_rxIn); OStreamSection aSection(_rxIn.get()); try { - ////////////////////////////////////////////////////////////////////// - // Liste loeschen - ::std::vector< OTableWindowData*>::iterator aIter = m_vTableData.begin(); - for(;aIter != m_vTableData.end();++aIter) - delete *aIter; - m_vTableData.clear(); - - sal_Int32 nCount = 0; - _rxIn >> nCount; - for(sal_Int32 i=0;i<nCount;++i) - { - OQueryTableWindowData* pData = new OQueryTableWindowData(); - pData->Load(_rxIn); - m_vTableData.push_back(pData); - } - // some data _rxIn >> m_nSplitPos; _rxIn >> m_nVisibleRows; @@ -1081,7 +987,7 @@ void OQueryController::Load(const Reference< XObjectInputStream>& _rxIn) delete *aFieldIter; m_vTableFieldDesc.clear(); - nCount = 0; + sal_Int32 nCount = 0; _rxIn >> nCount; for(sal_Int32 j=0;j<nCount;++j) { @@ -1095,41 +1001,6 @@ void OQueryController::Load(const Reference< XObjectInputStream>& _rxIn) } } // ----------------------------------------------------------------------------- -void OQueryController::SaveTabWinPosSize(OQueryTableWindow* pTabWin, long nOffsetX, long nOffsetY) -{ - // die Daten zum Fenster - OTableWindowData* pData = pTabWin->GetData(); - DBG_ASSERT(pData != NULL, "SbaQueryDocSh::SaveTabWinPosSize : TabWin hat keine Daten !"); - - // Position & Size der Daten neu setzen (aus den aktuellen Fenster-Parametern) - Point aPos = pTabWin->GetPosPixel(); - aPos.X() += nOffsetX; - aPos.Y() += nOffsetY; - pData->SetPosition(aPos); - pData->SetSize(pTabWin->GetSizePixel()); - -} -// ----------------------------------------------------------------------------- -void OQueryController::SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY ) -{ - // Das Loeschen und Neuanlegen der alten Implementation ist unter dem aktuellen Modell nicht mehr richtig : Die TabWins - // habe einen Zeiger auf ihre Daten, verwaltet werden sie aber von mir. Wenn ich die alten loesche, haben die TabWins - // ploetzlich Zeiger auf nicht mehr existente Objekte. - // Wenn die TabWins ein SetData haetten, koennte ich mir das sparen ... haben sie aber nicht, ausserdem muesste ich dann immer - // noch Informationen, die sich eigentlich nicht geaendert haben, auch neu setzen. - // Also loesche ich die TabWinDatas nicht, sondern aktualisiere sie nur. - DBG_ASSERT(m_vTableData.size() == pTabWinList->size(), - "SbaQueryDocSh::SaveTabWinsPosSize : inkonsistenter Zustand : sollte genausviel TabWinDatas haben wie TabWins !"); - - OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin(); - OQueryTableWindow* pTabWinLoop;// = (QueryTabWin*)pTabWinList->First(); - for(;aIter != pTabWinList->end();++aIter) - { - pTabWinLoop = static_cast<OQueryTableWindow*>(aIter->second); - SaveTabWinPosSize(pTabWinLoop, nOffsetX, nOffsetY); - } -} -// ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/queryview.cxx b/dbaccess/source/ui/querydesign/queryview.cxx index 505ae686a..bb1027b0c 100644 --- a/dbaccess/source/ui/querydesign/queryview.cxx +++ b/dbaccess/source/ui/querydesign/queryview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: queryview.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: oj $ $Date: 2001-02-05 09:34:25 $ + * last change: $Author: oj $ $Date: 2001-02-28 10:18:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -69,6 +69,9 @@ #endif #ifndef _DBAUI_MODULE_DBU_HXX_ #include "moduledbu.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" #endif @@ -77,8 +80,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; // ------------------------------------------------------------------------- OQueryView::OQueryView(Window* _pParent, OQueryController* _pController,const Reference< XMultiServiceFactory >& _rFactory) - :ODataView(_pParent,_rFactory) - ,m_pController(_pController) + :OJoinDesignView(_pParent,_pController,_rFactory) { } // ----------------------------------------------------------------------------- @@ -88,12 +90,13 @@ OQueryView::~OQueryView() // ------------------------------------------------------------------------- void OQueryView::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel) { - ODataView::Construct(xModel); // initialize m_xMe + OJoinDesignView::Construct(xModel); // initialize m_xMe } // ------------------------------------------------------------------------- void OQueryView::resizeControl(Rectangle& _rRect) { + OJoinDesignView::resizeControl(_rRect); } // ----------------------------------------------------------------------------- |