summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-02-28 09:09:17 +0000
committerOcke Janssen <oj@openoffice.org>2001-02-28 09:09:17 +0000
commit576a23aa42655d5ad0cd4bdd5fee319d0258a329 (patch)
treee7f409fca901a27e9edca8c354bb616bffe18a31
parent0cf53f6d793ba206e286b89309ad915014822933 (diff)
new relation design
-rw-r--r--dbaccess/source/ui/inc/ConnectionLine.hxx131
-rw-r--r--dbaccess/source/ui/inc/ConnectionLineData.hxx124
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx158
-rw-r--r--dbaccess/source/ui/inc/JoinDesignView.hxx132
-rw-r--r--dbaccess/source/ui/inc/JoinExchange.hxx102
-rw-r--r--dbaccess/source/ui/inc/RTableConnectionData.hxx148
-rw-r--r--dbaccess/source/ui/inc/RelationController.hxx128
-rw-r--r--dbaccess/source/ui/inc/RelationDesignView.hxx104
-rw-r--r--dbaccess/source/ui/inc/RelationDlg.hxx206
-rw-r--r--dbaccess/source/ui/inc/RelationTableView.hxx97
-rw-r--r--dbaccess/source/ui/inc/TableConnection.hxx128
-rw-r--r--dbaccess/source/ui/inc/TableConnectionData.hxx141
-rw-r--r--dbaccess/source/ui/inc/TableWindow.hxx191
-rw-r--r--dbaccess/source/ui/inc/TableWindowData.hxx115
-rw-r--r--dbaccess/source/ui/inc/TableWindowListBox.hxx107
-rw-r--r--dbaccess/source/ui/inc/TableWindowTitle.hxx93
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.cxx196
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnection.hxx95
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx506
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx834
-rw-r--r--dbaccess/source/ui/relationdesign/RelationDesignView.cxx162
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx460
-rw-r--r--dbaccess/source/ui/relationdesign/makefile.mk92
-rw-r--r--dbaccess/source/ui/relationdesign/relation.src212
24 files changed, 4662 insertions, 0 deletions
diff --git a/dbaccess/source/ui/inc/ConnectionLine.hxx b/dbaccess/source/ui/inc/ConnectionLine.hxx
new file mode 100644
index 000000000..f39628903
--- /dev/null
+++ b/dbaccess/source/ui/inc/ConnectionLine.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * $RCSfile: ConnectionLine.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:06:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_CONNECTIONLINE_HXX
+#define DBAUI_CONNECTIONLINE_HXX
+
+#ifndef _SV_GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef DBAUI_CONNECTIONLINEDATA_HXX
+#include "ConnectionLineData.hxx"
+#endif
+
+class SvLBoxEntry;
+class OutputDevice;
+namespace dbaui
+{
+
+ //==================================================================
+ // ConnData ---------->* ConnLineData
+ // ^1 ^1
+ // | |
+ // Conn ---------->* ConnLine
+ //==================================================================
+
+ /*
+ the class OConnectionLine represents the graphical line between the to two windows
+ **/
+ class OConnectionLineData;
+ class OTableConnection;
+ class OConnectionLine
+ {
+ OTableConnection* m_pTabConn;
+ OConnectionLineData* m_pData;
+
+ SvLBoxEntry* m_pSourceEntry;
+ SvLBoxEntry* m_pDestEntry;
+
+ Point m_aSourceConnPos,
+ m_aDestConnPos;
+ Point m_aSourceDescrLinePos,
+ m_aDestDescrLinePos;
+
+ public:
+ OConnectionLine( OTableConnection* pConn, const String& rSourceFieldName = String(),
+ const String& rDestFieldName = String() );
+ OConnectionLine( OTableConnection* pConn, OConnectionLineData* pLineData );
+ OConnectionLine( const OConnectionLine& rLine );
+ virtual ~OConnectionLine();
+
+ virtual OConnectionLine& operator=( const OConnectionLine& rLine );
+
+ Rectangle GetBoundingRect();
+ BOOL RecalcLine();
+ void Draw( OutputDevice* pOutDev );
+ BOOL CheckHit( const Point& rMousePos );
+ String GetSourceFieldName() const { return m_pData->GetSourceFieldName(); }
+ String GetDestFieldName() const { return m_pData->GetDestFieldName(); }
+
+ void SetSourceFieldName( const String& rSourceFieldName );
+ void SetDestFieldName( const String& rDestFieldName );
+ BOOL Connect( const String& rSourceFieldName, const String& rDestFieldName );
+ BOOL IsValid();
+
+ Rectangle GetSourceTextPos() const;
+ Rectangle GetDestTextPos() const;
+
+ OConnectionLineData* GetData() const { return m_pData; }
+ };
+}
+#endif // DBAUI_CONNECTIONLINE_HXX
diff --git a/dbaccess/source/ui/inc/ConnectionLineData.hxx b/dbaccess/source/ui/inc/ConnectionLineData.hxx
new file mode 100644
index 000000000..d9a54e07a
--- /dev/null
+++ b/dbaccess/source/ui/inc/ConnectionLineData.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: ConnectionLineData.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:06:09 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_CONNECTIONLINEDATA_HXX
+#define DBAUI_CONNECTIONLINEDATA_HXX
+
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef DBAUI_ENUMTYPES_HXX
+#include "QEnumTypes.hxx"
+#endif
+
+namespace dbaui
+{
+
+ //==================================================================
+ // ConnData ---------->* ConnLineData
+ // ^1 ^1
+ // | |
+ // Conn ---------->* ConnLine
+ //==================================================================
+
+
+ //==================================================================
+ /**
+ the class OConnectionLineData contains the data of a connection
+ e.g. the source and the destanation field
+ **/
+ class OConnectionLineData
+ {
+ ::rtl::OUString m_aSourceFieldName;
+ ::rtl::OUString m_aDestFieldName;
+
+ public:
+ OConnectionLineData();
+ OConnectionLineData( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName );
+ OConnectionLineData( const OConnectionLineData& rConnLineData );
+ virtual ~OConnectionLineData();
+
+ // eine Kopie der eigenen Instanz liefern (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
+ virtual void CopyFrom(const OConnectionLineData& rSource);
+
+ // Memberzugriff (schreiben)
+ void SetFieldName(EConnectionSide nWhich, const ::rtl::OUString& strFieldName)
+ {
+ if (nWhich==JTCS_FROM)
+ m_aSourceFieldName = strFieldName;
+ else
+ m_aDestFieldName = strFieldName;
+ }
+ void SetSourceFieldName( const ::rtl::OUString& rSourceFieldName ){ SetFieldName(JTCS_FROM, rSourceFieldName); }
+ void SetDestFieldName( const ::rtl::OUString& rDestFieldName ){ SetFieldName(JTCS_TO, rDestFieldName); }
+
+ // Memberzugriff (lesen)
+ ::rtl::OUString GetFieldName(EConnectionSide nWhich) const { return (nWhich == JTCS_FROM) ? m_aSourceFieldName : m_aDestFieldName; }
+ ::rtl::OUString GetSourceFieldName() const { return GetFieldName(JTCS_FROM); }
+ ::rtl::OUString GetDestFieldName() const { return GetFieldName(JTCS_TO); }
+
+ virtual BOOL IsValid();
+ virtual void Reset();
+ virtual OConnectionLineData& operator=( const OConnectionLineData& rConnLineData );
+ };
+
+}
+#endif // DBAUI_CONNECTIONLINEDATA_HXX
+
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
new file mode 100644
index 000000000..91d5cca20
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: JoinController.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:04:53 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_JOINCONTROLLER_HXX
+#define DBAUI_JOINCONTROLLER_HXX
+
+#ifndef DBAUI_GENERICCONTROLLER_HXX
+#include "genericcontroller.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
+#ifndef _UNDO_HXX
+#include <svtools/undo.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#endif
+#ifndef DBAUI_JOINTABLEVIEW_HXX
+#include "JoinTableView.hxx"
+#endif
+#ifndef DBAUI_JOINDESIGNVIEW_HXX
+#include "JoinDesignView.hxx"
+#endif
+#ifndef _MEMORY_
+#include <memory>
+#endif
+
+class VCLXWindow;
+namespace dbaui
+{
+ class OTableConnectionData;
+ class OTableWindowData;
+ class OAddTableDlg;
+ class OTableWindow;
+ class OJoinController : public OGenericUnoController
+ {
+ protected:
+ SfxUndoManager m_aUndoManager;
+ ::std::vector<OTableConnectionData*> m_vTableConnectionData;
+ ::std::vector<OTableWindowData*> m_vTableData;
+
+ Fraction m_aZoom;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+
+ ::rtl::OUString m_sDataSourceName; // is set in initialze
+
+ OAddTableDlg* m_pAddTabDlg; // is set by the first call of execute, the owner is the design view
+
+ sal_Bool m_bEditable; // is the control readonly or not
+ sal_Bool m_bModified; // is the data modified
+ sal_Bool m_bOwnConnection; // is true when we created our own connection
+
+
+ virtual void createNewConnection(sal_Bool _bUI = sal_False);
+
+ // state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
+ virtual FeatureState GetState(sal_uInt16 nId);
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId);
+
+ public:
+ OJoinController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM);
+
+ ~OJoinController();
+ // removes the connection from the vector and delete it
+ void removeConnectionData(::std::auto_ptr<OTableConnectionData> _pData);
+ ::std::vector< OTableWindowData*>* getTableWindowData() { return &m_vTableData; }
+ ::std::vector< OTableConnectionData*>* getTableConnectionData() { return &m_vTableConnectionData;}
+
+ void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection() { return m_xConnection; }
+
+ // should the statement be parsed by our own sql parser
+ sal_Bool isReadOnly() const { return !m_bEditable; }
+ sal_Bool isModified() const { return m_bModified; }
+
+ virtual void setModified(sal_Bool _bModified=sal_True);
+
+ void SaveTabWinPosSize(OTableWindow* pTabWin, long nOffsetX, long nOffsetY);
+
+ // need for undo's and redo's
+ SfxUndoManager* getUndoMgr();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose();
+
+ //
+ 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);
+ };
+}
+#endif // DBAUI_JOINCONTROLLER_HXX
+
diff --git a/dbaccess/source/ui/inc/JoinDesignView.hxx b/dbaccess/source/ui/inc/JoinDesignView.hxx
new file mode 100644
index 000000000..9124be045
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinDesignView.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: JoinDesignView.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:06:45 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef DBAUI_JOINDESIGNVIEW_HXX
+#define DBAUI_JOINDESIGNVIEW_HXX
+
+#ifndef DBAUI_DATAVIEW_HXX
+#include "dataview.hxx"
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef DBAUI_ENUMTYPES_HXX
+#include "QEnumTypes.hxx"
+#endif
+//#ifndef DBAUI_JOINTABLEVIEW_HXX
+//#include "JoinTableView.hxx"
+//#endif
+
+namespace dbaui
+{
+ class OAddTableDlg;
+ class OTableConnection;
+ class OConnectionLineData;
+ class OJoinController;
+ class OScrollWindowHelper;
+ class OJoinTableView;
+ class OTableWindow;
+
+ class OJoinDesignView : public ODataView
+ {
+ protected:
+ OScrollWindowHelper* m_pScrollWindow; // contains only the scrollbars
+ OJoinTableView* m_pTableView; // presents the upper window
+ OAddTableDlg* m_pAddTabDlg; // create by the first execute of the add table slot
+ OJoinController* m_pController;
+
+ public:
+ OJoinDesignView(Window* pParent,
+ OJoinController* _pController,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+ virtual ~OJoinDesignView();
+
+ // set the view readonly or not
+ virtual void setReadOnly(sal_Bool _bReadOnly);
+ // set the statement for representation
+ /// late construction
+ virtual void Construct(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel);
+ virtual void initialize();
+
+ virtual void SaveTabWinUIConfig(OTableWindow* pWin);
+ OJoinController* getController() const { return m_pController; }
+ // returs the add table dialog from the design view
+ OAddTableDlg* getAddTableDialog() { return m_pAddTabDlg; }
+ // called when fields are deleted
+ // called when a table from tabeview was deleted
+ void TableDeleted(const ::rtl::OUString& rAliasName);
+
+ OJoinTableView* getTableView() { return m_pTableView; }
+ void zoomTableView(const Fraction& _rFraction);
+ void SaveUIConfig();
+ protected:
+ // return the Rectangle where I can paint myself
+ virtual void resizeControl(Rectangle& rRect);
+ DECL_LINK( SplitHdl, void* );
+ };
+}
+#endif // DBAUI_JOINDESIGNVIEW_HXX
+
+
+
diff --git a/dbaccess/source/ui/inc/JoinExchange.hxx b/dbaccess/source/ui/inc/JoinExchange.hxx
new file mode 100644
index 000000000..0ef625749
--- /dev/null
+++ b/dbaccess/source/ui/inc/JoinExchange.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * $RCSfile: JoinExchange.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:05:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_JOINEXCHANGE_HXX
+#define DBAUI_JOINEXCHANGE_HXX
+
+#ifndef DBAUI_DBEXCHANGE_HXX
+#include "dbexchange.hxx"
+#endif
+#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX
+#include "TableWindowListBox.hxx"
+#endif
+
+namespace dbaui
+{
+ struct OJoinExchangeData
+ {
+ public:
+ OTableWindowListBox* pListBox; // die ListBox innerhalb desselben (daraus kann man sich das TabWin und daraus den WinName besorgen)
+ SvLBoxEntry* pEntry; // der Eintrag, der gedraggt oder auf den gedroppt wurde
+
+ OJoinExchangeData(OTableWindowListBox* pBox) : pListBox(pBox), pEntry(pBox->FirstSelected()) { }
+ };
+
+ //==================================================================
+ // OJoinExchObj :
+ // Zusaetzliche Daten fuer das Erzeugen von Joins in der JoinShell
+ //==================================================================
+
+ class OJoinExchObj
+ {
+ static String m_sJoinFormat;
+ protected:
+ OJoinExchangeData m_jxdSourceDescription;
+
+ public:
+ OJoinExchObj(const OJoinExchangeData& jxdSource);
+ ~OJoinExchObj();
+
+ OJoinExchangeData GetSourceDescription() const { return m_jxdSourceDescription; }
+ };
+}
+#endif // DBAUI_JOINEXCHANGE_HXX
+
+
diff --git a/dbaccess/source/ui/inc/RTableConnectionData.hxx b/dbaccess/source/ui/inc/RTableConnectionData.hxx
new file mode 100644
index 000000000..24117a7a1
--- /dev/null
+++ b/dbaccess/source/ui/inc/RTableConnectionData.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * $RCSfile: RTableConnectionData.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:07:39 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#define DBAUI_RTABLECONNECTIONDATA_HXX
+
+#ifndef DBAUI_TABLECONNECTIONDATA_HXX
+#include "TableConnectionData.hxx"
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef DBAUI_ENUMTYPES_HXX
+#include "QEnumTypes.hxx"
+#endif
+
+namespace dbaui
+{
+ const UINT16 CARDINAL_UNDEFINED = 0x0000;
+ const UINT16 CARDINAL_ONE_MANY = 0x0001;
+ const UINT16 CARDINAL_MANY_ONE = 0x0002;
+ const UINT16 CARDINAL_ONE_ONE = 0x0004;
+
+ class OConnectionLineData;
+ //==================================================================
+ class ORelationTableConnectionData : public OTableConnectionData
+ {
+ ::rtl::OUString m_sDatabaseName;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xTables;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xDest;
+
+ // @see com.sun.star.sdbc.KeyRule
+ sal_Int32 m_nUpdateRules;
+ sal_Int32 m_nDeleteRules;
+ sal_Int32 m_nCardinality;
+
+ BOOL checkPrimaryKey(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,EConnectionSide _eEConnectionSide) const;
+ BOOL IsSourcePrimKey() const { return checkPrimaryKey(m_xSource,JTCS_FROM); }
+ BOOL IsDestPrimKey() const { return checkPrimaryKey(m_xDest,JTCS_TO); }
+
+ protected:
+ virtual OConnectionLineData* CreateLineDataObj();
+ virtual OConnectionLineData* CreateLineDataObj( const OConnectionLineData& rConnLineData );
+
+ public:
+ ORelationTableConnectionData();
+ ORelationTableConnectionData( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xTables);
+ ORelationTableConnectionData( const ORelationTableConnectionData& rConnData );
+ ORelationTableConnectionData( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xTables,
+ const ::rtl::OUString& rSourceWinName,
+ const ::rtl::OUString& rDestWinName,
+ const ::rtl::OUString& rConnName = ::rtl::OUString() );
+ virtual ~ORelationTableConnectionData();
+
+ virtual void CopyFrom(const OTableConnectionData& rSource);
+ virtual OTableConnectionData* NewInstance() const { return new ORelationTableConnectionData(); }
+
+ ORelationTableConnectionData& operator=( const ORelationTableConnectionData& rConnData );
+
+ ::rtl::OUString GetDatabaseName() const { return m_sDatabaseName; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getTables() const { return m_xTables;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getSource() const { return m_xSource;}
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> getDest() const { return m_xDest; }
+
+ virtual void SetSourceWinName( const String& rSourceWinName );
+ virtual void SetDestWinName( const String& rDestWinName );
+
+ void SetCardinality();
+ void SetUpdateRules( sal_Int32 nAttr ){ m_nUpdateRules = nAttr; }
+ void SetDeleteRules( sal_Int32 nAttr ){ m_nDeleteRules = nAttr; }
+
+ sal_Int32 GetUpdateRules() const { return m_nUpdateRules; }
+ sal_Int32 GetDeleteRules() const { return m_nDeleteRules; }
+ sal_Int32 GetCardinality() const { return m_nCardinality; }
+
+ BOOL Update();
+ BOOL IsConnectionPossible();
+ void ChangeOrientation();
+ BOOL DropRelation();
+ };
+}
+
+#endif // DBAUI_RTABLECONNECTIONDATA_HXX
+
+
+
diff --git a/dbaccess/source/ui/inc/RelationController.hxx b/dbaccess/source/ui/inc/RelationController.hxx
new file mode 100644
index 000000000..2a626664e
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationController.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationController.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:04:44 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RELATIONCONTROLLER_HXX
+#define DBAUI_RELATIONCONTROLLER_HXX
+
+#ifndef DBAUI_JOINCONTROLLER_HXX
+#include "JoinController.hxx"
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef DBAUI_RELATIONDESIGNVIEW_HXX
+#include "RelationDesignView.hxx"
+#endif
+
+class VCLXWindow;
+namespace dbaui
+{
+ class OTableConnectionData;
+ class OTableWindowData;
+ class OAddTableDlg;
+ class OTableFieldDesc;
+ class OTableWindow;
+ class ORelationController : public OJoinController
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDataSource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTables;
+ protected:
+ // all the features which should be handled by this class
+ virtual void AddSupportedFeatures();
+ // execute a feature
+ virtual void Execute(sal_uInt16 nId);
+ virtual ToolBox* CreateToolBox(Window* pParent);
+
+ ORelationDesignView* getRelationView() { return static_cast<ORelationDesignView*>(m_pView); }
+ void loadData();
+ sal_Bool existsTable(const ::rtl::OUString& _rComposedTableName) const;
+ public:
+ ORelationController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM);
+
+ ~ORelationController();
+ // temp
+ void SaveTabWinsPosSize( OJoinTableView::OTableWindowMap* pTabWinList, long nOffsetX, long nOffsetY );
+
+ virtual sal_Bool Construct(Window* pParent);
+
+ // ::com::sun::star::beans::XPropertyChangeListener
+ virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt);
+ // ::com::sun::star::container::XContainerListener
+ virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::frame::XController
+ virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ // need by registration
+ static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
+ // lang::XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif // DBAUI_RELATIONCONTROLLER_HXX
+
diff --git a/dbaccess/source/ui/inc/RelationDesignView.hxx b/dbaccess/source/ui/inc/RelationDesignView.hxx
new file mode 100644
index 000000000..c29788b14
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationDesignView.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationDesignView.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:08:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef DBAUI_RELATIONDESIGNVIEW_HXX
+#define DBAUI_RELATIONDESIGNVIEW_HXX
+
+#ifndef DBAUI_JOINDESIGNVIEW_HXX
+#include "JoinDesignView.hxx"
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _STRING_HXX
+#include <tools/string.hxx>
+#endif
+#ifndef DBAUI_ENUMTYPES_HXX
+#include "QEnumTypes.hxx"
+#endif
+#ifndef DBAUI_RELATION_TABLEVIEW_HXX
+#include "RelationTableView.hxx"
+#endif
+
+namespace dbaui
+{
+ class OAddTableDlg;
+ class OTableConnection;
+ class ORelationTableConnectionData;
+ class OConnectionLineData;
+ class ORelationController;
+
+ class ORelationDesignView : public OJoinDesignView
+ {
+ public:
+ ORelationDesignView(Window* pParent, ORelationController* _pController,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+ virtual ~ORelationDesignView();
+
+ // set the statement for representation
+ /// late construction
+ virtual void Construct(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& xModel);
+ virtual void initialize();
+ };
+}
+#endif // DBAUI_RELATIONDESIGNVIEW_HXX
+
+
+
diff --git a/dbaccess/source/ui/inc/RelationDlg.hxx b/dbaccess/source/ui/inc/RelationDlg.hxx
new file mode 100644
index 000000000..94eff5cd5
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationDlg.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationDlg.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:08:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RELATIONDIALOG_HXX
+#define DBAUI_RELATIONDIALOG_HXX
+
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+
+#ifndef _GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _SV_LSTBOX_HXX //autogen
+#include <vcl/lstbox.hxx>
+#endif
+
+#ifndef _SVX_DBBROWSE_HXX
+#include <svx/dbbrowse.hxx>
+#endif // _SVX_DBBROWSE_HXX
+
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#include "RTableConnectionData.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
+
+
+namespace dbaui
+{
+ //========================================================================
+ class ORelationDialog;
+ class ORelationControl : public DbBrowseBox
+ {
+ friend class ORelationDialog;
+
+ ULONG m_nDeActivateEvent;
+ DbListBoxCtrl* m_pListCell;
+ ORelationTableConnectionData* m_pConnData;
+ long m_nDataPos;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSourceDef;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xDestDef;
+
+ void SetDef(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xDest,sal_Int32 _nPos);
+ public:
+ ORelationControl( ORelationDialog* pParent );
+ virtual ~ORelationControl();
+
+ void SetSourceDef(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xNewSource);
+ void SetDestDef(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xNewDest);
+
+ protected:
+ virtual void Resize();
+
+ virtual long PreNotify(NotifyEvent& rNEvt );
+
+ virtual BOOL IsTabAllowed(BOOL bForward) const;
+
+ virtual void Init() { DbBrowseBox::Init(); } // late construction
+ virtual void Init(ORelationTableConnectionData* _pConnData);
+ virtual void InitController( DbCellControllerRef& rController, long nRow, USHORT nCol );
+ virtual DbCellController* GetController( long nRow, USHORT nCol );
+ virtual void PaintCell( OutputDevice& rDev, const Rectangle& rRect, USHORT nColId ) const;
+ virtual BOOL SeekRow( long nRow );
+ virtual BOOL SaveModified();
+ virtual String GetCellText( long nRow, USHORT nColId );
+
+ virtual void CellModified();
+
+ private:
+
+ DECL_LINK( AsynchActivate, void* );
+ DECL_LINK( AsynchDeactivate, void* );
+ };
+
+ class OJoinTableView;
+ //========================================================================
+ class ORelationDialog : public ModalDialog
+ {
+ GroupBox aGB_InvolvedTables;
+ ListBox m_lmbLeftTable,
+ m_lmbRightTable;
+
+ GroupBox aGB_InvolvedFields;
+
+ GroupBox aGB_CascUpd;
+ RadioButton aRB_NoCascUpd,
+ aRB_CascUpd,
+ aRB_CascUpdNull,
+ aRB_CascUpdDefault;
+ GroupBox aGB_CascDel;
+ RadioButton aRB_NoCascDel,
+ aRB_CascDel,
+ aRB_CascDelNull,
+ aRB_CascDelDefault;
+
+ OKButton aPB_OK;
+ CancelButton aPB_CANCEL;
+ HelpButton aPB_HELP;
+
+ ORelationControl* m_pRC_Tables;
+ ORelationTableConnectionData* m_pConnData;
+ ORelationTableConnectionData* m_pOrigConnData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+
+ String m_strCurrentLeft;
+ String m_strCurrentRight;
+ BOOL m_bTriedOneUpdate;
+
+ public:
+ ORelationDialog(OJoinTableView* pParent,
+ ORelationTableConnectionData* pConnectionData,
+ BOOL bAllowTableSelect = FALSE );
+ virtual ~ORelationDialog();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection(){ return m_xConnection; }
+
+ void NotifyCellChange();
+
+ virtual short Execute();
+
+ protected:
+ void Init(ORelationTableConnectionData* _pConnData);
+
+ private:
+ DECL_LINK( OKClickHdl, Button* );
+ DECL_LINK( OnTableChanged, ListBox* );
+ };
+}
+#endif // DBAUI_RELATIONDIALOG_HXX
+
+
diff --git a/dbaccess/source/ui/inc/RelationTableView.hxx b/dbaccess/source/ui/inc/RelationTableView.hxx
new file mode 100644
index 000000000..4bdc0ec21
--- /dev/null
+++ b/dbaccess/source/ui/inc/RelationTableView.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationTableView.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:05:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RELATION_TABLEVIEW_HXX
+#define DBAUI_RELATION_TABLEVIEW_HXX
+
+#ifndef DBAUI_JOINTABLEVIEW_HXX
+#include "JoinTableView.hxx"
+#endif
+
+namespace dbaui
+{
+ class ORelationDesignView;
+ class ORelationTableView : public OJoinTableView
+ {
+ protected:
+ virtual void ConnDoubleClicked( OTableConnection* pConnection );
+ virtual void KeyInput( const KeyEvent& rEvt );
+ virtual void AddTabWin(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rWinName, BOOL bNewTable = FALSE);
+
+ public:
+ ORelationTableView( Window* pParent, ORelationDesignView* pView );
+ virtual ~ORelationTableView();
+
+ // virtual void AddTabWin(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rWinName, BOOL bNewTable = FALSE);
+ // virtual void RemoveTabWin( OTableWindow* pTabWin );
+ virtual void AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest);
+ virtual BOOL RemoveConnection(OTableConnection* pConn);
+
+ virtual void ReSync();
+
+ void AddNewRelation();
+ // reisst den Dialog fuer eine voellig neue Relation hoch
+ // wird vom AddTabDlg benutzt, um festzustellen, ob noch Tabellen hinzugefuegt werden duerfen
+ virtual BOOL IsAddAllowed();
+ };
+}
+#endif // DBAUI_RELATION_TABLEVIEW_HXX
+
+
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
new file mode 100644
index 000000000..889f4b43e
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableConnection.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:05:50 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_TABLECONNECTION_HXX
+#define DBAUI_TABLECONNECTION_HXX
+
+#ifndef _SV_GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef DBAUI_CONNECTIONLINE_HXX
+#include "ConnectionLine.hxx"
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+
+namespace dbaui
+{
+ class OTableConnectionData;
+ class OTableWindow;
+ class OJoinTableView;
+ class OTableConnection
+ {
+ ::std::vector<OConnectionLine*> m_vConnLine;
+ OTableConnectionData* m_pData;
+ OJoinTableView* m_pParent;
+
+ BOOL m_bSelected;
+
+ void Init();
+
+ protected:
+ OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine );
+
+ public:
+ TYPEINFO();
+ OTableConnection( OJoinTableView* pContainer, OTableConnectionData* pTabConnData );
+ OTableConnection( const OTableConnection& rConn );
+ // WICHTIG : normalerweise bekomme ich von aussen einen Zeiger auf OTableConnectionData mitgegeben, hier aber muss ich
+ // mir (ueber OTableConnectionData::NewInstance) selber eine INstanz anlegen, die ich aber - wie in allen anderen Faellen auch -
+ // NIE loesche. Der Aufrufer ist also bei Benutzung dieses Constructors dafuer verantwortlich, meine Daten abzufragen und
+ // sich irgendwo zu merken, um sie dann irgendwann zu loeschen.
+ virtual ~OTableConnection();
+
+ OTableConnection& operator=( const OTableConnection& rConn );
+
+ void Select();
+ void Deselect();
+ BOOL IsSelected() const { return m_bSelected; }
+ BOOL CheckHit( const Point& rMousePos );
+ void Invalidate();
+ void UpdateLineList();
+
+ OTableWindow* GetSourceWin() const;
+ OTableWindow* GetDestWin() const;
+
+ void RecalcLines();
+
+ Rectangle GetBoundingRect();
+
+ OTableConnectionData* GetData() const { return m_pData; }
+ const ::std::vector<OConnectionLine*>* GetConnLineList() const { return &m_vConnLine; }
+ OJoinTableView* GetParent(){ return m_pParent; }
+ virtual void Draw( const Rectangle& rRect );
+ };
+}
+#endif // DBAUI_TABLECONNECTION_HXX
+
diff --git a/dbaccess/source/ui/inc/TableConnectionData.hxx b/dbaccess/source/ui/inc/TableConnectionData.hxx
new file mode 100644
index 000000000..0bef1d16a
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableConnectionData.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableConnectionData.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:05:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_TABLECONNECTIONDATA_HXX
+#define DBAUI_TABLECONNECTIONDATA_HXX
+
+#ifndef DBAUI_CONNECTIONLINEDATA_HXX
+#include "ConnectionLineData.hxx"
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+
+namespace dbaui
+{
+#define MAX_CONN_COUNT 2
+ //==================================================================
+ // ConnData ---------->* ConnLineData
+ // ^1 ^1
+ // | |
+ // Conn ---------->* ConnLine
+ //==================================================================
+
+
+ //==================================================================
+ /*
+ the class OTableConnectionData contains all connectiondata which exists between two windows
+ **/
+ class OTableConnectionData
+ {
+ protected:
+ String m_aSourceWinName;
+ String m_aDestWinName;
+ String m_aConnName;
+
+ ::std::vector<OConnectionLineData*> m_vConnLineData;
+
+ void Init();
+ void Init(const String& rSourceWinName, const String& rDestWinName, const String& rConnName = String() );
+ // Das erste Init baut darauf, dass die 3 String-Members schon korrekt gesetzt sind und aConnLineDataList leer ist.
+ // Das zweite stellt genau diesen Zustand her
+
+ virtual OConnectionLineData* CreateLineDataObj();
+ virtual OConnectionLineData* CreateLineDataObj( const OConnectionLineData& rConnLineData );
+
+ public:
+ TYPEINFO();
+ OTableConnectionData();
+ OTableConnectionData( const String& rSourceWinName, const String& rDestWinName, const String& rConnName = String() );
+ OTableConnectionData( const OTableConnectionData& rConnData );
+ virtual ~OTableConnectionData();
+
+ // sich aus einer Quelle initialisieren (das ist mir irgendwie angenehmer als ein virtueller Zuweisungsoperator)
+ virtual void CopyFrom(const OTableConnectionData& rSource);
+
+ // eine neue Instanz meines eigenen Typs liefern (braucht NICHT initialisiert sein)
+ virtual OTableConnectionData* NewInstance() const;
+ // (von OTableConnectionData abgeleitete Klasse muessen entsprechend eine Instanz ihrer Klasse liefern)
+
+ OTableConnectionData& operator=( const OTableConnectionData& rConnData );
+
+ BOOL SetConnLine( USHORT nIndex, const String& rSourceFieldName, const String& rDestFieldName );
+ BOOL AppendConnLine( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName );
+ void ResetConnLines( BOOL bUseDefaults = TRUE );
+ // loescht die Liste der ConnLines, bei bUseDefaults == TRUE werden danach MAX_CONN_COUNT neue Dummy-Linien eingefuegt
+
+ ::std::vector<OConnectionLineData*>* GetConnLineDataList(){ return &m_vConnLineData; }
+
+ String GetSourceWinName() const { return m_aSourceWinName; }
+ String GetDestWinName() const { return m_aDestWinName; }
+ String GetConnName() const { return m_aConnName; }
+
+ virtual void SetSourceWinName( const String& rSourceWinName ){ m_aSourceWinName = rSourceWinName; }
+ virtual void SetDestWinName( const String& rDestWinName ){ m_aDestWinName = rDestWinName; }
+ virtual void SetConnName( const String& rConnName ){ m_aConnName = rConnName; }
+ };
+
+}
+#endif // DBAUI_TABLECONNECTIONDATA_HXX
+
+
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
new file mode 100644
index 000000000..423e4333a
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableWindow.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:07:01 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_TABLEWINDOW_HXX
+#define DBAUI_TABLEWINDOW_HXX
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef DBAUI_TABLEWINDOWTITLE_HXX
+#include "TableWindowTitle.hxx"
+#endif
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+#ifndef DBAUI_TABLEWINDOWDATA_HXX
+#include "TableWindowData.hxx"
+#endif
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+
+class SvLBoxEntry;
+namespace dbaui
+{
+ //////////////////////////////////////////////////////////////////////////
+ // Flags fuer die Groessenanpassung der SbaJoinTabWins
+ const UINT16 SIZING_NONE = 0x0000;
+ const UINT16 SIZING_TOP = 0x0001;
+ const UINT16 SIZING_BOTTOM = 0x0002;
+ const UINT16 SIZING_LEFT = 0x0004;
+ const UINT16 SIZING_RIGHT = 0x0008;
+
+ class OTableWindowListBox;
+ class OJoinDesignView;
+ class OJoinTableView;
+
+ class OTableWindow : public Window
+ {
+ friend class OTableWindowTitle;
+ friend class OTableWindowListBox;
+ protected:
+ // und die Tabelle selber (brauche ich, da ich sie locken will, solange das Fenster lebt)
+ OTableWindowTitle m_aTitle;
+ OTableWindowListBox* m_pListBox;
+ private:
+ // the columns of the table
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xTable;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns;
+
+ OTableWindowData* m_pData;
+ ::rtl::OUString m_strInitialWinName;
+ UINT16 m_nSizingFlags;
+ BOOL m_bActive;
+
+ void Draw3DBorder( const Rectangle& rRect );
+
+ protected:
+ virtual void Resize();
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseMove( const MouseEvent& rEvt );
+ virtual void MouseButtonDown( const MouseEvent& rEvt );
+ virtual void KeyInput( const KeyEvent& rEvt );
+
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ virtual OTableWindowListBox* CreateListBox();
+ // wird im ERSTEN Init aufgerufen
+ virtual BOOL FillListBox();
+ // wird in JEDEM Init aufgerufen
+
+ virtual void EmptyListBox();
+ // Liste wird geleert, damit haben abgeleitete Klassen die Moeglichkeit, eventuell gesetzte UserData zu loeschen
+
+ virtual void OnEntryDoubleClicked(SvLBoxEntry* pEntry) { }
+ // wird aus dem DoubleClickHdl der ListBox heraus aufgerufen
+
+ // die unterliegende Tabellendefinition (un)locken
+ // void LockTable() { if (m_xTableDef.Is()) m_xTableDef->AddUsage(); }
+ // void UnlockTable() { if (m_xTableDef.Is()) m_xTableDef->ReleaseUsage(); }
+
+ public:
+ TYPEINFO();
+ OTableWindow( Window* pParent, OTableWindowData* pTabWinData);
+ virtual ~OTableWindow();
+
+ // spaeter Constructor, siehe auch CreateListbox und FillListbox
+ virtual BOOL Init();
+
+ OJoinTableView* getTableView();
+ const OJoinTableView* getTableView() const;
+ OJoinDesignView* getDesignView();
+ void SetPosPixel( const Point& rNewPos );
+ void SetSizePixel( const Size& rNewSize );
+ void SetPosSizePixel( const Point& rNewPos, const Size& rNewSize );
+
+ void SetTitle( const ::rtl::OUString& rTit );
+ void SetBoldTitle( BOOL bBold );
+
+ void Remove();
+ BOOL IsActive(){ return m_bActive; }
+
+ ::rtl::OUString GetTableName() const { return m_pData->GetTableName(); }
+ ::rtl::OUString GetWinName() const { return m_pData->GetWinName(); }
+ ::rtl::OUString GetComposedName() const { return m_pData->GetComposedName(); }
+ OTableWindowListBox* GetListBox() const { return m_pListBox; }
+ OTableWindowData* GetData() const { return m_pData; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> GetOriginalColumns() const { return m_xColumns; }
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> GetTable() const { return m_xTable; }
+
+ UINT16 GetSizingFlags() const { return m_nSizingFlags; }
+
+ // window override
+ virtual void StateChanged( StateChangedType nStateChange );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+ // Linien neu zeichnen
+ void InvalidateLines();
+ // habe ich Connections nach aussen ?
+ BOOL ExistsAConn() const;
+
+ virtual void EnumValidFields(::std::vector< ::rtl::OUString>& arrstrFields);
+ };
+}
+#endif //DBAUI_TABLEWINDOW_HXX
+
+
diff --git a/dbaccess/source/ui/inc/TableWindowData.hxx b/dbaccess/source/ui/inc/TableWindowData.hxx
new file mode 100644
index 000000000..6588750ec
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowData.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableWindowData.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:05:14 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_TABLEWINDOWDATA_HXX
+#define DBAUI_TABLEWINDOWDATA_HXX
+
+#ifndef _SV_GEN_HXX
+#include <tools/gen.hxx>
+#endif
+#ifndef _RTTI_HXX
+#include <tools/rtti.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectOutputStream.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include <com/sun/star/io/XObjectInputStream.hpp>
+#endif
+
+namespace dbaui
+{
+ class OTableWindowData
+ {
+ protected:
+ ::rtl::OUString m_aTableName;
+ ::rtl::OUString m_aWinName;
+ ::rtl::OUString m_sComposedName;
+ Point m_aPosition;
+ Size m_aSize;
+ sal_Bool m_bShowAll;
+
+ public:
+ TYPEINFO();
+ OTableWindowData();
+ OTableWindowData( const ::rtl::OUString& _rComposedName, const ::rtl::OUString& strTableName, const ::rtl::OUString& rWinName = ::rtl::OUString() );
+ virtual ~OTableWindowData();
+
+ 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);
+
+ ::rtl::OUString GetComposedName() const { return m_sComposedName; }
+ ::rtl::OUString GetTableName() const { return m_aTableName; }
+ ::rtl::OUString GetWinName() const { return m_aWinName; }
+ Point GetPosition() const { return m_aPosition; }
+ Size GetSize() const { return m_aSize; }
+ BOOL IsShowAll() const { return m_bShowAll; }
+ BOOL HasPosition() const;
+ BOOL HasSize() const;
+
+ void SetTableName( const ::rtl::OUString& rTableName ) { m_aTableName = rTableName; }
+ void SetWinName( const ::rtl::OUString& rWinName ) { m_aWinName = rWinName; }
+ void SetPosition( const Point& rPos ) { m_aPosition=rPos; }
+ void SetSize( const Size& rSize ) { m_aSize = rSize; }
+ void ShowAll( BOOL bAll ) { m_bShowAll = bAll; }
+ };
+}
+#endif // DBAUI_TABLEWINDOWDATA_HXX
+
diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx
new file mode 100644
index 000000000..b0c78e237
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableWindowListBox.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:07:19 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX
+#define DBAUI_TABLEWINDOWLISTBOX_HXX
+
+#ifndef _SVTREEBOX_HXX
+#include <svtools/svtreebx.hxx>
+#endif
+
+namespace dbaui
+{
+ class OTableWindow;
+ class OTableWindowListBox : public SvTreeListBox
+ {
+ DECL_LINK( DoubleClickHdl, SvTreeListBox* );
+ DECL_LINK( ScrollUpHdl, SvTreeListBox* );
+ DECL_LINK( ScrollDownHdl, SvTreeListBox* );
+
+ Timer m_aScrollTimer;
+ Point m_aMousePos;
+
+ OTableWindow* m_pTabWin;
+
+ BOOL m_bReallyScrolled : 1;
+ BOOL m_bDragSource : 1;
+
+ protected:
+ virtual void Command(const CommandEvent& rEvt);
+ virtual void LoseFocus();
+ virtual void GetFocus();
+ virtual void NotifyScrolled();
+ virtual void NotifyEndScroll();
+
+ virtual long PreNotify(NotifyEvent& rNEvt);
+
+ public:
+ OTableWindowListBox(OTableWindow* pParent, const String& rDatabaseName, const String& rTableName);
+ virtual ~OTableWindowListBox();
+
+ OTableWindow* GetTabWin(){ return m_pTabWin; }
+ virtual BOOL QueryDrop( DropEvent& rDEvt );
+ virtual BOOL Drop( const DropEvent& rDEvt );
+ SvLBoxEntry* GetEntryFromText( const String& rEntryText );
+ };
+}
+#endif // DBAUI_TABLEWINDOWLISTBOX_HXX
+
+
+
diff --git a/dbaccess/source/ui/inc/TableWindowTitle.hxx b/dbaccess/source/ui/inc/TableWindowTitle.hxx
new file mode 100644
index 000000000..be442444d
--- /dev/null
+++ b/dbaccess/source/ui/inc/TableWindowTitle.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: TableWindowTitle.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:08:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_TABLEWINDOWTITLE_HXX
+#define DBAUI_TABLEWINDOWTITLE_HXX
+
+#ifndef _SV_CTRL_HXX
+#include <vcl/ctrl.hxx>
+#endif
+
+namespace dbaui
+{
+ class OTableWindow;
+ class OTableWindowTitle : public Control
+ {
+ OTableWindow* m_pTabWin;
+
+ protected:
+ virtual void Command(const CommandEvent& rEvt);
+ virtual void Paint( const Rectangle& rRect );
+ virtual void MouseButtonDown( const MouseEvent& rEvt );
+ virtual void KeyInput( const KeyEvent& rEvt );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+
+ public:
+ OTableWindowTitle( OTableWindow* pParent );
+ virtual ~OTableWindowTitle();
+ virtual void LoseFocus();
+ virtual void GetFocus();
+ virtual void RequestHelp( const HelpEvent& rHEvt );
+ // window override
+ virtual void StateChanged( StateChangedType nStateChange );
+ };
+}
+#endif // DBAUI_TABLEWINDOWTITLE_HXX
+
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
new file mode 100644
index 000000000..22f9a2890
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * $RCSfile: RTableConnection.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:06:52 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RTABLECONNECTION_HXX
+#include "RTableConnection.hxx"
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef DBAUI_RELATION_TABLEVIEW_HXX
+#include "RelationTableView.hxx"
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+using namespace dbaui;
+//========================================================================
+// class ORelationTableConnection
+//========================================================================
+DBG_NAME(ORelationTableConnection);
+//------------------------------------------------------------------------
+ORelationTableConnection::ORelationTableConnection( ORelationTableView* pContainer,
+ ORelationTableConnectionData* pTabConnData )
+ :OTableConnection( pContainer, pTabConnData )
+{
+ DBG_CTOR(ORelationTableConnection,NULL);
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnection::ORelationTableConnection( const ORelationTableConnection& rConn )
+ : OTableConnection( rConn )
+{
+ DBG_CTOR(ORelationTableConnection,NULL);
+ // keine eigenen Members, also reicht die Basisklassenfunktionalitaet
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnection::~ORelationTableConnection()
+{
+ DBG_DTOR(ORelationTableConnection,NULL);
+}
+
+//------------------------------------------------------------------------
+OConnectionLine* ORelationTableConnection::CreateConnLine( const OConnectionLine& rConnLine )
+{
+ DBG_CHKTHIS(ORelationTableConnection,NULL);
+ return new OConnectionLine( rConnLine );
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnection& ORelationTableConnection::operator=( const ORelationTableConnection& rConn )
+{
+ DBG_CHKTHIS(ORelationTableConnection,NULL);
+ // nicht dass es was aendern wuerde, da die Basisklasse das auch testet und ich keine eigenen Members zu kopieren habe
+ if (&rConn == this)
+ return *this;
+
+ OTableConnection::operator=( rConn );
+ return *this;
+}
+
+
+//------------------------------------------------------------------------
+void ORelationTableConnection::Draw( const Rectangle& rRect )
+{
+ DBG_CHKTHIS(ORelationTableConnection,NULL);
+ OTableConnection::Draw( rRect );
+ ORelationTableConnectionData* pData;
+
+ if ((pData = (ORelationTableConnectionData*) GetData()) &&
+ (pData->GetCardinality() == CARDINAL_UNDEFINED) )
+ return;
+
+ //////////////////////////////////////////////////////////////////////
+ // Linien nach oberster Linie durchsuchen
+ Rectangle aBoundingRect;
+ long nTop = GetBoundingRect().Bottom();
+ long nTemp;
+
+ const OConnectionLine* pTopLine = NULL;
+ const ::std::vector<OConnectionLine*>* pConnLineList = GetConnLineList();
+ ::std::vector<OConnectionLine*>::const_iterator aIter = pConnLineList->begin();
+ for(;aIter != pConnLineList->end();++aIter)
+ {
+ if( (*aIter)->IsValid() )
+ {
+ aBoundingRect = (*aIter)->GetBoundingRect();
+ nTemp = aBoundingRect.Top();
+ if( nTemp<nTop )
+ {
+ nTop = nTemp;
+ pTopLine = (*aIter);
+ }
+ }
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Kardinalitaet antragen
+ if( !pTopLine )
+ return;
+
+ Rectangle aSourcePos = pTopLine->GetSourceTextPos();
+ Rectangle aDestPos = pTopLine->GetDestTextPos();
+
+ String aSourceText;
+ String aDestText;
+
+ switch( ((ORelationTableConnectionData*)GetData())->GetCardinality() )
+ {
+ case CARDINAL_ONE_MANY:
+ aSourceText = '1';
+ aDestText = 'n';
+ break;
+
+ case CARDINAL_MANY_ONE:
+ aSourceText = 'n';
+ aDestText = '1';
+ break;
+
+ case CARDINAL_ONE_ONE:
+ aSourceText = '1';
+ aDestText = '1';
+ break;
+ }
+
+ if (IsSelected())
+ GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetHighlightColor());
+ else
+ GetParent()->SetTextColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor());
+
+
+ GetParent()->DrawText( aSourcePos, aSourceText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM);
+ GetParent()->DrawText( aDestPos, aDestText, TEXT_DRAW_CLIP | TEXT_DRAW_CENTER | TEXT_DRAW_BOTTOM);
+}
+// -----------------------------------------------------------------------------
+
+
+
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.hxx b/dbaccess/source/ui/relationdesign/RTableConnection.hxx
new file mode 100644
index 000000000..511ecbfb5
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: RTableConnection.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:09:00 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RTABLECONNECTION_HXX
+#define DBAUI_RTABLECONNECTION_HXX
+
+#ifndef DBAUI_TABLECONNECTION_HXX
+#include "TableConnection.hxx"
+#endif
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#include "RTableConnectionData.hxx"
+#endif
+
+namespace dbaui
+{
+ class ORelationTableView;
+ //==================================================================
+ class ORelationTableConnection : public OTableConnection
+ {
+ protected:
+ OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine );
+
+ public:
+ ORelationTableConnection( ORelationTableView* pContainer, ORelationTableConnectionData* pTabConnData );
+ ORelationTableConnection( const ORelationTableConnection& rConn );
+ // wichtiger Kommentar zum CopyConstructor siehe OTableConnection(const OTableConnection&)
+ virtual ~ORelationTableConnection();
+
+ ORelationTableConnection& operator=( const ORelationTableConnection& rConn );
+
+ virtual void Draw( const Rectangle& rRect );
+ };
+}
+#endif // DBAUI_RTABLECONNECTION_HXX
+
+
+
+
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
new file mode 100644
index 000000000..05ddf7538
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -0,0 +1,506 @@
+/*************************************************************************
+ *
+ * $RCSfile: RTableConnectionData.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:09:17 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#include "RTableConnectionData.hxx"
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_KEYRULE_HPP_
+#include <com/sun/star/sdbc/KeyRule.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
+#include "dbustrings.hrc"
+#endif
+#ifndef DBAUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
+using namespace dbaui;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+DBG_NAME(ORelationTableConnectionData);
+//========================================================================
+// class ORelationTableConnectionData
+//========================================================================
+
+//------------------------------------------------------------------------
+ORelationTableConnectionData::ORelationTableConnectionData()
+ :OTableConnectionData()
+ ,m_nUpdateRules(KeyRule::NO_ACTION)
+ ,m_nDeleteRules(KeyRule::NO_ACTION)
+ ,m_nCardinality(CARDINAL_UNDEFINED)
+{
+ DBG_CTOR(ORelationTableConnectionData,NULL);
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnectionData::ORelationTableConnectionData( const Reference< XNameAccess>& _xTables)
+ :OTableConnectionData()
+ ,m_nUpdateRules(KeyRule::NO_ACTION)
+ ,m_nDeleteRules(KeyRule::NO_ACTION)
+ ,m_nCardinality(CARDINAL_UNDEFINED)
+ ,m_xTables(_xTables)
+{
+ DBG_CTOR(ORelationTableConnectionData,NULL);
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnectionData::ORelationTableConnectionData( const Reference< XNameAccess>& _xTables,
+ const ::rtl::OUString& rSourceWinName,
+ const ::rtl::OUString& rDestWinName,
+ const ::rtl::OUString& rConnName )
+ :OTableConnectionData( rSourceWinName, rDestWinName, rConnName )
+
+ ,m_nUpdateRules(KeyRule::NO_ACTION)
+ ,m_nDeleteRules(KeyRule::NO_ACTION)
+ ,m_nCardinality(CARDINAL_UNDEFINED)
+ ,m_xTables(_xTables)
+{
+ DBG_CTOR(ORelationTableConnectionData,NULL);
+ SetCardinality();
+ if(m_xTables->hasByName(rSourceWinName))
+ m_xTables->getByName(rSourceWinName) >>= m_xSource;
+ if(m_xTables->hasByName(rDestWinName))
+ m_xTables->getByName(rDestWinName) >>= m_xDest;
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnectionData::ORelationTableConnectionData( const ORelationTableConnectionData& rConnData )
+ :OTableConnectionData( rConnData )
+{
+ DBG_CTOR(ORelationTableConnectionData,NULL);
+ *this = rConnData;
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnectionData::~ORelationTableConnectionData()
+{
+ DBG_DTOR(ORelationTableConnectionData,NULL);
+}
+
+//------------------------------------------------------------------------
+BOOL ORelationTableConnectionData::DropRelation()
+{
+ DBG_CHKTHIS(ORelationTableConnectionData,NULL);
+ ////////////////////////////////////////////////////////////
+ // Relation loeschen
+ Reference<XKeysSupplier> xSup(m_xSource,UNO_QUERY);
+ Reference< XIndexAccess> xKeys;
+ if(xSup.is() )
+ xKeys = xSup->getKeys();
+ else
+ return FALSE;
+
+ if( m_aConnName.Len() && xKeys.is() )
+ {
+ for(sal_Int32 i=0;i<xKeys->getCount();++i)
+ {
+ Reference< XPropertySet> xKey;
+ xKeys->getByIndex(i) >>= xKey;
+ OSL_ENSURE(xKey.is(),"Key is not valid!");
+ if(xKey.is())
+ {
+ ::rtl::OUString sName;
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sName;
+ if(String(sName) == m_aConnName)
+ {
+ Reference< XDrop> xDrop(xKeys,UNO_QUERY);
+ OSL_ENSURE(xDrop.is(),"can't drop key because we haven't a drop interface!");
+ if(xDrop.is())
+ xDrop->dropByIndex(i);
+ break;
+ }
+ }
+ }
+ }
+ return TRUE;
+}
+
+//------------------------------------------------------------------------
+void ORelationTableConnectionData::ChangeOrientation()
+{
+ DBG_CHKTHIS(ORelationTableConnectionData,NULL);
+ //////////////////////////////////////////////////////////////////////
+ // Source- und DestFieldName der Linien austauschen
+ ::rtl::OUString sTempString;
+ ::std::vector<OConnectionLineData*>::iterator aIter = m_vConnLineData.begin();
+ for(;aIter != m_vConnLineData.end();++aIter)
+ {
+ sTempString = (*aIter)->GetSourceFieldName();
+ (*aIter)->SetSourceFieldName( (*aIter)->GetDestFieldName() );
+ (*aIter)->SetDestFieldName( sTempString );
+ }
+
+ //////////////////////////////////////////////////////////////////////
+ // Member anpassen
+ sTempString = m_aSourceWinName;
+ m_aSourceWinName = m_aDestWinName;
+ m_aDestWinName = sTempString;
+
+ Reference<XPropertySet> xTemp;
+ xTemp = m_xSource;
+ m_xSource = m_xDest;
+ m_xDest = xTemp;
+}
+
+//------------------------------------------------------------------------
+void ORelationTableConnectionData::SetSourceWinName( const String& rSourceWinName )
+{
+ OTableConnectionData::SetSourceWinName(rSourceWinName);
+ if(m_xTables->hasByName(rSourceWinName))
+ m_xTables->getByName(rSourceWinName) >>= m_xSource;
+}
+
+//------------------------------------------------------------------------
+void ORelationTableConnectionData::SetDestWinName( const String& rDestWinName )
+{
+ OTableConnectionData::SetDestWinName(rDestWinName);
+ if(m_xTables->hasByName(rDestWinName))
+ m_xTables->getByName(rDestWinName) >>= m_xDest;
+}
+
+//------------------------------------------------------------------------
+void ORelationTableConnectionData::SetCardinality()
+{
+ DBG_CHKTHIS(ORelationTableConnectionData,NULL);
+ m_nCardinality = CARDINAL_UNDEFINED;
+
+ if( IsSourcePrimKey() )
+ {
+ if( IsDestPrimKey() )
+ m_nCardinality = CARDINAL_ONE_ONE;
+ else
+ m_nCardinality = CARDINAL_ONE_MANY;
+ }
+
+ if( IsDestPrimKey() )
+ {
+ if( !IsSourcePrimKey() )
+ m_nCardinality = CARDINAL_MANY_ONE;
+ }
+
+}
+// -----------------------------------------------------------------------------
+BOOL ORelationTableConnectionData::checkPrimaryKey(const Reference< XPropertySet>& _xTable,EConnectionSide _eEConnectionSide) const
+{
+ // check if Table has the primary key column dependig on _eEConnectionSide
+ USHORT nPrimKeysCount = 0,
+ nValidLinesCount = 0;
+ ::std::vector<Reference<XNameAccess> > vKeyColumns = ::dbaui::getKeyColumns(_xTable,KeyType::PRIMARY);
+ if(vKeyColumns.size())
+ {
+ OSL_ENSURE(vKeyColumns.size()==1,"There can be only one primary key in a table!");
+ Reference<XNameAccess> xKeyColumns = *vKeyColumns.begin();
+ Sequence< ::rtl::OUString> aKeyColumns = xKeyColumns->getElementNames();
+ const ::rtl::OUString* pKeyBegin = aKeyColumns.getConstArray();
+ const ::rtl::OUString* pKeyEnd = pKeyBegin + aKeyColumns.getLength();
+
+ for(;pKeyBegin != pKeyEnd;++pKeyBegin)
+ {
+ ::std::vector<OConnectionLineData*>::const_iterator aIter = m_vConnLineData.begin();
+ for(;aIter != m_vConnLineData.end();++aIter)
+ {
+ if( (*aIter)->IsValid() )
+ nValidLinesCount++;
+ if((*aIter)->GetFieldName(_eEConnectionSide) == *pKeyBegin)
+ {
+ nPrimKeysCount++;
+ break;
+ }
+ }
+ }
+ if(nPrimKeysCount != aKeyColumns.getLength())
+ return FALSE;
+ }
+ if( !nPrimKeysCount || nPrimKeysCount != nValidLinesCount )
+ return FALSE;
+
+ return TRUE;
+}
+//------------------------------------------------------------------------
+BOOL ORelationTableConnectionData::IsConnectionPossible()
+{
+ DBG_CHKTHIS(ORelationTableConnectionData,NULL);
+ if( !m_xSource.is() || !m_xDest.is() )
+ return FALSE;
+
+ if( !m_aSourceWinName.Len() || !m_aDestWinName.Len() )
+ return FALSE;
+
+ //////////////////////////////////////////////////////////////////////
+ // Wenn die SourceFelder ein PrimKey sind, ist nur die Orientierung falsch
+ if( IsSourcePrimKey() )
+ ChangeOrientation();
+
+ return TRUE;
+}
+
+//------------------------------------------------------------------------
+OConnectionLineData* ORelationTableConnectionData::CreateLineDataObj()
+{
+ return new OConnectionLineData();
+}
+
+//------------------------------------------------------------------------
+OConnectionLineData* ORelationTableConnectionData::CreateLineDataObj( const OConnectionLineData& rConnLineData )
+{
+ return new OConnectionLineData( rConnLineData );
+}
+
+//------------------------------------------------------------------------
+void ORelationTableConnectionData::CopyFrom(const OTableConnectionData& rSource)
+{
+ // wie in der Basisklasse zurueckziehen auf das (nicht-virtuelle) operator=
+ *this = *static_cast<const ORelationTableConnectionData*>(&rSource);
+}
+
+//------------------------------------------------------------------------
+ORelationTableConnectionData& ORelationTableConnectionData::operator=( const ORelationTableConnectionData& rConnData )
+{
+ if (&rConnData == this)
+ return *this;
+
+ OTableConnectionData::operator=( rConnData );
+ m_nUpdateRules = rConnData.GetUpdateRules();
+ m_nDeleteRules = rConnData.GetDeleteRules();
+ m_nCardinality = rConnData.GetCardinality();
+
+ // m_sDatabaseName = rConnData.getTablesName();
+
+ m_xTables = rConnData.getTables();
+ m_xSource = rConnData.getSource();
+ m_xDest = rConnData.getDest();
+
+ return *this;
+}
+
+//------------------------------------------------------------------------
+BOOL ORelationTableConnectionData::Update()
+{
+ ////////////////////////////////////////////////////////////
+ // Alte Relation loeschen
+ Reference<XKeysSupplier> xSup(m_xSource,UNO_QUERY);
+ Reference< XIndexAccess> xKeys;
+ if(xSup.is() )
+ xKeys = xSup->getKeys();
+ else
+ return FALSE;
+
+ if( m_aConnName.Len() && xKeys.is() )
+ {
+ for(sal_Int32 i=0;i<xKeys->getCount();++i)
+ {
+ Reference< XPropertySet> xKey;
+ xKeys->getByIndex(i) >>= xKey;
+ OSL_ENSURE(xKey.is(),"Key is not valid!");
+ if(xKey.is())
+ {
+ ::rtl::OUString sName;;
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sName;
+ if(sName == ::rtl::OUString(m_aConnName))
+ {
+ Reference< XDrop> xDrop(xKeys,UNO_QUERY);
+ OSL_ENSURE(xDrop.is(),"can't drop key because we haven't a drop interface!");
+ if(xDrop.is())
+ xDrop->dropByIndex(i);
+ break;
+ }
+ }
+ }
+ }
+
+ if( !IsConnectionPossible() )
+ return FALSE;
+
+ ////////////////////////////////////////////////////////////
+ // Neue Relation erzeugen
+ Reference<XDataDescriptorFactory> xKeyFactory(xKeys,UNO_QUERY);
+ OSL_ENSURE(xKeyFactory.is(),"No XDataDescriptorFactory Interface!");
+ Reference<XAppend> xAppend(xKeyFactory,UNO_QUERY);
+ OSL_ENSURE(xAppend.is(),"No XAppend Interface!");
+
+ Reference<XPropertySet> xKey = xKeyFactory->createDataDescriptor();
+ OSL_ENSURE(xKey.is(),"Key is null!");
+ xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::FOREIGN));
+ xKey->setPropertyValue(PROPERTY_REFERENCEDTABLE,makeAny(::rtl::OUString(m_aDestWinName)));
+ xKey->setPropertyValue(PROPERTY_UPDATERULE, makeAny(GetUpdateRules()));
+ xKey->setPropertyValue(PROPERTY_DELETERULE, makeAny(GetDeleteRules()));
+
+ Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
+ if(xColSup.is())
+ {
+ Reference<XNameAccess> xColumns = xColSup->getColumns();
+ Reference<XDataDescriptorFactory> xColumnFactory(xColumns,UNO_QUERY);
+ Reference<XAppend> xColumnAppend(xColumns,UNO_QUERY);
+
+ ::std::vector<OConnectionLineData*>::iterator aIter = m_vConnLineData.begin();
+ for(;aIter != m_vConnLineData.end();++aIter)
+ {
+ if((*aIter)->GetSourceFieldName().getLength() && (*aIter)->GetDestFieldName().getLength())
+ {
+ Reference<XPropertySet> xColumn;
+ xColumn = xColumnFactory->createDataDescriptor();
+ xColumn->setPropertyValue(PROPERTY_NAME,makeAny((*aIter)->GetSourceFieldName()));
+ xColumn->setPropertyValue(PROPERTY_RELATEDCOLUMN,makeAny((*aIter)->GetDestFieldName()));
+ xColumnAppend->appendByDescriptor(xColumn);
+ }
+ }
+
+ if(xColumns->getElementNames().getLength())
+ xAppend->appendByDescriptor(xKey);
+ // to get the key we have to reget it because after append it is no longer valid
+ }
+
+ // get the name of foreign key // search for columns
+ m_aConnName = ::rtl::OUString();
+ xKey = NULL;
+ for(sal_Int32 i=0;i<xKeys->getCount();++i)
+ {
+ xKeys->getByIndex(i) >>= xKey;
+ OSL_ENSURE(xKey.is(),"Key is not valid!");
+ if(xKey.is())
+ {
+ sal_Int32 nType = 0;
+ xKey->getPropertyValue(PROPERTY_TYPE) >>= nType;
+ if(nType == KeyType::FOREIGN)
+ {
+ ::rtl::OUString sName;
+ xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sName;
+ if(sName == ::rtl::OUString(m_aDestWinName))
+ {
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sName;
+ m_aConnName = sName;
+ break;
+ }
+ }
+ }
+ xKey = NULL;
+ }
+
+ OSL_ENSURE(xKey.is(),"No key found have insertion!");
+
+ xColSup = Reference<XColumnsSupplier>(xKey,UNO_QUERY);
+ if(xColSup.is())
+ {
+ // The fields the relation marks may not be the same as our LineDatas mark after the relation has been updated
+ ::std::vector<OConnectionLineData*>::iterator aIter = m_vConnLineData.begin();
+ for(;aIter != m_vConnLineData.end();++aIter)
+ delete *aIter;
+ m_vConnLineData.clear();
+
+ Reference<XNameAccess> xColumns = xColSup->getColumns();
+ Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
+ const ::rtl::OUString* pBegin = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aNames.getLength();
+ for(;pBegin != pEnd;++pBegin)
+ {
+ Reference<XPropertySet> xColumn;
+ xColumns->getByName(*pBegin) >>= xColumn;
+ if (xColumn.is())
+ {
+ OConnectionLineData* pNewData = CreateLineDataObj();
+
+ ::rtl::OUString sName,sRelatedColumn;
+
+ xColumn->getPropertyValue(PROPERTY_NAME) >>= sName;
+ xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn;
+
+ pNewData->SetSourceFieldName(sName);
+ pNewData->SetDestFieldName(sRelatedColumn);
+ m_vConnLineData.push_back(pNewData);
+ }
+ }
+ }
+ // NOTE : the caller is resposible for updating any other objects referencing the old LineDatas (for instance a ConnLine)
+
+ ////////////////////////////////////////////////////////////
+ // Kardinalitaet bestimmen
+ SetCardinality();
+
+ return TRUE;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
new file mode 100644
index 000000000..c7bac7a73
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -0,0 +1,834 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationController.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:06:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _DBAU_REGHELPER_HXX_
+#include "dbu_reghelper.hxx"
+#endif
+#ifndef _SFXSIDS_HRC
+#include <sfx2/sfxsids.hrc>
+#endif
+#ifndef _DBU_RESOURCE_HRC_
+#include "dbu_resource.hrc"
+#endif
+#ifndef _SV_TOOLBOX_HXX
+#include <vcl/toolbox.hxx>
+#endif
+#ifndef DBACCESS_UI_BROWSER_ID_HXX
+#include "browserids.hxx"
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
+#include "dbustrings.hrc"
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include <com/sun/star/frame/FrameSearchFlag.hpp>
+#endif
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
+#include <com/sun/star/sdb/SQLContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
+#include <com/sun/star/sdbc/ColumnValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
+#include <com/sun/star/sdbc/XRow.hpp>
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UI_XEXECUTABLEDIALOG_HPP_
+#include <com/sun/star/ui/XExecutableDialog.hpp>
+#endif
+#ifndef _COMPHELPER_STREAMSECTION_HXX_
+#include <comphelper/streamsection.hxx>
+#endif
+#ifndef _COMPHELPER_BASIC_IO_HXX_
+#include <comphelper/basicio.hxx>
+#endif
+#ifndef _COMPHELPER_SEQSTREAM_HXX
+#include <comphelper/seqstream.hxx>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#endif
+#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
+#include <com/sun/star/io/XActiveDataSink.hpp>
+#endif
+#ifndef _DBAUI_SQLMESSAGE_HXX_
+#include "sqlmessage.hxx"
+#endif
+#ifndef DBAUI_RELATIONCONTROLLER_HXX
+#include "RelationController.hxx"
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef DBAUI_TABLEWINDOWDATA_HXX
+#include "TableWindowData.hxx"
+#endif
+#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
+#include "dbustrings.hrc"
+#endif
+#ifndef DBAUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#include "RTableConnectionData.hxx"
+#endif
+#ifndef DBAUI_RELATION_TABLEVIEW_HXX
+#include "RelationTableView.hxx"
+#endif
+#ifndef DBAUI_RELATIONDESIGNVIEW_HXX
+#include "RelationDesignView.hxx"
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XFLUSHABLE_HPP_
+#include <com/sun/star/util/XFlushable.hpp>
+#endif
+
+extern "C" void SAL_CALL createRegistryInfo_ORelationControl()
+{
+ static ::dbaui::OMultiInstanceAutoRegistration< ::dbaui::ORelationController > aAutoRegistration;
+}
+
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::io;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::frame;
+using namespace ::com::sun::star::util;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdb;
+using namespace ::com::sun::star::ui;
+using namespace ::com::sun::star::util;
+// using namespace ::com::sun::star::sdbcx;
+// using namespace ::connectivity;
+using namespace ::dbtools;
+using namespace ::dbaui;
+using namespace ::comphelper;
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL ORelationController::getImplementationName() throw( RuntimeException )
+{
+ return getImplementationName_Static();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString ORelationController::getImplementationName_Static() throw( RuntimeException )
+{
+ return ::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ORelationDesign");
+}
+//------------------------------------------------------------------------------
+Sequence< ::rtl::OUString> ORelationController::getSupportedServiceNames_Static(void) throw( RuntimeException )
+{
+ Sequence< ::rtl::OUString> aSupported(1);
+ aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.RelationDesign");
+ return aSupported;
+}
+//-------------------------------------------------------------------------
+Sequence< ::rtl::OUString> SAL_CALL ORelationController::getSupportedServiceNames() throw(RuntimeException)
+{
+ return getSupportedServiceNames_Static();
+}
+// -------------------------------------------------------------------------
+Reference< XInterface > SAL_CALL ORelationController::Create(const Reference<XMultiServiceFactory >& _rxFactory)
+{
+ return *(new ORelationController(_rxFactory));
+}
+// -----------------------------------------------------------------------------
+ORelationController::ORelationController(const Reference< XMultiServiceFactory >& _rM) : OJoinController(_rM)
+{
+ InvalidateAll();
+}
+// -----------------------------------------------------------------------------
+ORelationController::~ORelationController()
+{
+}
+// -----------------------------------------------------------------------------
+void ORelationController::Execute(sal_uInt16 _nId)
+{
+ switch(_nId)
+ {
+ case ID_BROWSER_SAVEDOC:
+ {
+ OSL_ENSURE(m_bEditable,"Slot ID_BROWSER_SAVEDOC should not be enabled!");
+ // now we save the layout information
+ // create the output stream
+ try
+ {
+
+ Sequence< sal_Int8 > aOutputSeq;
+ if(m_xDataSource->getPropertySetInfo()->hasPropertyByName(PROPERTY_LAYOUTINFORMATION))
+ {
+ Reference< XOutputStream> xOutStreamHelper = new OSequenceOutputStream(aOutputSeq);
+ Reference< XObjectOutputStream> xOutStream(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectOutputStream")),UNO_QUERY);
+ Reference< XOutputStream> xMarkOutStream(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableOutputStream")),UNO_QUERY);
+ Reference< XActiveDataSource >(xMarkOutStream,UNO_QUERY)->setOutputStream(xOutStreamHelper);
+ Reference< XActiveDataSource > xOutDataSource(xOutStream, UNO_QUERY);
+ OSL_ENSURE(xOutDataSource.is(),"Couldn't create com.sun.star.io.ObjectOutputStream!");
+ xOutDataSource->setOutputStream(xMarkOutStream);
+ Save(xOutStream);
+
+ m_xDataSource->setPropertyValue(PROPERTY_LAYOUTINFORMATION,makeAny(aOutputSeq));
+ Reference<XFlushable> xFlush(m_xDataSource,UNO_QUERY);
+ if(xFlush.is())
+ xFlush->flush();
+ setModified(sal_False);
+ }
+ }
+ catch(Exception&)
+ {
+ }
+ }
+ break;
+ case ID_REALTION_ADD_RELATION:
+ static_cast<ORelationTableView*>(static_cast<ORelationDesignView*>(m_pView)->getTableView())->AddNewRelation();
+ break;
+ default:
+ OJoinController::Execute(_nId);
+ return;
+ break;
+ }
+ InvalidateFeature(_nId);
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ORelationController::initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException)
+{
+ try
+ {
+ OGenericUnoController::initialize(aArguments);
+
+ // m_pWindow->initialize(m_xCurrentFrame);
+
+ PropertyValue aValue;
+ const Any* pBegin = aArguments.getConstArray();
+ const Any* pEnd = pBegin + aArguments.getLength();
+
+ for(;pBegin != pEnd;++pBegin)
+ {
+ if((*pBegin >>= aValue) && aValue.Name == PROPERTY_ACTIVECONNECTION)
+ {
+ aValue.Value >>= m_xConnection;
+ OSL_ENSURE(m_xConnection.is(),"We need at least a connection!");
+ // be notified when connection is in disposing
+ Reference< XComponent > xComponent(m_xConnection, UNO_QUERY);
+ if (xComponent.is())
+ {
+ Reference< ::com::sun::star::lang::XEventListener> xEvtL((::cppu::OWeakObject*)this,UNO_QUERY);
+ xComponent->addEventListener(xEvtL);
+ }
+ }
+ else if(aValue.Name == PROPERTY_DATASOURCENAME)
+ {
+ aValue.Value >>= m_sDataSourceName;
+ }
+ }
+
+ if (!m_xConnection.is())
+ { // whoever instantiated us did not give us a connection to share. Okay, create an own one
+ createNewConnection(sal_False);
+ }
+ if(!m_xConnection.is()) // so what should otherwise
+ {
+ String aMessage(ModuleRes(RID_STR_CONNECTION_LOST));
+ ODataView* pWindow = getView();
+ InfoBox(pWindow, aMessage).Execute();
+ dispose(); // we are helpless without a connection
+ }
+ // check if this database supports relations
+ if(!m_xConnection->getMetaData()->supportsIntegrityEnhancementFacility())
+ {
+ OSQLMessageBox aDlg(getView(),ModuleRes(STR_RELATIONDESIGN),ModuleRes(STR_RELATIONDESIGN_NOT_AVAILABLE));
+ aDlg.Execute();
+ dispose();
+ }
+
+ Reference<XTablesSupplier> xSup(m_xConnection,UNO_QUERY);
+ OSL_ENSURE(xSup.is(),"Connection isn't a XTablesSupplier!");
+ if(xSup.is())
+ m_xTables = xSup->getTables();
+ // load the layoutInformation
+ try
+ {
+ Reference<XChild> xChild(m_xConnection,UNO_QUERY);
+ if(xChild.is())
+ m_xDataSource = Reference< XPropertySet >(xChild->getParent(),UNO_QUERY);
+
+ OSL_ENSURE(m_xDataSource.is(),"We need a datasource from our connection!");
+ if(m_xDataSource.is())
+ {
+ Sequence< sal_Int8 > aInputSequence;
+ if(m_xDataSource->getPropertySetInfo()->hasPropertyByName(PROPERTY_LAYOUTINFORMATION))
+ {
+ m_xDataSource->getPropertyValue(PROPERTY_LAYOUTINFORMATION) >>= aInputSequence;
+ {
+ Reference< XInputStream> xInStreamHelper = new SequenceInputStream(aInputSequence);; // used for wrapping sequence to xinput
+ Reference< XObjectInputStream> xInStream = Reference< XObjectInputStream >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")),UNO_QUERY);
+ Reference< XInputStream> xMarkInStream = Reference< XInputStream >(getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.io.MarkableInputStream")),UNO_QUERY);
+ Reference< XActiveDataSink >(xMarkInStream,UNO_QUERY)->setInputStream(xInStreamHelper);
+ Reference< XActiveDataSink > xInDataSource(xInStream, UNO_QUERY);
+ OSL_ENSURE(xInDataSource.is(),"Couldn't create com.sun.star.io.ObjectInputStream!");
+ xInDataSource->setInputStream(xMarkInStream);
+ Load(xInStream);
+ }
+ }
+ }
+ }
+ catch(Exception&)
+ {
+ }
+
+ loadData();
+ getView()->initialize(); // show the windows and fill with our informations
+ getUndoMgr()->Clear(); // clear all undo redo things
+ setModified(sal_False); // and we are not modified yet
+ }
+ catch(SQLException&)
+ {
+ OSL_ASSERT(0);
+ }
+
+}
+// -----------------------------------------------------------------------------
+sal_Bool ORelationController::Construct(Window* pParent)
+{
+ m_pView = new ORelationDesignView(pParent,this,m_xMultiServiceFacatory);
+ OGenericUnoController::Construct(pParent);
+ m_pView->Construct(NULL);
+ m_pView->Show();
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ORelationController::propertyChange(const PropertyChangeEvent& evt)
+{
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ORelationController::elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( RuntimeException )
+{
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ORelationController::elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( RuntimeException )
+{
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL ORelationController::elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( RuntimeException )
+{
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL ORelationController::suspend(sal_Bool bSuspend) throw( RuntimeException )
+{
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+void ORelationController::AddSupportedFeatures()
+{
+ m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DBSlots/Redo")] = ID_BROWSER_REDO;
+ m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DBSlots/Save")] = ID_BROWSER_SAVEDOC;
+ m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:DBSlots/Undo")] = ID_BROWSER_UNDO;
+
+ m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:BrowserMode")] = SID_BROWSER_MODE;
+ m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:HelpMenu")] = SID_HELPMENU;
+ // m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:NewDoc")] = SID_NEWDOC;
+ // m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:SaveAsDoc")] = SID_SAVEASDOC;
+ // m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:ExplorerContentOpen")] = SID_EXPLORERCONTENT_OPEN;
+ // m_aSupportedFeatures[ ::rtl::OUString::createFromAscii(".uno:ExplorerContentOpenDocument")] = SID_EXPLORERCONTENT_OPEN_DOCUMENT;
+
+}
+// -----------------------------------------------------------------------------
+ToolBox* ORelationController::CreateToolBox(Window* _pParent)
+{
+ return new ToolBox(_pParent, ModuleRes(RID_BRW_REALTIONDESIGN_TOOLBOX));
+}
+// -----------------------------------------------------------------------------
+void ORelationController::loadData()
+{
+ try
+ {
+ if(!m_xTables.is())
+ return;
+
+ Sequence< ::rtl::OUString> aNames = m_xTables->getElementNames();
+ const ::rtl::OUString* pBegin = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aNames.getLength();
+ for(;pBegin != pEnd;++pBegin)
+ {
+ Reference<XKeysSupplier> xKeySup;
+ m_xTables->getByName(*pBegin) >>= xKeySup;
+ Reference<XIndexAccess> xKeys;
+ if(xKeySup.is())
+ xKeys = xKeySup->getKeys();
+ if(xKeys.is())
+ {
+ Reference<XPropertySet> xKey;
+ for(sal_Int32 i=0;i< xKeys->getCount();++i)
+ {
+ xKeys->getByIndex(i) >>= xKey;
+ sal_Int32 nKeyType = 0;
+ xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
+ if(KeyType::FOREIGN == nKeyType)
+ {
+ ::rtl::OUString sSourceName,sReferencedTable;
+ Reference<XPropertySet> xTableProp(xKeySup,UNO_QUERY);
+
+ ::dbaui::composeTableName(m_xConnection->getMetaData(),xTableProp,sSourceName,sal_False);
+ xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable;
+ //////////////////////////////////////////////////////////////////////
+ // insert windows
+ if( !existsTable(sSourceName) )
+ {
+ OTableWindowData* pData = new OTableWindowData(sSourceName, sSourceName);
+ pData->ShowAll(FALSE);
+ m_vTableData.push_back(pData);
+ }
+
+ if( !existsTable(sReferencedTable) )
+ {
+ OTableWindowData* pData = new OTableWindowData(sReferencedTable, sReferencedTable);
+ pData->ShowAll(FALSE);
+ m_vTableData.push_back(pData);
+ }
+
+ ::rtl::OUString sKeyName;
+ xKey->getPropertyValue(PROPERTY_NAME) >>= sKeyName;
+ //////////////////////////////////////////////////////////////////////
+ // insert connection
+ ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData( m_xTables, sSourceName, sReferencedTable, sKeyName );
+ m_vTableConnectionData.push_back(pTabConnData);
+ //////////////////////////////////////////////////////////////////////
+ // insert columns
+ Reference<XColumnsSupplier> xColsSup(xKey,UNO_QUERY);
+ OSL_ENSURE(xColsSup.is(),"Key is no XColumnsSupplier!");
+ Reference<XNameAccess> xColumns = xColsSup->getColumns();
+ Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
+ const ::rtl::OUString* pBegin = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aNames.getLength();
+ ::rtl::OUString sColumnName,sRelatedName;
+ for(sal_uInt16 j=0;pBegin != pEnd;++pBegin,++j)
+ {
+ Reference<XPropertySet> xPropSet;
+ xColumns->getByName(*pBegin) >>= xPropSet;
+ xPropSet->getPropertyValue(PROPERTY_NAME) >>= sColumnName;
+ xPropSet->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedName;
+ pTabConnData->SetConnLine( j, sColumnName, sRelatedName );
+ }
+ //////////////////////////////////////////////////////////////////////
+ // Update/Del-Flags setzen
+ sal_Int32 nUpdateRule,
+ nDeleteRule;
+ xKey->getPropertyValue(PROPERTY_UPDATERULE) >>= nUpdateRule;
+ xKey->getPropertyValue(PROPERTY_DELETERULE) >>= nDeleteRule;
+
+ pTabConnData->SetUpdateRules( nUpdateRule );
+ pTabConnData->SetDeleteRules( nDeleteRule );
+
+ //////////////////////////////////////////////////////////////////////
+ // Kardinalitaet setzen
+ pTabConnData->SetCardinality();
+ }
+ }
+ }
+ }
+ }
+ catch(SQLException& e)
+ {
+ showError(SQLExceptionInfo(e));
+ }
+ catch(Exception&)
+ {
+ }
+
+}
+// -----------------------------------------------------------------------------
+sal_Bool ORelationController::existsTable(const ::rtl::OUString& _rComposedTableName) const
+{
+ ::comphelper::UStringMixEqual bCase(m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
+ ::std::vector<OTableWindowData*>::const_iterator aIter = m_vTableData.begin();
+ for(;aIter != m_vTableData.end();++aIter)
+ {
+ if(bCase((*aIter)->GetComposedName(),_rComposedTableName))
+ break;
+ }
+ return aIter != m_vTableData.end();
+}
+// -----------------------------------------------------------------------------
+//void ORelationController::appendColumns(Reference<XColumnsSupplier>& _rxColSup,sal_Bool _bKeyColumns)
+//{
+// try
+// {
+// // now append the columns
+// OSL_ENSURE(_rxColSup.is(),"No columns supplier");
+// if(!_rxColSup.is())
+// return;
+// Reference<XNameAccess> xColumns = _rxColSup->getColumns();
+// OSL_ENSURE(xColumns.is(),"No columns");
+// Reference<XDataDescriptorFactory> xColumnFactory(xColumns,UNO_QUERY);
+//
+// Reference<XAppend> xAppend(xColumns,UNO_QUERY);
+// OSL_ENSURE(xAppend.is(),"No XAppend Interface!");
+//
+// ::std::vector<OTableRow*>::iterator aIter = m_vRowList.begin();
+// for(;aIter != m_vRowList.end();++aIter)
+// {
+// OSL_ENSURE(*aIter,"OTableRow is null!");
+// OFieldDescription* pField = (*aIter)->GetActFieldDescr();
+// if(!pField)
+// continue;
+//
+// Reference<XPropertySet> xColumn;
+// if(pField->IsPrimaryKey() || !_bKeyColumns)
+// xColumn = xColumnFactory->createDataDescriptor();
+// if(xColumn.is())
+// {
+// if(!_bKeyColumns)
+// setColumnProperties(xColumn,pField);
+// else
+// xColumn->setPropertyValue(PROPERTY_NAME,makeAny(pField->GetName()));
+//
+// xAppend->appendByDescriptor(xColumn);
+// xColumn = NULL;
+// // now only the settings are missing
+// if(xColumns->hasByName(pField->GetName()))
+// {
+// xColumns->getByName(pField->GetName()) >>= xColumn;
+// if(xColumn.is())
+// {
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
+// xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
+// xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny((sal_Int32)pField->GetHorJustify()));
+// }
+// }
+// else
+// {
+// OSL_ASSERT(0);
+// }
+//
+// }
+// }
+// }
+// catch(SQLException& e)
+// {
+// showError(SQLExceptionInfo(e));
+// }
+// catch(Exception&)
+// {
+// OSL_ASSERT(0);
+// }
+//}
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+//void ORelationController::alterColumns()
+//{
+// Reference<XColumnsSupplier> xColSup(m_xTable,UNO_QUERY);
+// OSL_ENSURE(xColSup.is(),"What happen here?!");
+//
+// Reference<XNameAccess> xColumns = xColSup->getColumns();
+// OSL_ENSURE(xColumns.is(),"No columns");
+// Reference<XAlterTable> xAlter(m_xTable,UNO_QUERY);
+// Reference<XDrop> xDrop(xColumns,UNO_QUERY);
+// Reference<XAppend> xAppend(xColumns,UNO_QUERY);
+// Reference<XDataDescriptorFactory> xColumnFactory(xColumns,UNO_QUERY);
+//
+// sal_Bool bReload = sal_False; // refresh the data
+//
+// ::std::map< ::rtl::OUString,sal_Bool,::comphelper::UStringMixLess> aColumns(m_xConnection->getMetaData()->storesMixedCaseQuotedIdentifiers());
+// ::std::vector<OTableRow*>::iterator aIter = m_vRowList.begin();
+// for(;aIter != m_vRowList.end();++aIter)
+// {
+// OSL_ENSURE(*aIter,"OTableRow is null!");
+// OFieldDescription* pField = (*aIter)->GetActFieldDescr();
+// if(!pField)
+// continue;
+//
+// Reference<XPropertySet> xColumn;
+// if(xColumns->hasByName(pField->GetName()))
+// {
+// aColumns[pField->GetName()] = sal_True;
+// xColumns->getByName(pField->GetName()) >>= xColumn;
+// OSL_ENSURE(xColumn.is(),"Column is null!");
+//
+// sal_Int32 nType,nPrecision,nScale,nNullable,nFormatKey,nAlignment;
+// sal_Bool bAutoIncrement;
+// ::rtl::OUString sDescription,sDefaultValue;
+//
+// xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType;
+// xColumn->getPropertyValue(PROPERTY_PRECISION) >>= nPrecision;
+// xColumn->getPropertyValue(PROPERTY_SCALE) >>= nScale;
+// xColumn->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullable;
+// bAutoIncrement = ::cppu::any2bool(xColumn->getPropertyValue(PROPERTY_ISAUTOINCREMENT));
+// // xColumn->getPropertyValue(PROPERTY_ISCURRENCY,::cppu::bool2any(pField->IsCurrency()));
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DESCRIPTION))
+// xColumn->getPropertyValue(PROPERTY_DESCRIPTION) >>= sDescription;
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE))
+// xColumn->getPropertyValue(PROPERTY_DEFAULTVALUE) >>= sDefaultValue;
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
+// xColumn->getPropertyValue(PROPERTY_FORMATKEY) >>= nFormatKey;
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
+// xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlignment;
+//
+// // check if something changed
+// if((nType != pField->GetType() ||
+// nPrecision != pField->GetPrecision() ||
+// nScale != pField->GetScale() ||
+// nNullable != pField->GetIsNullable() ||
+// bAutoIncrement != pField->IsAutoIncrement() ||
+// sDescription != pField->GetDescription() ||
+// sDefaultValue != pField->GetDefaultValue()) &&
+// xColumnFactory.is())
+// {
+// Reference<XPropertySet> xNewColumn;
+// xNewColumn = xColumnFactory->createDataDescriptor();
+// setColumnProperties(xNewColumn,pField);
+// // first try to alter the column
+// sal_Bool bNotOk = sal_False;
+// try
+// {
+// if(xAlter.is())
+// xAlter->alterColumnByName(pField->GetName(),xNewColumn);
+// }
+// catch(SQLException&)
+// {
+// bNotOk = sal_True;
+// }
+// if((!xAlter.is() || bNotOk) && xDrop.is() && xAppend.is())
+// {
+// xDrop->dropByName(pField->GetName());
+// xAppend->appendByDescriptor(xNewColumn);
+// }
+// xNewColumn = NULL;
+// xColumns->getByName(pField->GetName()) >>= xColumn;
+// bReload = sal_True;
+// }
+//
+// if(nFormatKey != pField->GetFormatKey())
+// {
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
+// xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+// }
+// if(nAlignment != (sal_Int32)pField->GetHorJustify())
+// {
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
+// xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(nAlignment));
+// }
+// }
+// else if(xColumnFactory.is())
+// {
+// // Column is new
+// xColumn = xColumnFactory->createDataDescriptor();
+// setColumnProperties(xColumn,pField);
+// xAppend->appendByDescriptor(xColumn);
+// if(xColumns->hasByName(pField->GetName()))
+// {
+// xColumns->getByName(pField->GetName()) >>= xColumn;
+// if(xColumn.is())
+// {
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_FORMATKEY))
+// xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+// if(xColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ALIGN))
+// xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny((sal_Int32)pField->GetHorJustify()));
+// }
+// }
+// else
+// {
+// OSL_ASSERT(0);
+// }
+// }
+// }
+//
+// Reference<XNameAccess> xKeyColumns = getKeyColumns();
+// // now we have to look for the columns who where deleted
+// if(xDrop.is())
+// {
+// Sequence< ::rtl::OUString> aColumnNames = xColumns->getElementNames();
+// const ::rtl::OUString* pBegin = aColumnNames.getConstArray();
+// const ::rtl::OUString* pEnd = pBegin + aColumnNames.getLength();
+// for(;pBegin != pEnd;++pBegin)
+// {
+// if(aColumns.find(*pBegin) == aColumns.end()) // found a column to delete
+// {
+// if(xKeyColumns.is() && xKeyColumns->hasByName(*pBegin)) // check if this column is a memeber of the primary key
+// {
+// String aMsgT(ModuleRes(STR_TBL_COLUMN_IS_KEYCOLUMN));
+// aMsgT.SearchAndReplace(String::CreateFromAscii("\"$column$\""),*pBegin);
+// String aTitle(ModuleRes(STR_TBL_COLUMN_IS_KEYCOLUMN_TITLE));
+// OSQLMessageBox aMsg(getView(),aTitle,aMsgT,WB_YES_NO| WB_DEF_YES);
+// if(aMsg.Execute() == RET_YES)
+// {
+// xKeyColumns = NULL;
+// dropKey();
+// }
+// else
+// {
+// bReload = sal_True;
+// continue;
+// }
+// }
+// Reference<XDrop> xDrop(xColumns,UNO_QUERY);
+// xDrop->dropByName(*pBegin);
+// }
+// }
+// }
+// // check if we have to do something with the primary key
+// if(xKeyColumns.is())
+// {
+// aIter = m_vRowList.begin();
+// for(;aIter != m_vRowList.end();++aIter)
+// {
+// OSL_ENSURE(*aIter,"OTableRow is null!");
+// OFieldDescription* pField = (*aIter)->GetActFieldDescr();
+// if(!pField)
+// continue;
+// if(pField->IsPrimaryKey() && !xKeyColumns->hasByName(pField->GetName()))
+// {
+// dropKey();
+// Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
+// appendKey(xKeySup);
+// break;
+// }
+// }
+// }
+// else
+// {
+// Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
+// appendKey(xKeySup);
+// }
+//
+// if(bReload)
+// {
+// loadData(); // fill the column information form the table
+// getView()->initialize(); // show the windows and fill with our informations
+// getUndoMgr()->Clear(); // clear all undo redo things
+// setModified(sal_False); // and we are not modified yet
+// }
+//}
+// -----------------------------------------------------------------------------
+//void ORelationController::dropKey()
+//{
+// Reference<XKeysSupplier> xKeySup(m_xTable,UNO_QUERY);
+// Reference<XIndexAccess> xKeys;
+// if(xKeySup.is())
+// xKeys = xKeySup->getKeys();
+//
+// if(xKeys.is())
+// {
+// Reference<XPropertySet> xProp;
+// for(sal_Int32 i=0;i< xKeys->getCount();++i)
+// {
+// xKeys->getByIndex(i) >>= xProp;
+// sal_Int32 nKeyType = 0;
+// xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType;
+// if(KeyType::PRIMARY == nKeyType)
+// {
+// Reference<XDrop> xDrop(xKeys,UNO_QUERY);
+// xDrop->dropByIndex(i); // delete the key
+// break;
+// }
+// }
+// }
+//}
+// -----------------------------------------------------------------------------
+
+
+
+
+
+
diff --git a/dbaccess/source/ui/relationdesign/RelationDesignView.cxx b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
new file mode 100644
index 000000000..cfb2c2dca
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/RelationDesignView.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationDesignView.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:07:08 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RELATIONDESIGNVIEW_HXX
+#include "RelationDesignView.hxx"
+#endif
+#ifndef DBAUI_RELATION_TABLEVIEW_HXX
+#include "RelationTableView.hxx"
+#endif
+#ifndef _SV_TOOLBOX_HXX
+#include <vcl/toolbox.hxx>
+#endif
+#ifndef DBAUI_RELATIONCONTROLLER_HXX
+#include "RelationController.hxx"
+#endif
+#ifndef _UNDO_HXX
+#include <svtools/undo.hxx>
+#endif
+#ifndef DBAUI_QYDLGTAB_HXX
+#include "adtabdlg.hxx"
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef DBACCESS_UI_BROWSER_ID_HXX
+#include "browserids.hxx"
+#endif
+#ifndef _DBU_RESOURCE_HRC_
+#include "dbu_resource.hrc"
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include <com/sun/star/sdbc/DataType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef DBAUI_RTABLECONNECTION_HXX
+#include "RTableConnection.hxx"
+#endif
+#ifndef DBAUI_CONNECTIONLINE_HXX
+#include "ConnectionLine.hxx"
+#endif
+#ifndef DBAUI_CONNECTIONLINEDATA_HXX
+#include "ConnectionLineData.hxx"
+#endif
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#include "RTableConnectionData.hxx"
+#endif
+#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
+#include "dbustrings.hrc"
+#endif
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+#ifndef DBAUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
+
+using namespace ::dbaui;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+ORelationDesignView::ORelationDesignView(Window* _pParent, ORelationController* _pController,const Reference< XMultiServiceFactory >& _rFactory)
+ :OJoinDesignView(_pParent,_pController,_rFactory)
+{
+
+}
+// -----------------------------------------------------------------------------
+ORelationDesignView::~ORelationDesignView()
+{
+}
+// -------------------------------------------------------------------------
+void ORelationDesignView::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel)
+{
+ m_pTableView = new ORelationTableView(m_pScrollWindow,this);
+ OJoinDesignView::Construct(xModel); // initialize m_xMe
+}
+// -----------------------------------------------------------------------------
+void ORelationDesignView::initialize()
+{
+ m_pTableView->ReSync();
+
+ OJoinDesignView::initialize();
+}
+// -----------------------------------------------------------------------------
+
+
+
+
+
+
+
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
new file mode 100644
index 000000000..a989d778f
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -0,0 +1,460 @@
+/*************************************************************************
+ *
+ * $RCSfile: RelationTableView.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:07:28 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef DBAUI_RELATION_TABLEVIEW_HXX
+#include "RelationTableView.hxx"
+#endif
+#ifndef DBAUI_JOINEXCHANGE_HXX
+#include "JoinExchange.hxx"
+#endif
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+#ifndef DBACCESS_UI_BROWSER_ID_HXX
+#include "browserids.hxx"
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
+#include <com/sun/star/sdbc/XConnection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
+#include <com/sun/star/sdbcx/KeyType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
+#include "dbustrings.hrc"
+#endif
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#include <connectivity/dbtools.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _DBA_DBACCESS_HELPID_HRC_
+#include "dbaccess_helpid.hrc"
+#endif
+#ifndef DBAUI_RELATIONDESIGNVIEW_HXX
+#include "RelationDesignView.hxx"
+#endif
+#ifndef DBAUI_JOINCONTROLLER_HXX
+#include "JoinController.hxx"
+#endif
+#ifndef DBAUI_TABLEWINDOW_HXX
+#include "TableWindow.hxx"
+#endif
+#ifndef DBAUI_TABLEWINDOWDATA_HXX
+#include "TableWindowData.hxx"
+#endif
+#ifndef DBAUI_RTABLECONNECTION_HXX
+#include "RTableConnection.hxx"
+#endif
+#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
+#include "RTableConnectionData.hxx"
+#endif
+#ifndef DBAUI_RELATIONDIALOG_HXX
+#include "RelationDlg.hxx"
+#endif
+#ifndef _DBAUI_SQLMESSAGE_HXX_
+#include "sqlmessage.hxx"
+#endif
+#ifndef _DBU_RESOURCE_HRC_
+#include "dbu_resource.hrc"
+#endif
+#ifndef DBAUI_TOOLS_HXX
+#include "UITools.hxx"
+#endif
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#include <connectivity/dbexception.hxx>
+#endif
+
+using namespace dbaui;
+using namespace ::dbtools;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::sdbc;
+using namespace ::com::sun::star::sdbcx;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+
+//==================================================================
+// class ORelationTableView
+//==================================================================
+DBG_NAME(ORelationTableView);
+//------------------------------------------------------------------------
+ORelationTableView::ORelationTableView( Window* pParent, ORelationDesignView* pView )
+ : OJoinTableView( pParent, pView )
+{
+ DBG_CTOR(ORelationTableView,NULL);
+ SetHelpId(HID_CTL_RELATIONTAB);
+}
+
+//------------------------------------------------------------------------
+ORelationTableView::~ORelationTableView()
+{
+ DBG_DTOR(ORelationTableView,NULL);
+
+}
+
+//------------------------------------------------------------------------
+void ORelationTableView::ReSync()
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ // Es kann sein, dass in der DB Tabellen ausgeblendet wurden, die eigentlich Bestandteil einer Relation sind. Oder eine Tabelle
+ // befand sich im Layout (durchaus ohne Relation), existiert aber nicht mehr. In beiden Faellen wird das Anlegen des TabWins schief
+ // gehen, und alle solchen TabWinDatas oder darauf bezogenen ConnDatas muss ich dann loeschen.
+ ::std::vector< ::rtl::OUString> arrInvalidTables;
+
+ //////////////////////////////////////////////////////////////////////
+ // create and insert windows
+ ::std::vector< OTableWindowData*>* pTabWinDataList = m_pView->getController()->getTableWindowData();
+ ::std::vector< OTableWindowData*>::reverse_iterator aIter = pTabWinDataList->rbegin();
+ for(;aIter != pTabWinDataList->rend();++aIter)
+ {
+ OTableWindowData* pData = *aIter;
+ OTableWindow* pTabWin = new OTableWindow(this, pData);
+
+ if (!pTabWin->Init())
+ {
+ // das Initialisieren ging schief, dass heisst, dieses TabWin steht nicht zur Verfuegung, also muss ich es inklusive
+ // seiner Daten am Dokument aufraeumen
+ delete pTabWin;
+ arrInvalidTables.push_back(pData->GetTableName());
+
+ pTabWinDataList->erase( ::std::find(pTabWinDataList->begin(),pTabWinDataList->end(),*aIter) );
+ delete pData;
+ continue;
+ }
+
+ (*GetTabWinMap())[pData->GetComposedName()] = pTabWin; // am Anfang einfuegen, da ich die DataList ja rueckwaerts durchlaufe
+ // wenn in den Daten keine Position oder Groesse steht -> Default
+ if (!pData->HasPosition() && !pData->HasSize())
+ SetDefaultTabWinPosSize(pTabWin);
+
+ pTabWin->Show();
+ }
+
+ // Verbindungen einfuegen
+ ::std::vector< OTableConnectionData*>* pTabConnDataList = m_pView->getController()->getTableConnectionData();
+ ::std::vector< OTableConnectionData*>::reverse_iterator aConIter = pTabConnDataList->rbegin();
+
+ for(;aConIter != pTabConnDataList->rend();++aConIter)
+ {
+ ORelationTableConnectionData* pTabConnData = static_cast<ORelationTableConnectionData*>(*aConIter);
+ // gibt es die beiden Tabellen zur Connection ?
+ ::rtl::OUString strTabExistenceTest = pTabConnData->GetSourceWinName();
+ sal_Bool bInvalid = ::std::find(arrInvalidTables.begin(),arrInvalidTables.end(),strTabExistenceTest) != arrInvalidTables.end();
+ strTabExistenceTest = pTabConnData->GetDestWinName();
+ bInvalid |= ::std::find(arrInvalidTables.begin(),arrInvalidTables.end(),strTabExistenceTest) != arrInvalidTables.end();
+
+ if (bInvalid)
+ { // nein -> Pech gehabt, die Connection faellt weg
+ pTabConnDataList->erase( ::std::find(pTabConnDataList->begin(),pTabConnDataList->end(),*aConIter) );
+ delete pTabConnData;
+ continue;
+ }
+
+ GetTabConnList()->push_back(new ORelationTableConnection(this, pTabConnData));
+ }
+}
+//------------------------------------------------------------------------------
+BOOL ORelationTableView::IsAddAllowed()
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+
+ Reference<XConnection> xConnection = m_pView->getController()->getConnection();
+ if(!xConnection.is())
+ return FALSE;
+ Reference < XDatabaseMetaData > xMetaData( m_pView->getController()->getConnection()->getMetaData() );
+
+ return xMetaData->supportsIntegrityEnhancementFacility();
+}
+//------------------------------------------------------------------------
+void ORelationTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest)
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ // Aus selektierten Feldnamen LineDataObject setzen
+ // check if relation already exists
+ OTableWindow* pSourceWin = (OTableWindow*)jxdSource.pListBox->GetTabWin();
+ OTableWindow* pDestWin = (OTableWindow*)jxdDest.pListBox->GetTabWin();
+
+ ::std::vector<OTableConnection*>::const_iterator aIter = GetTabConnList()->begin();
+ for(;aIter != GetTabConnList()->end();++aIter)
+ {
+ OTableConnection* pFirst = *aIter;
+ 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);
+ return;
+ }
+ }
+ // Datenobjekt in DocShell einfuegen
+ ORelationTableConnectionData* pTabConnData = new ORelationTableConnectionData(Reference<XTablesSupplier>(getDesignView()->getController()->getConnection(),UNO_QUERY)->getTables(),
+ jxdSource.pListBox->GetTabWin()->GetWinName(),
+ jxdDest.pListBox->GetTabWin()->GetWinName());
+
+ // die Namen der betroffenen Felder
+ String aSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry);
+ String aDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry);
+
+ // die Anzahl der PKey-Felder in der Quelle
+
+ UINT16 nSourceKeys(0);
+ ::std::vector< Reference< XNameAccess> > aPkeys = ::dbaui::getKeyColumns(pSourceWin->GetTable(),KeyType::PRIMARY);
+ if(aPkeys.size())
+ {
+ OSL_ENSURE(aPkeys.size()==1,"There can't be more than one pkey!");
+ Reference< XNameAccess> xColumns = pSourceWin->GetOriginalColumns();
+ Sequence< ::rtl::OUString> aNames = xColumns->getElementNames();
+ const ::rtl::OUString* pBegin = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pBegin + aNames.getLength();
+ for(;pBegin != pEnd;++pBegin)
+ {
+ if((*aPkeys.begin())->hasByName(*pBegin))
+ pTabConnData->SetConnLine( nSourceKeys++, *pBegin, String() );
+ }
+ }
+
+ 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;
+ }
+ else
+ {
+ pTabConnData->ResetConnLines();
+ pTabConnData->SetConnLine( 0, aSourceFieldName, aDestFieldName );
+
+ //////////////////////////////////////////////////////////////////////
+ // 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;
+ }
+}
+
+
+//------------------------------------------------------------------------
+void ORelationTableView::ConnDoubleClicked( OTableConnection* pConnection )
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ ORelationTableConnectionData* pRelTabConnData = (ORelationTableConnectionData*)((ORelationTableConnection*)pConnection)->GetData();
+ ORelationDialog aRelDlg( this, pRelTabConnData );
+ switch (aRelDlg.Execute())
+ {
+ case RET_OK:
+ // successfully updated
+ pConnection->UpdateLineList();
+ // The connection references 1 ConnData and n ConnLines, each ConnData references n LineDatas, each Line exactly 1 LineData
+ // As the Dialog and the ConnData->Update may have changed the LineDatas we have to restore the consistent state
+ break;
+
+ case RET_NO:
+ // tried at least one update, but did not succeed -> the original connection is lost
+ RemoveConnection( pConnection );
+ break;
+
+ case RET_CANCEL:
+ // no break, as nothing happened and we don't need the code below
+ return;
+
+ }
+
+ Invalidate(INVALIDATE_NOCHILDREN);
+}
+
+//------------------------------------------------------------------------------
+void ORelationTableView::AddNewRelation()
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ ORelationTableConnectionData* pNewConnData = new ORelationTableConnectionData(Reference<XTablesSupplier>(getDesignView()->getController()->getConnection(),UNO_QUERY)->getTables());
+ ORelationDialog aRelDlg(this, pNewConnData, TRUE);
+
+ BOOL bSuccess = (aRelDlg.Execute() == RET_OK);
+ if (bSuccess)
+ {
+// bSuccess = pNewConnData->Update();
+ // already updated by the dialog
+ // dem Dokument bekanntgeben
+ getDesignView()->getController()->getTableConnectionData()->push_back(pNewConnData);
+
+ // das reale Connection-Objekt (bis jetzt haben wir nur die Datas)
+ ORelationTableConnection* pTabConn = new ORelationTableConnection(this, pNewConnData);
+ GetTabConnList()->push_back(pTabConn);
+
+ // neu zeichnen
+ Invalidate(INVALIDATE_NOCHILDREN);
+ }
+ else
+ delete pNewConnData;
+}
+
+//------------------------------------------------------------------------------
+BOOL ORelationTableView::RemoveConnection( OTableConnection* pConn )
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ ORelationTableConnectionData* pTabConnData = (ORelationTableConnectionData*)pConn->GetData();
+ BOOL bErg = FALSE;
+ try
+ {
+ if (bErg = pTabConnData->DropRelation())
+ OJoinTableView::RemoveConnection( pConn );
+ }
+ catch(SQLException& e)
+ {
+ getDesignView()->getController()->showError(SQLExceptionInfo(e));
+ }
+ catch(Exception&)
+ {
+ }
+ return bErg;
+}
+
+//------------------------------------------------------------------------------
+void ORelationTableView::KeyInput( const KeyEvent& rEvt )
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ OJoinTableView::KeyInput( rEvt );
+}
+//------------------------------------------------------------------------------
+void ORelationTableView::AddTabWin(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rWinName, BOOL bNewTable)
+{
+ DBG_CHKTHIS(ORelationTableView,NULL);
+ OSL_ENSURE(_rComposedName.getLength(),"There must be a table name supplied!");
+ OJoinTableView::OTableWindowMap::iterator aIter = GetTabWinMap()->find(_rComposedName);
+
+ if(aIter != GetTabWinMap()->end())
+ {
+ aIter->second->SetZOrder(NULL, WINDOW_ZORDER_FIRST);
+ aIter->second->GrabFocus();
+ EnsureVisible(aIter->second);
+ // no new one
+ return;
+ }
+
+ //////////////////////////////////////////////////////////////////
+ // Neue Datenstruktur in DocShell eintragen
+ OTableWindowData* pNewTabWinData = CreateImpl( _rComposedName, rWinName );
+ pNewTabWinData->ShowAll(FALSE);
+
+
+ //////////////////////////////////////////////////////////////////
+ // Neues Fenster in Fensterliste eintragen
+ OTableWindow* pNewTabWin = new OTableWindow( this, pNewTabWinData );
+ 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
+ (*GetTabWinMap())[_rComposedName] = pNewTabWin;
+
+ SetDefaultTabWinPosSize( pNewTabWin );
+ pNewTabWin->Show();
+
+ m_pView->getController()->setModified( sal_True );
+ m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE);
+ }
+ else
+ {
+ delete pNewTabWinData;
+ delete pNewTabWin;
+ }
+}
+// -----------------------------------------------------------------------------
+
diff --git a/dbaccess/source/ui/relationdesign/makefile.mk b/dbaccess/source/ui/relationdesign/makefile.mk
new file mode 100644
index 000000000..998e883ad
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/makefile.mk
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1 $
+#
+# last change: $Author: oj $ $Date: 2001-02-28 10:05:57 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+PRJINC=$(PRJ)$/source
+PRJNAME=dbaccess
+TARGET=relationdesign
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+# IMGLST_SRS=$(SRS)$/$(TARGET).srs
+# --- Files --------------------------------------------------------
+
+SLOFILES =\
+ $(SLO)$/RTableConnection.obj \
+ $(SLO)$/RTableConnectionData.obj \
+ $(SLO)$/RelationTableView.obj \
+ $(SLO)$/RelationDesignView.obj \
+ $(SLO)$/RelationController.obj
+
+SRCFILES = relation.src
+
+# --- Targets -------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
+$(SRS)$/$(TARGET).srs: $(SOLARINCDIR)$/svx$/globlmn.hrc
+
+
diff --git a/dbaccess/source/ui/relationdesign/relation.src b/dbaccess/source/ui/relationdesign/relation.src
new file mode 100644
index 000000000..63501f026
--- /dev/null
+++ b/dbaccess/source/ui/relationdesign/relation.src
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * $RCSfile: relation.src,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: oj $ $Date: 2001-02-28 10:06:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the License); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an AS IS basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifndef _DBU_RESOURCE_HRC_
+#include "dbu_resource.hrc"
+#endif
+#ifndef _GLOBLMN_HRC
+#include <svx/globlmn.hrc>
+#endif
+#ifndef _CNTIDS_HRC
+#include <sfx2/cntids.hrc>
+#endif
+#ifndef DBACCESS_UI_BROWSER_ID_HXX
+#include "browserids.hxx"
+#endif
+#ifndef _DBA_DBACCESS_HELPID_HRC_
+#include "dbaccess_helpid.hrc"
+#endif
+#ifndef DBAUI_TOOLBOX_HXX
+#include "toolbox.hrc"
+#endif
+
+
+ToolBox RID_BRW_REALTIONDESIGN_TOOLBOX
+{
+ SVLook = TRUE ;
+ Pos = MAP_APPFONT ( 3 , 1 ) ;
+ Size = MAP_APPFONT ( 200 , 14 ) ;
+ OutputSize = TRUE ;
+ Align = BOXALIGN_TOP ;
+ ItemImageList = RID_DEFAULTIMAGELIST_SC ;
+ HideWhenDeactivate = TRUE ;
+ HelpId = HID_TLB_RELATIONDESIGN ;
+
+ ItemList =
+ {
+ ToolBoxItem
+ {
+ Identifier = ID_BROWSER_EDITDOC ;
+ HelpId = ID_BROWSER_EDITDOC ;
+ Text = "Bearbeiten" ;
+ Text [ ENGLISH ] = "Edit" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ID_BROWSER_SAVEDOC ;
+ HelpId = ID_BROWSER_SAVEDOC ;
+ Text = "Speichern" ;
+ Text [ ENGLISH ] = "Save" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_PRINTDOCDIRECT ;
+ HelpId = SID_PRINTDOCDIRECT ;
+ Hide = TRUE;
+ Text = "Drucken" ;
+ Text [ ENGLISH ] = "Print" ;
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ID_BROWSER_UNDO ;
+ HelpId = ID_BROWSER_UNDO ;
+ Text = "Rckgngig" ;
+ Text [ ENGLISH ] = "Undo" ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ID_BROWSER_REDO ;
+ HelpId = ID_BROWSER_REDO ;
+ Text = "Wiederherstellen" ;
+ Text [ ENGLISH ] = "Redo" ;
+
+ };
+ ToolBoxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR ;
+ };
+ ToolBoxItem
+ {
+ Identifier = ID_BROWSER_ADDTABLE;
+ HelpId = ID_BROWSER_ADDTABLE ;
+ Text = "Tabellen hinzufgen ..." ;
+ Text [ ENGLISH ] = "Add tables ..." ;
+ };
+ ToolboxItem
+ {
+ Type = TOOLBOXITEM_SEPARATOR;
+ };
+ ToolboxItem
+ {
+ Identifier = ID_REALTION_ADD_RELATION ;
+ HelpId = ID_REALTION_ADD_RELATION ;
+ Text = "neue Relation ..." ;
+ Text [ ENGLISH ] = "new relation ..." ;
+ };
+/* ToolBoxItem
+ {
+ Identifier = SID_ZOOM_OUT ;
+ HelpId = SID_ZOOM_OUT ;
+ };
+ ToolBoxItem
+ {
+ Identifier = SID_ZOOM_IN ;
+ HelpId = SID_ZOOM_IN ;
+ };
+*/
+ };
+};
+
+String STR_QUERY_REL_EDIT_RELATION
+{
+ Text = "Diese Relation existiert bereits. Mchten Sie sie bearbeiten?" ;
+ Text [ ENGLISH ] = "This relation already exsits. Do you want to edit it?" ;
+ Text [ english_us ] = "This relation already exsits. Do you want to edit it?" ;
+ Text[ portuguese ] = "Esta relao j existe. Editar?";
+ Text[ russian ] = " . ?";
+ Text[ greek ] = " . ;";
+ Text[ dutch ] = "Deze relatie bestaat reeds. Wilt u deze bewerken.";
+ Text[ french ] = "Cette relation existe dj. Souhaitez-vous l'diter ?";
+ Text[ spanish ] = "Ya existe esta relacin. Desea editarla?";
+ Text[ italian ] = "Questa relazione esiste gi. Volete modificarla?";
+ Text[ danish ] = "Denne ralation eksisterer allerede. Vil du redigere den?";
+ Text[ swedish ] = "Den hr relationen finns redan. Vill Du bearbeta den?";
+ Text[ polish ] = "Relacja ju istnieje. Czy chcesz j edytowa?";
+ Text[ portuguese_brazilian ] = "This relation already exsits. Do you want to edit it?";
+ Text[ japanese ] = "ڰ݂͂łɂ܂BҏW܂?";
+ Text[ korean ] = " ̹ ֽϴ. ̰ Ͻðڽϱ ?";
+ Text[ chinese_simplified ] = "ϵѾڡ༭";
+ Text[ chinese_traditional ] = "oYwgsbCns襦H";
+ Text[ arabic ] = " . ǿ";
+ Text[ turkish ] = "Bu iliki mevcut durumda. Dzenlemek istiyor musunuz?";
+};
+String STR_RELATIONDESIGN
+{
+ Text = "Relationenentwurf" ;
+ Text [ English ] = "Relation design" ;
+ Text [ english_us ] = "Relation design" ;
+};
+String STR_RELATIONDESIGN_NOT_AVAILABLE
+{
+ Text = "Die Datenbank untersttzt keine Relationen. Der Relationenenwurf wird wieder geschlossen!" ;
+ Text [ English ] = "The database doesn't support any relations. The relation design will be closed!" ;
+ Text [ english_us ] = "The database doesn't support any relations. The relation design will be closed!" ;
+};
+
+
+