diff options
-rw-r--r-- | dbaccess/source/ui/inc/JoinController.hxx | 22 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/JoinTableView.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/RelationTableView.hxx | 9 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableWindowListBox.hxx | 21 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 8 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/JoinTableView.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindowListBox.cxx | 21 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/RelationTableView.cxx | 97 | ||||
-rw-r--r-- | dbaccess/source/ui/relationdesign/relation.src | 10 |
9 files changed, 143 insertions, 67 deletions
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx index cb6fe445a65e..49d921a8e593 100644 --- a/dbaccess/source/ui/inc/JoinController.hxx +++ b/dbaccess/source/ui/inc/JoinController.hxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinController.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: oj $ $Date: 2001-04-24 14:34:10 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,7 @@ namespace dbaui ::std::vector<OTableWindowData*> m_vTableData; Fraction m_aZoom; + ::dbtools::SQLExceptionInfo m_aExceptionInfo; ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource; @@ -157,6 +158,23 @@ namespace dbaui virtual void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxIn); virtual void Save(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOut); + /** + only defines a method to save a SQLException in d&d methods to show the error at a later state + set the internal member m_aExceptionInfo to _rInfo + */ + void setErrorOccured(const ::dbtools::SQLExceptionInfo& _rInfo) + { + m_aExceptionInfo = _rInfo; + } + /** + just returns the internal member and clears it + */ + ::dbtools::SQLExceptionInfo clearOccuredError() + { + ::dbtools::SQLExceptionInfo aInfo = m_aExceptionInfo; + m_aExceptionInfo = ::dbtools::SQLExceptionInfo(); + return aInfo; + } protected: virtual OTableWindowData* createTableWindowData() = 0; virtual void AddSupportedFeatures(); diff --git a/dbaccess/source/ui/inc/JoinTableView.hxx b/dbaccess/source/ui/inc/JoinTableView.hxx index dafd30915a8c..dd72a1ef88c7 100644 --- a/dbaccess/source/ui/inc/JoinTableView.hxx +++ b/dbaccess/source/ui/inc/JoinTableView.hxx @@ -2,9 +2,9 @@ * * $RCSfile: JoinTableView.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: oj $ $Date: 2001-07-06 09:55:43 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -228,6 +228,12 @@ namespace dbaui virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); + /** + can be used in derevied classes to make some special ui handling + after d&d + */ + virtual void lookForUiActivities(); + protected: virtual void MouseButtonUp( const MouseEvent& rEvt ); virtual void MouseButtonDown( const MouseEvent& rEvt ); @@ -259,7 +265,6 @@ namespace dbaui virtual OTableWindowData* CreateImpl(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& _rWinName); - private: void InitColors(); BOOL ScrollWhileDragging(); diff --git a/dbaccess/source/ui/inc/RelationTableView.hxx b/dbaccess/source/ui/inc/RelationTableView.hxx index 86ec39ab46f8..8d6524297f34 100644 --- a/dbaccess/source/ui/inc/RelationTableView.hxx +++ b/dbaccess/source/ui/inc/RelationTableView.hxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationTableView.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: oj $ $Date: 2001-03-23 09:09:24 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,8 +68,11 @@ namespace dbaui { class ORelationDesignView; + class ORelationTableConnectionData; class ORelationTableView : public OJoinTableView { + OTableConnection* m_pExistingConnection; // is set when a connection was draged on an existing connection + ORelationTableConnectionData* m_pCurrentlyTabConnData; // set when we creating a connection with more than one keycolumn protected: virtual void ConnDoubleClicked( OTableConnection* pConnection ); virtual void KeyInput( const KeyEvent& rEvt ); @@ -90,6 +93,8 @@ namespace dbaui // reisst den Dialog fuer eine voellig neue Relation hoch // wird vom AddTabDlg benutzt, um festzustellen, ob noch Tabellen hinzugefuegt werden duerfen virtual BOOL IsAddAllowed(); + + virtual void lookForUiActivities(); }; } #endif // DBAUI_RELATION_TABLEVIEW_HXX diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx index fb4db8cb0787..2ab7741df7c5 100644 --- a/dbaccess/source/ui/inc/TableWindowListBox.hxx +++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx @@ -2,9 +2,9 @@ * * $RCSfile: TableWindowListBox.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: fs $ $Date: 2001-03-30 13:05:53 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -82,22 +82,18 @@ namespace dbaui class OTableWindowListBox :public SvTreeListBox ,public IDragTransferableListener -#if SUPD<627 - ,public DragSourceHelper - ,public DropTargetHelper -#endif { DECL_LINK( DoubleClickHdl, SvTreeListBox* ); DECL_LINK( ScrollUpHdl, SvTreeListBox* ); DECL_LINK( ScrollDownHdl, SvTreeListBox* ); - Timer m_aScrollTimer; - Point m_aMousePos; + Timer m_aScrollTimer; + Point m_aMousePos; - OTableWindow* m_pTabWin; + OTableWindow* m_pTabWin; - BOOL m_bReallyScrolled : 1; - BOOL m_bDragSource : 1; + BOOL m_bReallyScrolled : 1; + BOOL m_bDragSource : 1; protected: virtual void LoseFocus(); @@ -107,7 +103,8 @@ namespace dbaui virtual long PreNotify(NotifyEvent& rNEvt); - virtual void dragFinished( ); + virtual void dragFinished( ); + public: OTableWindowListBox(OTableWindow* pParent, const String& rDatabaseName, const String& rTableName); diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 9c9809636ac9..58837776f1ba 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -2,9 +2,9 @@ * * $RCSfile: dbu_resource.hrc,v $ * - * $Revision: 1.54 $ + * $Revision: 1.55 $ * - * last change: $Author: oj $ $Date: 2001-07-06 08:13:55 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -440,6 +440,7 @@ #define STR_DSBROWSER_TITLE RID_STRING_START + 179 #define STR_ADABAS_ERROR_SYSTEMTABLES RID_STRING_START + 180 #define STR_TABLEDESIGN_ALTER_ERROR RID_STRING_START + 181 +#define STR_QUERY_REL_DELETE_WINDOW RID_STRING_START + 182 //======================================================================== // untyped resources @@ -454,6 +455,9 @@ /************************************************************************* * history: * $Log: not supported by cvs2svn $ + * Revision 1.54 2001/07/06 08:13:55 oj + * #88923# correct table altering + * * Revision 1.53 2001/07/04 13:09:13 oj * #85663# check if table is accessable and returns data * diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx index ffe08a17cd74..1e02fdd0f584 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.12 $ + * $Revision: 1.13 $ * - * last change: $Author: oj $ $Date: 2001-07-06 11:25:44 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1510,6 +1510,10 @@ void OJoinTableView::dragFinished( ) { } //------------------------------------------------------------------------------ +void OJoinTableView::StartDrag( sal_Int8 nAction, const Point& rPosPixel ) +{ +} +// ----------------------------------------------------------------------------- void OJoinTableView::clearLayoutInformation() { ////////////////////////////////////////////////////////////////////// @@ -1527,10 +1531,9 @@ void OJoinTableView::clearLayoutInformation() GetTabConnList()->clear(); } // ----------------------------------------------------------------------------- -void OJoinTableView::StartDrag( sal_Int8 nAction, const Point& rPosPixel ) +void OJoinTableView::lookForUiActivities() { } // ----------------------------------------------------------------------------- - diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index 95621008c073..499b75c4b146 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.9 $ + * $Revision: 1.10 $ * - * last change: $Author: oj $ $Date: 2001-07-06 09:55:40 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -130,6 +130,10 @@ OTableWindowListBox::OTableWindowListBox( OTableWindow* pParent, const String& r void OTableWindowListBox::dragFinished( ) { m_bDragSource = sal_False; + // first show the error msg when existing + m_pTabWin->getDesignView()->getController()->showError(m_pTabWin->getDesignView()->getController()->clearOccuredError()); + // second look for ui activities which should happen after d&d + m_pTabWin->getTableView()->lookForUiActivities(); } //------------------------------------------------------------------------------ @@ -358,10 +362,17 @@ sal_Int8 OTableWindowListBox::ExecuteDrop( const ExecuteDropEvent& _rEvt ) // source window description OJoinExchangeData jxdSource = OJoinExchObj::GetSourceDescription(_rEvt.maDropEvent.Transferable); - // create the connection - OQueryTableView* pCont = static_cast<OQueryTableView*>(m_pTabWin->getTableView()); - pCont->AddConnection(jxdSource, jxdDest); + try + { + OQueryTableView* pCont = static_cast<OQueryTableView*>(m_pTabWin->getTableView()); + pCont->AddConnection(jxdSource, jxdDest); + } + catch(const SQLException& e) + { + // remember the exception so that we can show them later when d&d is finished + m_pTabWin->getDesignView()->getController()->setErrorOccured(::dbtools::SQLExceptionInfo(e)); + } return DND_ACTION_LINK; } diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx index 4c1b7d6ab31b..0c938a6dfe75 100644 --- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx +++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx @@ -2,9 +2,9 @@ * * $RCSfile: RelationTableView.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: oj $ $Date: 2001-06-28 14:24:04 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,6 +158,8 @@ DBG_NAME(ORelationTableView); //------------------------------------------------------------------------ ORelationTableView::ORelationTableView( Window* pParent, ORelationDesignView* pView ) : OJoinTableView( pParent, pView ) + ,m_pExistingConnection(NULL) + ,m_pCurrentlyTabConnData(NULL) { DBG_CTOR(ORelationTableView,NULL); SetHelpId(HID_CTL_RELATIONTAB); @@ -268,9 +270,7 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const if((pFirst->GetSourceWin() == pSourceWin && pFirst->GetDestWin() == pDestWin) || (pFirst->GetSourceWin() == pDestWin && pFirst->GetDestWin() == pSourceWin)) { - OSQLMessageBox aDlg(this,ModuleRes(STR_QUERY_REL_EDIT_RELATION),String(),WB_YES_NO|WB_DEF_YES); - if(aDlg.Execute() == RET_YES) - ConnDoubleClicked(pFirst); + m_pExistingConnection = pFirst; return; } } @@ -280,8 +280,8 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const OSL_ENSURE(xTablesSup.is(),"ORelationTableView::AddConnection no TablesSupplier"); if(xTablesSup.is()) pTabConnData = new ORelationTableConnectionData(xTablesSup->getTables(), - jxdSource.pListBox->GetTabWin()->GetWinName(), - jxdDest.pListBox->GetTabWin()->GetWinName()); + jxdSource.pListBox->GetTabWin()->GetComposedName(), + jxdDest.pListBox->GetTabWin()->GetComposedName()); // die Namen der betroffenen Felder String aSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry); @@ -309,40 +309,38 @@ void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const } if(nSourceKeys>1) - { - ORelationDialog aRelDlg( this, pTabConnData ); - if (aRelDlg.Execute() == RET_OK) - { - ////////////////////////////////////////////////////////////////// - // Koennen die neuen Daten eine neue Relation erzeugen? -// if (pTabConnData->Update()) - // already updated by the dialog - getDesignView()->getController()->getTableConnectionData()->push_back( pTabConnData); - ORelationTableConnection* pTabConn = new ORelationTableConnection( this, pTabConnData ); - GetTabConnList()->push_back( pTabConn); - Invalidate(); - } - else - delete pTabConnData; - } + m_pCurrentlyTabConnData = pTabConnData; else { pTabConnData->ResetConnLines(); pTabConnData->SetConnLine( 0, aSourceFieldName, aDestFieldName ); - ////////////////////////////////////////////////////////////////////// - // Daten der Datenbank uebergeben - if( pTabConnData->Update() ) + try { ////////////////////////////////////////////////////////////////////// - // UI-Object in ConnListe eintragen - getDesignView()->getController()->getTableConnectionData()->push_back( pTabConnData ); - ORelationTableConnection* pTabConn = new ORelationTableConnection( this, pTabConnData ); - GetTabConnList()->push_back( pTabConn); - Invalidate(); + // Daten der Datenbank uebergeben + if( pTabConnData->Update() ) + { + ////////////////////////////////////////////////////////////////////// + // UI-Object in ConnListe eintragen + getDesignView()->getController()->getTableConnectionData()->push_back( pTabConnData ); + ORelationTableConnection* pTabConn = new ORelationTableConnection( this, pTabConnData ); + GetTabConnList()->push_back( pTabConn); + Invalidate(); + } + else + delete pTabConnData; } - else + catch(const SQLException&) + { delete pTabConnData; + throw; + } + catch(const Exception&) + { + delete pTabConnData; + OSL_ENSURE(0,"ORelationTableView::AddConnection: Exception oocured!"); + } } } @@ -485,8 +483,37 @@ void ORelationTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const // ----------------------------------------------------------------------------- void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin ) { - OJoinTableView::RemoveTabWin( pTabWin ); - m_pView->getController()->InvalidateFeature(ID_REALTION_ADD_RELATION); + OSQLMessageBox aDlg(this,ModuleRes(STR_QUERY_REL_DELETE_WINDOW),String(),WB_YES_NO|WB_DEF_YES,OSQLMessageBox::Warning); + if(aDlg.Execute() == RET_YES) + { + OJoinTableView::RemoveTabWin( pTabWin ); + m_pView->getController()->InvalidateFeature(ID_REALTION_ADD_RELATION); + } +} +// ----------------------------------------------------------------------------- +void ORelationTableView::lookForUiActivities() +{ + if(m_pExistingConnection) + { + OSQLMessageBox aDlg(this,ModuleRes(STR_QUERY_REL_EDIT_RELATION),String(),WB_YES_NO|WB_DEF_YES); + if(aDlg.Execute() == RET_YES) + ConnDoubleClicked(m_pExistingConnection); + m_pExistingConnection = NULL; + } + else if(m_pCurrentlyTabConnData) + { + ORelationDialog aRelDlg( this, m_pCurrentlyTabConnData ); + if (aRelDlg.Execute() == RET_OK) + { + // already updated by the dialog + getDesignView()->getController()->getTableConnectionData()->push_back( m_pCurrentlyTabConnData); + ORelationTableConnection* pTabConn = new ORelationTableConnection( this, m_pCurrentlyTabConnData ); + GetTabConnList()->push_back( pTabConn); + Invalidate(INVALIDATE_NOCHILDREN); + } + else + delete m_pCurrentlyTabConnData; + m_pCurrentlyTabConnData = NULL; + } } // ----------------------------------------------------------------------------- - diff --git a/dbaccess/source/ui/relationdesign/relation.src b/dbaccess/source/ui/relationdesign/relation.src index 143141866cf7..3018aaf71071 100644 --- a/dbaccess/source/ui/relationdesign/relation.src +++ b/dbaccess/source/ui/relationdesign/relation.src @@ -2,9 +2,9 @@ * * $RCSfile: relation.src,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: kz $ $Date: 2001-06-29 02:08:14 $ + * last change: $Author: oj $ $Date: 2001-07-09 06:56:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -601,6 +601,12 @@ Menu RID_RELATION_DESIGN_MAIN_MENU }; }; +String STR_QUERY_REL_DELETE_WINDOW +{ + Text = "Wenn Sie diese Tabelle lschen werden alle zugehrigen Relationen ebenfalls gelscht. Fortfahren?" ; + Text [ ENGLISH ] = "When you delete this table all corresponding relations will be deleted as well. Continue?" ; +}; + |