diff options
author | Ocke Janssen <oj@openoffice.org> | 2001-02-05 08:26:47 +0000 |
---|---|---|
committer | Ocke Janssen <oj@openoffice.org> | 2001-02-05 08:26:47 +0000 |
commit | e718950884fa2db240822e1711f301b39a70ad3e (patch) | |
tree | d0641eefda6b3399ef6b2993be352770c163e96c | |
parent | db3cecce28d2162cefb58d3942ba541f44981a6b (diff) |
new querydesign
31 files changed, 11501 insertions, 0 deletions
diff --git a/dbaccess/source/ui/querydesign/ConnectionData.hxx b/dbaccess/source/ui/querydesign/ConnectionData.hxx new file mode 100644 index 000000000000..2ce2f67e3a79 --- /dev/null +++ b/dbaccess/source/ui/querydesign/ConnectionData.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * $RCSfile: ConnectionData.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:19:47 $ + * + * 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_CONNECTIONDATA_HXX +#define DBAUI_CONNECTIONDATA_HXX + +namespace dbaui +{ + + //================================================================== + // ConnData ---------->* ConnLineData + // ^1 ^1 + // | | + // Conn ---------->* ConnLine + //================================================================== + + +} +#endif // DBAUI_CONNECTIONDATA_HXX + +DECLARE_LIST( OConnectionLineDataList, OConnectionLineData* ); + +//================================================================== +class SbaJoinTabConn; + + + +DECLARE_LIST( OConnectionLineList, OConnectionLine* ); + +DECLARE_LIST( OTableConnectionDataList, OTableConnectionData* ); + +//================================================================== +const USHORT MAX_CONN_COUNT = 2; + +class SbaJoinTabWin; +class SbaJoinTabWinCont; + + + +DECLARE_LIST( SbaJoinTabConnList, SbaJoinTabConn* ); diff --git a/dbaccess/source/ui/querydesign/ConnectionLine.cxx b/dbaccess/source/ui/querydesign/ConnectionLine.cxx new file mode 100644 index 000000000000..ea9e638f0090 --- /dev/null +++ b/dbaccess/source/ui/querydesign/ConnectionLine.cxx @@ -0,0 +1,476 @@ +/************************************************************************* + * + * $RCSfile: ConnectionLine.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:23:23 $ + * + * 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 +#include "ConnectionLine.hxx" +#endif +#ifndef DBAUI_CONNECTIONLINEDATA_HXX +#include "ConnectionLineData.hxx" +#endif +#ifndef DBAUI_TABLEWINDOW_HXX +#include "TableWindow.hxx" +#endif +#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX +#include "TableWindowListBox.hxx" +#endif +#ifndef DBAUI_TABLECONNECTION_HXX +#include "TableConnection.hxx" +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _INC_MATH +#include <math.h> +#endif + + +using namespace dbaui; +const long DESCRIPT_LINE_WIDTH = 15; +const long HIT_SENSITIVE_RADIUS = 5; +//======================================================================== +// class OConnectionLine +//======================================================================== + +//------------------------------------------------------------------------ +OConnectionLine::OConnectionLine( OTableConnection* _pConn, OConnectionLineData* _pLineData ) + : m_pTabConn( _pConn ) + ,m_pData( _pLineData ) + ,m_pSourceEntry( NULL ) + ,m_pDestEntry( NULL ) +{ +} + +//------------------------------------------------------------------------ +OConnectionLine::OConnectionLine( OTableConnection* _pConn, const String& _rSourceFieldName, + const String& _rDestFieldName ) + : m_pTabConn( _pConn ) + ,m_pSourceEntry( NULL ) + ,m_pDestEntry( NULL ) +{ + m_pData->SetSourceFieldName( _rSourceFieldName ); + m_pData->SetDestFieldName( _rDestFieldName ); +} + +//------------------------------------------------------------------------ +OConnectionLine::OConnectionLine( const OConnectionLine& _rLine ) +{ + m_pData = new OConnectionLineData( *_rLine.GetData() ); + *this = _rLine; +} + +//------------------------------------------------------------------------ +OConnectionLine::~OConnectionLine() +{ +} + +//------------------------------------------------------------------------ +void OConnectionLine::SetSourceFieldName( const String& rSourceFieldName ) +{ + m_pData->SetSourceFieldName( rSourceFieldName ); +// m_pSourceEntry = m_pTabConn->GetSourceWin()->GetListBox()->GetEntryFromText( rSourceFieldName ); +} + +//------------------------------------------------------------------------ +void OConnectionLine::SetDestFieldName( const String& rDestFieldName ) +{ + m_pData->SetDestFieldName( rDestFieldName ); +// m_pDestEntry = m_pTabConn->GetDestWin()->GetListBox()->GetEntryFromText( rDestFieldName ); +} + +//------------------------------------------------------------------------ +OConnectionLine& OConnectionLine::operator=( const OConnectionLine& rLine ) +{ + if( &rLine == this ) + return *this; + + // da mir die Daten nicht gehoeren, loesche ich die alten nicht + m_pData->CopyFrom(*rLine.GetData()); + // CopyFrom ist virtuell, damit ist es kein Problem, wenn m_pData von einem von OTableConnectionData abgeleiteten Typ ist + + m_pTabConn = rLine.m_pTabConn; + m_pSourceEntry = rLine.m_pSourceEntry; + m_pDestEntry = rLine.m_pDestEntry; + m_aSourceConnPos = rLine.m_aSourceConnPos; + m_aDestConnPos = rLine.m_aDestConnPos; + m_aSourceDescrLinePos = rLine.m_aSourceDescrLinePos; + m_aDestDescrLinePos = rLine.m_aDestDescrLinePos; + + return *this; +} + +//------------------------------------------------------------------------ +BOOL OConnectionLine::Connect( const String& rSourceFieldName, const String& rDestFieldName ) +{ + ////////////////////////////////////////////////////////////////////// + // Parameter duerfen nicht leer sein + if( !rSourceFieldName.Len() || !rDestFieldName.Len() ) + return FALSE; + + ////////////////////////////////////////////////////////////////////// + // Feldnamen setzen + m_pData->SetSourceFieldName( rSourceFieldName ); + m_pData->SetDestFieldName( rDestFieldName ); + + ////////////////////////////////////////////////////////////////////// + // Entries setzen +/* m_pSourceEntry = m_pTabConn->GetSourceWin()->GetListBox()->GetEntryFromText( rSourceFieldName ); + if( !m_pSourceEntry ) + return FALSE; + m_pDestEntry = m_pTabConn->GetDestWin()->GetListBox()->GetEntryFromText( rDestFieldName ); + if( !m_pDestEntry ) + return FALSE; +*/ + + return TRUE; +} + + +//------------------------------------------------------------------------ +Rectangle OConnectionLine::GetBoundingRect() +{ + ////////////////////////////////////////////////////////////////////// + // Umgebendes Rechteck bestimmen + Rectangle aBoundingRect( Point(0,0), Point(0,0) ); + if( !IsValid() ) + return aBoundingRect; + + Point aTopLeft; + Point aBottomRight; + + if( m_aSourceDescrLinePos.Y() <= m_aDestDescrLinePos.Y() ) + { + aTopLeft.Y() = m_aSourceDescrLinePos.Y(); + aBottomRight.Y() = m_aDestDescrLinePos.Y(); + } + else + { + aTopLeft.Y() = m_aDestDescrLinePos.Y(); + aBottomRight.Y() = m_aSourceDescrLinePos.Y(); + } + + if( m_aSourceDescrLinePos.X() <= m_aDestDescrLinePos.X() ) + { + aTopLeft.X() = m_aSourceDescrLinePos.X(); + aBottomRight.X() = m_aDestDescrLinePos.X(); + } + else + { + aTopLeft.X() = m_aDestDescrLinePos.X(); + aBottomRight.X() = m_aSourceDescrLinePos.X(); + } + + ////////////////////////////////////////////////////////////////////// + // Linie verlaeuft in z-Form + if( Abs(m_aSourceConnPos.X() - m_aDestConnPos.X()) > Abs(m_aSourceDescrLinePos.X() - m_aDestDescrLinePos.X()) ) + { + aTopLeft.X() -= DESCRIPT_LINE_WIDTH; + aBottomRight.X() += DESCRIPT_LINE_WIDTH; + } + + aBoundingRect = Rectangle( aTopLeft-Point(0,17), aBottomRight+Point(0,2) ); + + return aBoundingRect; +} + +//------------------------------------------------------------------------ +BOOL OConnectionLine::RecalcLine() +{ + ////////////////////////////////////////////////////////////////////// + // Fenster und Entries muessen gesetzt sein + const OTableWindow* pSourceWin = m_pTabConn->GetSourceWin(); + const OTableWindow* pDestWin = m_pTabConn->GetDestWin(); + + if( !pSourceWin || !pDestWin ) + return FALSE; + + m_pSourceEntry = pSourceWin->GetListBox()->GetEntryFromText( GetData()->GetSourceFieldName() ); + m_pDestEntry = pDestWin->GetListBox()->GetEntryFromText( GetData()->GetDestFieldName() ); + + if( !m_pSourceEntry || !m_pDestEntry ) + return FALSE; + + ////////////////////////////////////////////////////////////////////// + // X-Koordinaten bestimmen + Point aSourceCenter( 0, 0 ); + Point aDestCenter( 0, 0 ); + + aSourceCenter.X() = pSourceWin->GetPosPixel().X() + (long)( 0.5*pSourceWin->GetSizePixel().Width() ); + aDestCenter.X() = pDestWin->GetPosPixel().X() + (long)( 0.5*pDestWin->GetSizePixel().Width() ); + if( aDestCenter.X()>aSourceCenter.X() ) + { + ////////////////////////////////////////////////////////////////////// + // DestWin liegt rechts vom SourceWin + m_aSourceConnPos.X() = pSourceWin->GetPosPixel().X()+pSourceWin->GetSizePixel().Width(); + m_aSourceDescrLinePos.X() = m_aSourceConnPos.X(); + m_aSourceConnPos.X() += DESCRIPT_LINE_WIDTH; + + m_aDestConnPos.X() = pDestWin->GetPosPixel().X(); + m_aDestDescrLinePos.X() = m_aDestConnPos.X(); + m_aDestConnPos.X() -= DESCRIPT_LINE_WIDTH; + } + else + { + ////////////////////////////////////////////////////////////////////// + // DestWin liegt links vom SourceWin + m_aSourceConnPos.X() = pSourceWin->GetPosPixel().X(); + m_aSourceDescrLinePos.X() = m_aSourceConnPos.X(); + m_aSourceConnPos.X() -= DESCRIPT_LINE_WIDTH; + + m_aDestConnPos.X() = pDestWin->GetPosPixel().X()+pDestWin->GetSizePixel().Width(); + m_aDestDescrLinePos.X() = m_aDestConnPos.X(); + m_aDestConnPos.X() += DESCRIPT_LINE_WIDTH; + } + + ////////////////////////////////////////////////////////////////////// + // aSourceConnPosY bestimmen + OTableWindowListBox* pListBox = pSourceWin->GetListBox(); + long nRowHeight = pListBox->GetEntryHeight(); + + m_aSourceConnPos.Y() = pSourceWin->GetPosPixel().Y(); + m_aSourceConnPos.Y() += pListBox->GetPosPixel().Y(); + long nEntryPos = pListBox->GetEntryPos( m_pSourceEntry ).Y(); + + if( nEntryPos >= 0 ) + { + m_aSourceConnPos.Y() += nEntryPos; + m_aSourceConnPos.Y() += (long)( 0.5 * nRowHeight ); + } + else + m_aSourceConnPos.Y() -= (long)( 0.5 * nRowHeight ); + + long nListBoxBottom = pSourceWin->GetPosPixel().Y() + +pListBox->GetPosPixel().Y() + +pListBox->GetSizePixel().Height(); + if( m_aSourceConnPos.Y() > nListBoxBottom ) + m_aSourceConnPos.Y() = nListBoxBottom + 2; + + m_aSourceDescrLinePos.Y() = m_aSourceConnPos.Y(); + + ////////////////////////////////////////////////////////////////////// + // aDestConnPosY bestimmen + pListBox = pDestWin->GetListBox(); + + m_aDestConnPos.Y() = pDestWin->GetPosPixel().Y(); + m_aDestConnPos.Y() += pListBox->GetPosPixel().Y(); + nEntryPos = pListBox->GetEntryPos( m_pDestEntry ).Y(); + if( nEntryPos >= 0 ) + { + m_aDestConnPos.Y() += nEntryPos; + m_aDestConnPos.Y() += (long)( 0.5 * nRowHeight ); + } + else + m_aDestConnPos.Y() -= (long)( 0.5 * nRowHeight ); + + nListBoxBottom = pDestWin->GetPosPixel().Y() + +pListBox->GetPosPixel().Y() + +pListBox->GetSizePixel().Height(); + if( m_aDestConnPos.Y() > nListBoxBottom ) + m_aDestConnPos.Y() = nListBoxBottom + 2; + + m_aDestDescrLinePos.Y() = m_aDestConnPos.Y(); + + return TRUE; +} + +//------------------------------------------------------------------------ +Rectangle OConnectionLine::GetSourceTextPos() +{ + const OTableWindow* pDestWin = m_pTabConn->GetDestWin(); + OTableWindowListBox* pListBox = pDestWin ? pDestWin->GetListBox() : NULL; + DBG_ASSERT(pDestWin && pListBox, "OConnectionLine::GetSourceTextPos : invalid call !"); + + long nRowHeight = pListBox->GetEntryHeight(); + + Rectangle aReturn; + aReturn.Top() = m_aSourceConnPos.Y() - nRowHeight; + aReturn.Bottom() = aReturn.Top() + nRowHeight; + if (m_aSourceDescrLinePos.X() < m_aSourceConnPos.X()) + { + aReturn.Left() = m_aSourceDescrLinePos.X(); + aReturn.Right() = aReturn.Left() + m_aSourceConnPos.X() - m_aSourceDescrLinePos.X(); + } + else + { + aReturn.Left() = m_aSourceConnPos.X(); + aReturn.Right() = aReturn.Left() + m_aSourceDescrLinePos.X() - m_aSourceConnPos.X(); + } + + return aReturn; +} + +//------------------------------------------------------------------------ +Rectangle OConnectionLine::GetDestTextPos() +{ + const OTableWindow* pSourceWin = m_pTabConn->GetSourceWin(); + OTableWindowListBox* pListBox = pSourceWin ? pSourceWin->GetListBox() : NULL; + DBG_ASSERT(pSourceWin && pListBox, "OConnectionLine::GetSourceTextPos : invalid call !"); + + long nRowHeight = pListBox->GetEntryHeight(); + + Rectangle aReturn; + aReturn.Top() = m_aDestConnPos.Y() - nRowHeight; + aReturn.Bottom() = aReturn.Top() + nRowHeight; + if (m_aDestDescrLinePos.X() < m_aDestConnPos.X()) + { + aReturn.Left() = m_aDestDescrLinePos.X(); + aReturn.Right() = aReturn.Left() + m_aDestConnPos.X() - m_aDestDescrLinePos.X(); + } + else + { + aReturn.Left() = m_aDestConnPos.X(); + aReturn.Right() = aReturn.Left() + m_aDestDescrLinePos.X() - m_aDestConnPos.X(); + } + + return aReturn; +} + +//------------------------------------------------------------------------ +void OConnectionLine::Draw( OutputDevice* pOutDev ) +{ + const UINT16 nRectSize = 3; + + ////////////////////////////////////////////////////////////////////// + // Neue Dimensionen berechnen + if( !RecalcLine() ) + return; + + ////////////////////////////////////////////////////////////////////// + // Zeichnen der Linien + if (m_pTabConn->IsSelected()) + pOutDev->SetLineColor(Application::GetSettings().GetStyleSettings().GetHighlightColor()); + else + pOutDev->SetLineColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor()); + + pOutDev->DrawLine( m_aSourceDescrLinePos, m_aSourceConnPos ); + pOutDev->DrawLine( m_aDestDescrLinePos, m_aDestConnPos ); + pOutDev->DrawLine( m_aSourceConnPos, m_aDestConnPos ); + // wenn die Linie selektiert ist, sollte sie dicker erscheinen + // da OutputDevice nach meinem Wissen (das ich nur aus dem Headerfile habe) kein + // SetLineWidth (o..) hat, ein Fake + if (m_pTabConn->IsSelected()) + { + UINT16 xOffset, yOffset; + if (abs(m_aSourceConnPos.Y() - m_aDestConnPos.Y()) > abs(m_aSourceConnPos.X()-m_aDestConnPos.X())) + { + xOffset = 1; + yOffset = 0; + } else + { + xOffset = 0; + yOffset = 1; + } + pOutDev->DrawLine(m_aSourceConnPos + Point(-xOffset, -yOffset), m_aDestConnPos + Point(-xOffset, -yOffset)); + pOutDev->DrawLine(m_aSourceConnPos + Point(xOffset, yOffset), m_aDestConnPos + Point(xOffset, yOffset)); + } + + + ////////////////////////////////////////////////////////////////////// + // Zeichnen der Verbindungs-Rechtecke +// pOutDev->SetLineColor(Application::GetSettings().GetStyleSettings().GetWindowTextColor()); + Rectangle aSourceRect( m_aSourceDescrLinePos-Point(nRectSize,nRectSize), + m_aSourceDescrLinePos+Point(nRectSize,nRectSize) ); + + Rectangle aDestRect( m_aDestDescrLinePos-Point(nRectSize,nRectSize), + m_aDestDescrLinePos+Point(nRectSize,nRectSize) ); + pOutDev->SetFillColor(Application::GetSettings().GetStyleSettings().GetWindowColor()); + pOutDev->DrawRect( aSourceRect ); + pOutDev->DrawRect( aDestRect ); +} + +//------------------------------------------------------------------------ +BOOL OConnectionLine::IsValid() +{ + return m_pData->IsValid(); +} +//------------------------------------------------------------------------ +double dist_Euklid(const Point &p1, const Point& p2,const Point& pM, Point& q) +{ + int vx = p2.X() - p1.X(); + int vy = p2.Y() - p1.Y(); + Point v(p2 - p1); + Point w(pM - p1); + double a = sqrt((double)(v.X()*v.X() + v.Y()*v.Y())); + double l = (v.X() * w.Y() - v.Y() * w.X()) / a; + double a2 = w.X()*v.X()+w.Y()*v.Y(); + a = a2 / (a * a); + q.X() = (long)p1.X() + a * v.X(); q.Y() = (long)p1.Y() + a * v.Y(); + return l; +} +//------------------------------------------------------------------------ +BOOL OConnectionLine::CheckHit( const Point& rMousePos ) +{ + ////////////////////////////////////////////////////////////////////// + /* + Vorgehensweise beim HitTest: + Es wird der Abstand nach Euklid berechnet. + */ + Point q; + double l = fabs(dist_Euklid(m_aSourceConnPos,m_aDestConnPos,rMousePos,q)); + if( l < HIT_SENSITIVE_RADIUS) + { + if(::std::min(m_aSourceConnPos.X(),m_aDestConnPos.X()) <= q.X() && ::std::min(m_aSourceConnPos.Y(),m_aDestConnPos.Y()) <= q.Y() + && q.X() <= ::std::max(m_aDestConnPos.X(),m_aSourceConnPos.X()) && q.Y() <= ::std::max(m_aDestConnPos.Y(),m_aSourceConnPos.Y())) + return TRUE; + } + + return FALSE; +} + + diff --git a/dbaccess/source/ui/querydesign/ConnectionLineData.cxx b/dbaccess/source/ui/querydesign/ConnectionLineData.cxx new file mode 100644 index 000000000000..2bf7f324ad0d --- /dev/null +++ b/dbaccess/source/ui/querydesign/ConnectionLineData.cxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * $RCSfile: ConnectionLineData.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:19:54 $ + * + * 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 +#include "ConnectionLineData.hxx" +#endif + +using namespace dbaui; +//================================================================== +//class OConnectionLineData +//================================================================== +//------------------------------------------------------------------------ +OConnectionLineData::OConnectionLineData() +{ +} + +//------------------------------------------------------------------------ +OConnectionLineData::OConnectionLineData( const ::rtl::OUString& rSourceFieldName, const ::rtl::OUString& rDestFieldName ) + :m_aSourceFieldName( rSourceFieldName ) + ,m_aDestFieldName( rDestFieldName ) +{ +} + +//------------------------------------------------------------------------ +OConnectionLineData::OConnectionLineData( const OConnectionLineData& rConnLineData ) +{ + *this = rConnLineData; +} + +//------------------------------------------------------------------------ +OConnectionLineData::~OConnectionLineData() +{ +} + +//------------------------------------------------------------------------ +void OConnectionLineData::CopyFrom(const OConnectionLineData& rSource) +{ + *this = rSource; + // hier ziehe ich mich auf das (nicht-virtuelle) operator= zurueck, das nur meine Members kopiert +} + +//------------------------------------------------------------------------ +BOOL OConnectionLineData::IsValid() +{ + return (GetSourceFieldName().getLength() && GetDestFieldName().getLength()); +} + +//------------------------------------------------------------------------ +OConnectionLineData& OConnectionLineData::operator=( const OConnectionLineData& rConnLineData ) +{ + if (&rConnLineData == this) + return *this; + + m_aSourceFieldName = rConnLineData.GetSourceFieldName(); + m_aDestFieldName = rConnLineData.GetDestFieldName(); + + return *this; +} + +//------------------------------------------------------------------------ +void OConnectionLineData::Reset() +{ + m_aDestFieldName = m_aSourceFieldName = ::rtl::OUString(); +} + diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx new file mode 100644 index 000000000000..ccc792070fff --- /dev/null +++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx @@ -0,0 +1,1512 @@ +/************************************************************************* + * + * $RCSfile: JoinTableView.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:23:47 $ + * + * 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_QUERYTABLEVIEW_HXX +#include "JoinTableView.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#include "QueryDesignView.hxx" +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef DBAUI_TABLEWINDOW_HXX +#include "TableWindow.hxx" +#endif +#ifndef DBAUI_QUERY_TABLEWINDOWDATA_HXX +#include "QTableWindowData.hxx" +#endif +#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX +#include "TableWindowListBox.hxx" +#endif +#ifndef DBAUI_TABLECONNECTION_HXX +#include "TableConnection.hxx" +#endif +#ifndef DBAUI_TABLECONNECTIONDATA_HXX +#include "TableConnectionData.hxx" +#endif +#ifndef DBAUI_CONNECTIONLINE_HXX +#include "ConnectionLine.hxx" +#endif +#ifndef DBAUI_CONNECTIONLINEDATA_HXX +#include "ConnectionLineData.hxx" +#endif +#ifndef DBACCESS_UI_BROWSER_ID_HXX +#include "browserids.hxx" +#endif +#ifndef _SV_DRAG_HXX +#include <vcl/drag.hxx> +#endif +#ifndef _URLBMK_HXX +#include <svtools/urlbmk.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif + + +using namespace dbaui; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; +const long LINE_SIZE = 50; + +OScrollWindowHelper::OScrollWindowHelper( Window* pParent) : Window( pParent) + ,m_aHScrollBar( this, WB_HSCROLL|WB_REPEAT|WB_DRAG ) + ,m_aVScrollBar( this, WB_VSCROLL|WB_REPEAT|WB_DRAG ) + ,m_pTableView(NULL) +{ + ////////////////////////////////////////////////////////////////////// + // ScrollBars + + GetHScrollBar()->SetRange( Range(0, 1000) ); + GetVScrollBar()->SetRange( Range(0, 1000) ); + + GetHScrollBar()->SetLineSize( LINE_SIZE ); + GetVScrollBar()->SetLineSize( LINE_SIZE ); + + GetHScrollBar()->Show(); + GetVScrollBar()->Show(); + +} +// ----------------------------------------------------------------------------- +void OScrollWindowHelper::setTableView(OJoinTableView* _pTableView) +{ + m_pTableView = _pTableView; + ////////////////////////////////////////////////////////////////////// + // ScrollBars + GetHScrollBar()->SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) ); + GetVScrollBar()->SetScrollHdl( LINK(m_pTableView, OJoinTableView, ScrollHdl) ); +} +//------------------------------------------------------------------------------ +void OScrollWindowHelper::Resize() +{ + Window::Resize(); + + Size aTotalOutputSize = GetOutputSizePixel(); + long nHScrollHeight = GetHScrollBar()->GetSizePixel().Height(); + long nVScrollWidth = GetVScrollBar()->GetSizePixel().Width(); + + GetHScrollBar()->SetPosSizePixel( + Point( 0, aTotalOutputSize.Height()-nHScrollHeight ), + Size( aTotalOutputSize.Width()-nVScrollWidth, nHScrollHeight ) + ); + + GetVScrollBar()->SetPosSizePixel( + Point( aTotalOutputSize.Width()-nVScrollWidth, 0 ), + Size( nVScrollWidth, aTotalOutputSize.Height()-nHScrollHeight ) + ); + + GetHScrollBar()->SetPageSize( aTotalOutputSize.Width() ); + GetHScrollBar()->SetVisibleSize( aTotalOutputSize.Width() ); + + GetVScrollBar()->SetPageSize( aTotalOutputSize.Height() ); + GetVScrollBar()->SetVisibleSize( aTotalOutputSize.Height() ); + + // adjust the ranges of the scrollbars if neccessary + long lRange = GetHScrollBar()->GetRange().Max() - GetHScrollBar()->GetRange().Min(); + if (m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() > lRange) + GetHScrollBar()->SetRangeMax(m_pTableView->GetScrollOffset().X() + aTotalOutputSize.Width() + GetHScrollBar()->GetRange().Min()); + + lRange = GetVScrollBar()->GetRange().Max() - GetVScrollBar()->GetRange().Min(); + if (m_pTableView->GetScrollOffset().Y() + aTotalOutputSize.Height() > lRange) + GetVScrollBar()->SetRangeMax(m_pTableView->GetScrollOffset().Y() + aTotalOutputSize.Height() + GetVScrollBar()->GetRange().Min()); + + m_pTableView->SetPosSizePixel(Point( 0, 0 ),Size( aTotalOutputSize.Width()-nVScrollWidth, aTotalOutputSize.Height()-nHScrollHeight )); +} +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +TYPEINIT0(OJoinTableView); +//================================================================== +// class OJoinTableView +//================================================================== + +//const long WINDOW_WIDTH = 1000; +//const long WINDOW_HEIGHT = 1000; +DBG_NAME(OJoinTableView); +//------------------------------------------------------------------------------ +OJoinTableView::OJoinTableView( Window* pParent, OQueryDesignView* pView ) : + Window( pParent,WB_BORDER ) + ,m_pView( pView ) + ,m_pDragWin( NULL ) + ,m_pSizingWin( NULL ) + ,m_pSelectedConn( NULL ) + ,m_aDragOffset( Point(0,0) ) + ,m_aScrollOffset( Point(0,0) ) + ,m_bTrackingInitiallyMoved(FALSE) + ,m_pLastFocusTabWin(NULL) +{ + DBG_CTOR(OJoinTableView,NULL); + SetSizePixel( Size(1000, 1000) ); + + InitColors(); + + m_aDragScrollTimer.SetTimeoutHdl(LINK(this, OJoinTableView, OnDragScrollTimer)); +} + +//------------------------------------------------------------------------------ +OJoinTableView::~OJoinTableView() +{ + DBG_DTOR(OJoinTableView,NULL); +} +//------------------------------------------------------------------------------ +IMPL_LINK( OJoinTableView, ScrollHdl, ScrollBar*, pScrollBar ) +{ + ////////////////////////////////////////////////////////////////////// + // Alle Fenster verschieben + Scroll( pScrollBar->GetDelta(), (pScrollBar == GetHScrollBar()), FALSE ); + + return 0; +} +//------------------------------------------------------------------------------ +void OJoinTableView::Resize() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + Window::Resize(); + m_aOutputSize = GetSizePixel(); + + // tab win positions may not be up-to-date + if (!m_aTableMap.size()) + // no tab wins ... + return; + + // we have at least one table so resize it + m_aScrollOffset.X() = GetHScrollBar()->GetThumbPos(); + m_aScrollOffset.Y() = GetVScrollBar()->GetThumbPos(); + + OTableWindow* pCheck = m_aTableMap.begin()->second; + Point aRealPos = pCheck->GetPosPixel(); + Point aAssumedPos = pCheck->GetData()->GetPosition() - GetScrollOffset(); + + if (aRealPos == aAssumedPos) + // all ok + return; + + OTableWindowMapIterator aIter = m_aTableMap.begin(); + for(;aIter != m_aTableMap.end();++aIter) + { + OTableWindow* pCurrent = aIter->second; + Point aPos(pCurrent->GetData()->GetPosition() - GetScrollOffset()); + pCurrent->SetPosPixel(aPos); + } +} + +//------------------------------------------------------------------------------ +BOOL OJoinTableView::Drop( const DropEvent& rEvt ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + BOOL bDrop = FALSE; +/* + ////////////////////////////////////////////////////////////////////// + // Nach dem richtigen Format suchen + for(USHORT i = 0; i < DragServer::GetItemCount(); ++i) + { + if (INetBookmark::DragServerHasFormat(i) ) + { + INetBookmark aBmk; + if (aBmk.PasteDragServer(i)) + { + ////////////////////////////////////////////////////////////////////// + // Tabellenname aus URL-Obj holen + INetURLObject aObj(aBmk.GetURL()); + aObj.SetSmartProtocol(INET_PROT_FILE); + String aMark(aObj.GetMark()); + aMark.Erase(0, strlen(char(11))); + + ////////////////////////////////////////////////////////////////////// + // Stammt die Tabelle aus derselben Datenbank? + String aDatabaseName = aObj.PathToFileName(); + DirEntry aDBEntry(aDatabaseName); + SbaDatabase* pDatabase = GetDatabase(); + if (aDBEntry == DirEntry(pDatabase->Name())) + { + ////////////////////////////////////////////////////////////////////// + // Neue Tabelle hinzufuegen + SbaDBDefRef xDef = pDatabase->OpenDBDef( dbTable, aMark ); + if (xDef.Is()) + { + SdbTable* pTable = ((SbaTableDef*)&xDef)->GetTable(); + if (pTable && pTable->IsOpen()) + { + AddTabWin( pTable->QualifierName(), pTable->Name() ); + bDrop = TRUE; + } + } + } + + if (!bDrop) + Sound::Beep(); + break; + } + } + } +*/ + return bDrop; +} + +//------------------------------------------------------------------------------ +BOOL OJoinTableView::QueryDrop( DropEvent& rEvt ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ////////////////////////////////////////////////////////////////////// + // Wenn Bookmark-Format, Drop erlaubt + BOOL bDrop = FALSE; + DropAction eAction = rEvt.GetAction(); + + for (USHORT i = 0; i < DragServer::GetItemCount(); ++i) + { + if (INetBookmark::DragServerHasFormat(i) && eAction != DROP_MOVE) + { + bDrop = TRUE; + break; + } + } + return bDrop; +} + +//------------------------------------------------------------------------------ +ULONG OJoinTableView::GetTabWinCount() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + return m_aTableMap.size(); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) +{ + DBG_CHKTHIS(OJoinTableView,NULL); +} + +//------------------------------------------------------------------------------ +BOOL OJoinTableView::RemoveConnection( OTableConnection* pConn ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + DeselectConn(pConn); + + pConn->Invalidate(); + // damit der Bereich neu gezeichntet wird + + m_pView->getController()->removeConnectionData( pConn->GetData() ); + delete *(m_vTableConnection.erase( ::std::find(m_vTableConnection.begin(),m_vTableConnection.end(),pConn) )); + + return TRUE; +} + +//------------------------------------------------------------------------ +OTableWindow* OJoinTableView::GetWindow( const String& rName ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + return m_aTableMap[rName]; +} + +//------------------------------------------------------------------------------ +void OJoinTableView::AddTabWin(const String& _rComposedName, const String& rWinName, BOOL bNewTable) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + OSL_ENSURE(_rComposedName.Len(),"There must be a table name supplied!"); + + ////////////////////////////////////////////////////////////////// + // Neue Datenstruktur in DocShell eintragen + OQueryTableWindowData* pNewTabWinData = new OQueryTableWindowData( _rComposedName, rWinName,String() ); + m_pView->getController()->getTableWindowData()->push_back( pNewTabWinData); + + ////////////////////////////////////////////////////////////////// + // Neues Fenster in Fensterliste eintragen + OTableWindow* pNewTabWin = new OTableWindow( this, pNewTabWinData ); + pNewTabWin->Init(); + + // when we already have a table with this name insert the full qualified one instead + if(m_aTableMap.find(rWinName) != m_aTableMap.end()) + m_aTableMap[_rComposedName] = pNewTabWin; + else + m_aTableMap[rWinName] = pNewTabWin; + + SetDefaultTabWinPosSize( pNewTabWin ); + pNewTabWin->Show(); + + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::RemoveTabWin( OTableWindow* pTabWin ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ////////////////////////////////////////////////////////////////////// + // first delete all connections of this window to others + String aWinName = pTabWin->GetWinName(); + BOOL bRemove = TRUE; + sal_Int32 nCount = m_vTableConnection.size(); + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + { + OTableConnection* pTabConn = (*aIter); + if( + ( aWinName == pTabConn->GetData()->GetSourceWinName()) || + ( aWinName == pTabConn->GetData()->GetDestWinName()) + ) + bRemove = RemoveConnection( pTabConn ); + } + + ////////////////////////////////////////////////////////////////////// + // then delete the window itself + if(bRemove) + { + pTabWin->Hide(); + delete *(m_pView->getController()->getTableWindowData()->erase( ::std::find(m_pView->getController()->getTableWindowData()->begin(),m_pView->getController()->getTableWindowData()->end(),pTabWin->GetData()) )); + + m_aTableMap.erase( aWinName ); + if (pTabWin == m_pLastFocusTabWin) + m_pLastFocusTabWin = NULL; + delete pTabWin; + } + + if(bRemove && (sal_Int32)m_aTableMap.size() < (nCount-1)) // if some connections could be removed + { + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature( ID_BROWSER_SAVEDOC ); + m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); + } +} + +//------------------------------------------------------------------------------ +void OJoinTableView::EnsureVisible(const OTableWindow* _pWin) +{ + // data about the tab win + OTableWindowData* pData = _pWin->GetData(); + Point aUpperLeft = pData->GetPosition(); + // normalize with respect to visibility + aUpperLeft.X() -= GetScrollOffset().X(); + aUpperLeft.Y() -= GetScrollOffset().Y(); + Point aLowerRight(aUpperLeft.X() + pData->GetSize().Width(), aUpperLeft.Y() + pData->GetSize().Height()); + // aLowerRight.Y() -= GetScrollOffset().Y(); + + // data about ourself + Size aSize = GetOutputSizePixel(); + + BOOL bFitsHor = (aUpperLeft.X() >= 0) && (aLowerRight.X() <= aSize.Width()); + BOOL bFitsVert = (aUpperLeft.Y() >= 0) && (aLowerRight.Y() <= aSize.Height()); + if (bFitsHor && bFitsVert) + // nothing to do + return; + + long nScrollX(0); + if (!bFitsHor) + { + // ensure the visibility of the right border + if (aLowerRight.X() > aSize.Width()) + nScrollX = (aLowerRight.X() - aSize.Width() + TABWIN_SPACING_X); + + // ensure the cisibility of the left border (higher priority) + if (aUpperLeft.X() - nScrollX < 0) + nScrollX = aUpperLeft.X() - TABWIN_SPACING_X; + } + + long nScrollY(0); + if (!bFitsVert) + { + // lower border + if (aLowerRight.Y() > aSize.Height()) + nScrollY = (aLowerRight.Y() - aSize.Height() + TABWIN_SPACING_Y); + + // upper border + if (aUpperLeft.Y() - nScrollY < 0) + nScrollY = aUpperLeft.Y() - TABWIN_SPACING_Y; + } + + if (nScrollX) + Scroll(nScrollX, TRUE, TRUE); + + if (nScrollY) + Scroll(nScrollY, FALSE, TRUE); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::SetDefaultTabWinPosSize( OTableWindow* pTabWin ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ////////////////////////////////////////////////////////////////// + // Position bestimmen: + // Das Fenster wird in Zeilen der Hoehe TABWIN_SPACING_Y+TABWIN_HEIGTH_STD aufgeteilt. + // Dann wird fuer jede Zeile geprueft, ob noch Platz fuer ein weiteres Fenster ist. + // Wenn kein Platz ist, wird die naechste Zeile ueberprueft. + Size aOutSize = GetSizePixel(); + Point aNewPos( 0,0 ); + USHORT nRow = 0; + BOOL bEnd = FALSE; + while( !bEnd ) + { + ////////////////////////////////////////////////////////////////// + // Neue Position auf Zeilenbeginn setzen + aNewPos.X() = TABWIN_SPACING_X; + aNewPos.Y() = (nRow+1) * TABWIN_SPACING_Y; + + ////////////////////////////////////////////////////////////////// + // Rectangle fuer die jeweilige Zeile bestimmen + Rectangle aRowRect( Point(0,0), aOutSize ); + aRowRect.Top() = nRow * ( TABWIN_SPACING_Y + TABWIN_HEIGHT_STD ); + aRowRect.Bottom() = (nRow+1) * ( TABWIN_SPACING_Y + TABWIN_HEIGHT_STD ); + + ////////////////////////////////////////////////////////////////// + // Belegte Bereiche dieser Zeile pruefen + OTableWindow* pOtherTabWin;// = GetTabWinMap()->First(); + OTableWindowMapIterator aIter = m_aTableMap.begin(); + for(;aIter != m_aTableMap.end();++aIter) + { + pOtherTabWin = aIter->second; + Rectangle aOtherTabWinRect( pOtherTabWin->GetPosPixel(), pOtherTabWin->GetSizePixel() ); + + if( + ( (aOtherTabWinRect.Top()>aRowRect.Top()) && (aOtherTabWinRect.Top()<aRowRect.Bottom()) ) || + ( (aOtherTabWinRect.Bottom()>aRowRect.Top()) && (aOtherTabWinRect.Bottom()<aRowRect.Bottom()) ) + ) + { + ////////////////////////////////////////////////////////////////// + // TabWin liegt in der Zeile + if( aOtherTabWinRect.Right()>aNewPos.X() ) + aNewPos.X() = aOtherTabWinRect.Right() + TABWIN_SPACING_X; + } + } + + ////////////////////////////////////////////////////////////////// + // Ist in dieser Zeile noch Platz? + if( (aNewPos.X()+TABWIN_WIDTH_STD)<aRowRect.Right() ) + { + aNewPos.Y() = aRowRect.Top() + TABWIN_SPACING_Y; + bEnd = TRUE; + } + else + { + if( (aRowRect.Bottom()+aRowRect.GetHeight()) > aOutSize.Height() ) + { + // insert it in the first row + sal_Int32 nCount = m_aTableMap.size() % (nRow+1); + ++nCount; + aNewPos.Y() = nCount * TABWIN_SPACING_Y + (nCount-1)*CalcZoom(TABWIN_HEIGHT_STD); + bEnd = TRUE; + } + else + nRow++; + + } + } + + ////////////////////////////////////////////////////////////////// + // Groesse bestimmen + Size aNewSize( CalcZoom(TABWIN_WIDTH_STD), CalcZoom(TABWIN_HEIGHT_STD) ); + + // check if the new position in inside the scrollbars ranges + Point aBottom(aNewPos); + aBottom.X() += aNewSize.Width(); + aBottom.Y() += aNewSize.Height(); + + if(!GetHScrollBar()->GetRange().IsInside(aBottom.X())) + GetHScrollBar()->SetRange( Range(0, aBottom.X()) ); + if(!GetVScrollBar()->GetRange().IsInside(aBottom.Y())) + GetVScrollBar()->SetRange( Range(0, aBottom.Y()) ); + + pTabWin->SetPosSizePixel( aNewPos, aNewSize ); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::DataChanged(const DataChangedEvent& rDCEvt) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + if (rDCEvt.GetType() == DATACHANGED_SETTINGS) + { + // nehmen wir den worst-case an : die Farben haben sich geaendert, also + // mich anpassen + InitColors(); + Invalidate(INVALIDATE_NOCHILDREN); + // durch das Invalidate werden auch die Connections neu gezeichnet, so dass die auch + // gleich in den neuen Farben dargestellt werden + } +} + +//------------------------------------------------------------------------------ +void OJoinTableView::InitColors() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + // die Farben fuer die Darstellung sollten die Systemfarben sein + StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); + SetBackground(Wallpaper(Color(aSystemStyle.GetWindowColor()))); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::BeginChildMove( OTableWindow* pTabWin, const Point& rMousePos ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + + if (m_pView->getController()->isReadOnly()) + return; + + m_pDragWin = pTabWin; + SetPointer(Pointer(POINTER_MOVE)); + Point aMousePos = ScreenToOutputPixel( rMousePos ); + m_aDragOffset = aMousePos-pTabWin->GetPosPixel(); + m_pDragWin->SetZOrder(NULL, WINDOW_ZORDER_FIRST); + m_bTrackingInitiallyMoved = FALSE; + StartTracking(); +} + +void OJoinTableView::NotifyTitleClicked( OTableWindow* pTabWin, const Point rMousePos ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + DeselectConn(GetSelectedConn()); + BeginChildMove(pTabWin, rMousePos); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::BeginChildSizing( OTableWindow* pTabWin, const Pointer& rPointer ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + + if (m_pView->getController()->isReadOnly()) + return; + + SetPointer( rPointer ); + m_pSizingWin = pTabWin; + StartTracking(); +} + +//------------------------------------------------------------------------------ +BOOL OJoinTableView::Scroll( long nDelta, BOOL bHoriz, BOOL bPaintScrollBars ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + BOOL bRet = TRUE; + + ////////////////////////////////////////////////////////////////////// + // ScrollBar-Positionen anpassen + if( bPaintScrollBars ) + { + if( bHoriz ) + { + long nOldThumbPos = GetHScrollBar()->GetThumbPos(); + long nNewThumbPos = nOldThumbPos + nDelta; + if( nNewThumbPos < 0 ) + { + nNewThumbPos = 0; + bRet = FALSE; + } + if( nNewThumbPos > GetHScrollBar()->GetRange().Max() ) + { + nNewThumbPos = GetHScrollBar()->GetRange().Max(); + bRet = FALSE; + } + GetHScrollBar()->SetThumbPos( nNewThumbPos ); + nDelta = GetHScrollBar()->GetThumbPos() - nOldThumbPos; + } + else + { + long nOldThumbPos = GetVScrollBar()->GetThumbPos(); + long nNewThumbPos = nOldThumbPos+nDelta; + if( nNewThumbPos < 0 ) + { + nNewThumbPos = 0; + bRet = FALSE; + } + if( nNewThumbPos > GetVScrollBar()->GetRange().Max() ) + { + nNewThumbPos = GetVScrollBar()->GetRange().Max(); + bRet = FALSE; + } + GetVScrollBar()->SetThumbPos( nNewThumbPos ); + nDelta = GetVScrollBar()->GetThumbPos() - nOldThumbPos; + } + } + + ////////////////////////////////////////////////////////////////////// + // Wenn ScrollOffset bereits an den Grenzen liegt, kein Neuzeichnen + if( (GetHScrollBar()->GetThumbPos()==m_aScrollOffset.X()) && + (GetVScrollBar()->GetThumbPos()==m_aScrollOffset.Y()) ) + return FALSE; + + ////////////////////////////////////////////////////////////////////// + // ScrollOffset neu setzen + if (bHoriz) + m_aScrollOffset.X() = GetHScrollBar()->GetThumbPos(); + else + m_aScrollOffset.Y() = GetVScrollBar()->GetThumbPos(); + + ////////////////////////////////////////////////////////////////////// + // Alle Fenster verschieben + OTableWindow* pTabWin; + Point aPos; + + OTableWindowMapIterator aIter = m_aTableMap.begin(); + for(;aIter != m_aTableMap.end();++aIter) + { + pTabWin = aIter->second; + aPos = pTabWin->GetPosPixel(); + + if( bHoriz ) + aPos.X() -= nDelta; + else aPos.Y() -= nDelta; + + pTabWin->SetPosPixel( aPos ); + } + + Invalidate(); // INVALIDATE_NOCHILDREN + + return bRet; +} + +//------------------------------------------------------------------------------ +void OJoinTableView::Tracking( const TrackingEvent& rTEvt ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + HideTracking(); + + if (rTEvt.IsTrackingEnded()) + { + if( m_pDragWin ) + { + if (m_aDragScrollTimer.IsActive()) + m_aDragScrollTimer.Stop(); + + ////////////////////////////////////////////////////////////////////// + // Position des Childs nach Verschieben anpassen + ////////////////////////////////////////////////////////////////////// + // Fenster duerfen nicht aus Anzeigebereich herausbewegt werden + Point aDragWinPos = rTEvt.GetMouseEvent().GetPosPixel() - m_aDragOffset; + Size aDragWinSize = m_pDragWin->GetSizePixel(); + if( aDragWinPos.X() < 0 ) + aDragWinPos.X() = 0; + if( aDragWinPos.Y() < 0 ) + aDragWinPos.Y() = 0; + if( (aDragWinPos.X() + aDragWinSize.Width()) > m_aOutputSize.Width() ) + aDragWinPos.X() = m_aOutputSize.Width() - aDragWinSize.Width(); + if( (aDragWinPos.Y() + aDragWinSize.Height()) > m_aOutputSize.Height() ) + aDragWinPos.Y() = m_aOutputSize.Height() - aDragWinSize.Height(); + if( aDragWinPos.X() < 0 ) + aDragWinPos.X() = 0; + if( aDragWinPos.Y() < 0 ) + aDragWinPos.Y() = 0; + // TODO : nicht das Fenster neu positionieren, wenn es uebersteht, sondern einfach meinen Bereich erweitern + + + ////////////////////////////////////////////////////////////////////// + // Fenster positionieren + EndTracking(); + m_pDragWin->SetZOrder(NULL, WINDOW_ZORDER_FIRST); + // erst mal testen, ob ich mich ueberhaupt bewegt habe + // (das verhindert das Setzen des modified-Flags, wenn sich eigentlich gar nichts getan hat) + OTableWindowData* pData = m_pDragWin->GetData(); + if (pData && pData->HasPosition() && (pData->GetPosition() == aDragWinPos)) + { + m_pDragWin = NULL; + SetPointer(Pointer(POINTER_ARROW)); + return; + } + + // die alten logischen Koordinaten + Point ptOldPos = m_pDragWin->GetPosPixel() + Point(GetHScrollBar()->GetThumbPos(), GetVScrollBar()->GetThumbPos()); + // neu positionieren + m_pDragWin->SetPosPixel(aDragWinPos); + TabWinMoved(m_pDragWin, ptOldPos); + + Invalidate(INVALIDATE_NOCHILDREN); + + m_pDragWin->GrabFocus(); + m_pDragWin = NULL; + SetPointer(Pointer(POINTER_ARROW)); + + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature( ID_BROWSER_SAVEDOC ); + return; + } + ////////////////////////////////////////////////////////////////////// + // Position des Childs nach Sizing anpassen + if( m_pSizingWin ) + { + SetPointer( Pointer() ); + EndTracking(); + + // die alten physikalischen Koordinaten + + Size szOld = m_pSizingWin->GetSizePixel(); + Point ptOld = m_pSizingWin->GetPosPixel(); + Size aNewSize(CalcZoom(m_aSizingRect.GetSize().Width()),CalcZoom(m_aSizingRect.GetSize().Height())); + m_pSizingWin->SetPosSizePixel( m_aSizingRect.TopLeft(), aNewSize ); + TabWinSized(m_pSizingWin, ptOld, szOld); + + m_pSizingWin->Invalidate( m_aSizingRect ); + m_pSizingWin = NULL; + + Invalidate(INVALIDATE_NOCHILDREN); + + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature( ID_BROWSER_SAVEDOC ); + return; + } + } + else if (rTEvt.IsTrackingCanceled()) + { + if (m_aDragScrollTimer.IsActive()) + m_aDragScrollTimer.Stop(); + EndTracking(); + }else + { + if( m_pDragWin ) + { + m_ptPrevDraggingPos = rTEvt.GetMouseEvent().GetPosPixel(); + // an Fenstergrenzen scrollen + ScrollWhileDragging(); + } + + if( m_pSizingWin ) + { + Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel(); + m_aSizingRect = Rectangle( m_pSizingWin->GetPosPixel(), m_pSizingWin->GetSizePixel() ); + UINT16 nSizingFlags = m_pSizingWin->GetSizingFlags(); + + if( nSizingFlags & SIZING_TOP ) + { + if( aMousePos.Y() < 0 ) + m_aSizingRect.Top() = 0; + else + m_aSizingRect.Top() = aMousePos.Y(); + } + + if( nSizingFlags & SIZING_BOTTOM ) + { + if( aMousePos.Y() > m_aOutputSize.Height() ) + m_aSizingRect.Bottom() = m_aOutputSize.Height(); + else + m_aSizingRect.Bottom() = aMousePos.Y(); + } + + + if( nSizingFlags & SIZING_RIGHT ) + { + if( aMousePos.X() > m_aOutputSize.Width() ) + m_aSizingRect.Right() = m_aOutputSize.Width(); + else + m_aSizingRect.Right() = aMousePos.X(); + } + + if( nSizingFlags & SIZING_LEFT ) + { + if( aMousePos.X() < 0 ) + m_aSizingRect.Left() = 0; + else + m_aSizingRect.Left() = aMousePos.X(); + } + + Update(); + ShowTracking( m_aSizingRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); + } + } +} + +//------------------------------------------------------------------------------ +void OJoinTableView::ConnDoubleClicked( OTableConnection* pConnection ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::MouseButtonDown( const MouseEvent& rEvt ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + GrabFocus(); + Window::MouseButtonDown(rEvt); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::MouseButtonUp( const MouseEvent& rEvt ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + Window::MouseButtonUp(rEvt); + ////////////////////////////////////////////////////////////////////// + // Wurde eine Connection ausgewaehlt? + if( !m_vTableConnection.size() ) + return; + + DeselectConn(GetSelectedConn()); + + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + { + if( (*aIter)->CheckHit(rEvt.GetPosPixel()) ) + { + SelectConn((*aIter)); + + // Doppelclick + if( rEvt.GetClicks() == 2 ) + ConnDoubleClicked( (*aIter) ); + + break; + } + } + +} + +//------------------------------------------------------------------------------ +void OJoinTableView::KeyInput( const KeyEvent& rEvt ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + USHORT nCode = rEvt.GetKeyCode().GetCode(); + BOOL bShift = rEvt.GetKeyCode().IsShift(); + BOOL bCtrl = rEvt.GetKeyCode().IsMod1(); + + if( !bCtrl && !bShift && (nCode==KEY_DELETE) ) + { + if (GetSelectedConn()) + RemoveConnection(GetSelectedConn()); + } + else + Window::KeyInput( rEvt ); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::DeselectConn(OTableConnection* pConn) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + if (!pConn || !pConn->IsSelected()) + return; + + // die zugehoerigen Eitnraege in der ListBox des Tabellenfenster deselektieren + OTableWindow* pWin = pConn->GetSourceWin(); + if (pWin && pWin->GetListBox()) + pWin->GetListBox()->SelectAll(FALSE); + + pWin = pConn->GetDestWin(); + if (pWin && pWin->GetListBox()) + pWin->GetListBox()->SelectAll(FALSE); + + pConn->Deselect(); + m_pSelectedConn = NULL; +} + +//------------------------------------------------------------------------------ +void OJoinTableView::SelectConn(OTableConnection* pConn) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + DeselectConn(GetSelectedConn()); + + // die betroffenene Eintraege in den Windows selektieren + OTableWindow* pConnSource = pConn->GetSourceWin(); + OTableWindow* pConnDest = pConn->GetDestWin(); + if (pConnSource && pConnDest) + { + OTableWindowListBox* pSourceBox = pConnSource->GetListBox(); + OTableWindowListBox* pDestBox = pConnDest->GetListBox(); + if (pSourceBox && pDestBox) + { + pSourceBox->SelectAll(FALSE); + pDestBox->SelectAll(FALSE); + + SvLBoxEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView(); + SvLBoxEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView(); + + const ::std::vector<OConnectionLine*>* pLines = pConn->GetConnLineList(); + ::std::vector<OConnectionLine*>::const_reverse_iterator aIter = pLines->rbegin(); + for(;aIter != pLines->rend();++aIter) + { + if ((*aIter)->IsValid()) + { + SvLBoxEntry* pSourceEntry = pSourceBox->GetEntryFromText((*aIter)->GetData()->GetSourceFieldName()); + if (pSourceEntry) + { + pSourceBox->Select(pSourceEntry, TRUE); + pSourceBox->MakeVisible(pSourceEntry); + } + + SvLBoxEntry* pDestEntry = pDestBox->GetEntryFromText((*aIter)->GetData()->GetDestFieldName()); + if (pDestEntry) + { + pDestBox->Select(pDestEntry, TRUE); + pDestBox->MakeVisible(pDestEntry); + } + } + } + + if ((pFirstSourceVisible != pSourceBox->GetFirstEntryInView()) + || (pFirstDestVisible != pDestBox->GetFirstEntryInView())) + // es wurde gescrollt -> neu zeichnen + Invalidate(INVALIDATE_NOCHILDREN); + } + } + + pConn->Select(); + m_pSelectedConn = pConn; +} +//------------------------------------------------------------------------------ +void OJoinTableView::Paint( const Rectangle& rRect ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + DrawConnections( rRect ); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::InvalidateConnections() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ////////////////////////////////////////////////////////////////////// + // Die Joins zeichnen + + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + (*aIter)->Invalidate(); +} + +//------------------------------------------------------------------------------ +void OJoinTableView::DrawConnections( const Rectangle& rRect ) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ////////////////////////////////////////////////////////////////////// + // Die Joins zeichnen + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + (*aIter)->Draw( rRect ); + // zum Schluss noch mal die selektierte ueber alle anderen drueber + if (GetSelectedConn()) + GetSelectedConn()->Draw( rRect ); +} + + +//------------------------------------------------------------------------------ +BOOL OJoinTableView::ExistsAConn(const OTableWindow* pFrom) const +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ::std::vector<OTableConnection*>::const_iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + { + if (pFrom == (*aIter)->GetSourceWin() || pFrom == (*aIter)->GetDestWin()) + break; + } + + return (aIter != m_vTableConnection.end()); +} + +//------------------------------------------------------------------------ +void OJoinTableView::ClearAll() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + SetUpdateMode(FALSE); + OTableWindowMapIterator aTableIter = m_aTableMap.begin(); + + for(;aTableIter != m_aTableMap.end();++aTableIter) + { + OTableWindow* pEntry = aTableIter->second; + ::std::vector< OTableWindowData*>::iterator aFind = ::std::find(m_pView->getController()->getTableWindowData()->begin(),m_pView->getController()->getTableWindowData()->end(),pEntry->GetData()); + if(aFind != m_pView->getController()->getTableWindowData()->end()) + { + delete *aFind; + m_pView->getController()->getTableWindowData()->erase(aFind); + } + delete pEntry; + } + m_aTableMap.clear(); + + // und das selbe mit den Connections + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + { + OTableConnectionData* pData = (*aIter)->GetData(); + m_pView->getController()->removeConnectionData(pData); + delete (*aIter); + } + m_vTableConnection.clear(); + + // scroll to the upper left + Scroll(-GetScrollOffset().X(), TRUE, TRUE); + Scroll(-GetScrollOffset().Y(), FALSE, TRUE); +} + +//------------------------------------------------------------------------ +BOOL OJoinTableView::ScrollWhileDragging() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + DBG_ASSERT(m_pDragWin != NULL, "OJoinTableView::ScrollWhileDragging darf nur waehrend Dragging eines Fensters aufgerufen werden !"); + + // den Timer schon mal killen + if (m_aDragScrollTimer.IsActive()) + m_aDragScrollTimer.Stop(); + + Point aDragWinPos = m_ptPrevDraggingPos - m_aDragOffset; + Size aDragWinSize = m_pDragWin->GetSizePixel(); + Point aLowerRight(aDragWinPos.X() + aDragWinSize.Width(), aDragWinPos.Y() + aDragWinSize.Height()); + + if (!m_bTrackingInitiallyMoved && (aDragWinPos == m_pDragWin->GetPosPixel())) + return TRUE; + + // Darstellungsfehler vermeiden (wenn bei aktivem TrackingRect gescrollt wird) + HideTracking(); + + BOOL bScrolling = FALSE; + BOOL bNeedScrollTimer = FALSE; + + // An Fenstergrenzen scrollen + // TODO : nur dann abfangen, wenn das Fenster komplett verschwinden wuerde (nicht, solange noch ein Pixel sichtbar ist) + if( aDragWinPos.X() < 5 ) + { + bScrolling = Scroll( -LINE_SIZE, TRUE, TRUE ); + if( !bScrolling && (aDragWinPos.X()<0) ) + aDragWinPos.X() = 0; + + // brauche ich weiteres (timergesteuertes) Scrolling ? + bNeedScrollTimer = bScrolling && (aDragWinPos.X() < 5); + } + + if( aLowerRight.X() > m_aOutputSize.Width() - 5 ) + { + bScrolling = Scroll( LINE_SIZE, TRUE, TRUE ) ; + if( !bScrolling && ( aLowerRight.X() > m_aOutputSize.Width() ) ) + aDragWinPos.X() = m_aOutputSize.Width() - aDragWinSize.Width(); + + // brauche ich weiteres (timergesteuertes) Scrolling ? + bNeedScrollTimer = bScrolling && (aLowerRight.X() > m_aOutputSize.Width() - 5); + } + + if( aDragWinPos.Y() < 5 ) + { + bScrolling = Scroll( -LINE_SIZE, FALSE, TRUE ); + if( !bScrolling && (aDragWinPos.Y()<0) ) + aDragWinPos.Y() = 0; + + bNeedScrollTimer = bScrolling && (aDragWinPos.Y() < 5); + } + + if( aLowerRight.Y() > m_aOutputSize.Height() - 5 ) + { + bScrolling = Scroll( LINE_SIZE, FALSE, TRUE ); + if( !bScrolling && ( (aDragWinPos.Y() + aDragWinSize.Height()) > m_aOutputSize.Height() ) ) + aDragWinPos.Y() = m_aOutputSize.Height() - aDragWinSize.Height(); + + bNeedScrollTimer = bScrolling && (aLowerRight.Y() > m_aOutputSize.Height() - 5); + } + + // Timer neu setzen, wenn noch notwendig + if (bNeedScrollTimer) + { + m_aDragScrollTimer.SetTimeout(100); + m_aDragScrollTimer.Start(); + } + + // das DraggingRect neu zeichnen + m_aDragRect = Rectangle(m_ptPrevDraggingPos - m_aDragOffset, m_pDragWin->GetSizePixel()); + Update(); + ShowTracking( m_aDragRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW ); + + return bScrolling; +} + +//------------------------------------------------------------------------ +IMPL_LINK(OJoinTableView, OnDragScrollTimer, void*, EMPTYARG) +{ + ScrollWhileDragging(); + return 0L; +} + +//------------------------------------------------------------------------ +void OJoinTableView::TabWinMoved(OTableWindow* ptWhich, const Point& ptOldPosition) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + Point ptThumbPos(GetHScrollBar()->GetThumbPos(), GetVScrollBar()->GetThumbPos()); + ptWhich->GetData()->SetPosition(ptWhich->GetPosPixel() + ptThumbPos); +} + +//------------------------------------------------------------------------ +void OJoinTableView::TabWinSized(OTableWindow* ptWhich, const Point& ptOldPosition, const Size& szOldSize) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + ptWhich->GetData()->SetSize(ptWhich->GetSizePixel()); + ptWhich->GetData()->SetPosition(ptWhich->GetPosPixel()); +} + +//------------------------------------------------------------------------------ +BOOL OJoinTableView::IsAddAllowed() +{ + DBG_CHKTHIS(OJoinTableView,NULL); + + // nicht wenn Db readonly + if (m_pView->getController()->isReadOnly()) + return FALSE; + + // nicht wenn schon zuviele Tabellen + Reference < XDatabaseMetaData > + xMetaData( m_pView->getController()->getConnection()->getMetaData() ); + + sal_Int32 nMax = xMetaData->getMaxTablesInSelect(); + if (nMax && nMax <= (sal_Int32)m_aTableMap.size()) + return FALSE; + + // nicht wenn keine Joins moeglich +// if (!GetDatabase()->IsCapable(SDB_CAP_JOIN) && nMax <= GetTabWinCount()) +// return FALSE; + + return TRUE; +} +//------------------------------------------------------------------------------ +void OJoinTableView::Command(const CommandEvent& rEvt) +{ + DBG_CHKTHIS(OJoinTableView,NULL); + + BOOL bHandled = FALSE; + + switch (rEvt.GetCommand()) + { + case COMMAND_CONTEXTMENU: + { + if (!rEvt.IsMouseEvent()) + { + Window::Command(rEvt); + return; + } + + if( !m_vTableConnection.size() ) + return; + DeselectConn(GetSelectedConn()); + + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + { + if( (*aIter)->CheckHit(rEvt.GetMousePosPixel()) ) + { + SelectConn((*aIter)); + + PopupMenu aContextMenu(ModuleRes(RID_QUERYCOLPOPUPMENU)); + switch (aContextMenu.Execute(this, rEvt.GetMousePosPixel())) + { + case SID_DELETE: + RemoveConnection((*aIter)); + break; + } + break; + } + } + bHandled = TRUE; + } + } + if (!bHandled) + Window::Command(rEvt); +} + +//------------------------------------------------------------------------------ +OTableConnection* OJoinTableView::GetTabConn(OTableWindow* pLhs,OTableWindow* pRhs, OTableConnection* _rpFirstAfter) +{ + OTableConnection* pConn = NULL; + DBG_ASSERT(pRhs || pLhs, "OJoinTableView::GetTabConn : invalid args !"); + // only one NULL-arg allowed + + if ((!pLhs || pLhs->ExistsAConn()) && (!pRhs || pRhs->ExistsAConn())) + { + BOOL bFoundStart = _rpFirstAfter ? FALSE : TRUE; + + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter) + { + OTableConnection* pData = *aIter; + + if ( ( (pData->GetSourceWin() == pLhs) + && ( (pData->GetDestWin() == pRhs) + || (NULL == pRhs) + ) + ) + || ( (pData->GetSourceWin() == pRhs) + && ( (pData->GetDestWin() == pLhs) + || (NULL == pLhs) + ) + ) + ) + { + if (bFoundStart) + { + pConn = pData; + break; + } + + if (!pConn) + // used as fallback : if there is no conn after _rpFirstAfter the first conn between the two tables + // will be used + pConn = pData; + + if (pData == _rpFirstAfter) + bFoundStart = TRUE; + } + } + } + return pConn; +} + +//------------------------------------------------------------------------------ +long OJoinTableView::PreNotify(NotifyEvent& rNEvt) +{ + BOOL bHandled = FALSE; + switch (rNEvt.GetType()) + { + case EVENT_COMMAND: + { + const CommandEvent* pCommand = rNEvt.GetCommandEvent(); + if (pCommand->GetCommand() == COMMAND_WHEEL) + { + const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); + if (pData->GetMode() == COMMAND_WHEEL_SCROLL) + { + if (pData->GetDelta() > 0) + Scroll(-10 * pData->GetScrollLines(), pData->IsHorz(), TRUE); + else + Scroll(10 * pData->GetScrollLines(), pData->IsHorz(), TRUE); + bHandled = TRUE; + } + } + } + break; + case EVENT_KEYINPUT: + { + if (!m_aTableMap.size()) + // no tab wins -> no conns -> no traveling + break; + + const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent(); + if (!pKeyEvent->GetKeyCode().IsMod1()) + { + switch (pKeyEvent->GetKeyCode().GetCode()) + { + case KEY_TAB: + { + if (!HasChildPathFocus()) + break; + + BOOL bForward = !pKeyEvent->GetKeyCode().IsShift(); + // is there an active tab win ? + OTableWindowMapIterator aIter = m_aTableMap.begin(); + for(;aIter != m_aTableMap.end();++aIter) + if (aIter->second && aIter->second->HasChildPathFocus()) + break; + + OTableWindow* pNextWin = NULL; + OTableConnection* pNextConn = NULL; + + if (aIter != m_aTableMap.end()) + { // there is a currently active tab win + // check if there is an "overflow" and we should select a conn instead of a win + if (m_vTableConnection.size()) + { + if ((aIter->second == m_aTableMap.rbegin()->second) && bForward) + // the last win is active and we're travelling forward -> select the first conn + pNextConn = *m_vTableConnection.begin(); + if ((aIter == m_aTableMap.begin()) && !bForward) + // the first win is active an we're traveling backward -> select the last conn + pNextConn = *m_vTableConnection.rbegin(); + } + + if (!pNextConn) + // no conn for any reason -> select the next or previous tab win + pNextWin = m_aTableMap.rbegin()->second; + } + else + { // no active tab win -> travel the connections + // find the currently selected conn within the conn list + sal_Int32 i(0); + ::std::vector<OTableConnection*>::iterator aIter = m_vTableConnection.begin(); + for(;aIter != m_vTableConnection.end();++aIter,++i) + { + if ((*aIter) == GetSelectedConn()) + break; + } + if (i == sal_Int32(m_vTableConnection.size() - 1) && bForward) + // the last conn is active and we're travelling forward -> select the first win + pNextWin = m_aTableMap.begin()->second; + if ((i == 0) && !bForward && m_aTableMap.size()) + // the first conn is active and we're travelling backward -> select the last win + pNextWin = m_aTableMap.rbegin()->second; + + if (pNextWin) + DeselectConn(GetSelectedConn()); + else + // no win for any reason -> select the next or previous conn + if (i < (sal_Int32)m_vTableConnection.size()) + // there is a currently active conn + pNextConn = m_vTableConnection[(i + (bForward ? 1 : m_vTableConnection.size() - 1)) % m_vTableConnection.size()]; + else + { // no tab win selected, no conn selected + if (m_vTableConnection.size()) + pNextConn = m_vTableConnection[bForward ? 0 : m_vTableConnection.size() - 1]; + else if (m_aTableMap.size()) + { + if(bForward) + pNextWin = m_aTableMap.begin()->second; + else + pNextWin = m_aTableMap.rbegin()->second; + } + } + } + + // now select the object + if (pNextWin) + { + if (pNextWin->GetListBox()) + pNextWin->GetListBox()->GrabFocus(); + else + pNextWin->GrabFocus(); + EnsureVisible(pNextWin); + } + else if (pNextConn) + { + SelectConn(pNextConn); + GrabFocus(); + // neccessary : a conn may be selected even if a tab win has the focus, in this case + // the next travel would select the same conn again if we would not reset te focus ... + } + } + break; + case KEY_RETURN: + { + if (!pKeyEvent->GetKeyCode().IsShift() && GetSelectedConn() && HasFocus()) + ConnDoubleClicked(GetSelectedConn()); + break; + } + } + } + } + break; + case EVENT_GETFOCUS: + { + Window* pSource = rNEvt.GetWindow(); + if (pSource) + { + Window* pSearchFor = NULL; + if (pSource->GetParent() == this) + // it may be one of the tab wins + pSearchFor = pSource; + else if (pSource->GetParent() && (pSource->GetParent() == this)) + // it may be one of th list boxes of one of the tab wins + pSearchFor = pSource->GetParent(); + + if (pSearchFor) + { + OTableWindowMapIterator aIter = m_aTableMap.begin(); + for(;aIter != m_aTableMap.end();++aIter) + { + if (aIter->second == pSearchFor) + { + m_pLastFocusTabWin = aIter->second; + break; + } + } + } + } + } + break; + } + + if (!bHandled) + return Window::PreNotify(rNEvt); + return 0; +} + +//------------------------------------------------------------------------------ +void OJoinTableView::GrabTabWinFocus() +{ + if (m_pLastFocusTabWin) + { + if (m_pLastFocusTabWin->GetListBox()) + m_pLastFocusTabWin->GetListBox()->GrabFocus(); + else + m_pLastFocusTabWin->GrabFocus(); + } + else if (m_aTableMap.size() && m_aTableMap.begin()->second) + { + OTableWindow* pFirstWin = m_aTableMap.begin()->second; + if (pFirstWin->GetListBox()) + pFirstWin->GetListBox()->GrabFocus(); + else + pFirstWin->GrabFocus(); + } +} +// ----------------------------------------------------------------------------- +void OJoinTableView::StateChanged( StateChangedType nType ) +{ + Window::StateChanged( nType ); + + if ( nType == STATE_CHANGE_ZOOM ) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + Font aFont = rStyleSettings.GetGroupFont(); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + + OTableWindowMapIterator aIter = m_aTableMap.begin(); + for(;aIter != m_aTableMap.end();++aIter) + { + aIter->second->SetZoom(GetZoom()); + Size aSize(CalcZoom(aIter->second->GetSizePixel().Width()),CalcZoom(aIter->second->GetSizePixel().Height())); + aIter->second->SetSizePixel(aSize); + } + Resize(); + } +} + + + diff --git a/dbaccess/source/ui/querydesign/QTableConnection.cxx b/dbaccess/source/ui/querydesign/QTableConnection.cxx new file mode 100644 index 000000000000..a8e7ea2b9ab8 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QTableConnection.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * $RCSfile: QTableConnection.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20: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_QUERYTABLECONNECTION_HXX +#include "QTableConnection.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +using namespace dbaui; + + +TYPEINIT1(OQueryTableConnection, OTableConnection); + +//======================================================================== +// class OQueryTableConnection +//======================================================================== +DBG_NAME(OQueryTableConnection); + +//------------------------------------------------------------------------ +OQueryTableConnection::OQueryTableConnection(OQueryTableView* pContainer, OQueryTableConnectionData* pTabConnData) + :OTableConnection(pContainer, pTabConnData) +{ + DBG_CTOR(OQueryTableConnection,NULL); +} + + +//------------------------------------------------------------------------ +OQueryTableConnection::OQueryTableConnection(const OQueryTableConnection& rConn) + :OTableConnection( rConn ) +{ + DBG_CTOR(OQueryTableConnection,NULL); + // keine eigenen Members, also reicht die Basisklassenfunktionalitaet +} + + +//------------------------------------------------------------------------ +OQueryTableConnection::~OQueryTableConnection() +{ + DBG_DTOR(OQueryTableConnection,NULL); +} + +//------------------------------------------------------------------------ +OConnectionLine* OQueryTableConnection::CreateConnLine( const OConnectionLine& rConnLine ) +{ + // keine Spezialisierung bei den ConnectionLines, also eine Instanz der Standard-Klasse + return new OConnectionLine(rConnLine); +} + +//------------------------------------------------------------------------ +OQueryTableConnection& OQueryTableConnection::operator=(const OQueryTableConnection& rConn) +{ + if (&rConn == this) + return *this; + + OTableConnection::operator=(rConn); + // keine eigenen Members ... + return *this; +} + +//------------------------------------------------------------------------ +sal_Bool OQueryTableConnection::operator==(const OQueryTableConnection& rCompare) +{ + DBG_ASSERT(GetData() && rCompare.GetData(), "OQueryTableConnection::operator== : einer der beiden Teilnehmer hat keine Daten !"); + + // allzuviel brauche ich nicht vergleichen (schon gar nicht alle Member) : lediglich die Fenster, an denen wir haengen, und + // die Indizies in der entsprechenden Tabelle muessen uebereinstimmen + OQueryTableConnectionData* pMyData = (OQueryTableConnectionData*)GetData(); + OQueryTableConnectionData* pCompData = (OQueryTableConnectionData*)rCompare.GetData(); + + // Connections werden als gleich angesehen, wenn sie in Source-/Dest-Fenstername und Source-/Dest-FieldIndex uebereinstimmen ... + return ( ( (pMyData->GetSourceWinName() == pCompData->GetSourceWinName()) && + (pMyData->GetDestWinName() == pCompData->GetDestWinName()) && + (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_TO)) && + (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_FROM)) + ) + || // ... oder diese Uebereinstimmung ueber Kreuz besteht + ( (pMyData->GetSourceWinName() == pCompData->GetDestWinName()) && + (pMyData->GetDestWinName() == pCompData->GetSourceWinName()) && + (pMyData->GetFieldIndex(JTCS_TO) == pCompData->GetFieldIndex(JTCS_FROM)) && + (pMyData->GetFieldIndex(JTCS_FROM) == pCompData->GetFieldIndex(JTCS_TO)) + ) + ); +} +// ----------------------------------------------------------------------------- + + + + + + diff --git a/dbaccess/source/ui/querydesign/QTableConnection.hxx b/dbaccess/source/ui/querydesign/QTableConnection.hxx new file mode 100644 index 000000000000..39c1a3a97599 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QTableConnection.hxx @@ -0,0 +1,100 @@ +/************************************************************************* + * + * $RCSfile: QTableConnection.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:24: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_QUERYTABLECONNECTION_HXX +#define DBAUI_QUERYTABLECONNECTION_HXX + +#ifndef DBAUI_TABLECONNECTION_HXX +#include "TableConnection.hxx" +#endif +#ifndef DBAUI_QTABLECONNECTIONDATA_HXX +#include "QTableConnectionData.hxx" +#endif +#ifndef DBAUI_ENUMTYPES_HXX +#include "QEnumTypes.hxx" +#endif + +namespace dbaui +{ + //================================================================== + class OQueryTableView; + class OQueryTableConnection : public OTableConnection + { + sal_Bool m_bVisited; // is true if the conn was already visited through the join algorithm + protected: + OConnectionLine* CreateConnLine( const OConnectionLine& rConnLine ); + + public: + TYPEINFO(); + OQueryTableConnection(OQueryTableView* pContainer, OQueryTableConnectionData* pTabConnData); + OQueryTableConnection(const OQueryTableConnection& rConn); + virtual ~OQueryTableConnection(); + + OQueryTableConnection& operator=(const OQueryTableConnection& rConn); + sal_Bool operator==(const OQueryTableConnection& rCompare); + + ::rtl::OUString GetAliasName(EConnectionSide nWhich) const { return static_cast<OQueryTableConnectionData*>(GetData())->GetAliasName(nWhich); } + + sal_Bool IsVisited() const { return m_bVisited; } + void SetVisited(sal_Bool bVisited) { m_bVisited = bVisited; } + + }; +} +#endif // DBAUI_QUERYTABLECONNECTION_HXX
\ No newline at end of file diff --git a/dbaccess/source/ui/querydesign/QTableConnectionData.hxx b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx new file mode 100644 index 000000000000..6495e9c5b55e --- /dev/null +++ b/dbaccess/source/ui/querydesign/QTableConnectionData.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * $RCSfile: QTableConnectionData.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20: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 DBAUI_QTABLECONNECTIONDATA_HXX +#define DBAUI_QTABLECONNECTIONDATA_HXX + +#ifndef DBAUI_TABLECONNECTIONDATA_HXX +#include "TableConnectionData.hxx" +#endif +#ifndef DBAUI_TABLEFIELDDESC_HXX +#include "TableFieldDescription.hxx" +#endif +#ifndef DBAUI_ENUMTYPES_HXX +#include "QEnumTypes.hxx" +#endif +#ifndef _RTTI_HXX +#include <tools/rtti.hxx> +#endif + +namespace dbaui +{ + class OQueryTableConnectionData : public OTableConnectionData + { + sal_Int32 m_nFromEntryIndex; + sal_Int32 m_nDestEntryIndex; + EJoinType m_eJoinType; + + ETableFieldType m_eFromType; + ETableFieldType m_eDestType; + + // meine Basisklasse merkt sich leider nur die Fensternamen (was hier das selbe wie die Aliasnamen ist), ich aber brauche + // auch Zugriff auf die realen Tabellennamen. Damit ich mir nicht die Fenster dazu merken muss (das waere schmutzig, da die + // TabConDatas normalerweise vom Dokument verwaltet werden und voellig losgeloest von der Repraesentation der Tabellen als + // Fenster sein sollten), habe ich zwei ::rtl::OUString-Member + ::rtl::OUString m_strSourceTableName; + ::rtl::OUString m_strDestTableName; + + protected: + // fuer das Anlegen und Duplizieren von Lines vom eigenen Typ + virtual OConnectionLineData* CreateLineDataObj(); + virtual OConnectionLineData* CreateLineDataObj( const OConnectionLineData& rConnLineData ); + + public: + TYPEINFO(); + OQueryTableConnectionData(); + OQueryTableConnectionData( const OQueryTableConnectionData& rConnData ); + OQueryTableConnectionData( const ::rtl::OUString& strSourceTable, const ::rtl::OUString& strDestTable, + const ::rtl::OUString& strSourceAlias, const ::rtl::OUString& strDestAlias, const ::rtl::OUString& rConnName=::rtl::OUString()); + virtual ~OQueryTableConnectionData(); + + virtual void CopyFrom(const OTableConnectionData& rSource); + virtual OTableConnectionData* NewInstance() const; + + OQueryTableConnectionData& operator=( const OQueryTableConnectionData& rConnData ); + + ::rtl::OUString GetTableName(EConnectionSide nWhich) const; + ::rtl::OUString GetAliasName(EConnectionSide nWhich) const; + + sal_Int32 GetFieldIndex(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_nDestEntryIndex : m_nFromEntryIndex; } + void SetFieldIndex(EConnectionSide nWhich, sal_Int32 nVal) { if (nWhich==JTCS_TO) m_nDestEntryIndex=nVal; else m_nFromEntryIndex=nVal; } + + ETableFieldType GetFieldType(EConnectionSide nWhich) const { return nWhich==JTCS_TO ? m_eDestType : m_eFromType; } + void SetFieldType(EConnectionSide nWhich, ETableFieldType eType) { if (nWhich==JTCS_TO) m_eDestType=eType; else m_eFromType=eType; } + + void InitFromDrag(const OTableFieldDesc& rDragLeft, const OTableFieldDesc& rDragRight); + + EJoinType GetJoinType() const { return m_eJoinType; }; + void SetJoinType(const EJoinType& eJT) { m_eJoinType = eJT; }; + + }; + +} +#endif // DBAUI_QTABLECONNECTIONDATA_HXX
\ No newline at end of file diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx new file mode 100644 index 000000000000..8468da88ca34 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx @@ -0,0 +1,380 @@ +/************************************************************************* + * + * $RCSfile: QTableWindow.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:24: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 DBAUI_QUERY_TABLEWINDOWDATA_HXX +#include "QTableWindow.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC +#include "dbustrings.hrc" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#include "dbaccess_helpid.hrc" +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif +#ifndef DBACCESS_UI_BROWSER_ID_HXX +#include "browserids.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#ifndef _SV_IMAGE_HXX +#include <vcl/image.hxx> +#endif +#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX +#include "TableWindowListBox.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef DBAUI_QUERY_HRC +#include "Query.hrc" +#endif +#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XKeysSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef DBAUI_TABLEFIELDINFO_HXX +#include "TableFieldInfo.hxx" +#endif +#ifndef _COMPHELPER_UNO3_HXX_ +#include <comphelper/uno3.hxx> +#endif + +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::sdbcx; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; +using namespace dbaui; +TYPEINIT1(OQueryTableWindow, OTableWindow); +//======================================================================== +// class OQueryTableWindow +//======================================================================== +DBG_NAME(OQueryTableWindow); +//------------------------------------------------------------------------------ +OQueryTableWindow::OQueryTableWindow( Window* pParent, OQueryTableWindowData* pTabWinData, sal_Unicode* pszInitialAlias) + :OTableWindow( pParent, pTabWinData ) + ,m_nAliasNum(0) +{ + DBG_CTOR(OQueryTableWindow,NULL); + if (pszInitialAlias != NULL) + m_strInitialAlias = ::rtl::OUString(pszInitialAlias); + else + m_strInitialAlias = pTabWinData->GetAliasName(); + + // wenn der Tabellen- gleich dem Aliasnamen ist, dann darf ich das nicht an InitialAlias weiterreichen, denn das Anhaengen + // eines eventuelle Tokens nicht klappen ... + if (m_strInitialAlias == pTabWinData->GetTableName()) + m_strInitialAlias = ::rtl::OUString(); + + SetHelpId(HID_CTL_QRYDGNTAB); +} + +//------------------------------------------------------------------------------ +OQueryTableWindow::~OQueryTableWindow() +{ + EmptyListBox(); + DBG_DTOR(OQueryTableWindow,NULL); +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableWindow::Init() +{ + sal_Bool bSuccess = OTableWindow::Init(); + + OQueryTableView* pContainer = static_cast<OQueryTableView*>(getTableView()); + + // zuerst Alias bestimmen + ::rtl::OUString strAliasName; + + OTableWindowData* pWinData = GetData(); + DBG_ASSERT(pWinData->ISA(OQueryTableWindowData), "OQueryTableWindow::Init() : habe keine OQueryTableWindowData"); + + if (m_strInitialAlias.getLength() ) + // Der Alias wurde explizit mit angegeben + strAliasName = m_strInitialAlias; + else + { + ::rtl::OUString aInitialTitle = pWinData->GetTableName(); + sal_Bool bOwner = sal_False; + if(GetTable().is()) + { + ::rtl::OUString sName; + GetTable()->getPropertyValue(PROPERTY_NAME) >>= sName; + strAliasName = sName.getStr(); + } + } + + // Alias mit fortlaufender Nummer versehen + if (pContainer->CountTableAlias(strAliasName, m_nAliasNum)) + { + strAliasName += ::rtl::OUString('_'); + strAliasName += ::rtl::OUString::valueOf(m_nAliasNum); + } + + + strAliasName = String(strAliasName).EraseAllChars('"'); + SetAliasName(strAliasName); + // SetAliasName reicht das als WinName weiter, dadurch benutzt es die Basisklasse + // reset the titel + m_aTitle.SetText( pWinData->GetWinName() ); + m_aTitle.Show(); + + // sal_Bool bSuccess(sal_True); + if (!bSuccess) + { // es soll nur ein Dummy-Window aufgemacht werden ... + DBG_ASSERT(GetAliasName().getLength(), "OQueryTableWindow::Init : kein Alias- UND kein Tabellenname geht nicht !"); + // .. aber das braucht wenigstens einen Alias + + // ::com::sun::star::form::ListBox anlegen + if (!m_pListBox) + m_pListBox = CreateListBox(); + + // Titel setzen + m_aTitle.SetText(GetAliasName()); + m_aTitle.Show(); + + EmptyListBox(); + // neu zu fuellen brauche ich die nicht, da ich ja keine Tabelle habe + m_pListBox->Show(); + } + + getTableView()->getDesignView()->getController()->InvalidateFeature(ID_BROWSER_QUERY_EXECUTE); + return bSuccess; +} +//------------------------------------------------------------------------------ +sal_Bool OQueryTableWindow::FillListBox() +{ + ImageList aImageList(ModuleRes(IMG_JOINS)); + Image aPrimKeyImage = aImageList.GetImage(IMG_PRIMARY_KEY); + + + + // first we need the keys from the table + Reference<XKeysSupplier> xKeys(GetTable(),UNO_QUERY); + Reference<XNameAccess> xPKeyColumns; + if(xKeys.is()) + { + Reference< XIndexAccess> xKeyIndex = xKeys->getKeys(); + Reference<XColumnsSupplier> xColumnsSupplier; + // search the one and only primary key + for(sal_Int32 i=0;i< xKeyIndex->getCount();++i) + { + Reference<XPropertySet> xProp; + xKeyIndex->getByIndex(i) >>= xProp; + sal_Int32 nKeyType = 0; + xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + if(KeyType::PRIMARY == nKeyType) + { + xColumnsSupplier = Reference<XColumnsSupplier>(xProp,UNO_QUERY); + break; + } + } + if(xColumnsSupplier.is()) + xPKeyColumns = xColumnsSupplier->getColumns(); + } + + // first we need a * + SvLBoxEntry* pEntry = NULL; + if (GetData()->IsShowAll()) + { + pEntry = m_pListBox->InsertEntry( ::rtl::OUString::createFromAscii("*") ); + pEntry->SetUserData( new OTableFieldInfo() ); + } + + Sequence< ::rtl::OUString> aColumns = GetOriginalColumns()->getElementNames(); + const ::rtl::OUString* pBegin = aColumns.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aColumns.getLength(); + + for (; pBegin != pEnd; ++pBegin) + { + OTableFieldInfo* pInfo = new OTableFieldInfo(); + // is this column in the primary key + if (xPKeyColumns.is() && xPKeyColumns->hasByName(*pBegin)) + { + pEntry = m_pListBox->InsertEntry(*pBegin, aPrimKeyImage, aPrimKeyImage); + pInfo->SetKey(TAB_PRIMARY_FIELD); + } + else + { + pEntry = m_pListBox->InsertEntry(*pBegin); + pInfo->SetKey(TAB_NORMAL_FIELD); + } + Reference<XPropertySet> xColumn; + GetOriginalColumns()->getByName(*pBegin) >>= xColumn; + OSL_ENSURE(xColumn.is(),"No column!"); + pInfo->SetDataType(::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_TYPE))); + pEntry->SetUserData( pInfo ); + } + return sal_True; +} + +//------------------------------------------------------------------------------ +void OQueryTableWindow::EmptyListBox() +{ + if(m_pListBox) + { + SvLBoxEntry* pEntry = m_pListBox->First(); + + while(pEntry) + { + OTableFieldInfo* pInf = (OTableFieldInfo*)pEntry->GetUserData(); + delete pInf; + + SvLBoxEntry* pNextEntry = m_pListBox->Next(pEntry); + m_pListBox->GetModel()->Remove(pEntry); + pEntry = pNextEntry; + } + } +} + +//------------------------------------------------------------------------------ +void OQueryTableWindow::OnEntryDoubleClicked(SvLBoxEntry* pEntry) +{ + DBG_ASSERT(pEntry != NULL, "OQueryTableWindow::OnEntryDoubleClicked : pEntry darf nicht NULL sein !"); + // man koennte das auch abfragen und dann ein return hinsetzen, aber so weist es vielleicht auf Fehler bei Aufrufer hin + + if (getTableView()->getDesignView()->getController()->isReadOnly()) + return; + + OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData()); + DBG_ASSERT(pInf != NULL, "OQueryTableWindow::OnEntryDoubleClicked : Feld hat keine FieldInfo !"); + + // eine DragInfo aufbauen + OTableFieldDesc aInfo; + aInfo.SetTabWindow(this); + aInfo.SetField(m_pListBox->GetEntryText(pEntry)); + aInfo.SetTable(GetTableName()); + aInfo.SetAlias(GetAliasName()); + aInfo.SetDatabase(GetComposedName()); + aInfo.SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry)); + aInfo.SetDataType(pInf->GetDataType()); + + // und das entsprechende Feld einfuegen + static_cast<OQueryTableView*>(getTableView())->InsertField(aInfo); +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableWindow::ExistsField(const ::rtl::OUString& strFieldName, OTableFieldDesc& rInfo) +{ + DBG_ASSERT(m_pListBox != NULL, "OQueryTableWindow::ExistsField : habe keine ::com::sun::star::form::ListBox !"); + SvLBoxEntry* pEntry = m_pListBox->First(); + ::comphelper::UStringMixEqual bCase(getTableView()->getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + + while (pEntry) + { + if (bCase(strFieldName,::rtl::OUString(m_pListBox->GetEntryText(pEntry)))) + { + OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData()); + DBG_ASSERT(pInf != NULL, "OQueryTableWindow::ExistsField : Feld hat keine FieldInfo !"); + + rInfo.SetTabWindow(this); + rInfo.SetField(strFieldName); + rInfo.SetTable(GetTableName()); + rInfo.SetAlias(GetAliasName()); + rInfo.SetDatabase(GetComposedName()); + rInfo.SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry)); + rInfo.SetDataType(pInf->GetDataType()); + return sal_True; + } + pEntry = m_pListBox->Next(pEntry); + } + + return sal_False; +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableWindow::ExistsAVisitedConn() const +{ + return static_cast<const OQueryTableView*>(getTableView())->ExistsAVisitedConn(this); +} + +//------------------------------------------------------------------------------ +void OQueryTableWindow::KeyInput( const KeyEvent& rEvt ) +{ + OTableWindow::KeyInput( rEvt ); +} +// ----------------------------------------------------------------------------- + + + diff --git a/dbaccess/source/ui/querydesign/QTableWindowData.cxx b/dbaccess/source/ui/querydesign/QTableWindowData.cxx new file mode 100644 index 000000000000..4e152d69e0d7 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QTableWindowData.cxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * $RCSfile: QTableWindowData.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20: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_QUERY_TABLEWINDOWDATA_HXX +#include "QTableWindowData.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + + +using namespace dbaui; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; + +TYPEINIT1(OQueryTableWindowData, OTableWindowData); + +DBG_NAME(OQueryTableWindowData); +//================================================================== +// class OQueryTableWindowData +//================================================================== + +//------------------------------------------------------------------------------ +OQueryTableWindowData::OQueryTableWindowData() + :OTableWindowData() +{ + DBG_CTOR(OQueryTableWindowData,NULL); + m_bShowAll = sal_True; +} + +//------------------------------------------------------------------------------ +OQueryTableWindowData::OQueryTableWindowData(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rTableName, const ::rtl::OUString& rTableAlias ) + :OTableWindowData(_rComposedName, rTableName, rTableAlias) +{ + DBG_CTOR(OQueryTableWindowData,NULL); + m_bShowAll = sal_True; +} + +//------------------------------------------------------------------------------ +OQueryTableWindowData::~OQueryTableWindowData() +{ + DBG_DTOR(OQueryTableWindowData,NULL); +} +//------------------------------------------------------------------------------ +void OQueryTableWindowData::Load(const Reference<XObjectInputStream>& _rxIn) +{ + OTableWindowData::Load(_rxIn); +} +//------------------------------------------------------------------------------ +void OQueryTableWindowData::Save(const Reference<XObjectOutputStream>& _rxOut) +{ + OTableWindowData::Save(_rxOut); +} +// ----------------------------------------------------------------------------- + + + diff --git a/dbaccess/source/ui/querydesign/QTableWindowData.hxx b/dbaccess/source/ui/querydesign/QTableWindowData.hxx new file mode 100644 index 000000000000..020d6afa76b1 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QTableWindowData.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * $RCSfile: QTableWindowData.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:24:24 $ + * + * 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_QUERY_TABLEWINDOWDATA_HXX +#define DBAUI_QUERY_TABLEWINDOWDATA_HXX + +#ifndef DBAUI_TABLEWINDOWDATA_HXX +#include "TableWindowData.hxx" +#endif +#ifndef _VECTOR_ +#include <vector> +#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 OQueryTableWindowData : public OTableWindowData + { + protected: + // ::std::vector< ::rtl::OUString> m_vField; + public: + TYPEINFO(); + OQueryTableWindowData(); + OQueryTableWindowData(const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rTableName, const ::rtl::OUString& rTableAlias); + virtual ~OQueryTableWindowData(); + + 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 GetAliasName() { return GetWinName(); } + void SetAliasName(const ::rtl::OUString& rNewAlias) { SetWinName(rNewAlias); } + }; +} +#endif // DBAUI_QUERY_TABLEWINDOWDATA_HXX + + diff --git a/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx new file mode 100644 index 000000000000..9650e431a046 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryAddTabConnUndoAction.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * $RCSfile: QueryAddTabConnUndoAction.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:24:34 $ + * + * 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_QUERYADDTABCONNUNDOACTION_HXX +#define DBAUI_QUERYADDTABCONNUNDOACTION_HXX + +#ifndef DBAUI_QUERYTABCONNUNDOACTION_HXX +#include "QueryTabConnUndoAction.hxx" +#endif + +namespace dbaui +{ + // ================================================================================================ + // OQueryAddTabConnUndoAction - Undo-Klasse fuer Einfuegen einer Connection + + class OQueryAddTabConnUndoAction : public OQueryTabConnUndoAction + { + public: + OQueryAddTabConnUndoAction(OQueryTableView* pOwner) : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_INSERTCONNECTION) { } + + virtual void Undo() { m_pOwner->DropConnection(m_pConnection); SetOwnership(TRUE); } + virtual void Redo() { m_pOwner->GetConnection(m_pConnection); SetOwnership(FALSE); } + }; + + // ================================================================================================ + // OQueryDelTabConnUndoAction - Undo-Klasse fuer Einfuegen einer Connection + + class OQueryDelTabConnUndoAction : public OQueryTabConnUndoAction + { + public: + OQueryDelTabConnUndoAction(OQueryTableView* pOwner) : OQueryTabConnUndoAction(pOwner, STR_QUERY_UNDO_REMOVECONNECTION) { } + + virtual void Undo() { m_pOwner->GetConnection(m_pConnection); SetOwnership(FALSE); } + virtual void Redo() { m_pOwner->DropConnection(m_pConnection); SetOwnership(TRUE); } + }; +} +#endif // DBAUI_QUERYADDTABCONNUNDOACTION_HXX + + diff --git a/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx new file mode 100644 index 000000000000..637858cf38df --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryDesignFieldUndoAct.hxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * $RCSfile: QueryDesignFieldUndoAct.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20:40 $ + * + * 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_QUERYDESIGNFIELDUNDOACT_HXX +#define DBAUI_QUERYDESIGNFIELDUNDOACT_HXX + +#ifndef DBAUI_GENERALUNDO_HXX +#include "GeneralUndo.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#ifndef DBAUI_QUERYDESIGN_OSELECTIONBROWSEBOX_HXX +#include "SelectionBrowseBox.hxx" +#endif + + +namespace dbaui +{ + // ================================================================================================ + // OQueryDesignFieldUndoAct - Basisklasse fuer Undos in der Feldauflistung im Abfrageentwurf + + + class OQueryDesignFieldUndoAct : public OCommentUndoAction + { + protected: + OSelectionBrowseBox* pOwner; + long m_nColId; + + virtual void Undo() = 0; + virtual void Redo() = 0; + + public: + OQueryDesignFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, USHORT nCommentID) : OCommentUndoAction(nCommentID), pOwner(pSelBrwBox), m_nColId(-1) { } + + void SetColId(long nCol) { m_nColId = nCol; } + }; + + // ================================================================================================ + // OTabFieldCellModifiedUndoAct - Undo-Klasse fuer Aendern einer Zelle einer Spaltenbeschreibung + + class OTabFieldCellModifiedUndoAct : public OQueryDesignFieldUndoAct + { + protected: + String m_strNextCellContents; + sal_Int32 m_nCellIndex; + + public: + OTabFieldCellModifiedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_MODIFY_CELL) { } + + void SetCellContents(const String& str) { m_strNextCellContents = str; } + void SetCellIndex(sal_Int32 nIndex) { m_nCellIndex = nIndex; } + + virtual void Undo(); + virtual void Redo() { Undo(); } + }; + + // ================================================================================================ + // OTabFieldSizedUndoAct - Undo-Klasse fuer Aendern einer Spaltenbreite + + class OTabFieldSizedUndoAct : public OQueryDesignFieldUndoAct + { + protected: + long m_nNextWidth; + + public: + OTabFieldSizedUndoAct(OSelectionBrowseBox* pSelBrwBox) : OQueryDesignFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_SIZE_COLUMN), m_nNextWidth(0) { } + + void SetOriginalWidth(long nWidth) { m_nNextWidth = nWidth; } + + virtual void Undo(); + virtual void Redo() { Undo(); } + }; + + // ================================================================================================ + // OTabFieldUndoAct - Basisklasse fuer Undos in der Feldauflistung im Abfrageentwurf, die mit Veraendern einer kompletten Feldbeschreibung zu tun haben + + class OTabFieldUndoAct : public OQueryDesignFieldUndoAct + { + protected: + OTableFieldDesc* pDescr; // geloeschte Spaltenbeschreibung + BOOL m_bOwnerOfDescription; + + public: + OTabFieldUndoAct(OSelectionBrowseBox* pSelBrwBox, USHORT nCommentID) : OQueryDesignFieldUndoAct(pSelBrwBox, nCommentID) { } + virtual ~OTabFieldUndoAct() { if (m_bOwnerOfDescription) delete pDescr; } + + void SetTabFieldDescr(OTableFieldDesc* pDescription) { pDescr = pDescription; } + // anschliessend bitte SetOwnership + void SetOwnership(BOOL bTakeIt) { m_bOwnerOfDescription = bTakeIt; } + }; + + // ================================================================================================ + // OTabFieldDelUndoAct - Undo-Klasse fuer Loeschen eines Feldes + + class OTabFieldDelUndoAct : public OTabFieldUndoAct + { + protected: + virtual void Undo() { pOwner->InsertColumn(pDescr, m_nColId); SetOwnership(FALSE); } + virtual void Redo() { pOwner->RemoveColumn((USHORT)m_nColId); SetOwnership(TRUE); } + + public: + OTabFieldDelUndoAct(OSelectionBrowseBox* pSelBrwBox) : OTabFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_TABFIELDDELETE) { } + }; + + // ================================================================================================ + // OTabFieldDelUndoAct - Undo-Klasse fuer Anlegen eines Feldes + + class OTabFieldCreateUndoAct : public OTabFieldUndoAct + { + protected: + virtual void Undo() { pOwner->RemoveColumn((USHORT)m_nColId); SetOwnership(TRUE); } + virtual void Redo() { pOwner->InsertColumn(pDescr, m_nColId); SetOwnership(FALSE); } + + public: + OTabFieldCreateUndoAct(OSelectionBrowseBox* pSelBrwBox) : OTabFieldUndoAct(pSelBrwBox, STR_QUERY_UNDO_TABFIELDCREATE) { } + }; +} +#endif // DBAUI_QUERYDESIGNFIELDUNDOACT_HXX + + + diff --git a/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx new file mode 100644 index 000000000000..4d3ce263e51e --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryDesignUndoAction.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * $RCSfile: QueryDesignUndoAction.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:24:42 $ + * + * 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_QUERYDESIGNUNDOACTION_HXX +#define DBAUI_QUERYDESIGNUNDOACTION_HXX + +#ifndef DBAUI_GENERALUNDO_HXX +#include "GeneralUndo.hxx" +#endif + +namespace dbaui +{ + // ================================================================================================ + // OQueryDesignUndoAction - Undo-Basisklasse fuer Aktionen im graphischen Abfrageentwurf (ohne Feldliste) + + class OQueryTableView; + class OQueryDesignUndoAction : public OCommentUndoAction + { + protected: + OQueryTableView* m_pOwner; // in diesem Container spielt sich alles ab + + public: + OQueryDesignUndoAction(OQueryTableView* pOwner, USHORT nCommentID) : OCommentUndoAction(nCommentID), m_pOwner(pOwner) { } + }; +} +#endif // DBAUI_QUERYDESIGNUNDOACTION_HXX + diff --git a/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx new file mode 100644 index 000000000000..b0d83447e2e5 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryMoveTabWinUndoAct.cxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * $RCSfile: QueryMoveTabWinUndoAct.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:25:03 $ + * + * 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_OQUERYMOVETABWINUNDOACT_HXX +#include "QueryMoveTabWinUndoAct.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef DBAUI_QUERY_TABLEWINDOW_HXX +#include "QTableWindow.hxx" +#endif +using namespace dbaui; +//------------------------------------------------------------------------------ +void OQueryMoveTabWinUndoAct::TogglePosition() +{ + Point ptFrameScrollPos(m_pOwner->GetHScrollBar()->GetThumbPos(), m_pOwner->GetVScrollBar()->GetThumbPos()); + Point ptNext = m_pTabWin->GetPosPixel() + ptFrameScrollPos; + + m_pTabWin->SetPosPixel(m_ptNextPosition - ptFrameScrollPos); + // sieht so aus, als wenn das ptFrameScrollPos sinnlos ist, da ich es hier abziehe und auf das ptNext aufaddiere, wo + // ich es das naechste Mal ja wieder abziehe ... Aber ptFrameScrollPos kann sich natuerlich beim naechsten Mal schon wieder + // geaendert haben ... + m_pOwner->EnsureVisible(m_pTabWin); + + m_ptNextPosition = ptNext; +} + + diff --git a/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx new file mode 100644 index 000000000000..997692ff2259 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QuerySizeTabWinUndoAct.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * $RCSfile: QuerySizeTabWinUndoAct.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:21:06 $ + * + * 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_QUERYSIZETABWINUNDOACT_HXX +#define DBAUI_QUERYSIZETABWINUNDOACT_HXX + +#ifndef DBAUI_QUERYDESIGNUNDOACTION_HXX +#include "QueryDesignUndoAction.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif + +namespace dbaui +{ + + // ================================================================================================ + // OQuerySizeTabWinUndoAct - Undo-Klasse fuer Groessenveraenderung eines TabWins + class OQueryTableWindow; + class OQuerySizeTabWinUndoAct : public OQueryDesignUndoAction + { + Point m_ptNextPosition; + Size m_szNextSize; + OQueryTableWindow* m_pTabWin; + + protected: + inline void ToggleSizePosition(); + + public: + OQuerySizeTabWinUndoAct(OQueryTableView* pOwner, const Point& ptOriginalPos, const Size& szOriginalSize, OQueryTableWindow* pTabWin); + // Nebenbedingung : es darf nicht gescrollt worden sein, waehrend die neue Groesse/Position ermittelt wurde, das heisst, die Position + // hier sind physische, nicht logische Koordinaten + // (im Gegensatz zur QueryMoveTabWinUndoAct) + + virtual void Undo() { ToggleSizePosition(); } + virtual void Redo() { ToggleSizePosition(); } + }; + + //------------------------------------------------------------------------------ + inline OQuerySizeTabWinUndoAct::OQuerySizeTabWinUndoAct(OQueryTableView* pOwner, const Point& ptOriginalPos, const Size& szOriginalSize, OQueryTableWindow* pTabWin) + :OQueryDesignUndoAction(pOwner, STR_QUERY_UNDO_SIZETABWIN) + ,m_ptNextPosition(ptOriginalPos) + ,m_szNextSize(szOriginalSize) + ,m_pTabWin(pTabWin) + { + } + + //------------------------------------------------------------------------------ + inline void OQuerySizeTabWinUndoAct::ToggleSizePosition() + { + Point ptNext = m_pTabWin->GetPosPixel(); + Size szNext = m_pTabWin->GetSizePixel(); + + m_pOwner->Invalidate(INVALIDATE_NOCHILDREN); + m_pTabWin->SetPosSizePixel(m_ptNextPosition, m_szNextSize); + m_pOwner->Invalidate(INVALIDATE_NOCHILDREN); + + m_ptNextPosition = ptNext; + m_szNextSize = szNext; + } +} + +#endif //DBAUI_QUERYSIZETABWINUNDOACT_HXX + + diff --git a/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx new file mode 100644 index 000000000000..3b21a8d0fba7 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryTabConnUndoAction.cxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * $RCSfile: QueryTabConnUndoAction.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:25:10 $ + * + * 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_QUERYTABCONNUNDOACTION_HXX +#include "QueryTabConnUndoAction.hxx" +#endif +#ifndef DBAUI_QUERYTABLECONNECTION_HXX +#include "QTableConnection.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +using namespace dbaui; + +DBG_NAME(OQueryTabConnUndoAction); +// ------------------------------------------------------------------------------------------------ +OQueryTabConnUndoAction::~OQueryTabConnUndoAction() +{ + DBG_DTOR(OQueryTabConnUndoAction,NULL); + if (m_bOwnerOfConn) + { // ich besitze die Connection -> loeschen + delete m_pConnection->GetData(); + delete m_pConnection; + } +} + +// ------------------------------------------------------------------------------------------------ +OQueryTabConnUndoAction::OQueryTabConnUndoAction(OQueryTableView* pOwner, USHORT nCommentID) + :OQueryDesignUndoAction(pOwner, nCommentID) + ,m_pConnection(NULL) + ,m_bOwnerOfConn(FALSE) +{ + DBG_CTOR(OQueryTabConnUndoAction,NULL); +} + + diff --git a/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx b/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx new file mode 100644 index 000000000000..cb0fddaed553 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryTabWinShowUndoAct.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * $RCSfile: QueryTabWinShowUndoAct.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:25: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_QUERYTABWINSHOWUNDOACT_HXX +#define DBAUI_QUERYTABWINSHOWUNDOACT_HXX + +#ifndef DBAUI_QUERYTABWINUNDOACT_HXX +#include "QueryTabWinUndoAct.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif + +namespace dbaui +{ + // ================================================================================================ + // OQueryTabWinShowUndoAct - Undo-Klasse fuer Anzeigen eines TabWins + + class OQueryTabWinShowUndoAct : public OQueryTabWinUndoAct + { + public: + OQueryTabWinShowUndoAct(OQueryTableView* pOwner) : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINSHOW) { } + + virtual void Undo() { m_pOwner->HideTabWin(m_pTabWin, this); SetOwnership(TRUE); } + virtual void Redo() { m_pOwner->ShowTabWin(m_pTabWin, this); SetOwnership(FALSE); } + }; + + // ================================================================================================ + // OQueryTabWinDelUndoAct - Undo-Klasse fuer Loeschen eines TabWins + + class OQueryTabWinDelUndoAct : public OQueryTabWinUndoAct + { + public: + OQueryTabWinDelUndoAct(OQueryTableView* pOwner) : OQueryTabWinUndoAct(pOwner, STR_QUERY_UNDO_TABWINDELETE) { } + + virtual void Undo() { m_pOwner->ShowTabWin( m_pTabWin, this ); SetOwnership(FALSE); } + virtual void Redo() { m_pOwner->HideTabWin( m_pTabWin, this ); SetOwnership(TRUE); } + }; +} +#endif // DBAUI_QUERYTABWINSHOWUNDOACT_HXX + + + diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx new file mode 100644 index 000000000000..7c45106f48b6 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx @@ -0,0 +1,1222 @@ +/************************************************************************* + * + * $RCSfile: QueryTableView.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:21:16 $ + * + * 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_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef DBAUI_TABLEFIELDINFO_HXX +#include "TableFieldInfo.hxx" +#endif +#ifndef DBAUI_TABLEFIELDDESC_HXX +#include "TableFieldDescription.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#include "dbaccess_helpid.hrc" +#ifndef DBAUI_QUERY_TABLEWINDOW_HXX +#include "QTableWindow.hxx" +#endif +#ifndef DBAUI_QUERYTABLECONNECTION_HXX +#include "QTableConnection.hxx" +#endif +#ifndef DBAUI_QTABLECONNECTIONDATA_HXX +#include "QTableConnectionData.hxx" +#endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#ifndef DBAUI_OQUERYMOVETABWINUNDOACT_HXX +#include "QueryMoveTabWinUndoAct.hxx" +#endif +#ifndef DBAUI_QUERYADDTABCONNUNDOACTION_HXX +#include "QueryAddTabConnUndoAction.hxx" +#endif +#ifndef DBAUI_QUERYTABWINSHOWUNDOACT_HXX +#include "QueryTabWinShowUndoAct.hxx" +#endif +#ifndef DBAUI_QUERYSIZETABWINUNDOACT_HXX +#include "QuerySizeTabWinUndoAct.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_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 DBAUI_QUERYDLG_HXX +#include "querydlg.hxx" +#endif +#ifndef DBAUI_JOINEXCHANGE_HXX +#include "JoinExchange.hxx" +#endif + +using namespace dbaui; +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; + +TYPEINIT1(OQueryTableView, OJoinTableView); + +//------------------------------------------------------------------------------ +::rtl::OUString ConvertAlias(const ::rtl::OUString& _rName) +{ + if (!_rName.getLength()) + return _rName; + + String rName(_rName); + + const sal_Unicode* pStr = rName.GetBuffer(); + sal_Bool bValid(!((*pStr >= 48) && (*pStr <= 57))); // keine Zahl am Anfang + + String aTmp; + if (bValid) + aTmp = rName; + + for (sal_Int32 i=0; i < rName.Len() && *pStr;i++, pStr++ ){ + if ( ((*pStr >= 97) && (*pStr <= 122)) ||((*pStr >= 65) && (*pStr <= 90)) || + ((*pStr >= 48) && (*pStr <= 57)) || *pStr == '_' ) + ; + else + aTmp.SearchAndReplace(*pStr,'_'); + + } + + return aTmp; +} + +//================================================================== +// class OQueryTableView +//================================================================== +DBG_NAME(OQueryTableView); +//------------------------------------------------------------------------ +OQueryTableView::OQueryTableView( Window* pParent,OQueryDesignView* pView) + : OJoinTableView( pParent,pView) +{ + DBG_CTOR(OQueryTableView,NULL); + SetHelpId(HID_CTL_QRYDGNTAB); + EnableDrop(); +} + +//------------------------------------------------------------------------ +OQueryTableView::~OQueryTableView() +{ + DBG_DTOR(OQueryTableView,NULL); + ////////////////////////////////////////////////////////////////////// + // Listen loeschen + OTableWindowMapIterator aIter = GetTabWinMap()->begin(); + for(;aIter != GetTabWinMap()->end();++aIter) + delete aIter->second; + + GetTabWinMap()->clear(); + + ::std::vector<OTableConnection*>::iterator aIter2 = GetTabConnList()->begin(); + for(;aIter2 != GetTabConnList()->end();++aIter2) + delete *aIter2; + + // den Undo-Manager des Dokuments leeren (da die UndoActions sich eventuell TabWins von mir halten, das gibt sonst eine + // Assertion in Window::~Window) + m_pView->getController()->getUndoMgr()->Clear(); +} + +//------------------------------------------------------------------------ +sal_uInt16 OQueryTableView::CountTableAlias(const String& rName, sal_uInt16& rMax) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + sal_uInt16 nRet = 0; + + OTableWindowMapIterator aIter = GetTabWinMap()->find(rName); + while(aIter != GetTabWinMap()->end()) + { + OTableWindow* pWin = aIter->second; + + String aNewName; + aNewName = rName; + aNewName += '_'; + aNewName += String::CreateFromInt32(++nRet); + + aIter = GetTabWinMap()->find(aNewName); + } + + rMax = nRet; + + return nRet; +} + + +//------------------------------------------------------------------------ +void OQueryTableView::TabWinMoved(OTableWindow* pWhich, const Point& ptOldPosition) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OJoinTableView::TabWinMoved(pWhich, ptOldPosition); + + SfxUndoAction* pUndoAction = new OQueryMoveTabWinUndoAct(this, ptOldPosition, static_cast< OQueryTableWindow*>(pWhich)); + m_pView->getController()->getUndoMgr()->AddUndoAction(pUndoAction); +} + +//------------------------------------------------------------------------ +void OQueryTableView::TabWinSized(OTableWindow* pWhich, const Point& ptOldPosition, const Size& szOldSize) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OJoinTableView::TabWinSized(pWhich, ptOldPosition, szOldSize); + + SfxUndoAction* pUndoAction = new OQuerySizeTabWinUndoAct(this, ptOldPosition, szOldSize, static_cast< OQueryTableWindow*>(pWhich)); + m_pView->getController()->getUndoMgr()->AddUndoAction(pUndoAction); +} + +//------------------------------------------------------------------------ +void OQueryTableView::ReSync() +{ + DBG_CHKTHIS(OQueryTableView,NULL); + ::std::vector< OTableWindowData*>* pTabWinDataList = m_pView->getController()->getTableWindowData(); + DBG_ASSERT((GetTabConnList()->size()==0) && (GetTabWinMap()->size()==0), + "vor OQueryTableView::ReSync() bitte ClearAll aufrufen !"); + + // ich brauche eine Sammlung aller Fensternamen, deren Anlegen schief geht, damit ich die entsprechenden Connections + // gar nicht erst anlege + ::std::vector<String> arrInvalidTables; + + ::std::vector< OTableWindowData*>::reverse_iterator aIter = pTabWinDataList->rbegin(); + // Fenster kreieren und einfuegen + + for(;aIter != pTabWinDataList->rend();++aIter) + { + OQueryTableWindowData* pData = static_cast<OQueryTableWindowData*>(*aIter); + OQueryTableWindow* pTabWin = new OQueryTableWindow(this, pData); + + // ich gehe jetzt NICHT ueber ShowTabWin, da dieses die Daten des Fensters in die Liste des Docs einfuegt, was + // schlecht waere, denn genau von dort hole ich sie ja gerade + // also Schritt fuer Schritt + 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->GetAliasName()); + + pTabWinDataList->erase( ::std::find(pTabWinDataList->begin(),pTabWinDataList->end(),*aIter) ); + delete pData; + continue; + } + + (*GetTabWinMap())[pData->GetAliasName()] = 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) + { + OQueryTableConnectionData* pTabConnData = static_cast<OQueryTableConnectionData*>(*aConIter); + + // gibt es die beiden Tabellen zur Connection ? + String 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 OQueryTableConnection(this, pTabConnData)); + } +} + +//------------------------------------------------------------------------ +void OQueryTableView::ClearAll() +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OJoinTableView::ClearAll(); + + SetUpdateMode(sal_True); + m_pView->getController()->setModified(sal_True); +} + +//------------------------------------------------------------------------------ +void OQueryTableView::NotifyTabConnection(const OQueryTableConnection& rNewConn, sal_Bool _bCreateUndoAction) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + // erst mal schauen, ob ich diese Connection schon habe + OQueryTableConnection* pTabConn = NULL; + ::std::vector<OTableConnection*>::iterator aIter = ::std::find(GetTabConnList()->begin(),GetTabConnList()->end(),static_cast<const OTableConnection*>(&rNewConn)); + if(aIter == GetTabConnList()->end()) + { + aIter = GetTabConnList()->begin(); + for(;aIter != GetTabConnList()->end();++aIter) + { + if(*static_cast<OQueryTableConnection*>(*aIter) == rNewConn) + { + pTabConn = static_cast<OQueryTableConnection*>(*aIter); + break; + } + } + } + else + pTabConn = static_cast<OQueryTableConnection*>(*aIter); + // nein -> einfuegen + if (pTabConn == NULL) + { + // die neuen Daten ... + OQueryTableConnectionData* pNewData = static_cast< OQueryTableConnectionData*>(rNewConn.GetData()->NewInstance()); + pNewData->CopyFrom(*rNewConn.GetData()); + // ... an das Dokument anhaengen + m_pView->getController()->getTableConnectionData()->push_back(pNewData); + // ... und an eine neue OQueryTableConnection-Instanz haengen, die ich mir gleich merke + OQueryTableConnection* pNewConn = new OQueryTableConnection(this, pNewData); + GetTabConnList()->push_back(pNewConn); + + // Modified-Flag + m_pView->getController()->setModified(sal_True); + + // eine Undo-Action fuer die Connection + if (_bCreateUndoAction) + { + OQueryTabConnUndoAction* pUndoAction = new OQueryAddTabConnUndoAction(this); + pUndoAction->SetOwnership(sal_False); + pUndoAction->SetConnection(pNewConn); + m_pView->getController()->getUndoMgr()->AddUndoAction(pUndoAction); + } + + // und neu zeichnen + pNewConn->RecalcLines(); + // fuer das unten folgende Invalidate muss ich dieser neuen Connection erst mal die Moeglichkeit geben, + // ihr BoundingRect zu ermitteln + pNewConn->Invalidate(); + } +} + +//------------------------------------------------------------------------------ +void OQueryTableView::AddTabWin(const String& strDatabase, const String& strTableName, sal_Bool bNewTable) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + // das ist die aus der Basisklasse geerbte Methode, die fuehre ich auf die an meinem Parent zurueck, die mir eventuell einen + // Alias dazu bastelt und das an mein anderes AddTabWin weiterreicht + + // leider ist strTableName voll qualifiziert, das OQueryDesignView erwartet aber einen String, der + // nur aus Schema und Tabelle besteht und keinen Katalog enthaelt. + ::rtl::OUString sCatalog, sSchema, sTable; + ::dbtools::qualifiedNameComponents(m_pView->getController()->getConnection()->getMetaData(), + strDatabase, + sCatalog, + sSchema, + sTable); + String sRealName(sSchema); + if (sRealName.Len()) + sRealName+= '.'; + sRealName += sTable.getStr(); + + AddTabWin(strDatabase, sRealName, ConvertAlias(sTable.getStr()), bNewTable); +} +// ----------------------------------------------------------------------------- +// find the table which has a foreign key with this referencedTable name +Reference<XPropertySet> getKeyReferencedTo(const Reference<XKeysSupplier>& _rxKeys,const ::rtl::OUString& _rReferencedTable) +{ + if(!_rxKeys.is()) + return Reference<XPropertySet>(); + + Reference< XIndexAccess> xKeyIndex = _rxKeys->getKeys(); + // search the one and only primary key + for(sal_Int32 i=0;i< xKeyIndex->getCount();++i) + { + Reference<XPropertySet> xKey; + xKeyIndex->getByIndex(i) >>= xKey; + if(xKey.is()) + { + sal_Int32 nKeyType = 0; + xKey->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + if(KeyType::FOREIGN == nKeyType) + { + ::rtl::OUString sReferencedTable; + xKey->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= sReferencedTable; + // TODO check case + if(sReferencedTable == _rReferencedTable) + return xKey; + } + } + } + return Reference<XPropertySet>(); +} +// ----------------------------------------------------------------------------- +sal_Bool isColumnInKeyType(const Reference<XKeysSupplier>& _rxKeys,const ::rtl::OUString& _rColumnName,sal_Int32 _nKeyType) +{ + sal_Bool bReturn = sal_False; + if(_rxKeys.is()) + { + Reference< XIndexAccess> xKeyIndex = _rxKeys->getKeys(); + Reference<XColumnsSupplier> xColumnsSupplier; + // search the one and only primary key + for(sal_Int32 i=0;i< xKeyIndex->getCount();++i) + { + Reference<XPropertySet> xProp; + xKeyIndex->getByIndex(i) >>= xProp; + if(xProp.is()) + { + sal_Int32 nKeyType = 0; + xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + if(_nKeyType == nKeyType) + { + xColumnsSupplier = Reference<XColumnsSupplier>(xProp,UNO_QUERY); + if(xColumnsSupplier.is()) + { + Reference<XNameAccess> xColumns = xColumnsSupplier->getColumns(); + if(xColumns.is() && xColumns->hasByName(_rColumnName)) + { + bReturn = sal_True; + break; + } + } + } + } + } + } + return bReturn; +} +// ----------------------------------------------------------------------------- +void OQueryTableView::addConnections(const OQueryTableWindow* _pSource,const OQueryTableWindow* _pDest,const Reference<XNameAccess>& _rxSourceForeignKeyColumns) +{ + // we found a table in our view where we can insert some connections + // the key columns have a property called RelatedColumn + // OQueryTableConnectionData aufbauen + OQueryTableConnectionData aNewConnData( _pSource->GetTableName(), _pDest->GetTableName(), + _pSource->GetAliasName(), _pDest->GetAliasName()); + + Reference<XKeysSupplier> xReferencedKeys(_pDest->GetTable(),UNO_QUERY); + ::rtl::OUString sRelatedColumn; + + // iterate through all foreignkey columns to create the connections + Sequence< ::rtl::OUString> aElements(_rxSourceForeignKeyColumns->getElementNames()); + const ::rtl::OUString* pBegin = aElements.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aElements.getLength(); + for(sal_Int32 i=0;pBegin != pEnd;++pBegin,++i) + { + Reference<XPropertySet> xColumn; + _rxSourceForeignKeyColumns->getByName(*pBegin) >>= xColumn; + + aNewConnData.SetFieldType(JTCS_FROM,TAB_NORMAL_FIELD); + + xColumn->getPropertyValue(PROPERTY_RELATEDCOLUMN) >>= sRelatedColumn; + aNewConnData.SetFieldType(JTCS_TO,isColumnInKeyType(xReferencedKeys,sRelatedColumn,KeyType::PRIMARY) ? TAB_PRIMARY_FIELD : TAB_NORMAL_FIELD); + + { + Sequence< sal_Int16> aFind(::comphelper::findValue(_pSource->GetOriginalColumns()->getElementNames(),*pBegin,sal_True)); + if(aFind.getLength()) + aNewConnData.SetFieldIndex(JTCS_FROM,aFind[0]+1); + else + OSL_ENSURE(0,"Column not found!"); + } + // get the position inside the tabe + Reference<XNameAccess> xRefColumns = _pDest->GetOriginalColumns(); + if(xRefColumns.is()) + { + Sequence< sal_Int16> aFind(::comphelper::findValue(xRefColumns->getElementNames(),sRelatedColumn,sal_True)); + if(aFind.getLength()) + aNewConnData.SetFieldIndex(JTCS_TO,aFind[0]+1); + else + OSL_ENSURE(0,"Column not found!"); + } + aNewConnData.AppendConnLine(*pBegin,sRelatedColumn); + + // dann die Conn selber dazu + OQueryTableConnection aNewConn(this, &aNewConnData); + // der Verweis auf die lokale Variable ist unkritisch, da NotifyQueryTabConn eine neue Kopie anlegt + // und mir hinzufuegen (wenn nicht schon existent) + NotifyTabConnection(aNewConn, sal_False); + // don't create an Undo-Action for the new connection : the connection is + // covered by the Undo-Action for the tabwin, as the "Undo the insert" will + // automatically remove all connections adjacent to the win. + // (Because of this automatism we would have an ownerhsip ambiguity for + // the connection data if we would insert the conn-Undo-Action) + // FS - 21.10.99 - 69183 + } +} +//------------------------------------------------------------------------------ +void OQueryTableView::AddTabWin(const String& _rComposedName, const String& strTableName, const String& strAlias, sal_Bool bNewTable) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + DBG_ASSERT(strTableName.Len() || strAlias.Len(), "OQueryTableView::AddTabWin : kein Tabellen- und kein Aliasname !"); + // wenn der Tabellenname nicht gesetzt ist, steht das fuer ein Dummy-Fenster, das braucht aber wenigstens einen Alias-Namen + + String strDBName = _rComposedName; + + // neue Datenstruktur erzeugen + OQueryTableWindowData* pNewTabWinData = new OQueryTableWindowData(strDBName, strTableName, strAlias); + // die TabWinData brauche ich nicht in die entsprechende Liste der DocShell eintragen, das macht ShowTabWin + + // neues Fenster erzeugen + OQueryTableWindow* pNewTabWin = new OQueryTableWindow(this, pNewTabWinData); + // das Init kann ich hier weglassen, da das in ShowTabWin passiert + + // Neue UndoAction + OQueryTabWinShowUndoAct* pUndoAction = new OQueryTabWinShowUndoAct(this); + pUndoAction->SetTabWin(pNewTabWin); // Fenster + sal_Bool bSuccess = ShowTabWin(pNewTabWin, pUndoAction); + + // Relationen zwischen den einzelnen Tabellen anzeigen + OTableWindowMap* pTabWins = GetTabWinMap(); + if(bNewTable && pTabWins->size() && strTableName.Len()) + { + Reference<XConnection> xCon = m_pView->getController()->getConnection(); + Reference<XTablesSupplier> xSup(xCon,UNO_QUERY); + Reference<XNameAccess> xTables = xSup->getTables(); + Reference<XPropertySet> xTable; + + if(xTables->hasByName(strTableName) && (xTables->getByName(strTableName) >>= xTable) && xTable.is() ) + { + ////////////////////////////////////////////////////////////////////// + // find relations between the table an the tables already inserted + Reference<XKeysSupplier> xKeys(xTable,UNO_QUERY); + Reference<XNameAccess> xFKeyColumns; + ::rtl::OUString aReferencedTable; + if(xKeys.is()) + { + Reference< XIndexAccess> xKeyIndex = xKeys->getKeys(); + Reference<XColumnsSupplier> xColumnsSupplier; + for(sal_Int32 i=0;i< xKeyIndex->getCount();++i) + { + Reference<XPropertySet> xProp; + xKeyIndex->getByIndex(i) >>= xProp; + sal_Int32 nKeyType = 0; + xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + xColumnsSupplier = Reference<XColumnsSupplier>(xProp,UNO_QUERY); + OSL_ENSURE(xColumnsSupplier.is(),"Key isn't a column supplier"); + xFKeyColumns = xColumnsSupplier->getColumns(); + OSL_ENSURE(xFKeyColumns.is(),"No Key columns available!"); + + if(KeyType::FOREIGN == nKeyType) + { // our new table has a foreign key + // so look if the referenced table is already in our list + xProp->getPropertyValue(PROPERTY_REFERENCEDTABLE) >>= aReferencedTable; + OSL_ENSURE(aReferencedTable.getLength(),"Foreign key without referencedTableName"); + + OTableWindowMap::const_iterator aIter = pTabWins->find(aReferencedTable); + if(aIter == pTabWins->end()) + { + for(aIter = pTabWins->begin();aIter != pTabWins->end();++aIter) + { + OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second); + OSL_ENSURE(pTabWinTmp,"TableWindow is null!"); + if(pTabWinTmp != pNewTabWin && pTabWinTmp->GetComposedName() == aReferencedTable.getStr()) + break; + } + } + if(aIter != pTabWins->end()) + addConnections(pNewTabWin,static_cast<OQueryTableWindow*>(aIter->second),xFKeyColumns); + } + else if(KeyType::PRIMARY == nKeyType) + { + // we have a primary key so look in our list if there exsits a key which this is refered to + OTableWindowMap::const_iterator aIter = pTabWins->begin(); + for(;aIter != pTabWins->end();++aIter) + { + OQueryTableWindow* pTabWinTmp = static_cast<OQueryTableWindow*>(aIter->second); + if(pTabWinTmp != pNewTabWin) + { + OSL_ENSURE(pTabWinTmp,"TableWindow is null!"); + Reference<XPropertySet> xFKKey = getKeyReferencedTo(Reference<XKeysSupplier>(pTabWinTmp->GetTable(),UNO_QUERY),pNewTabWin->GetComposedName()); + if(xFKKey.is()) + { + Reference<XColumnsSupplier> xFKColumnsSupplier = Reference<XColumnsSupplier>(xFKKey,UNO_QUERY); + OSL_ENSURE(xFKColumnsSupplier.is(),"Key isn't a column supplier"); + Reference<XNameAccess> xTColumns = xFKColumnsSupplier->getColumns(); + OSL_ENSURE(xTColumns.is(),"No Key columns available!"); + addConnections(pTabWinTmp,pNewTabWin,xTColumns); + } + } + } + } + } + + } + } + } + + // mein Parent brauche ich, da es vom Loeschen erfahren soll + m_pView->getController()->setModified(sal_True); + + m_pView->getController()->getUndoMgr()->AddUndoAction( pUndoAction ); + + if (bSuccess && m_lnkTabWinsChangeHandler.IsSet()) + { + TabWinsChangeNotification aHint(TabWinsChangeNotification::AT_ADDED_WIN, pNewTabWin->GetAliasName()); + m_lnkTabWinsChangeHandler.Call(&aHint); + } + + m_pView->getController()->InvalidateFeature(ID_BROWSER_UNDORECORD); + m_pView->getController()->InvalidateFeature(ID_BROWSER_REDO); + // GetViewShell()->GetViewShell()->UIFeatureChanged(); +} +//------------------------------------------------------------------------ +void OQueryTableView::AddConnection(const OJoinExchangeData& jxdSource, const OJoinExchangeData& jxdDest) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OQueryTableWindow* pSourceWin = static_cast< OQueryTableWindow*>(jxdSource.pListBox->GetTabWin()); + OQueryTableWindow* pDestWin = static_cast< OQueryTableWindow*>(jxdDest.pListBox->GetTabWin()); + + String aSourceFieldName, aDestFieldName; + aSourceFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry); + aDestFieldName = jxdDest.pListBox->GetEntryText(jxdDest.pEntry); + + OTableConnection* pConn = GetTabConn(pSourceWin,pDestWin); + if(!pConn) + { + // neues Daten-Objekt + OQueryTableConnectionData aNewConnectionData(pSourceWin->GetTableName(), pDestWin->GetTableName(), pSourceWin->GetAliasName(), pDestWin->GetAliasName()); + + sal_uInt32 nSourceFieldIndex, nDestFieldIndex; + ETableFieldType eSourceFieldType, eDestFieldType; + + // Namen/Position/Typ der beiden betroffenen Felder besorgen ... + // Source + + nSourceFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry); + eSourceFieldType = static_cast< OTableFieldInfo*>(jxdSource.pEntry->GetUserData())->GetKeyType(); + + // Dest + + nDestFieldIndex = jxdDest.pListBox->GetModel()->GetAbsPos(jxdDest.pEntry); + eDestFieldType = static_cast< OTableFieldInfo*>(jxdDest.pEntry->GetUserData())->GetKeyType(); + + // ... und setzen + + aNewConnectionData.SetFieldIndex(JTCS_FROM, nSourceFieldIndex); + aNewConnectionData.SetFieldIndex(JTCS_TO, nDestFieldIndex); + + aNewConnectionData.SetFieldType(JTCS_FROM, eSourceFieldType); + aNewConnectionData.SetFieldType(JTCS_TO, eDestFieldType); + + aNewConnectionData.AppendConnLine( aSourceFieldName,aDestFieldName ); + + OQueryTableConnection aNewConnection(this, &aNewConnectionData); + NotifyTabConnection(aNewConnection); + // wie immer bei NotifyTabConnection ist das Verwenden lokaler Variablen unkritisch, da sowieso eine Kopie erzeugt wird + } + else + { + // the connection could point on the other side + if(pConn->GetSourceWin() == pDestWin) + { + String aTmp(aSourceFieldName); + aSourceFieldName = aDestFieldName; + aDestFieldName = aTmp; + } + + pConn->GetData()->AppendConnLine( aSourceFieldName,aDestFieldName ); + pConn->UpdateLineList(); + // Modified-Flag + m_pView->getController()->setModified(sal_True); + + // eine Undo-Action fuer die Connection + OQueryTabConnUndoAction* pUndoAction = new OQueryAddTabConnUndoAction(this); + pUndoAction->SetOwnership(sal_False); + pUndoAction->SetConnection(static_cast< OQueryTableConnection*>(pConn)); + m_pView->getController()->getUndoMgr()->AddUndoAction(pUndoAction); + + // und neu zeichnen + pConn->RecalcLines(); + // fuer das unten folgende Invalidate muss ich dieser neuen Connection erst mal die Moeglichkeit geben, + // ihr BoundingRect zu ermitteln + pConn->Invalidate(); + } +} + + +//------------------------------------------------------------------------ +void OQueryTableView::ConnDoubleClicked(OTableConnection* pConnection) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + DBG_ASSERT(pConnection->ISA(OQueryTableConnection), "OQueryTableView::ConnDoubleClicked : pConnection hat falschen Typ"); + // da ich nur solche selber verwende, duerfen auch nur solche hier ankommen + + DlgQryJoin aDlg(this,static_cast< OQueryTableConnectionData*>(pConnection->GetData()),m_pView->getController()->getConnection()->getMetaData()); + aDlg.Execute(); + if(static_cast< OQueryTableConnectionData*>(pConnection->GetData())->GetJoinType() != aDlg.GetJoinType()) + { + static_cast< OQueryTableConnectionData*>(pConnection->GetData())->SetJoinType(aDlg.GetJoinType()); + m_pView->getController()->setModified(sal_True); + } +/* + String strMessage(ModuleRes(RID_STR_CONNECTION_DATA)); + strMessage.SearchAndReplace("$alias1$", static_cast< OQueryTableConnection*>(pConnection)->GetAliasName(JTCS_FROM)); + strMessage.SearchAndReplace("$alias2$", static_cast< OQueryTableConnection*>(pConnection)->GetAliasName(JTCS_TO)); + strMessage.SearchAndReplace("$field1$", static_cast< OQueryTableConnection*>(pConnection)->GetFieldName(JTCS_FROM)); + strMessage.SearchAndReplace("$field2$", static_cast< OQueryTableConnection*>(pConnection)->GetFieldName(JTCS_TO)); + + InfoBox(this, strMessage).Execute(); +*/ +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableView::RemoveConnection( OTableConnection* pConn ) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + DBG_ASSERT(pConn->ISA(OQueryTableConnection), "OQueryTableView::RemoveConnection : Connection ist vom falschen Typ !"); + // NICHT die Basisklasse erledigen lassen (die loescht die Connection hart, ich will sie aber ans Undo uebergeben) + DropConnection(static_cast< OQueryTableConnection*>(pConn)); + + // eine Undo-Action + OQueryTabConnUndoAction* pUndoAction = new OQueryDelTabConnUndoAction(this); + pUndoAction->SetOwnership(sal_True); + pUndoAction->SetConnection(static_cast< OQueryTableConnection*>(pConn)); + m_pView->getController()->getUndoMgr()->AddUndoAction(pUndoAction); + + // modified-Flag + m_pView->getController()->setModified(sal_True); + return sal_True; +} + +//------------------------------------------------------------------------------ +void OQueryTableView::KeyInput( const KeyEvent& rEvt ) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OJoinTableView::KeyInput( rEvt ); +} + +//------------------------------------------------------------------------------ +OQueryTableWindow* OQueryTableView::FindTable(const String& rAliasName) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + DBG_ASSERT(rAliasName.Len(), "OQueryTableView::FindTable : der AliasName sollte nicht leer sein !"); + // (nicht dass es schadet, aber es ist sinnlos und weist vielleicht auf Fehler beim Aufrufer hin) + OTableWindowMap::const_iterator aIter = GetTabWinMap()->find(rAliasName); + if(aIter != GetTabWinMap()->end()) + return static_cast<OQueryTableWindow*>(aIter->second); + return NULL; +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableView::FindTableFromField(const String& rFieldName, OTableFieldDesc& rInfo, sal_uInt16& rCnt) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + sal_Bool bRet = sal_False; + rCnt = 0; + OTableWindowMap::const_iterator aIter = GetTabWinMap()->begin(); + for(;aIter != GetTabWinMap()->end();++aIter) + { + if(static_cast<OQueryTableWindow*>(aIter->second)->ExistsField(rFieldName, rInfo)) + rCnt++; + } + + return rCnt == 1; +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableView::RemoveTabWin(const String& strAliasName) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OQueryTableWindow* pTabWin = FindTable(strAliasName); + if (!pTabWin) + return sal_False; + + RemoveTabWin(pTabWin); + return sal_True; +} + +//------------------------------------------------------------------------------ +void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + DBG_ASSERT(pTabWin != NULL, "OQueryTableView::RemoveTabWin : Fenster sollte ungleich NULL sein !"); + DBG_ASSERT(pTabWin->ISA(OQueryTableWindow), "OQueryTableView::RemoveTabWin : Fenster sollte ein OQueryTableWindow sein !"); + + // mein Parent brauche ich, da es vom Loeschen erfahren soll + OQueryDesignView* pParent = getDesignView(); + + SfxUndoManager* pUndoMgr = m_pView->getController()->getUndoMgr(); + pUndoMgr->EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() ); + + // Undo Actions und Loeschen der Felder in SelectionBrowseBox + pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData())->GetAliasName() ); + m_pView->getController()->setModified(sal_True); + + // Undo-Action anlegen + OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this); + pUndoAction->SetTabWin(static_cast< OQueryTableWindow*>(pTabWin)); + + // und Fenster verstecken + HideTabWin(static_cast< OQueryTableWindow*>(pTabWin), pUndoAction); + + pUndoMgr->AddUndoAction( pUndoAction ); + pUndoMgr->LeaveListAction(); + + m_pView->getController()->InvalidateFeature(ID_BROWSER_UNDORECORD); + m_pView->getController()->InvalidateFeature(ID_BROWSER_REDO); + // GetViewShell()->GetViewShell()->UIFeatureChanged(); + + if (m_lnkTabWinsChangeHandler.IsSet()) + { + TabWinsChangeNotification aHint(TabWinsChangeNotification::AT_REMOVED_WIN, static_cast< OQueryTableWindow*>(pTabWin)->GetAliasName()); + m_lnkTabWinsChangeHandler.Call(&aHint); + } +} + +//------------------------------------------------------------------------------ +void OQueryTableView::HideTabWins() +{ + DBG_CHKTHIS(OQueryTableView,NULL); + SetUpdateMode(sal_False); + + OTableWindowMap* pTabWins = GetTabWinMap(); + if (pTabWins) + { + OTableWindowMap::const_iterator aIter = GetTabWinMap()->begin(); + for(;aIter != GetTabWinMap()->end();++aIter) + RemoveTabWin(aIter->second); + } + + m_pView->getController()->setModified(sal_True); + + SetUpdateMode(sal_True); + +} + +//------------------------------------------------------------------------ +void OQueryTableView::EnsureVisible(const OTableWindow* pWin) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OJoinTableView::EnsureVisible(pWin); + Invalidate(INVALIDATE_NOCHILDREN); + return; +} + +//------------------------------------------------------------------------ +void OQueryTableView::GetConnection(OQueryTableConnection* pConn) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + // bei mir und dem Dokument einfuegen + GetTabConnList()->push_back(pConn); + m_pView->getController()->getTableConnectionData()->push_back(pConn->GetData()); + + // invalidieren (damit es neu gezeichnet wird) + pConn->Invalidate(); + + // modified-Flag + m_pView->getController()->setModified(sal_True); +} + +//------------------------------------------------------------------------ +void OQueryTableView::DropConnection(OQueryTableConnection* pConn) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + // Selektion beachten + DeselectConn(GetSelectedConn()); + + // bei mir und dem Dokument rausnehmen + GetTabConnList()->erase( ::std::find(GetTabConnList()->begin(),GetTabConnList()->end(),static_cast<OTableConnection*>(pConn))); + m_pView->getController()->getTableConnectionData()->erase( ::std::find(m_pView->getController()->getTableConnectionData()->begin(),m_pView->getController()->getTableConnectionData()->end(),pConn->GetData())); + + // invalidieren (damit es neu gezeichnet wird) + pConn->Invalidate(); + + // modified-Flag + m_pView->getController()->setModified(sal_True); +} + +//------------------------------------------------------------------------ +void OQueryTableView::HideTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction ) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + OTableWindowMap* pTabWins = GetTabWinMap(); + DBG_ASSERT(pTabWins != NULL, "OQueryTableView::HideTabWin : habe keine TabWins !"); + + if (pTabWin) + { + // Fenster + // die Position in seinen Daten speichern + getDesignView()->SaveTabWinUIConfig(pTabWin); + // (ich muss ueber das Parent gehen, da nur das die Position der Scrollbars kennt) + // dann aus der Liste der TabWins raus und verstecken + OTableWindowMap::iterator aIter = pTabWins->begin(); + for(;aIter != GetTabWinMap()->end();++aIter) + if(aIter->second == pTabWin) + pTabWins->erase(aIter); + + pTabWin->Hide(); // nicht zerstoeren, steht im Undo!! + + // die Daten zum TabWin muessen auch aus meiner Verantwortung entlassen werden + ::std::vector< OTableWindowData*>* pTabWinDataList = m_pView->getController()->getTableWindowData(); + pTabWinDataList->erase( ::std::find(pTabWinDataList->begin(),pTabWinDataList->end(),pTabWin->GetData())); + // NICHT loeschen, da ja das TabWin selber - das noch lebt - sie auch noch braucht + // Entweder geht es irgendwann wieder in meine Verantwortung ueber, (ueber ShowTabWin), dann fuege ich + // auch die Daten wieder ein, oder die Undo-Action, die im Augenblick die alleinige Verantwortung fuer das Fenster + // und dessen Daten hat, wird zestoert, dann loescht es beides + + if (m_pLastFocusTabWin == pTabWin) + m_pLastFocusTabWin = NULL; + + // Verbindungen, die zum Fenster gehoeren, einsammeln und der UndoAction uebergeben + ::std::vector< OTableConnectionData*>* pTabConnDataList = m_pView->getController()->getTableConnectionData(); + + sal_Int16 nCnt = 0; + ::std::vector<OTableConnection*>* pTabConList = GetTabConnList(); + ::std::vector<OTableConnection*>::iterator aIter2 = pTabConList->begin(); + for(;aIter2 != pTabConList->end();) + { + OQueryTableConnection* pTmpEntry = static_cast<OQueryTableConnection*>(*aIter2); + OSL_ENSURE(pTmpEntry,"OQueryTableConnection is null!"); + if( pTmpEntry->GetAliasName(JTCS_FROM) == pTabWin->GetAliasName() || + pTmpEntry->GetAliasName(JTCS_TO) == pTabWin->GetAliasName() ) + { + pUndoAction->InsertConnection(pTmpEntry); + // die Connection invalidieren (ich kann nicht unten einfach ein InvalidateConnections machen, da ja dann die Connection + // in meiner Liste nicht mehr existiert !) + pTmpEntry->Invalidate(); + + // die Daten aus dem Doc entfernen (Kommentar wie oben bei den Tabellendaten) + pTabConnDataList->erase( ::std::find(pTabConnDataList->begin(),pTabConnDataList->end(),pTmpEntry->GetData()) ); + // die Connection selber weg und weiter + aIter2 = pTabConList->erase(aIter2); // TODO check if this is ok + nCnt++; + } + else + ++aIter2; + } + + if (nCnt) + InvalidateConnections(); + + m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); + + // der UndoAction sagen, dass das Fenster (inklusive der Connections) jetzt in seinem Besitzt ist + pUndoAction->SetOwnership(sal_True); + + // damit habe ich das Doc natuerlich modifiziert + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature( ID_BROWSER_SAVEDOC ); + m_pView->getController()->InvalidateFeature(ID_BROWSER_CLEAR_QUERY); + } +} + +//------------------------------------------------------------------------ +sal_Bool OQueryTableView::ShowTabWin( OQueryTableWindow* pTabWin, OQueryTabWinUndoAct* pUndoAction ) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + + sal_Bool bSuccess = sal_False; + + if (pTabWin) + { + if (pTabWin->Init()) + { + OTableWindowData* pData = pTabWin->GetData(); + DBG_ASSERT(pData != NULL, "OQueryTableView::ShowTabWin : TabWin hat keine Daten !"); + // Wenn die Daten schon PosSize haben, diese benutzen + if (pData->HasPosition() && pData->HasSize()) + { + Size aSize(CalcZoom(pData->GetSize().Width()),CalcZoom(pData->GetSize().Height())); + pTabWin->SetPosSizePixel(pData->GetPosition(), aSize); + } + else + // ansonsten selber eine Default-Position ermitteln + SetDefaultTabWinPosSize(pTabWin); + + // Fenster zeigen und in Liste eintragen + (*GetTabWinMap())[static_cast< OQueryTableWindowData*>(pData)->GetAliasName()] = pTabWin; + pTabWin->Show(); + + pTabWin->Update(); + // Das Update ist notwendig, damit die Connections an dem Fenster richtig gezeichnet werden. Klingt absurd, + // ich weiss. Aber die Listbox haelt sich intern ein Member, was bei ersten Zeichnen (nachdem die Listbox im Init + // gerade neu gefuellt wurde) initialisiert wird, und genau dieses Member wird irgendwann benoetigt fuer + // GetEntryPos, und dieses wiederum von der Connection, wenn sie ihren Ansatzpunkt am Fenster feststellen will. + + // die Connections + sal_Int16 nCount(0); + ::std::vector<OTableConnection*>* pTableCon = pUndoAction->GetTabConnList(); + ::std::vector<OTableConnection*>::iterator aIter = pTableCon->begin(); + + for(;aIter != pTableCon->end();++aIter,++nCount) + { + // und in meine Liste rein + GetTabConnList()->push_back(*aIter); + // die Daten wieder in das Doc einfuegen + m_pView->getController()->getTableConnectionData()->push_back((*aIter)->GetData()); + } + pTableCon->clear(); + + if (nCount) + InvalidateConnections(); + + // und die Daten des Fensters ebenfalls in Liste (des Docs) + m_pView->getController()->getTableWindowData()->push_back(pTabWin->GetData()); + + m_pView->getController()->InvalidateFeature(ID_BROWSER_ADDTABLE); + + // und der UndoAction sagen, dass das Fenster jetzt meine ist ... + pUndoAction->SetOwnership(sal_False); + + bSuccess = sal_True; + } + else + ////////////////////////////////////////////////////////////////// + // Initialisierung fehlgeschlagen + // (z.B. wenn Verbindung zur Datenbank in diesem Augenblick unterbrochen worden ist) + delete pTabWin; + } + + // damit habe ich das Doc natuerlich modifiziert + if(!m_pView->getController()->isReadOnly()) + m_pView->getController()->setModified( sal_True ); + m_pView->getController()->InvalidateFeature( ID_BROWSER_SAVEDOC ); + m_pView->getController()->InvalidateFeature(ID_BROWSER_CLEAR_QUERY); + + return bSuccess; +} + + +//------------------------------------------------------------------------ +void OQueryTableView::InsertField(const OTableFieldDesc& rInfo) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + DBG_ASSERT(getDesignView() != NULL, "OQueryTableView::InsertField : habe kein Parent !"); + getDesignView()->InsertField(rInfo); +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableView::Drop(const DropEvent& rEvt) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + sal_Bool bDrop = sal_False; +/* + SbaDatabaseRef xDatabase(GetDatabase()); + ::com::sun::star::uno::Reference< ::com::sun::star::data::XDatabaseDescriptor > rMetaData = xDatabase->GetMetaData(); + ::com::sun::star::uno::Any aJoin = rMetaData->getInfo(::com::sun::star::data::DatabaseInfo::OUTER_JOIN_SUPPORT); + + if (!xDatabase.Is() || !((::utl::getINT16(aJoin) & ::com::sun::star::data::DatabaseOuterJoinSupport::PARTIAL) || (::utl::getINT16(aJoin) & ::com::sun::star::data::DatabaseOuterJoinSupport::YES)) && GetTabWinMap()->size()) + { + Sound::Beep(); + return sal_False; + } + + sal_Bool bDrop = sal_False; + + for (sal_uInt16 i = 0; i < DragServer::GetItemCount(); ++i) + { + if (INetBookmark::DragServerHasFormat(i) ) + { + INetBookmark aBmk; + if (aBmk.PasteDragServer(i)) + { + INetURLObject aObj(aBmk.GetURL()); + aObj.SetSmartProtocol(INET_PROT_FILE); + String aMark(aObj.GetMark()); + + if (aMark.GetTokenCount(';') > 1) + { + String sType = aMark.GetToken(0, ';'); + sType += ';'; + if (sType == String::CreateFromAscii(SDB_TABLEMARK_HEADER)) + { + aMark.Erase(0, strlen(SDB_TABLEMARK_HEADER)); + + String aDatabaseName = aObj.PathToFileName(); + DirEntry aDBEntry(aDatabaseName); + + if (aDBEntry == DirEntry(xDatabase->Name())) + { + SbaDBDefRef aDef = xDatabase->OpenDBDef(dbTable, aMark); + if (aDef.Is()) + { + if (aDef->Status().IsError()) + SBA_MOD()->ShowDbStatus(aDef->Status(), dbReadError,NULL); + + SdbTable* pTable = (static_cast< SbaTableDef*>(&aDef)->GetTable(); + if (pTable && pTable->IsOpen()) + { + AddTabWin(pTable->QualifierName(),pTable->GetFullName()); + bDrop = sal_True; + } + } + } + } + } + + if (!bDrop) + Sound::Beep(); + break; + } + } + } +*/ + return bDrop; +} + +//------------------------------------------------------------------------------ +sal_Bool OQueryTableView::QueryDrop(DropEvent& rEvt) +{ + DBG_CHKTHIS(OQueryTableView,NULL); + sal_Bool bDrop = sal_False; +/* + SbaDatabaseRef xDatabase(GetDatabase()); + + ::com::sun::star::uno::Reference< ::com::sun::star::data::XDatabaseDescriptor > rMetaData = xDatabase->GetMetaData(); + ::com::sun::star::uno::Any aJoin = rMetaData->getInfo(::com::sun::star::data::DatabaseInfo::OUTER_JOIN_SUPPORT); + if (!xDatabase.Is() || !((::utl::getINT16(aJoin) & ::com::sun::star::data::DatabaseOuterJoinSupport::PARTIAL) || (::utl::getINT16(aJoin) & ::com::sun::star::data::DatabaseOuterJoinSupport::YES)) && GetTabWinMap()->size()) + return sal_False; + + sal_Bool bDrop = sal_False; + DropAction eAction = rEvt.GetAction(); + + for (sal_uInt16 i = 0; i < DragServer::GetItemCount(); ++i) + { + if (INetBookmark::DragServerHasFormat(i)) + { + INetBookmark aBmk; + if (aBmk.PasteDragServer(i)) + { // it's a INetBookmark + INetURLObject aObj(aBmk.GetURL()); + aObj.SetSmartProtocol(INET_PROT_FILE); + String aMark(aObj.GetMark()); + + // maybe it's a reference to a db object + if (aMark.GetTokenCount(';') > 1) + { + String sType = aMark.GetToken(0, ';'); + sType += ';'; + if (sType == String::CreateFromAscii(SDB_TABLEMARK_HEADER)) + { // it's a reference to a table + aMark.Erase(0, strlen(SDB_TABLEMARK_HEADER)); + + String aDatabaseName = aObj.PathToFileName(); + DirEntry aDBEntry(aDatabaseName); + + if (aDBEntry == DirEntry(xDatabase->Name())) + { // it's a reference to a table of our own database + if (xDatabase->HasObjectByURL(aObj.GetMainURL())) + { + rEvt.SetAction(DROP_COPY); + bDrop = sal_True; + break; + } + } + } + } + } + } + } +*/ + return bDrop; +} +//------------------------------------------------------------------------------ +sal_Bool OQueryTableView::ExistsAVisitedConn(const OQueryTableWindow* pFrom) const +{ + DBG_CHKTHIS(OQueryTableView,NULL); + ::std::vector<OTableConnection*>* pList = const_cast< OQueryTableView*>(this)->GetTabConnList(); + if (pList) + { + ::std::vector<OTableConnection*>::iterator aIter = pList->begin(); + for(;aIter != pList->end();++aIter) + { + OQueryTableConnection* pTemp = static_cast<OQueryTableConnection*>(*aIter); + if (pTemp->IsVisited() && + (pFrom == static_cast< OQueryTableWindow*>(pTemp->GetSourceWin()) || pFrom == static_cast< OQueryTableWindow*>(pTemp->GetDestWin()))) + return pTemp != NULL; + } + } + + return sal_False; +} +// ----------------------------------------------------------------------------- + + + + diff --git a/dbaccess/source/ui/querydesign/QueryTextView.cxx b/dbaccess/source/ui/querydesign/QueryTextView.cxx new file mode 100644 index 000000000000..67cb057bb42d --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryTextView.cxx @@ -0,0 +1,329 @@ +/************************************************************************* + * + * $RCSfile: QueryTextView.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:25:27 $ + * + * 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): _______________________________________ + * + * + ************************************************************************/ +#include "QueryViewSwitch.hxx" +#ifndef DBAUI_QUERYVIEW_TEXT_HXX +#include "QueryTextView.hxx" +#endif +#ifndef _SV_TOOLBOX_HXX +#include <vcl/toolbox.hxx> +#endif +#ifndef DBAUI_SQLEDIT_HXX +#include "sqledit.hxx" +#endif +#ifndef DBAUI_UNDOSQLEDIT_HXX +#include "undosqledit.hxx" +#endif +#ifndef DBACCESS_UI_BROWSER_ID_HXX +#include "browserids.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/unohlp.hxx> +#endif +#ifndef _SV_SPLIT_HXX +#include <vcl/split.hxx> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _COMPHELPER_TYPES_HXX_ +#include <comphelper/types.hxx> +#endif + +using namespace dbaui; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::frame; +// temporary class +OQueryContainerWindow::OQueryContainerWindow(Window* pParent, OQueryController* _pController,const Reference< XMultiServiceFactory >& _rFactory) + : Window(pParent) + ,m_pBeamer(NULL) +{ + m_pView = new OQueryViewSwitch(this,_pController,_rFactory); + m_pView->Show(); + + m_pSplitter = new Splitter(this,WB_VSCROLL); + m_pSplitter->Hide(); + m_pSplitter->SetSplitHdl( LINK( this, OQueryContainerWindow, SplitHdl ) ); + m_pSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) ); + + // our UNO representation + m_xMe = VCLUnoHelper::CreateControlContainer(this); +} +// ----------------------------------------------------------------------------- +OQueryContainerWindow::~OQueryContainerWindow() +{ + if(m_xBeamer.is()) + m_xBeamer->setComponent(NULL,NULL); + m_xBeamer = NULL; + m_xMe = NULL; + delete m_pBeamer; + delete m_pSplitter; +} +// ----------------------------------------------------------------------------- +void OQueryContainerWindow::switchView() +{ + m_pView->switchView(); +} +// ----------------------------------------------------------------------------- +IMPL_LINK( OQueryContainerWindow, SplitHdl, void*, p ) +{ + long nTest = m_pSplitter->GetPosPixel().Y(); + m_pSplitter->SetPosPixel( Point( m_pSplitter->GetPosPixel().X(),m_pSplitter->GetSplitPosPixel() ) ); + Resize(); + + return 0L; +} +// ----------------------------------------------------------------------------- +void OQueryContainerWindow::Resize() +{ + Window::Resize(); + Size aSize = GetOutputSizePixel(); + if(!m_pBeamer || !m_pBeamer->IsVisible()) + m_pView->SetPosSizePixel(Point(0,0),aSize); + else + { + Point aSplitPos(0,0); + Size aSplitSize(0,0); + + aSplitPos = m_pSplitter->GetPosPixel(); + aSplitSize = m_pSplitter->GetOutputSizePixel(); + aSplitSize.Width() = aSize.Width(); + + if( ( aSplitPos.Y() + aSplitSize.Height() ) > ( aSize.Height() )) + aSplitPos.Y() = aSize.Height() - aSplitSize.Height(); + + if( aSplitPos.Y() <= 0) + aSplitPos.Y() = LogicToPixel( Size(0,sal_Int32(aSize.Height() * 0.2) ), MAP_APPFONT ).Height(); + + Size aBeamer(aSize.Width(),aSplitPos.Y()); + m_pBeamer->SetPosSizePixel(Point(0,0),aBeamer); + //set the size of the splitter + m_pSplitter->SetPosSizePixel( aSplitPos, Size( aSize.Width(), aSplitSize.Height()) ); + m_pSplitter->SetDragRectPixel( Rectangle( Point( 0, 0 ), aSize) ); + + Point aPos(0,aSplitPos.Y()+aSplitSize.Height()); + m_pView->SetPosSizePixel(aPos,Size( aSize.Width(), aSize.Height() - aSplitSize.Height() - aSplitPos.Y() )); + + } +} +// ----------------------------------------------------------------------------- +void OQueryContainerWindow::initialize(const Reference<XFrame>& _xFrame) +{ + // append our frame + Reference < XFramesSupplier > xSup(_xFrame,UNO_QUERY); + Reference < XFrames > xFrames = xSup->getFrames(); + xFrames->append( m_xBeamer ); +} +// ----------------------------------------------------------------------------- +void OQueryContainerWindow::hideBeamer() +{ + // here I know that we will be destroyed from the frame + m_pBeamer = NULL; + m_xBeamer = NULL; + m_pSplitter->Hide(); + Resize(); +} +// ----------------------------------------------------------------------------- +void OQueryContainerWindow::showBeamer(const Reference<XFrame>& _xFrame) +{ + if(!m_pBeamer) + { + m_pBeamer = new OBeamer(this); + m_xBeamer = Reference<XFrame>(m_pView->getORB()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.Frame")),UNO_QUERY); + OSL_ENSURE(m_xBeamer.is(),"No frame created!"); + m_xBeamer->initialize( VCLUnoHelper::GetInterface ( m_pBeamer ) ); + m_xBeamer->setName(::rtl::OUString::createFromAscii("_beamer")); + + // append our frame + Reference < XFramesSupplier > xSup(_xFrame,UNO_QUERY); + Reference < XFrames > xFrames = xSup->getFrames(); + xFrames->append( m_xBeamer ); + } + + + Size aSize = GetOutputSizePixel(); + Size aBeamer(aSize.Width(),aSize.Height()*0.33); + + const long nFrameHeight = LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height(); + Point aPos(0,aBeamer.Height()+nFrameHeight); + + m_pBeamer->SetPosSizePixel(Point(0,0),aBeamer); + m_pBeamer->Show(); + + m_pSplitter->SetPosSizePixel( Point(0,aBeamer.Height()), Size(aSize.Width(),nFrameHeight) ); + // a default pos for the splitter, so that the listbox is about 80 (logical) pixels wide + m_pSplitter->SetSplitPosPixel( aBeamer.Height() ); + m_pView->SetPosSizePixel(aPos,Size(aBeamer.Width(),aSize.Height() - aBeamer.Height()-nFrameHeight)); + + m_pSplitter->Show(); + Resize(); +} +// ----------------------------------------------------------------------------- + +// end of temp classes +// ------------------------------------------------------------------------- +OQueryTextView::OQueryTextView(Window* _pParent, OQueryController* _pController,const Reference< XMultiServiceFactory >& _rFactory) + :OQueryView(_pParent,_pController,_rFactory) +{ + m_pEdit = new OSqlEdit(this); + m_pEdit->ClearModifyFlag(); + m_pEdit->SaveValue(); + m_pEdit->Show(); + m_pEdit->GrabFocus(); + + ToolBox* pToolBox = getToolBox(); + if(pToolBox) + { + pToolBox->HideItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_ADDTABLE)-1)); // hide the separator + pToolBox->HideItem(ID_BROWSER_ADDTABLE); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_TABLES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_ALIASES); + pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); + } +} +// ----------------------------------------------------------------------------- +OQueryTextView::~OQueryTextView() +{ + delete m_pEdit; +} +// ------------------------------------------------------------------------- +void OQueryTextView::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel) +{ + OQueryView::Construct(xModel); // initialize m_xMe + +} +// ------------------------------------------------------------------------- +void OQueryTextView::resizeControl(Rectangle& _rRect) +{ + Size aToolBoxSize; + ToolBox* pToolBox = getToolBox(); + if(pToolBox) + aToolBoxSize = pToolBox->GetOutputSizePixel(); + Point aTopLeft(_rRect.TopLeft()); + aTopLeft.Y() += aToolBoxSize.Height(); + m_pEdit->SetPosSizePixel(aTopLeft,Size(_rRect.getWidth(),_rRect.GetHeight()-aTopLeft.Y())); + aToolBoxSize.Width() += _rRect.getWidth(); + _rRect.SetSize(aToolBoxSize); +} +// ----------------------------------------------------------------------------- +::rtl::OUString OQueryTextView::getStatement() +{ + return m_pEdit->GetText(); +} +// ----------------------------------------------------------------------------- +void OQueryTextView::setReadOnly(sal_Bool _bReadOnly) +{ + m_pEdit->SetReadOnly(_bReadOnly); +} +// ----------------------------------------------------------------------------- +void OQueryTextView::clear() +{ + + SfxUndoManager* pUndoMgr = getController()->getUndoMgr(); + OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( m_pEdit ); + + pUndoAct->SetOriginalText( m_pEdit->GetText() ); + pUndoMgr->AddUndoAction( pUndoAct ); + + m_pEdit->SetText(String()); +} +// ----------------------------------------------------------------------------- +void OQueryTextView::setStatement(const ::rtl::OUString& _rsStatement) +{ + m_pEdit->SetText(_rsStatement); + m_pEdit->Modify(); +} +// ----------------------------------------------------------------------------- +void OQueryTextView::copy() +{ + if(!m_pEdit->IsInAccelAct() ) + m_pEdit->Copy(); +} +// ----------------------------------------------------------------------------- +sal_Bool OQueryTextView::isCutAllowed() +{ + return m_pEdit->GetSelected().Len() != 0; +} +// ----------------------------------------------------------------------------- +void OQueryTextView::cut() +{ + if(!m_pEdit->IsInAccelAct() ) + m_pEdit->Cut(); + getController()->setModified(sal_True); +} +// ----------------------------------------------------------------------------- +void OQueryTextView::paste() +{ + if(!m_pEdit->IsInAccelAct() ) + m_pEdit->Paste(); + getController()->setModified(sal_True); +} +// -----------------------------------------------------------------------------
\ No newline at end of file diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx new file mode 100644 index 000000000000..a27163bcfc86 --- /dev/null +++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx @@ -0,0 +1,285 @@ +/************************************************************************* + * + * $RCSfile: QueryViewSwitch.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:21:23 $ + * + * 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_QUERYVIEWSWITCH_HXX +#include "QueryViewSwitch.hxx" +#endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif +#ifndef DBAUI_QUERYVIEW_TEXT_HXX +#include "QueryTextView.hxx" +#endif +#ifndef _SV_TOOLBOX_HXX +#include <vcl/toolbox.hxx> +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_Resource.hrc" +#endif +#ifndef DBACCESS_UI_BROWSER_ID_HXX +#include "browserids.hxx" +#endif +#ifndef DBAUI_QYDLGTAB_HXX +#include "adtabdlg.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif + + +using namespace dbaui; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; + + +OQueryViewSwitch::OQueryViewSwitch(Window* _pParent, OQueryController* _pController,const Reference< XMultiServiceFactory >& _rFactory) + :OQueryView(_pParent,_pController,_rFactory) +{ + m_pTextView = new OQueryTextView(this,_pController,_rFactory); + m_pTextView->Show(); + m_pDesignView = new OQueryDesignView(this,_pController,_rFactory); + + ToolBox* pToolBox = new ToolBox(this, ModuleRes(RID_BRW_QUERYDESIGN_TOOLBOX)); + setToolBox(pToolBox); + + if(pToolBox && m_pTextView->IsVisible()) + { + pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_ALIASES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_TABLES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); + pToolBox->HideItem(ID_BROWSER_ADDTABLE); + pToolBox->HideItem(ID_QUERY_ZOOM_IN); + pToolBox->HideItem(ID_QUERY_ZOOM_OUT); + // ToolBoxItemType eType = pToolBox->GetItemType(pToolBox->GetItemPos(ID_BROWSER_SQL)+1); + // pToolBox->HideItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_SQL))+1); // hide the separator + } +} +// ----------------------------------------------------------------------------- +OQueryViewSwitch::~OQueryViewSwitch() +{ + delete m_pTextView; + delete m_pDesignView; +} +// ------------------------------------------------------------------------- +void OQueryViewSwitch::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel) +{ + OQueryView::Construct(xModel); // initialize m_xMe + // m_pTextView->Construct(xModel); + // m_pDesignView->Construct(xModel); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::initialize() +{ + m_pTextView->initialize(); + m_pDesignView->initialize(); + if(getController()->isDesignMode()) + switchView(); +} +// ------------------------------------------------------------------------- +void OQueryViewSwitch::resizeControl(Rectangle& _rRect) +{ + Size aToolBoxSize; + ToolBox* pToolBox = getToolBox(); + if(pToolBox) + aToolBoxSize = pToolBox->GetOutputSizePixel(); + + Point aStart(_rRect.TopLeft()); + aStart.Y() += aToolBoxSize.Height(); + + m_pTextView->SetPosSizePixel(aStart,Size(_rRect.GetSize().Width(),_rRect.GetSize().Height()-aToolBoxSize.Height())); + m_pDesignView->SetPosSizePixel(aStart,Size(_rRect.GetSize().Width(),_rRect.GetSize().Height()-aToolBoxSize.Height())); + + aToolBoxSize.Width() += _rRect.getWidth(); + _rRect.SetSize(aToolBoxSize); +} +// ----------------------------------------------------------------------------- +::rtl::OUString OQueryViewSwitch::getStatement() +{ + if(m_pTextView->IsVisible()) + return m_pTextView->getStatement(); + return m_pDesignView->getStatement(); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::setReadOnly(sal_Bool _bReadOnly) +{ + if(m_pTextView->IsVisible()) + m_pTextView->setReadOnly(_bReadOnly); + else + m_pDesignView->setReadOnly(_bReadOnly); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::clear() +{ + if(m_pTextView->IsVisible()) + m_pTextView->clear(); + else + m_pDesignView->clear(); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::setStatement(const ::rtl::OUString& _rsStatement) +{ + if(m_pTextView->IsVisible()) + m_pTextView->setStatement(_rsStatement); + else + m_pDesignView->setStatement(_rsStatement); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::copy() +{ + if(m_pTextView->IsVisible()) + m_pTextView->copy(); + else + m_pDesignView->copy(); +} +// ----------------------------------------------------------------------------- +sal_Bool OQueryViewSwitch::isCutAllowed() +{ + if(m_pTextView->IsVisible()) + return m_pTextView->isCutAllowed(); + return m_pDesignView->isCutAllowed(); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::cut() +{ + if(m_pTextView->IsVisible()) + m_pTextView->cut(); + else + m_pDesignView->cut(); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::paste() +{ + if(m_pTextView->IsVisible()) + m_pTextView->paste(); + else + m_pDesignView->paste(); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::switchView() +{ + m_pTextView->Show(!m_pTextView->IsVisible()); + + ToolBox* pToolBox = getToolBox(); + if(pToolBox && m_pTextView->IsVisible()) + { + m_pDesignView->Show(FALSE); + pToolBox->HideItem(ID_BROWSER_QUERY_DISTINCT_VALUES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_ALIASES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_TABLES); + pToolBox->HideItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); + pToolBox->HideItem(ID_BROWSER_ADDTABLE); + pToolBox->HideItem(ID_QUERY_ZOOM_IN); + pToolBox->HideItem(ID_QUERY_ZOOM_OUT); + pToolBox->ShowItem(ID_BROWSER_ESACPEPROCESSING); + // ToolBoxItemType eType = pToolBox->GetItemType(pToolBox->GetItemPos(ID_BROWSER_SQL)+1); + // pToolBox->HideItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_SQL))+1); // hide the separator + m_pTextView->clear(); + m_pTextView->setStatement(getController()->getStatement()); + } + else if(pToolBox) + { + // pToolBox->ShowItem(pToolBox->GetItemId(pToolBox->GetItemPos(ID_BROWSER_ADDTABLE)-1)); // hide the separator + pToolBox->HideItem(ID_BROWSER_ESACPEPROCESSING); + pToolBox->ShowItem(ID_BROWSER_ADDTABLE); + pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_FUNCTIONS); + pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_TABLES); + pToolBox->ShowItem(ID_BROWSER_QUERY_VIEW_ALIASES); + pToolBox->ShowItem(ID_BROWSER_QUERY_DISTINCT_VALUES); + pToolBox->ShowItem(ID_QUERY_ZOOM_IN); + pToolBox->ShowItem(ID_QUERY_ZOOM_OUT); + + m_pDesignView->clear(); + getAddTableDialog()->Update(); + m_pDesignView->InitFromParseNode(); + // only show the view when the data is inserted + m_pDesignView->Show(!m_pDesignView->IsVisible()); + } + m_pDesignView->Resize(); +} +// ----------------------------------------------------------------------------- +OAddTableDlg* OQueryViewSwitch::getAddTableDialog() +{ + return m_pDesignView->getAddTableDialog(); +} +// ----------------------------------------------------------------------------- +BOOL OQueryViewSwitch::IsAddAllowed() +{ + return m_pDesignView->IsAddAllowed(); +} +// ----------------------------------------------------------------------------- +sal_Bool OQueryViewSwitch::isSlotEnabled(sal_Int32 _nSlotId) +{ + return m_pDesignView->isSlotEnabled(_nSlotId); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::setSlotEnabled(sal_Int32 _nSlotId,sal_Bool _bEnable) +{ + m_pDesignView->setSlotEnabled(_nSlotId,_bEnable); +} +// ----------------------------------------------------------------------------- +void OQueryViewSwitch::zoomTableView(const Fraction& _rFraction) +{ + m_pDesignView->zoomTableView(_rFraction); +} +// -----------------------------------------------------------------------------
\ No newline at end of file diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx new file mode 100644 index 000000000000..c09ad9eb4af0 --- /dev/null +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -0,0 +1,2031 @@ +/************************************************************************* + * + * $RCSfile: SelectionBrowseBox.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:25:42 $ + * + * 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_QUERYDESIGN_OSELECTIONBROWSEBOX_HXX +#include "SelectionBrowseBox.hxx" +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef _COM_SUN_STAR_SDBC_XDATABASEMETADATA_HPP_ +#include <com/sun/star/sdbc/XDatabaseMetaData.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef DBACCESS_UI_BROWSER_ID_HXX +#include "browserids.hxx" +#endif +#ifndef _COMPHELPER_TYPES_HXX_ +#include <comphelper/types.hxx> +#endif +#ifndef DBAUI_TABLEFIELDINFO_HXX +#include "TableFieldInfo.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#include "dbaccess_helpid.hrc" +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _SV_SYSTEM_HXX +#include <vcl/system.hxx> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif +#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC +#include "dbustrings.hrc" +#endif +#ifndef DBAUI_QUERY_TABLEWINDOW_HXX +#include "QTableWindow.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef _SV_MSGBOX_HXX +#include <vcl/msgbox.hxx> +#endif +#ifndef _SV_DRAG_HXX +#include <vcl/drag.hxx> +#endif +#ifndef __SGI_STL_ROPE +#include <rope> +#endif +#ifndef DBAUI_QUERYDESIGNFIELDUNDOACT_HXX +#include "QueryDesignFieldUndoAct.hxx" +#endif +#ifndef _SV_EXCHANGE_HXX +#include <vcl/exchange.hxx> +#endif +#ifndef _SVX_DBEXCH_HRC +#include <svx/dbexch.hrc> +#endif +#ifndef _COMPHELPER_STLTYPES_HXX_ +#include <comphelper/stl_types.hxx> +#endif + +using namespace ::dbaui; +using namespace ::connectivity; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::util; + +const String g_strOne = String::CreateFromAscii("1"); +const String g_strZero = String::CreateFromAscii("0"); + +#define DEFAULT_QUERY_COLS 20 +#define DEFAULT_SIZE GetTextWidth(g_strZero) * 30 +#define CHECKBOX_SIZE 10 +#define HANDLE_ID 0 +#define REGISTERID() (Exchange::RegisterFormatName( String::CreateFromAscii(SBA_JOIN_EXCHANGE_FORMAT) )) + +DBG_NAME(OSelectionBrowseBox); +//------------------------------------------------------------------------------ +OSelectionBrowseBox::OSelectionBrowseBox( Window* pParent ) + :DbBrowseBox( pParent,DBBF_NOROWPICTURE, WB_3DLOOK, BROWSER_COLUMNSELECTION | BROWSER_HIDESELECT | BROWSER_KEEPSELECTION | + BROWSER_HIDECURSOR | BROWSER_HLINESFULL | BROWSER_VLINESFULL) + ,m_nVisibleCount(0) + ,m_aFunctionStrings(ModuleRes(STR_QUERY_FUNCTIONS)) + ,m_bOrderByUnRelated(sal_True) + ,m_bGroupByUnRelated(sal_True) +{ + DBG_CTOR(OSelectionBrowseBox,NULL); + SetHelpId(HID_CTL_QRYDGNCRIT); + + m_nMode = BROWSER_COLUMNSELECTION | BROWSER_HIDESELECT | BROWSER_KEEPSELECTION | BROWSER_HIDECURSOR | BROWSER_HLINESFULL | BROWSER_VLINESFULL; + + m_pTextCell = new Edit(&GetDataWindow()); + // m_pTextCell->EnableSpecialCheck(sal_False); + m_pVisibleCell = new DbCheckBoxCtrl(&GetDataWindow()); + m_pTableCell = new DbListBoxCtrl(&GetDataWindow()); + m_pFieldCell = new DbComboBoxCtrl(&GetDataWindow()); + m_pOrderCell = new DbListBoxCtrl(&GetDataWindow()); + m_pFunctionCell = new DbListBoxCtrl(&GetDataWindow()); + + m_pVisibleCell->SetHelpId(HID_QRYDGN_ROW_VISIBLE); + m_pTableCell->SetHelpId(HID_QRYDGN_ROW_TABLE); + m_pFieldCell->SetHelpId(HID_QRYDGN_ROW_FIELD); + m_pOrderCell->SetHelpId(HID_QRYDGN_ROW_ORDER); + m_pFunctionCell->SetHelpId(HID_QRYDGN_ROW_FUNCTION); + + ////////////////////////////////////////////////////////////////////// + // TriState der ::com::sun::star::form::CheckBox abschalten + m_pVisibleCell->GetBox().EnableTriState( sal_False ); + + Font aTitleFont = System::GetStandardFont(STDFONT_SWISS); + aTitleFont.SetSize(Size(0, 6)); + SetTitleFont(aTitleFont); + + String aTxt(ModuleRes(STR_QUERY_SORTTEXT)); + xub_StrLen nCount = aTxt.GetTokenCount(); + xub_StrLen nIdx = 0; + for (; nIdx < nCount; nIdx++) + m_pOrderCell->InsertEntry(aTxt.GetToken(nIdx)); + + for(long i=0;i < BROW_ROW_CNT;i++) + m_bVisibleRow.push_back(sal_True); + + m_bVisibleRow[BROW_FUNCTION_ROW] = sal_False; // zuerst ausblenden +} + +//------------------------------------------------------------------------------ +OSelectionBrowseBox::~OSelectionBrowseBox() +{ + DBG_DTOR(OSelectionBrowseBox,NULL); + + delete m_pTextCell; + delete m_pVisibleCell; + delete m_pFieldCell; + delete m_pTableCell; + delete m_pOrderCell; + delete m_pFunctionCell; +} +// ----------------------------------------------------------------------------- +void OSelectionBrowseBox::initialize() +{ + Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + // Diese Funktionen stehen nur unter CORE zur Verfgung + if(xMetaData->supportsCoreSQLGrammar()) + { + xub_StrLen nCount = m_aFunctionStrings.GetTokenCount(); + for (xub_StrLen nIdx = 0; nIdx < nCount; nIdx++) + m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(nIdx)); + } + else // sonst nur COUNT(*) + { + m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(0)); + m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(2)); // 2 -> COUNT + } + + m_bOrderByUnRelated = xMetaData->supportsOrderByUnrelated(); + m_bGroupByUnRelated = xMetaData->supportsGroupByUnrelated(); + + Init(); +} +//============================================================================== +OQueryDesignView* OSelectionBrowseBox::getDesignView() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OSL_ENSURE(static_cast<const OQueryDesignView*>(GetParent()),"Parent isn't an OQueryDesignView!"); + return static_cast<OQueryDesignView*>(GetParent()); +} +// ----------------------------------------------------------------------------- +OQueryDesignView* OSelectionBrowseBox::getDesignView() const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OSL_ENSURE(static_cast<const OQueryDesignView*>(GetParent()),"Parent isn't an OQueryDesignView!"); + return static_cast<OQueryDesignView*>(GetParent()); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::Init() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DbBrowseBox::Init(); + + SetMapMode( MapMode(MAP_TWIP) ); + GetDataWindow().SetMapMode( GetMapMode() ); + + Font aFont( GetDataWindow().GetFont() ); + aFont.SetWeight( WEIGHT_NORMAL ); + GetDataWindow().SetFont( aFont ); + + //xxx richtige Zeilenhoehe fuer EditEng ??? + long nLSize = GetDataWindow().GetTextHeight() + 2; + SetDataRowHeight(nLSize); + + EnableDrop(); + SetTitleLines(1); + // Anzahl der sichtbaren Zeilen ermitteln + for(long i=0;i<BROW_ROW_CNT;i++) + { + if(m_bVisibleRow[i]) + m_nVisibleCount++; + } + RowInserted(0, m_nVisibleCount, sal_False); + Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + + m_nMaxColumns = xMetaData->getMaxColumnsInSelect(); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::ClearAll() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + SetUpdateMode(sal_False); + + if (GetCurRow() != 0) + GoToRow(0); + + ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + delete *aIter; + getDesignView()->getController()->getTableFieldDesc()->clear(); + + sal_uInt16 nCurCol = GetCurColumnId(); + long nCurRow = GetCurRow(); + DeactivateCell(); + + RemoveColumns(); + InsertHandleColumn( 70 ); + SetUpdateMode(sal_True); + + +#if defined (OS2) + Invalidate(); +#endif + +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::SetReadOnly(sal_Bool bRO) +{ + if (bRO) + { + DeactivateCell(); + m_nMode &= ~BROWSER_HIDECURSOR; + SetMode(m_nMode); + } + else + { + m_nMode |= BROWSER_HIDECURSOR; + SetMode(m_nMode); + ActivateCell(); + } +} + +//------------------------------------------------------------------------------ +DbCellController* OSelectionBrowseBox::GetController(long nRow, sal_uInt16 nColId) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + DBG_ASSERT(pEntry, "OSelectionBrowseBox::GetController : keine FieldDescription !"); + + if (!pEntry) + return NULL; + + if (getDesignView()->getController()->isReadOnly()) + return NULL; + + long nCellIndex = GetRealRow(nRow); + switch (nCellIndex) + { + case BROW_FIELD_ROW: + return new DbComboBoxCellController(m_pFieldCell); + case BROW_TABLE_ROW: + return new DbListBoxCellController(m_pTableCell); + case BROW_VIS_ROW: + return new DbCheckBoxCellController(m_pVisibleCell); + case BROW_ORDER_ROW: + return new DbListBoxCellController(m_pOrderCell); + case BROW_FUNCTION_ROW: + return new DbListBoxCellController(m_pFunctionCell); + default: + return new DbEditCellController(m_pTextCell); + } +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::InitController(DbCellControllerRef& rController, long nRow, sal_uInt16 nColId) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OSL_ENSURE(getDesignView()->getController()->getTableFieldDesc()->size() > (nColId-1),"ColID is to great!"); + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + DBG_ASSERT(pEntry, "OSelectionBrowseBox::InitController : keine FieldDescription !"); + long nCellIndex = GetRealRow(nRow); + + switch (nCellIndex) + { + case BROW_FIELD_ROW: + { + m_pFieldCell->Clear(); + m_pFieldCell->SetText(String()); + + String aField(pEntry->GetField()); + String aTable(pEntry->GetAlias()); + + getDesignView()->fillValidFields(aTable, m_pFieldCell); + + // * durch alias.* ersetzen + if ((aField.GetChar(0) == '*') && aTable.Len()) + { + aField = aTable; + aField.AppendAscii(".*"); + } + m_pFieldCell->SetText(aField); + } break; + case BROW_TABLE_ROW: + { + m_pTableCell->Clear(); + if(pEntry->GetFunctionType() != FKT_CONDITION) + { + m_pTableCell->Enable(); + m_pTableCell->EnableInput(sal_True); + OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + if (pTabWinList) + { + OJoinTableView::OTableWindowMap::iterator aIter = pTabWinList->begin(); + for(;aIter != pTabWinList->end();++aIter) + m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(aIter->second)->GetAliasName()); + + m_pTableCell->InsertEntry(String(ModuleRes(STR_QUERY_NOTABLE)), 0); + if (pEntry->GetAlias().getLength()) + m_pTableCell->SelectEntry(pEntry->GetAlias()); + else + m_pTableCell->SelectEntry(String(ModuleRes(STR_QUERY_NOTABLE))); + } + } + else + { + m_pTableCell->Disable(); + m_pTableCell->EnableInput(sal_False); + } + + + } break; + case BROW_VIS_ROW: + { + m_pVisibleCell->GetBox().Check(pEntry->IsVisible()); + m_pVisibleCell->GetBox().SaveValue(); + + if(pEntry->GetFunctionType() == FKT_CONDITION) + { + m_pTextCell->Disable(); + m_pTextCell->EnableInput(sal_False); + } + else + { + m_pTextCell->Enable(); + m_pTextCell->EnableInput(sal_True); + } + + if(!pEntry->IsVisible() && pEntry->GetOrderDir() != ORDER_NONE && !m_bOrderByUnRelated) + { + // Spalte muss sichtbar sein, um im ORDER BY aufzutauchen + pEntry->SetVisible(sal_True); + m_pVisibleCell->GetBox().Check(pEntry->IsVisible()); + m_pVisibleCell->GetBox().SaveValue(); + m_pVisibleCell->GetBox().Disable(); + m_pVisibleCell->GetBox().EnableInput(sal_False); + InfoBox(getDesignView(), String(ModuleRes(STR_QRY_ORDERBY_UNRELATED))).Execute(); + } + } break; + case BROW_ORDER_ROW: + { + m_pOrderCell->SelectEntryPos(pEntry->GetOrderDir()); + if(pEntry->GetFunctionType() == FKT_CONDITION) + { + m_pOrderCell->Disable(); + m_pOrderCell->EnableInput(sal_False); + } + else + { + m_pOrderCell->Enable(); + m_pOrderCell->EnableInput(sal_True); + } + } break; + case BROW_COLUMNALIAS_ROW: + { + + m_pTextCell->SetText(pEntry->GetFieldAlias()); + m_pTextCell->ClearModifyFlag(); + if (!m_pTextCell->HasFocus()) + m_pTextCell->GrabFocus(); + + if(pEntry->GetFunctionType() == FKT_CONDITION) + { + m_pTextCell->Disable(); + m_pTextCell->EnableInput(sal_False); + } + else + { + m_pTextCell->Enable(); + m_pTextCell->EnableInput(sal_True); + } + if (m_pTextCell->GetHelpId() != HID_QRYDGN_ROW_ALIAS) + // da TextCell in verschiedenen Kontexten verwendet wird, muss ich den gecachten HelpText loeschen + m_pTextCell->SetHelpText(String()); + m_pTextCell->SetHelpId(HID_QRYDGN_ROW_ALIAS); + } + break; + case BROW_FUNCTION_ROW: + { + Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + // Diese Funktionen stehen nur unter CORE zur Verfgung + if(xMetaData->supportsCoreSQLGrammar()) + { + if(pEntry->IsGroupBy()) + { + m_pFunctionCell->SelectEntry(m_pFunctionCell->GetEntry(m_pFunctionCell->GetEntryCount()-1)); + } + else if(m_pFunctionCell->GetEntryPos(String(pEntry->GetFunction())) != COMBOBOX_ENTRY_NOTFOUND) + m_pFunctionCell->SelectEntry(String(pEntry->GetFunction())); + else + m_pFunctionCell->SelectEntryPos(0); + + if(pEntry->GetFunctionType() == FKT_CONDITION) + { + m_pFunctionCell->Disable(); + m_pFunctionCell->EnableInput(sal_False); + } + else + { + m_pFunctionCell->Enable(); + m_pFunctionCell->EnableInput(sal_True); + } + } + else + { + // nur COUNT(*) erlaubt + if(pEntry->GetField().getLength() && pEntry->GetField().toChar() != '*') + m_pFunctionCell->RemoveEntry(1); + else if(m_pFunctionCell->GetEntryCount() < 2) + m_pFunctionCell->InsertEntry(m_aFunctionStrings.GetToken(2)); // 2 -> COUNT + if(m_pFunctionCell->GetEntryPos(String(pEntry->GetFunction())) != COMBOBOX_ENTRY_NOTFOUND) + m_pFunctionCell->SelectEntry(pEntry->GetFunction()); + else + m_pFunctionCell->SelectEntryPos(0); + } + } + break; + default: + { + sal_uInt16 nIdx = nCellIndex-BROW_CRIT1_ROW; + String aText( pEntry->GetCriteria( nIdx ) ); + + m_pTextCell->SetText(aText); + m_pTextCell->ClearModifyFlag(); + if (!m_pTextCell->HasFocus()) + m_pTextCell->GrabFocus(); + + if(pEntry->GetFunctionType() == FKT_CONDITION) + { + m_pTextCell->Disable(); + m_pTextCell->EnableInput(sal_False); + } + else + { + m_pTextCell->Enable(); + m_pTextCell->EnableInput(sal_True); + } + if (m_pTextCell->GetHelpId() != HID_QRYDGN_ROW_CRIT) + // da TextCell in verschiedenen Kontexten verwendet wird, muss ich den gecachten HelpText loeschen + m_pTextCell->SetHelpText(String()); + m_pTextCell->SetHelpId(HID_QRYDGN_ROW_CRIT); + } + } + Controller()->ClearModified(); +} + +//------------------------------------------------------------------------------ +sal_Bool OSelectionBrowseBox::SaveModified() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OTableFieldDesc* pEntry = NULL; + if(getDesignView()->getController()->getTableFieldDesc()->size() > GetCurColumnId() - 1) + pEntry = (*getDesignView()->getController()->getTableFieldDesc())[GetCurColumnId() - 1]; + + sal_Bool bWasEmpty = pEntry ? pEntry->IsEmpty() : sal_False; + sal_Bool bError = sal_False; + + if (pEntry && Controller().Is() && Controller()->IsModified()) + { + // fuer die Undo-Action + String strOldCellContents; + long nRow = GetRealRow(GetCurRow()); + switch (nRow) + { + case BROW_VIS_ROW: + if((m_bOrderByUnRelated || pEntry->GetOrderDir() == ORDER_NONE) && + (m_bGroupByUnRelated || !pEntry->IsGroupBy())) + { + strOldCellContents = pEntry->IsVisible() ? g_strOne : g_strZero; + pEntry->SetVisible(m_pVisibleCell->GetBox().IsChecked()); + } + else + { + strOldCellContents = pEntry->IsVisible() ? g_strOne : g_strZero; + pEntry->SetVisible(sal_True); + m_pVisibleCell->GetBox().Check(); + } + break; + + case BROW_FIELD_ROW: + { + String aFieldName(m_pFieldCell->GetText()); + + sal_Bool bIsPredicate = sal_False; + // wenn das Ergebnis ein Praedikat -> OK + String aTest(aFieldName); + + OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow()); + + if (!pWin && (aFieldName.GetTokenCount('.') == 2)) + { + OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + if (pTabWinList) + { + OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(aFieldName.GetToken(0, '.')); + if(aIter != pTabWinList->end()) + pWin = static_cast<OQueryTableWindow*>(aIter->second); + } + } + + Reference<XPropertySet> xColumn; + if (pWin) + { + Reference<XNameAccess> xColumns = pWin->GetOriginalColumns(); + if (aFieldName.GetTokenCount('.') == 2 && xColumns->hasByName(aFieldName.GetToken(1,'.'))) // falls alias.Feld angegeben + xColumns->getByName(aFieldName.GetToken(1,'.')) >>= xColumn; + else if(xColumns->hasByName(aFieldName)) + xColumns->getByName(aFieldName) >>= xColumn; + } + + if(!xColumn.is()) // only when text not a column of the table + { + ::rtl::OUString aErrorMsg; + bIsPredicate = sal_True; // #72670# + ::connectivity::OSQLParser& rParser = getDesignView()->getController()->getParser(); + OSQLParseNode* pParseNode = rParser.predicateTree(aErrorMsg, aTest, getDesignView()->getController()->getNumberFormatter(), xColumn); + if (pParseNode) + { + pEntry->SetVisible(sal_False); + bWasEmpty = sal_False; // XXXXX + delete pParseNode; + pEntry->SetFunctionType(FKT_CONDITION); + RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId()); + } + else + pEntry->SetFunctionType(FKT_OTHER); + } + + xub_StrLen nCount(aFieldName.GetTokenCount('(')); + if(nCount < 2 && !bIsPredicate) // keine Funktion + { + if (aFieldName.GetTokenCount('.') == 2) // falls alias.Feld angegeben + { + String sTableAlias(aFieldName.GetToken(0, '.')); + aFieldName = aFieldName.GetToken(1,'.'); + + // das erste Token in das Tabellenfeld eintragen (und entsprechend den Entry anpassen) + pEntry->SetAlias(sTableAlias); + if(m_bVisibleRow[BROW_TABLE_ROW]) + RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId()); + + OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + if (pTabWinList) + { + OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(sTableAlias); + if(aIter != pTabWinList->end()) + { + OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second); + if (pEntryTab) + { + pEntry->SetDatabase(pEntryTab->GetComposedName()); + pEntry->SetTable(pEntryTab->GetTableName()); + } + } + } + } + strOldCellContents = pEntry->GetField(); + pEntry->SetField(aFieldName); + + // Falls nur COUNT(*) erlaubt wird + Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + if(xMetaData->supportsCoreSQLGrammar() + && aFieldName.GetChar(0) != '*' && pEntry->GetFunction().getLength()) + { + pEntry->SetFunction(::rtl::OUString()); + m_pFunctionCell->SelectEntryPos(0); + if(!m_bVisibleRow[BROW_FUNCTION_ROW]) + { + SetRowVisible(BROW_FUNCTION_ROW, sal_True); + } + RowModified(GetBrowseRow(BROW_FUNCTION_ROW), GetCurColumnId()); + } + pEntry->SetFunctionType(FKT_NONE); + } + else + { // Funktion eingegeben + // m_pFieldCell auf Inhalt der Funktion setzen und pEntry mit ganzem Wert setzen + // BROW_FUNCTION_ROW setzen + strOldCellContents = pEntry->GetField(); + + String aFkt(aFieldName.GetToken(0,'(')); + + if(pEntry->GetFunctionType() != FKT_CONDITION && GetFunktionName(aFkt)) + { + // ist Aggregatefuntkion + pEntry->SetFunction(aFkt); + String aParameter(aFieldName.GetToken(1,'(')); + aParameter = aParameter.GetToken(aParameter.GetTokenCount()-1,')'); + pEntry->SetField(aParameter); // nur die Parameter einf"ugen + pEntry->SetFunctionType(FKT_AGGREGATE); + if (aParameter.GetTokenCount('.') == 2) // falls alias.Feld angegeben + { + String sTableAlias(aParameter.GetToken(0, '.')); + aParameter = aParameter.GetToken(1,'.'); + + // das erste Token in das Tabellenfeld eintragen (und entsprechend den Entry anpassen) + pEntry->SetAlias(sTableAlias); + if(m_bVisibleRow[BROW_TABLE_ROW]) + RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId()); + + OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + if (pTabWinList) + { + OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(sTableAlias); + if(aIter != pTabWinList->end()) + { + OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second); + pEntry->SetDatabase(pEntryTab->GetComposedName()); + pEntry->SetTable(pEntryTab->GetTableName()); + } + } + } + else + { + // nur eine Tabelle vorhanden oder der Benutzer hat vergessen diese anzugeben + // also einfach die erst beste nehmen + OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + if(pTabWinList) + { + OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(pTabWinList->begin()->second); + if (pEntryTab) + { + pEntry->SetDatabase(pEntryTab->GetComposedName()); + pEntry->SetTable(pEntryTab->GetTableName()); + pEntry->SetAlias(pEntry->GetTable()); + } + } + } + + m_pFieldCell->SetText(aParameter); + m_pFunctionCell->SelectEntry(aFkt); + if(!m_bVisibleRow[BROW_FUNCTION_ROW]) + { + SetRowVisible(BROW_FUNCTION_ROW, sal_True); + } + RowModified(GetBrowseRow(BROW_FUNCTION_ROW), GetCurColumnId()); + RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId()); + } + else + { + pEntry->SetField(aFieldName); + pEntry->SetAlias(String()); + pEntry->SetTable(String()); + pEntry->SetTabWindow(NULL); + m_pFieldCell->SetText(aFieldName); + m_pFunctionCell->SelectEntryPos(0); + if(m_bVisibleRow[BROW_TABLE_ROW]) + RowModified(GetBrowseRow(BROW_TABLE_ROW), GetCurColumnId()); + } + } + + if (!aFieldName.Len()) + { + ::std::replace(getDesignView()->getController()->getTableFieldDesc()->begin(),getDesignView()->getController()->getTableFieldDesc()->end(),pEntry,new OTableFieldDesc); + sal_uInt16 nCol = GetCurColumnId(); + for (int i = 0; i < m_nVisibleCount; i++) // Spalte neu zeichnen + RowModified(i,nCol); + } + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); + } + break; + + case BROW_TABLE_ROW: + { + String aAliasName = m_pTableCell->GetSelectEntry(); + strOldCellContents = pEntry->GetAlias(); + if (m_pTableCell->GetSelectEntryPos() != 0) + pEntry->SetAlias(aAliasName); + else + pEntry->SetAlias(String()); + + // jetzt noch ::com::sun::star::data::Database und Tabelle uebernehmen + OJoinTableView::OTableWindowMap* pTabWinList = getDesignView()->getTableView()->GetTabWinMap(); + if (pTabWinList) + { + OJoinTableView::OTableWindowMapIterator aIter = pTabWinList->find(aAliasName); + if(aIter != pTabWinList->end()) + { + OQueryTableWindow* pEntryTab = static_cast<OQueryTableWindow*>(aIter->second); + if (pEntryTab) + { + pEntry->SetDatabase(pEntryTab->GetComposedName()); + pEntry->SetTable(pEntryTab->GetTableName()); + } + } + } + } break; + + case BROW_ORDER_ROW: + { + strOldCellContents = String((sal_uInt16)pEntry->GetOrderDir()); + sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos(); + if (nIdx == sal_uInt16(-1)) + nIdx = 0; + pEntry->SetOrderDir(EOrderDir(nIdx)); + if(!m_bOrderByUnRelated) + { + pEntry->SetVisible(sal_True); + m_pVisibleCell->GetBox().Check(); + RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId()); + } + } break; + + case BROW_COLUMNALIAS_ROW: + strOldCellContents = pEntry->GetFieldAlias(); + pEntry->SetFieldAlias(m_pTextCell->GetText()); + break; + case BROW_FUNCTION_ROW: + { + strOldCellContents = pEntry->GetFunction(); + sal_uInt16 nPos = m_pFunctionCell->GetSelectEntryPos(); + Reference< XDatabaseMetaData > xMetaData = getDesignView()->getController()->getConnection()->getMetaData(); + // Diese Funktionen stehen nur unter CORE zur Verfgung + sal_uInt16 nFunctionCount = + xMetaData->supportsCoreSQLGrammar() + ? + m_pFunctionCell->GetEntryCount()-1 + : + m_pFunctionCell->GetEntryCount(); + if(nPos >= 1 && nPos < nFunctionCount) + { + pEntry->SetFunctionType(FKT_AGGREGATE); + pEntry->SetFunction(m_pFunctionCell->GetEntry(nPos)); + pEntry->SetGroupBy(sal_False); + } + else + { + pEntry->SetFunctionType(FKT_NONE); + if(nPos > 1) + { + pEntry->SetGroupBy(sal_True); + if(!m_bGroupByUnRelated) + { + pEntry->SetVisible(sal_True); + m_pVisibleCell->GetBox().Check(); + RowModified(GetBrowseRow(BROW_VIS_ROW), GetCurColumnId()); + } + } + else + pEntry->SetGroupBy(sal_False); + pEntry->SetFunction(String()); + } + } + break; + default: + { + + sal_uInt16 nIdx = nRow - BROW_CRIT1_ROW; + String aText = m_pTextCell->GetText(); + + aText.EraseLeadingChars(); + ::rtl::OUString aCrit; + if(aText.Len()) + { + ::connectivity::OSQLParser& rParser = getDesignView()->getController()->getParser(); + OQueryTableWindow* pWin = static_cast<OQueryTableWindow*>(pEntry->GetTabWindow()); + + String aTest(aText); + + Reference<XPropertySet> xColumn; + if (pWin) + { + Reference<XNameAccess> xColumns = pWin->GetOriginalColumns(); + if (xColumns->hasByName(pEntry->GetField())) + xColumns->getByName(pEntry->GetField()) >>= xColumn; + } + + ::rtl::OUString aErrorMsg; + OSQLParseNode* pParseNode = rParser.predicateTree(aErrorMsg, aTest, getDesignView()->getController()->getNumberFormatter(), xColumn); + if (pParseNode) + { + pParseNode->parseNodeToPredicateStr(aCrit, + getDesignView()->getController()->getConnection()->getMetaData(), + getDesignView()->getController()->getNumberFormatter(), + xColumn, + getDesignView()->getLocale(), + getDesignView()->getDecimalSeparator().toChar()); + delete pParseNode; + } + else + { + if(xColumn.is()) + { + sal_Int32 nType = 0; + xColumn->getPropertyValue(PROPERTY_TYPE) >>= nType; + switch(nType) + { + case DataType::CHAR: + case DataType::VARCHAR: + case DataType::LONGVARCHAR: + if(aTest.GetChar(0) != '\'' || aTest.GetChar(aTest.Len() -1) != '\'') + { + aTest.SearchAndReplaceAll(String::CreateFromAscii("'"),String::CreateFromAscii("''")); + String aTmp(String::CreateFromAscii("'")); + (aTmp += aTest) += String::CreateFromAscii("'"); + aTest = aTmp; + } + break; + default: + ; + } + pParseNode = rParser.predicateTree(aErrorMsg, aTest, getDesignView()->getController()->getNumberFormatter(), xColumn); + if (pParseNode) + { + pParseNode->parseNodeToPredicateStr(aCrit, + getDesignView()->getController()->getConnection()->getMetaData(), + getDesignView()->getController()->getNumberFormatter(), + xColumn, + getDesignView()->getLocale(), + getDesignView()->getDecimalSeparator().toChar()); + delete pParseNode; + } + else + { + // SbaExtInfoBox(this,aErrorMsg).Execute(); + // TODO show error + bError = sal_True; + } + } + else + { + // SbaExtInfoBox(this,aErrorMsg).Execute(); + // TODO show error + bError = sal_True; + } + } + } + strOldCellContents = pEntry->GetCriteria(nIdx); + pEntry->SetCriteria(nIdx, aCrit); + if(aCrit.getLength() && nRow >= (GetRowCount()-1)) + { + RowInserted( GetRowCount()-1, 1, TRUE ); + m_bVisibleRow.push_back(sal_True); + ++m_nVisibleCount; + } + } + } + if(!bError && Controller()) + Controller()->ClearModified(); + + RowModified(GetCurRow(), GetCurColumnId()); + + // und noch die Undo-Action fuer das Ganze + OTabFieldCellModifiedUndoAct* pUndoAct = new OTabFieldCellModifiedUndoAct(this); + pUndoAct->SetCellIndex(GetCurRow()); + pUndoAct->SetColId(GetCurColumnId()); + pUndoAct->SetCellContents(strOldCellContents); + getDesignView()->getController()->getUndoMgr()->AddUndoAction(pUndoAct); + } + + // habe ich Daten in einer FieldDescription gespeichert, die vorher leer war und es nach den Aenderungen nicht mehr ist ? + if (pEntry && bWasEmpty && !pEntry->IsEmpty() && !bError) + { + // Default auf sichtbar + pEntry->SetVisible(sal_True); + RowModified(BROW_VIS_ROW, GetCurColumnId()); + + // wenn noetig neue freie Spalten anlegen + long nDummy; + CheckFreeColumns(nDummy); + } + + return pEntry != NULL && !bError; +} + +//------------------------------------------------------------------------------ +sal_Bool OSelectionBrowseBox::SeekRow(long nRow) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + sal_Bool bRet = sal_False; + + m_nSeekRow = nRow; + if (nRow < m_nVisibleCount ) + bRet = sal_True; + + return bRet; +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::PaintCell(OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId) const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + rDev.SetClipRegion( rRect ); + OTableFieldDesc* pEntry = NULL; + + if(getDesignView()->getController()->getTableFieldDesc()->size() > nColumnId - 1) + pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColumnId - 1]; + + if (!pEntry) + return; + + long nRow = GetRealRow(m_nSeekRow); + if (nRow == BROW_VIS_ROW) + PaintTristate(rDev, rRect, pEntry->IsVisible() ? STATE_CHECK : STATE_NOCHECK); + else + rDev.DrawText(rRect.TopLeft(), GetCellText(nRow, nColumnId)); + + rDev.SetClipRegion( ); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::PaintStatusCell(OutputDevice& rDev, const Rectangle& rRect) const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + Point aPos(rRect.TopLeft()); + aPos.Y() -= 2; + String aLabel(ModuleRes(STR_QUERY_HANDLETEXT)); + + // ab BROW_CRIT2_ROW werden alle Zeilen mit "oder" angegeben + xub_StrLen nToken = (sal_uInt16) (m_nSeekRow >= GetBrowseRow(BROW_CRIT2_ROW)) + ? + BROW_CRIT2_ROW : GetRealRow(m_nSeekRow); + rDev.DrawText(aPos, aLabel.GetToken(nToken)); +} + +//------------------------------------------------------------------------------ +sal_Bool OSelectionBrowseBox::QueryDrop(const BrowserDropEvent& rEvt) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + return rEvt.GetColumnId() > 0 && rEvt.GetRow() >= 0 && DragServer::HasFormat(0, REGISTERID()); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::RemoveColumn(sal_uInt16 nColId) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(getDesignView()->getController()->getTableFieldDesc()->size() == ColCount() - 1, "OSelectionBrowseBox::RemoveColumn : inkonsistent state !"); + // das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn + DBG_ASSERT((nColId == 0) || (nColId <= getDesignView()->getController()->getTableFieldDesc()->size()), "OSelectionBrowseBox::RemoveColumn : invalid parameter nColId"); + // ColId ist bei mir gleichbedeutend mit Position, und da sollte die Bedingung natuerlich zutreffen + + sal_uInt16 nCurCol = GetCurColumnId(); + long nCurRow = GetCurRow(); + + DeactivateCell(); + // Spalteninfo rausnehmen und am Ende neues Info einfuegen + OTableFieldDesc* pOld = (*getDesignView()->getController()->getTableFieldDesc())[((sal_uInt32)nColId - 1)]; + getDesignView()->getController()->getTableFieldDesc()->erase( getDesignView()->getController()->getTableFieldDesc()->begin() + ((sal_uInt32)nColId - 1) ); + // der Aufrufer ist dafuer verantwortlich, sich vorher die Description zu besorgen und die irgendwie aufzuraeumen + // (im Normalfall wohl erst mal in ein Undo zu schieben) + OTableFieldDesc* pNew = new OTableFieldDesc; + getDesignView()->getController()->getTableFieldDesc()->push_back(pNew); + + // Nachfolgende Spalten optisch verschieben + sal_uInt16 nCount = (sal_uInt16)ColCount(); + // (das funktioniert nur, weil hier Column-Id gleich Column-Pos ist) + for (sal_uInt16 i = nColId; i < nCount; i++) + SetColumnWidth(i, GetColumnWidth(i + 1)); + + // letzte Spalte erhaelt den default Wert + SetColumnWidth(nCount-1, DEFAULT_SIZE); + pNew->SetColWidth(DEFAULT_SIZE); + + // Neuzeichnen + Rectangle aInvalidRect = GetInvalidRect( nColId ); + Invalidate( aInvalidRect ); + + ActivateCell( nCurRow, nCurCol ); + + getDesignView()->getController()->setModified(); + + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_UNDO ); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_REDO ); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); + +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::RemoveField(sal_uInt16 nId, sal_Bool bActivate) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OSL_ENSURE(getDesignView()->getController()->getTableFieldDesc()->size() > (nId-1),"ID is to great!"); + + OTableFieldDesc* pDesc = (*getDesignView()->getController()->getTableFieldDesc())[(sal_uInt32)(nId - 1)] ; + pDesc->SetColWidth( (sal_uInt16)GetColumnWidth(nId) ); // hat er sich vorher leider nicht gemerkt + + // UndoAction erzeugen + OTabFieldDelUndoAct* pUndoAction = new OTabFieldDelUndoAct( this ); + pUndoAction->SetTabFieldDescr(pDesc); + pUndoAction->SetOwnership(sal_True); + pUndoAction->SetColId( nId ); + getDesignView()->getController()->getUndoMgr()->AddUndoAction( pUndoAction ); + + RemoveColumn(nId); + + // damit das Ganze potentiell unendlich ist, zieht ein Remove auch gleich ein Insert einer leeren Spalte nach sich +// AppendNewCol(1); + + getDesignView()->getController()->InvalidateFeature(ID_BROWSER_UNDO); + getDesignView()->getController()->InvalidateFeature(ID_BROWSER_REDO); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::MouseButtonDown(const BrowserMouseEvent& rEvt) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + if( rEvt.IsLeft() ) + { + sal_Bool bOnHeader = rEvt.GetRow() < 0 && rEvt.GetColumnId() != HANDLE_ID; + // wenn ein Header selectiert wird, mu die selection angezeigt werden, sonst nicht) + if (bOnHeader) + { + if (GetSelectColumnCount() == 0) + // wenn es schon eine selektierte Spalte gibt, bin ich schon im richtigen Modus + if ((m_nMode & BROWSER_HIDESELECT) == BROWSER_HIDESELECT) + { + m_nMode &= ~BROWSER_HIDESELECT; + m_nMode |= BROWSER_MULTISELECTION; + SetMode(m_nMode); + } + } + else if (!((m_nMode & BROWSER_HIDESELECT) == BROWSER_HIDESELECT)) + { + if (GetSelectColumnCount() != 0) + SetNoSelection(); + if (rEvt.GetColumnId() == HANDLE_ID) + { + m_nMode |= BROWSER_HIDESELECT; + m_nMode &= ~BROWSER_MULTISELECTION; + SetMode(m_nMode); + } + } + } + DbBrowseBox::MouseButtonDown(rEvt); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::MouseButtonUp(const BrowserMouseEvent& rEvt) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DbBrowseBox::MouseButtonUp( rEvt ); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::KeyInput( const KeyEvent& rEvt ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + if (IsColumnSelected(GetCurColumnId())) + { + if (rEvt.GetKeyCode().GetCode() == KEY_DELETE && // Delete rows + !rEvt.GetKeyCode().IsShift() && + !rEvt.GetKeyCode().IsMod1()) + { + RemoveField(GetCurColumnId()); + return; + } + } + DbBrowseBox::KeyInput(rEvt); +} + + +//------------------------------------------------------------------------------ +sal_Bool OSelectionBrowseBox::Drop( const BrowserDropEvent& rEvt ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OTableFieldDesc aInfo; + if (DragServer::HasFormat(0,REGISTERID())) + { + // Einfuegen des Feldes an der gewuenschten Position + SvDataObjectRef xDataObj = SvDataObject::PasteDragServer(rEvt); + OJoinExchObj* xJoinExchObj = (OJoinExchObj*)&xDataObj; + OJoinExchangeData jxdSource = xJoinExchObj->GetSourceDescription(); + InsertField(jxdSource); + } + return sal_False; +} + +//------------------------------------------------------------------------------ +OTableFieldDesc* OSelectionBrowseBox::AppendNewCol( sal_uInt16 nCnt ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + // es koennen mehrere angelegt werden, aber der Erste + // wird returnt + sal_uInt32 nCount = getDesignView()->getController()->getTableFieldDesc()->size(); + OTableFieldDesc* pNewDesc; + for (sal_uInt16 i=0 ; i<nCnt ; i++) + { + pNewDesc = new OTableFieldDesc; + pNewDesc->SetColWidth(DEFAULT_SIZE); + getDesignView()->getController()->getTableFieldDesc()->push_back(pNewDesc); + InsertDataColumn((sal_uInt16)getDesignView()->getController()->getTableFieldDesc()->size(), String(), DEFAULT_SIZE, HIB_STDSTYLE, HEADERBAR_APPEND); + } + + return (*getDesignView()->getController()->getTableFieldDesc())[nCount]; +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::DeleteFields(const String& rAliasName) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + if (getDesignView()->getController()->getTableFieldDesc()->size()) + { + sal_uInt16 nColId = GetCurColumnId(); + sal_uInt32 nRow = GetCurRow(); + + sal_Bool bWasEditing = IsEditing(); + if (bWasEditing) + DeactivateCell(); + + ::std::vector<OTableFieldDesc*>::reverse_iterator aIter = getDesignView()->getController()->getTableFieldDesc()->rbegin(); + OTableFieldDesc* pEntry = NULL; + for(sal_Int32 nPos=getDesignView()->getController()->getTableFieldDesc()->size();aIter != getDesignView()->getController()->getTableFieldDesc()->rend();++aIter,--nPos) + { + pEntry = *aIter; + if (pEntry->GetAlias() == ::rtl::OUString(rAliasName) ) + RemoveField((sal_uInt16)nPos, sal_False); + } + + if (bWasEditing) + ActivateCell(nRow , nColId); + } +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::SetColWidth() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + // Spaltenbreite ermitteln + sal_uInt16 nColCount = ColCount(); + sal_uInt32 nColWidth = 0; + + for( sal_uInt16 nColId=1; nColId<=nColCount; nColId++ ) + { + nColWidth = getDesignView()->getController()->getColWidth( nColId ); + + if( nColWidth == 0) + nColWidth = DEFAULT_SIZE; + SetColumnWidth( nColId, nColWidth ); + } +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::SetColWidth(sal_uInt16 nColId, long nNewWidth) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + sal_Bool bWasEditing = IsEditing(); + if (bWasEditing) + DeactivateCell(); + + // die Basisklasse machen lassen + SetColumnWidth(nColId, nNewWidth); + + // der FieldDescription Bescheid sagen + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId - 1]; + if (pEntry) + pEntry->SetColWidth(GetColumnWidth(nColId)); + + if (bWasEditing) + ActivateCell(GetCurRow(), GetCurColumnId()); +} + +//------------------------------------------------------------------------------ +Rectangle OSelectionBrowseBox::GetInvalidRect( sal_uInt16 nColId ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + ////////////////////////////////////////////////////////////////////// + // Rechteck ist erst einmal der gesamte Outputbereich des Fensters + Rectangle aInvalidRect( Point(0,0), GetOutputSizePixel() ); + + ////////////////////////////////////////////////////////////////////// + // Dann wird die linke Seite angepasst + Rectangle aFieldRect(GetFieldRectPixel( 0, nColId )); + aInvalidRect.Left() = aFieldRect.Left(); + + return aInvalidRect; +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::InsertColumn(OTableFieldDesc* pEntry, long& nColId) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(getDesignView()->getController()->getTableFieldDesc()->size() == ColCount() - 1, "OSelectionBrowseBox::InsertColumn : inkonsistent state !"); + // das Control sollte immer genau eine Spalte mehr haben, naemlich die HandleColumn + DBG_ASSERT((nColId == -1) || (nColId <= getDesignView()->getController()->getTableFieldDesc()->size()), "OSelectionBrowseBox::InsertColumn : invalid parameter nColId."); + // -1 heisst ganz hinten, Count heisst ganz hinten, der Rest bezeichnet eine richtige Position + + sal_uInt16 nCurCol = GetCurColumnId(); + long nCurRow = GetCurRow(); + + DeactivateCell(); + + // Gueltigkeit von nColId pruefen (ColId von 1 bis ...) + // Wenn zu klein oder zu gross, auf Ende der Liste setzen + if ((nColId == -1) || (nColId >= getDesignView()->getController()->getTableFieldDesc()->size())) // Anhaengen des Feldes + { + if (FindFirstFreeCol(nColId) == NULL) // keine freie Column mehr + { + AppendNewCol(1); + nColId = getDesignView()->getController()->getTableFieldDesc()->size(); + } + else + nColId++; // innerhalb der vorgegebenen Liste + } + + // in Liste der Spaltenbeschreibungen neues Element + getDesignView()->getController()->getTableFieldDesc()->insert( getDesignView()->getController()->getTableFieldDesc()->begin()+(sal_uInt32)nColId-1 ,pEntry); + // da ich meine Spaltenzahl immer auf dem selben Wert wie die Zahl der FieldDescriptions halten muss (plus 1, da es eine + // HandleClumn gibt), muss ich fuer diese gerade eingefuegte Description auch eine loeschen + long nFirstFreeCol = -1; + CheckFreeColumns(nFirstFreeCol); + // (es kann sein, dass es keine leere gab, dann erzwingt CheckFreeColumns das) + + delete (*getDesignView()->getController()->getTableFieldDesc())[(sal_uInt16)nFirstFreeCol]; + getDesignView()->getController()->getTableFieldDesc()->erase(getDesignView()->getController()->getTableFieldDesc()->begin()+(sal_uInt16)nFirstFreeCol); + + // jetzt kann wieder keine leere Spalte vorhanden sein (falls naemlich die soeben geloeschte die einzige war) ... + CheckFreeColumns(nFirstFreeCol); + + // Nachfolgende Spalten optisch verschieben + sal_uInt16 nCount = (sal_uInt16)getDesignView()->getController()->getTableFieldDesc()->size(); + for (sal_uInt16 i = nCount-1; i > nColId; --i) + SetColumnWidth(i, GetColumnWidth(i - 1)); + + // Spaltenbreite setzen + SetColumnWidth((sal_uInt16)nColId, pEntry->GetColWidth() ); + + // Neuzeichnen + Rectangle aInvalidRect = GetInvalidRect( (sal_uInt16)nColId ); + Invalidate( aInvalidRect ); + + ActivateCell( nCurRow, nCurCol ); + getDesignView()->getController()->setModified(); + + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_UNDO ); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_REDO ); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_EXECUTE ); +} + +//------------------------------------------------------------------------------ +OTableFieldDesc* OSelectionBrowseBox::InsertField(const OJoinExchangeData& jxdSource, long nColId, sal_Bool bVis, sal_Bool bActivate) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(jxdSource.pListBox->GetTabWin()); + if (!pSourceWin) + return NULL; + + // Namen/Position des selektierten Feldes + String aFieldName = jxdSource.pListBox->GetEntryText(jxdSource.pEntry); + sal_uInt32 nFieldIndex = jxdSource.pListBox->GetModel()->GetAbsPos(jxdSource.pEntry); + OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(jxdSource.pEntry->GetUserData()); + + // eine DragInfo aufbauen, damit ich mich auf das andere InsertField zurueckziehen kann + OTableFieldDesc aInfo; + aInfo.SetTabWindow(pSourceWin); + aInfo.SetFieldIndex(nFieldIndex); + aInfo.SetFieldType(pInf->GetKeyType()); + aInfo.SetField(aFieldName); + aInfo.SetTable(pSourceWin->GetTableName()); + aInfo.SetAlias(pSourceWin->GetAliasName()); + aInfo.SetDatabase(pSourceWin->GetComposedName()); + + aInfo.SetDataType(pInf->GetDataType()); + aInfo.SetVisible(bVis); + + return InsertField(aInfo, nColId, bVis, bActivate); +} + +//------------------------------------------------------------------------------ +OTableFieldDesc* OSelectionBrowseBox::InsertField(const OTableFieldDesc& rInfo, long nColId, sal_Bool bVis, sal_Bool bActivate) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + + if(m_nMaxColumns && m_nMaxColumns <= FieldsCount()) + return NULL; + if (bActivate) + SaveModified(); + + // Neue Spaltenbeschreibung + OTableFieldDesc* pEntry = new OTableFieldDesc(rInfo); + pEntry->SetVisible(bVis); + sal_uInt32 nColWidth; + if( getDesignView()->getColWidth(rInfo.GetAlias(), rInfo.GetField(), nColWidth) ) + pEntry->SetColWidth( (sal_uInt16)nColWidth ); + else + pEntry->SetColWidth( (sal_uInt16)DEFAULT_SIZE ); + + // Spalte einfuegen + InsertColumn( pEntry, nColId ); + + // UndoAction erzeugen + OTabFieldCreateUndoAct* pUndoAction = new OTabFieldCreateUndoAct( this ); + pUndoAction->SetTabFieldDescr( pEntry ); + pUndoAction->SetOwnership(sal_False); + pUndoAction->SetColId( nColId ); + getDesignView()->getController()->getUndoMgr()->AddUndoAction( pUndoAction ); + + return pEntry; +} + +//------------------------------------------------------------------------------ +sal_uInt16 OSelectionBrowseBox::FieldsCount() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + sal_uInt16 nCount = 0; + + while (aIter != getDesignView()->getController()->getTableFieldDesc()->end()) + { + if ((*aIter) && !(*aIter)->IsEmpty()) + nCount++; + ++aIter; + } + + return nCount; +} + +//------------------------------------------------------------------------------ +OTableFieldDesc* OSelectionBrowseBox::FindFirstFreeCol( long& rCol ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + rCol = -1; + while (aIter != getDesignView()->getController()->getTableFieldDesc()->end()) + { + ++rCol; + if ((*aIter) && (*aIter)->IsEmpty()) + return *aIter; + ++aIter; + } + + return NULL; +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::CheckFreeColumns(long& rCol) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + if (FindFirstFreeCol(rCol) == NULL) + { + // es ist voll, also einen Packen Spalten anhaengen + AppendNewCol(DEFAULT_QUERY_COLS); + OSL_VERIFY(FindFirstFreeCol(rCol)); + } +} +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::AddGroupBy( const OTableFieldDesc& rInfo ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(!rInfo.IsEmpty(),"AddGroupBy:: OTableFieldDesc sollte nicht Empty sein!"); + OTableFieldDesc* pEntry; + ::comphelper::UStringMixEqual bCase(getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + { + pEntry = *aIter; + OSL_ENSURE(pEntry,"OTableFieldDesc was null!"); + + ::rtl::OUString aField = pEntry->GetField(); + ::rtl::OUString aAlias = pEntry->GetAlias(); + + if (bCase(aField,rInfo.GetField()) && + bCase(aAlias,rInfo.GetAlias()) && + pEntry->GetFunctionType() == rInfo.GetFunctionType()) + { + if((pEntry->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) + pEntry->SetGroupBy(sal_False); + else + { + pEntry->SetGroupBy(rInfo.IsGroupBy()); + if(!m_bOrderByUnRelated && pEntry->IsGroupBy()) + pEntry->SetVisible(sal_True); + } + break; + } + } + + if (aIter == getDesignView()->getController()->getTableFieldDesc()->end()) + { + OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False ); + if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen + pTmp->SetGroupBy(sal_False); + } +} +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::AddCondition( const OTableFieldDesc& rInfo, const String& rValue, const sal_uInt16 nLevel, const char* pOp ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(!rInfo.IsEmpty(),"AddCondition:: OTableFieldDesc sollte nicht Empty sein!"); + OTableFieldDesc* pEntry; + ::comphelper::UStringMixEqual bCase(getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + + ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + { + pEntry = *aIter; + ::rtl::OUString aField = pEntry->GetField(); + ::rtl::OUString aAlias = pEntry->GetAlias(); + + if (bCase(aField,rInfo.GetField()) && + bCase(aAlias,rInfo.GetAlias()) && + pEntry->GetFunctionType() == rInfo.GetFunctionType()) + { + if((pEntry->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) + pEntry->SetGroupBy(sal_False); + else + { + pEntry->SetGroupBy(rInfo.IsGroupBy()); + if(!m_bOrderByUnRelated && pEntry->IsGroupBy()) + pEntry->SetVisible(sal_True); + } + if (!pEntry->GetCriteria(nLevel).getLength()) + { + pEntry->SetCriteria( nLevel, rValue); + if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1)) + { + RowInserted( GetRowCount()-1, 1, TRUE ); + m_bVisibleRow.push_back(sal_True); + ++m_nVisibleCount; + } + break; + } + } + } + + if (aIter == getDesignView()->getController()->getTableFieldDesc()->end()) + { + OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False ); + if((pTmp->GetFunctionType() == FKT_AGGREGATE && rInfo.IsGroupBy())) // das GroupBy wird bereits von rInfo "ubernommen + pTmp->SetGroupBy(sal_False); + if(pTmp) + { + pTmp->SetCriteria( nLevel, rValue); + if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1)) + { + RowInserted( GetRowCount()-1, 1, TRUE ); + m_bVisibleRow.push_back(sal_True); + ++m_nVisibleCount; + } + } + } +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::AddOrder( const OTableFieldDesc& rInfo, const EOrderDir eDir, sal_uInt16& nPos ) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(!rInfo.IsEmpty(),"AddOrder:: OTableFieldDesc sollte nicht Empty sein!"); + // nPos merkt sich die Spalte in die Sortierung eingetragen wird, + // da weitere Sortierungen nur dahinter abgelegt werden duerfen + OTableFieldDesc* pEntry; + ::comphelper::UStringMixEqual bCase(getDesignView()->getController()->getConnection()->getMetaData()->storesMixedCaseQuotedIdentifiers()); + + ::std::vector<OTableFieldDesc*>::iterator aIter = getDesignView()->getController()->getTableFieldDesc()->begin(); + for(;aIter != getDesignView()->getController()->getTableFieldDesc()->end();++aIter) + { + pEntry = *aIter; + ::rtl::OUString aField = pEntry->GetField(); + ::rtl::OUString aAlias = pEntry->GetAlias(); + + if (bCase(aField,rInfo.GetField()) && + bCase(aAlias,rInfo.GetAlias())) + { + if(!m_bOrderByUnRelated) + pEntry->SetVisible(sal_True); + pEntry->SetOrderDir( eDir ); + nPos = getDesignView()->getController()->getTableFieldDesc()->end() - aIter; + break; + } + } + + if (aIter == getDesignView()->getController()->getTableFieldDesc()->end()) + { + OTableFieldDesc* pTmp = InsertField(rInfo, -1, sal_False, sal_False ); + if(pTmp) + { + if(!m_bOrderByUnRelated) + pEntry->SetVisible(sal_True); + pTmp->SetOrderDir( eDir ); + } + + nPos = (sal_uInt16)( getDesignView()->getController()->getTableFieldDesc()->size()-1 ); + } +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::ArrangeControls(sal_uInt16& nX, sal_uInt16 nY) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DbBrowseBox::ArrangeControls(nX, nY); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::Save() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + if (IsModified()) + SaveModified(); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::CellModified() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + long nRow = GetRealRow(GetCurRow()); + switch (nRow) + { + case BROW_VIS_ROW: + { + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[GetCurColumnId() - 1]; + sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos(); + if(!m_bOrderByUnRelated && nIdx > 0 && nIdx != sal_uInt16(-1)) + { + m_pVisibleCell->GetBox().Check(); + pEntry->SetVisible(sal_True); + } + else + pEntry->SetVisible(m_pVisibleCell->GetBox().IsChecked()); + } + break; + } + getDesignView()->getController()->setModified(); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::Fill() +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(ColCount() >= 1, "OSelectionBrowseBox::Fill : please call only after inserting the handle column !"); + + sal_uInt16 nColCount = ColCount() - 1; + if (nColCount < DEFAULT_QUERY_COLS) + AppendNewCol(DEFAULT_QUERY_COLS - nColCount); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::Command(const CommandEvent& rEvt) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + switch (rEvt.GetCommand()) + { + case COMMAND_CONTEXTMENU: + { + if (!rEvt.IsMouseEvent()) + { + DbBrowseBox::Command(rEvt); + return; + } + + Point aPoint(rEvt.GetMousePosPixel()); + sal_uInt16 nColId = GetColumnAtXPosPixel(rEvt.GetMousePosPixel().X()); + long nRow = GetRowAtYPosPixel(rEvt.GetMousePosPixel().Y()); + + if (nRow < 0 && nColId > HANDLE_ID && IsColumnSelected(nColId) ) + { + if (!getDesignView()->getController()->isReadOnly()) + { + PopupMenu aContextMenu(ModuleRes(RID_QUERYCOLPOPUPMENU)); + switch (aContextMenu.Execute(this, aPoint)) + { + case SID_DELETE: // Aussch + RemoveField(nColId); + break; + } + } + } + else if(nRow >= 0 && nColId <= HANDLE_ID) + { + if (!getDesignView()->getController()->isReadOnly()) + { + PopupMenu aContextMenu(ModuleRes(RID_QUERYFUNCTION_POPUPMENU)); + aContextMenu.CheckItem( ID_QUERY_FUNCTION, m_bVisibleRow[BROW_FUNCTION_ROW]); + aContextMenu.CheckItem( ID_QUERY_TABLENAME, m_bVisibleRow[BROW_TABLE_ROW]); + aContextMenu.CheckItem( ID_QUERY_ALIASNAME, m_bVisibleRow[BROW_COLUMNALIAS_ROW]); + aContextMenu.CheckItem( ID_QUERY_DISTINCT, getDesignView()->getController()->isDistinct()); + + switch (aContextMenu.Execute(this, aPoint)) + { + case ID_QUERY_FUNCTION: + SetRowVisible(BROW_FUNCTION_ROW, !IsRowVisible(BROW_FUNCTION_ROW)); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_VIEW_FUNCTIONS ); + break; + case ID_QUERY_TABLENAME: + SetRowVisible(BROW_TABLE_ROW, !IsRowVisible(BROW_TABLE_ROW)); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_VIEW_TABLES ); + break; + case ID_QUERY_ALIASNAME: + SetRowVisible(BROW_COLUMNALIAS_ROW, !IsRowVisible(BROW_COLUMNALIAS_ROW)); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_VIEW_ALIASES ); + break; + case ID_QUERY_DISTINCT: + getDesignView()->getController()->setDistinct(!getDesignView()->getController()->isDistinct()); + getDesignView()->getController()->setModified(); + getDesignView()->getController()->InvalidateFeature( ID_BROWSER_QUERY_DISTINCT_VALUES ); + break; + } + + getDesignView()->getController()->setModified(); + } + } + else + { + DbBrowseBox::Command(rEvt); + return; + } + } + default: + DbBrowseBox::Command(rEvt); + } +} + +//------------------------------------------------------------------------------ +sal_Bool OSelectionBrowseBox::IsRowVisible(sal_uInt16 _nWhich) const +{ + DBG_ASSERT(_nWhich>=0 && _nWhich<(m_bVisibleRow.size()), "OSelectionBrowseBox::IsRowVisible : invalid parameter !"); + return m_bVisibleRow[_nWhich]; +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::SetRowVisible(sal_uInt16 _nWhich, sal_Bool _bVis) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(_nWhich>=0 && _nWhich<m_bVisibleRow.size(), "OSelectionBrowseBox::SetRowVisible : invalid parameter !"); + + sal_Bool bWasEditing = IsEditing(); + if (bWasEditing) + DeactivateCell(); + + // do this before removing or inserting rows, as this triggers ActivateCell-calls, which rely on m_bVisibleRow + m_bVisibleRow[_nWhich] = !m_bVisibleRow[_nWhich]; + + long nId = GetBrowseRow(_nWhich); + if (_bVis) + { + RowInserted(nId,1); + m_nVisibleCount++; + } + else + { + RowRemoved(nId,1); + m_nVisibleCount--; + } + + if (bWasEditing) + ActivateCell(); +} + +//------------------------------------------------------------------------------ +long OSelectionBrowseBox::GetBrowseRow(long nRowId) const +{ + long nCount(0); + for(long i=0;i<nRowId;i++) + { + if(m_bVisibleRow[i]) + nCount++; + } + return nCount; +} +//------------------------------------------------------------------------------ +long OSelectionBrowseBox::GetRealRow(long nRowId) const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + long nErg=0,i; + for(i=0;i < m_bVisibleRow.size(); i++) + { + if(m_bVisibleRow[i]) + { + if(nErg++ == nRowId) + break; + } + } + DBG_ASSERT(nErg <= m_bVisibleRow.size(),"nErg kann nicht groesser als BROW_ROW_CNT sein!"); + return i; +} +static long nVisibleRowMask[] = + { + 0x0001, + 0x0002, + 0x0004, + 0x0008, + 0x0010, + 0x0020, + 0x0040, + 0x0080, + 0x0100, + 0x0200, + 0x0400, + 0x0800 + }; +//------------------------------------------------------------------------------ +sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const +{ + sal_Int32 nErg(0); + // only the foirst 11 row are interesting + sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); + for(sal_Int32 i=0;i<nSize;i++) + { + if(!m_bVisibleRow[i]) + nErg |= nVisibleRowMask[i]; + } + return nErg; +} +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::SetNoneVisbleRow(long nRows) +{ + // only the foirst 11 row are interesting + sal_Int32 nSize = sizeof(nVisibleRowMask) / sizeof(nVisibleRowMask[0]); + for(sal_Int32 i=0;i< nSize;i++) + m_bVisibleRow[i] = !(nRows & nVisibleRowMask[i]); +} +//------------------------------------------------------------------------------ +String OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellText : invalid column id, prepare for GPF ... "); + if(pEntry->IsEmpty()) + return String(); + //if (!pEntry) + // return String(); + + String aText; + switch (nRow) + { + case BROW_TABLE_ROW: + aText = pEntry->GetAlias(); + break; + case BROW_FIELD_ROW: + { + String aField = pEntry->GetField(); + if (aField.GetChar(0) == '*') // * durch alias.* ersetzen + { + aField = pEntry->GetAlias(); + aField += '.'; + aField += '*'; + } + aText = aField; + } break; + case BROW_ORDER_ROW: + if (pEntry->GetOrderDir() != ORDER_NONE) + aText = String(ModuleRes(STR_QUERY_SORTTEXT) ).GetToken(pEntry->GetOrderDir()); + break; + case BROW_VIS_ROW: + break; + case BROW_COLUMNALIAS_ROW: + aText = pEntry->GetFieldAlias(); + break; + case BROW_FUNCTION_ROW: + if(pEntry->GetFunctionType() == FKT_AGGREGATE) + aText = pEntry->GetFunction(); + else if(pEntry->IsGroupBy()) + aText = m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1); + break; + default: + aText = pEntry->GetCriteria(nRow - BROW_CRIT1_ROW); + } + return aText; +} +//------------------------------------------------------------------------------ +sal_Bool OSelectionBrowseBox::GetFunktionName(String& rFkt) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + sal_Bool bErg=sal_True; + String aText; + + if(rFkt.EqualsIgnoreCaseAscii("AVG")) + rFkt = m_pFunctionCell->GetEntry(1); + else if(rFkt.EqualsIgnoreCaseAscii("COUNT")) + rFkt = m_pFunctionCell->GetEntry(2); + else if(rFkt.EqualsIgnoreCaseAscii("MAX")) + rFkt = m_pFunctionCell->GetEntry(3); + else if(rFkt.EqualsIgnoreCaseAscii("MIN")) + rFkt = m_pFunctionCell->GetEntry(4); + else if(rFkt.EqualsIgnoreCaseAscii("SUM")) + rFkt = m_pFunctionCell->GetEntry(5); + else + { + xub_StrLen nCount = m_aFunctionStrings.GetTokenCount(); + for (xub_StrLen i = 0; i < nCount-1; i++) // Gruppierung wird nicht mit gez"ahlt + { + if(rFkt.EqualsIgnoreCaseAscii(m_aFunctionStrings.GetToken(i))) + { + rFkt = m_aFunctionStrings.GetToken(i); + break; + } + } + if(i == nCount-1) + bErg = sal_False; + } + return bErg; +} +//------------------------------------------------------------------------------ +String OSelectionBrowseBox::GetCellContents(sal_uInt16 nCellIndex, long nColId) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(nCellIndex < (GetRowCount()-1),"CellIndex ist zu gross"); + SaveModified(); + + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId - 1]; + DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::GetCellContents : invalid column id, prepare for GPF ... "); + + + long nRow = GetRealRow(nCellIndex); + switch (nRow) + { + case BROW_VIS_ROW : + return pEntry->IsVisible() ? g_strOne : g_strZero; + case BROW_ORDER_ROW: + { + sal_uInt16 nIdx = m_pOrderCell->GetSelectEntryPos(); + if (nIdx == sal_uInt16(-1)) + nIdx = 0; + return String(nIdx); + } + default: + return GetCellText(nRow, nColId); + } +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::SetCellContents(sal_uInt16 nRow, long nColId, const String& strNewText) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + sal_Bool bWasEditing = IsEditing() && (GetCurColumnId() == nColId) && (GetCurRow() == nRow); + if (bWasEditing) + DeactivateCell(); + + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId - 1]; + DBG_ASSERT(pEntry != NULL, "OSelectionBrowseBox::SetCellContents : invalid column id, prepare for GPF ... "); + + long nCellIndex = GetRealRow(nRow); + switch (nCellIndex) + { + case BROW_VIS_ROW: + pEntry->SetVisible(strNewText == g_strOne); + break; + case BROW_FIELD_ROW: + pEntry->SetField(strNewText); + if (strNewText.Len() == 0) // bei leerem Feld auch den Tabellennamen loeschen + pEntry->SetAlias(strNewText); + break; + case BROW_TABLE_ROW: + pEntry->SetAlias(strNewText); + break; + case BROW_ORDER_ROW: + { + sal_uInt16 nIdx = (sal_uInt16)strNewText.ToInt32(); + pEntry->SetOrderDir(EOrderDir(nIdx)); + } break; + case BROW_COLUMNALIAS_ROW: + pEntry->SetFieldAlias(strNewText); + break; + case BROW_FUNCTION_ROW: + pEntry->SetFunction(strNewText); + if(m_aFunctionStrings.GetToken(m_aFunctionStrings.GetTokenCount()-1).EqualsIgnoreCaseAscii(strNewText)) + pEntry->SetGroupBy(sal_True); + else + pEntry->SetFunctionType(FKT_AGGREGATE); + break; + default: + pEntry->SetCriteria(nCellIndex - BROW_CRIT1_ROW, strNewText); + } + + RowModified(nCellIndex, nColId); + + // die entsprechende Feld-Beschreibung ist jetzt leer -> Visible auf sal_False (damit das konsistent mit normalen leeren Spalten ist) + if (pEntry->IsEmpty()) + pEntry->SetVisible(sal_False); + + if (bWasEditing) + ActivateCell(nCellIndex, nColId); + + getDesignView()->getController()->setModified(); +} +//------------------------------------------------------------------------------ +sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRow, sal_uInt16 nColId) const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + if (!pEntry) + return DEFAULT_SIZE; + + long nRowId = GetRealRow(nRow); + if (nRowId == BROW_VIS_ROW) + return CHECKBOX_SIZE; + else + return GetDataWindow().GetTextWidth(GetCellText(nRowId, nColId)); +} + +//------------------------------------------------------------------------------ +void OSelectionBrowseBox::ColumnResized(sal_uInt16 nColId) +{ + if (getDesignView()->getController()->isReadOnly()) + return; + // The resizing of columns can't be suppressed (BrowseBox doesn't support that) so we have to do this + // fake. It's not _that_ bad : the user may change column widths while in read-only mode to see all details + // but the changes aren't permanent ... + + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT(nColId <= getDesignView()->getController()->getTableFieldDesc()->size(),"ColumnResized:: nColId sollte nicht groesser als List::count sein!"); + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + DBG_ASSERT(pEntry, "OSelectionBrowseBox::ColumnResized : keine FieldDescription !"); + getDesignView()->getController()->setModified(); + DbBrowseBox::ColumnResized(nColId); + + if (pEntry) + { + OTabFieldSizedUndoAct* pUndo = new OTabFieldSizedUndoAct(this); + pUndo->SetColId(nColId); + pUndo->SetOriginalWidth(pEntry->GetColWidth()); + getDesignView()->getController()->getUndoMgr()->AddUndoAction(pUndo); + pEntry->SetColWidth(GetColumnWidth(nColId)); + } +} + +//------------------------------------------------------------------------------ +sal_uInt32 OSelectionBrowseBox::GetTotalCellWidth(long nRowId, sal_uInt16 nColId) +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + DBG_ASSERT((nColId == 0) || (nColId <= getDesignView()->getController()->getTableFieldDesc()->size()), "OSelectionBrowseBox::GetTotalCellWidth : invalid parameter nColId"); + + OTableFieldDesc* pEntry = (*getDesignView()->getController()->getTableFieldDesc())[nColId-1]; + DBG_ASSERT(pEntry!=NULL, "OSelectionBrowseBox::GetTotalCellWidth : invalid FieldDescription !"); + + long nRow = GetRealRow(nRowId); + String strText(GetCellText(nRow, nColId)); + return GetDataWindow().LogicToPixel(Size(GetDataWindow().GetTextWidth(strText),0)).Width(); +} + +//------------------------------------------------------------------------------ +sal_uInt16 OSelectionBrowseBox::GetDefaultColumnWidth(const String& rName) const +{ + DBG_CHKTHIS(OSelectionBrowseBox,NULL); + // die Baissklasse macht das von dem Text abhaengig, ich habe aber keine Spaltenueberschriften, daher haette ich + // hier gern einen anderen Default-Wert + return DEFAULT_SIZE; +} +//------------------------------------------------------------------------------ diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx new file mode 100644 index 000000000000..0a1cb810e5c5 --- /dev/null +++ b/dbaccess/source/ui/querydesign/TableConnection.cxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * $RCSfile: TableConnection.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:21: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 DBAUI_TABLECONNECTION_HXX +#include "TableConnection.hxx" +#endif +#ifndef DBAUI_CONNECTIONLINE_HXX +#include "ConnectionLine.hxx" +#endif +#ifndef DBAUI_TABLECONNECTIONDATA_HXX +#include "TableConnectionData.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef _COMPHELPER_STLTYPES_HXX_ +#include <comphelper/stl_types.hxx> +#endif + + +using namespace dbaui; +using namespace comphelper; + +TYPEINIT0(OTableConnection); +//======================================================================== +// class OTableConnection +//======================================================================== +DBG_NAME(OTableConnection); +//------------------------------------------------------------------------ +OTableConnection::OTableConnection( OQueryTableView* _pContainer, OTableConnectionData* _pTabConnData ) + :m_bSelected( FALSE ) + ,m_pParent( _pContainer ) + ,m_pData( _pTabConnData ) +{ + DBG_CTOR(OTableConnection,NULL); + Init(); +} + +//------------------------------------------------------------------------ +OTableConnection::OTableConnection( const OTableConnection& _rConn ) +{ + DBG_CTOR(OTableConnection,NULL); + m_pData = _rConn.GetData()->NewInstance(); + *this = _rConn; +} +//------------------------------------------------------------------------ +OTableConnection::~OTableConnection() +{ + ////////////////////////////////////////////////////////////////////// + // clear vector + for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter) + delete *aIter; + m_vConnLine.clear(); + DBG_DTOR(OTableConnection,NULL); +} + +//------------------------------------------------------------------------ +void OTableConnection::Init() +{ + ////////////////////////////////////////////////////////////////////// + // Linienliste mit Defaults initialisieren + ::std::vector<OConnectionLineData*>* pLineData = GetData()->GetConnLineDataList(); + ::std::vector<OConnectionLineData*>::const_iterator aIter = pLineData->begin(); + for(;aIter != pLineData->end();++aIter) + { + OConnectionLine* pConnLine = new OConnectionLine(this, *aIter); + m_vConnLine.push_back( pConnLine); + } +} + +//------------------------------------------------------------------------ +OConnectionLine* OTableConnection::CreateConnLine( const OConnectionLine& rConnLine ) +{ + return new OConnectionLine( rConnLine ); +} +//------------------------------------------------------------------------ +void OTableConnection::UpdateLineList() +{ + ////////////////////////////////////////////////////////////////////// + // Linienliste loeschen + for(::std::vector<OConnectionLine*>::iterator aLineIter = m_vConnLine.begin();aLineIter != m_vConnLine.end();++aLineIter) + delete *aLineIter; + m_vConnLine.clear(); + + ////////////////////////////////////////////////////////////////////// + // Linienliste aus der Datenliste neu erstellen + ::std::vector<OConnectionLineData*>* pLineData = GetData()->GetConnLineDataList(); + ::std::vector<OConnectionLineData*>::const_iterator aIter = pLineData->begin(); + for(;aIter != pLineData->end();++aIter) + { + OConnectionLine* pConnLine = new OConnectionLine( this, *aIter ); + m_vConnLine.push_back(pConnLine); + } + +} + +//------------------------------------------------------------------------ +OTableConnection& OTableConnection::operator=( const OTableConnection& rConn ) +{ + if( &rConn == this ) + return *this; + + // Linienliste loeschen + for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter) + delete *aIter; + m_vConnLine.clear(); + + // Linienliste kopieren + if( rConn.GetConnLineList()->size() ) + { + const ::std::vector<OConnectionLine*>* pLine = rConn.GetConnLineList(); + ::std::vector<OConnectionLine*>::const_iterator aIter = pLine->begin(); + for(;aIter != pLine->end();++aIter) + { + OConnectionLine* pDestLine = CreateConnLine( **aIter ); + m_vConnLine.push_back( pDestLine); + } + } + + // da mir die Daten nicht gehoeren, loesche ich die alten nicht + m_pData->CopyFrom(*rConn.GetData()); + // CopyFrom ist virtuell, damit ist es kein Problem, wenn m_pData von einem von OTableConnectionData abgeleiteten Typ ist + + m_bSelected = rConn.m_bSelected; + m_pParent = rConn.m_pParent; + + return *this; +} + + +//------------------------------------------------------------------------ +void OTableConnection::RecalcLines() +{ + for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter) + (*aIter)->RecalcLine(); +} +//------------------------------------------------------------------------ +OTableWindow* OTableConnection::GetSourceWin() const +{ + return m_pParent->GetWindow( GetData()->GetSourceWinName() ); +} +//------------------------------------------------------------------------ +OTableWindow* OTableConnection::GetDestWin() const +{ + return m_pParent->GetWindow( GetData()->GetDestWinName() ); +} + +//------------------------------------------------------------------------ +void OTableConnection::Select() +{ + m_bSelected = TRUE; + m_pParent->Invalidate( GetBoundingRect(), INVALIDATE_NOCHILDREN); +} + +//------------------------------------------------------------------------ +void OTableConnection::Deselect() +{ + m_bSelected = FALSE; + Rectangle rcBounding = GetBoundingRect(); + rcBounding.Bottom() += 1; + rcBounding.Right() += 1; + m_pParent->Invalidate( rcBounding, INVALIDATE_NOCHILDREN ); + // Kommentar siehe ::Invalidate ... +} + +//------------------------------------------------------------------------ +BOOL OTableConnection::CheckHit( const Point& rMousePos ) +{ + ////////////////////////////////////////////////////////////////////// + // Pruefen, ob auf eine der Linien geclickt worden ist + for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter) + { + if( (*aIter)->IsValid() && (*aIter)->CheckHit(rMousePos) ) + return TRUE; + } + return FALSE; +} + +//------------------------------------------------------------------------ +void OTableConnection::Invalidate() +{ + Rectangle rcBounding = GetBoundingRect(); + rcBounding.Bottom() += 1; + rcBounding.Right() += 1; + // ich glaube, dass sich Invalidate und Draw(Rectangle) nicht konsistent verhalten : jedenfalls waere dadurch zu + // erklaeren, warum ohne diesen Fake hier beim Loeschen einer Connection ein Strich an ihrem unteren Ende stehen bleibt : + // Invalidate erfasst dabei offensichtlich eine Pixelzeile weniger als Draw. + // Oder alles haengt ganz anders zusammen ... jedenfalls klappt es so ... + m_pParent->Invalidate( rcBounding, INVALIDATE_NOCHILDREN ); +} + +//------------------------------------------------------------------------ +Rectangle OTableConnection::GetBoundingRect() +{ + ////////////////////////////////////////////////////////////////////// + // Aus allen Linien das umgebende Rechteck bestimmen + Rectangle aBoundingRect( Point(0,0), Point(0,0) ); + Rectangle aTempRect; + for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter) + { + aTempRect = (*aIter)->GetBoundingRect(); + + ////////////////////////////////////////////////////////////////////// + // Ist das BoundingRect dieser Linie gueltig? + if( (aTempRect.GetWidth()!=1) && (aTempRect.GetHeight()!=1) ) + { + if( (aBoundingRect.GetWidth()==1) && (aBoundingRect.GetHeight()==1) ) + aBoundingRect = (*aIter)->GetBoundingRect(); + else + aBoundingRect.Union( (*aIter)->GetBoundingRect() ); + } + } + + return aBoundingRect; +} + +//------------------------------------------------------------------------ +void OTableConnection::Draw( const Rectangle& rRect ) +{ + ////////////////////////////////////////////////////////////////////// + // Nur neu zeichnen, wenn Connection innerhalb des ungueltigen Bereichs liegt +/* Rectangle aIntersectRect = GetBoundingRect().GetIntersection( rRect ); + Rectangle aBoundingRect = GetBoundingRect(); + if( !aIntersectRect.GetWidth() && !aIntersectRect.GetHeight() ) + return; +*/ + + ////////////////////////////////////////////////////////////////////// + // Linien zeichnen + for(::std::vector<OConnectionLine*>::iterator aIter = m_vConnLine.begin();aIter != m_vConnLine.end();++aIter) + (*aIter)->Draw( m_pParent ); +} + + + diff --git a/dbaccess/source/ui/querydesign/TableFieldDescription.cxx b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx new file mode 100644 index 000000000000..6189e37edf74 --- /dev/null +++ b/dbaccess/source/ui/querydesign/TableFieldDescription.cxx @@ -0,0 +1,259 @@ +/************************************************************************* + * + * $RCSfile: TableFieldDescription.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:21:47 $ + * + * 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_TABLEFIELDDESC_HXX +#include "TableFieldDescription.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_ +#include <com/sun/star/sdbc/DataType.hpp> +#endif +#ifndef _COMPHELPER_STREAMSECTION_HXX_ +#include <comphelper/streamsection.hxx> +#endif +#ifndef _COMPHELPER_BASIC_IO_HXX_ +#include <comphelper/basicio.hxx> +#endif + + +using namespace ::com::sun::star::sdbc; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; +using namespace comphelper; +using namespace dbaui; + +DBG_NAME(OTableFieldDesc); +//============================================================================== +OTableFieldDesc::OTableFieldDesc() + :m_bVisible(sal_False) + ,m_pTabWindow(0) + ,m_eOrderDir( ORDER_NONE ) + ,m_eFunctionType( FKT_NONE ) + ,m_bGroupBy(sal_False) + ,m_nColWidth(0) + ,m_eFieldType(TAB_NORMAL_FIELD) + ,m_nIndex(0) + ,m_eDataType(1000) +{ + DBG_CTOR(OTableFieldDesc,NULL); +} +//------------------------------------------------------------------------------ +OTableFieldDesc::OTableFieldDesc(const OTableFieldDesc& rRS) + :m_aTableName(rRS.GetTable()), + m_aAliasName(rRS.GetAlias()), // table range + m_aFieldName(rRS.GetField()), // column + m_aFieldAlias(rRS.GetFieldAlias()), // column alias + m_aDatabaseName(rRS.GetDatabase()), // qualifier or catalog + m_aFunctionName(rRS.GetFunction()), // Funktionsname + m_bVisible(rRS.IsVisible()), + m_pTabWindow(rRS.GetTabWindow()), + m_eDataType(rRS.GetDataType()), + m_eOrderDir(rRS.GetOrderDir()), + m_nColWidth(rRS.GetColWidth()), + m_eFieldType(rRS.GetFieldType()), + m_nIndex(rRS.GetFieldIndex()), + m_eFunctionType( rRS.GetFunctionType() ), + m_bGroupBy(rRS.IsGroupBy()) + +{ + DBG_CTOR(OTableFieldDesc,NULL); + m_vecCriteria = rRS.GetCriteria(); +} + +//------------------------------------------------------------------------------ +OTableFieldDesc::OTableFieldDesc(const ::rtl::OUString& rT, const ::rtl::OUString& rF ) + :m_bVisible(sal_False) + ,m_pTabWindow(0) + ,m_eOrderDir( ORDER_NONE ) + ,m_eFunctionType( FKT_NONE ) + ,m_bGroupBy(sal_False) +{ + DBG_CTOR(OTableFieldDesc,NULL); + SetField( rF ); SetTable( rT ); +} + +//------------------------------------------------------------------------------ +OTableFieldDesc::~OTableFieldDesc() +{ + DBG_DTOR(OTableFieldDesc,NULL); +} + +//------------------------------------------------------------------------------ +sal_Bool OTableFieldDesc::operator==( const OTableFieldDesc& rDesc ) +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + + return ( m_eOrderDir != rDesc.GetOrderDir() || + m_eDataType != rDesc.GetDataType() || + m_aAliasName != rDesc.GetAlias() || + m_aDatabaseName != rDesc.GetDatabase() || + m_aFunctionName != rDesc.GetFunction() || + m_aFieldName != rDesc.GetField() || + m_aTableName != rDesc.GetTable() || + m_bGroupBy != rDesc.IsGroupBy() || + m_vecCriteria != rDesc.GetCriteria() || + m_bVisible != rDesc.IsVisible() ); + +} + +//------------------------------------------------------------------------------ +void OTableFieldDesc::NextOrderDir() +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + int nTmp = ((int)m_eOrderDir); + nTmp++; + nTmp %= (ORDER_DESC+1); + m_eOrderDir = EOrderDir(nTmp); +} + +//------------------------------------------------------------------------------ +void OTableFieldDesc::SetCriteria( sal_uInt16 nIdx, const ::rtl::OUString& rCrit) +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + if (nIdx < m_vecCriteria.size()) + m_vecCriteria[nIdx] = rCrit; + else + { + for(sal_Int32 i=m_vecCriteria.size();i<nIdx;++i) + m_vecCriteria.push_back( ::rtl::OUString()); + m_vecCriteria.push_back(rCrit); + } +} + +//------------------------------------------------------------------------------ +::rtl::OUString OTableFieldDesc::GetCriteria( sal_uInt16 nIdx ) const +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + ::rtl::OUString aRetStr; + if( nIdx < m_vecCriteria.size()) + aRetStr = m_vecCriteria[nIdx]; + + return aRetStr; +} + +//------------------------------------------------------------------------------ +sal_Bool OTableFieldDesc::IsNumericDataType() const +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + sal_Bool bErg(sal_False); + switch (m_eDataType) + { + case DataType::BIT: + case DataType::TINYINT: + case DataType::SMALLINT: + case DataType::INTEGER: + case DataType::REAL: + case DataType::DOUBLE: + case DataType::DECIMAL: + case DataType::NUMERIC: + bErg = sal_True; + } + return bErg; +} +// ----------------------------------------------------------------------------- +void OTableFieldDesc::Load(const Reference< XObjectInputStream>& _rxIn) +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + OStreamSection aSection(_rxIn.get()); + _rxIn >> m_aTableName; + _rxIn >> m_aAliasName; + _rxIn >> m_aFieldName; + _rxIn >> m_aFieldAlias; + _rxIn >> m_aDatabaseName; + _rxIn >> m_aFunctionName; + _rxIn >> m_eDataType; + sal_Int32 nValue = 0; + _rxIn >> nValue; + m_eFunctionType = (EFunctionType)nValue; + _rxIn >> nValue; + m_eFieldType = (ETableFieldType)nValue; + _rxIn >> nValue; + m_eOrderDir = (EOrderDir)nValue; + _rxIn >> m_nColWidth; + _rxIn >> m_bGroupBy; + _rxIn >> m_bVisible; +} +//------------------------------------------------------------------------------ +void OTableFieldDesc::Save(const Reference< XObjectOutputStream>& _rxOut) +{ + DBG_CHKTHIS(OTableFieldDesc,NULL); + OStreamSection aSection(_rxOut.get()); + + _rxOut << m_aTableName; + _rxOut << m_aAliasName; + _rxOut << m_aFieldName; + _rxOut << m_aFieldAlias; + _rxOut << m_aDatabaseName; + _rxOut << m_aFunctionName; + _rxOut << m_eDataType; + _rxOut << (sal_Int32)m_eFunctionType; + _rxOut << (sal_Int32)m_eFieldType; + _rxOut << (sal_Int32)m_eOrderDir; + _rxOut << m_nColWidth; + _rxOut << m_bGroupBy; + _rxOut << m_bVisible; +} +// ----------------------------------------------------------------------------- + + + diff --git a/dbaccess/source/ui/querydesign/TableFieldInfo.hxx b/dbaccess/source/ui/querydesign/TableFieldInfo.hxx new file mode 100644 index 000000000000..2d85d549d5e6 --- /dev/null +++ b/dbaccess/source/ui/querydesign/TableFieldInfo.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * $RCSfile: TableFieldInfo.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:21:54 $ + * + * 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_TABLEFIELDINFO_HXX +#define DBAUI_TABLEFIELDINFO_HXX + +#ifndef DBAUI_ENUMTYPES_HXX +#include "QEnumTypes.hxx" +#endif +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + +namespace dbaui +{ + class OTableFieldInfo + { + private: + ETableFieldType m_eFieldType; + sal_Int32 m_eDataType; + + public: + OTableFieldInfo(); + ~OTableFieldInfo(); + + inline ETableFieldType GetKeyType() const { return m_eFieldType; } + inline void SetKey(ETableFieldType bKey=TAB_NORMAL_FIELD) { m_eFieldType = bKey; } + inline sal_Int32 GetDataType() const { return m_eDataType; } + inline void SetDataType(sal_Int32 eTyp) { m_eDataType = eTyp; } + }; +} +#endif // DBAUI_TABLEFIELDINFO_HXX + + diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx new file mode 100644 index 000000000000..e4e633d9ac6e --- /dev/null +++ b/dbaccess/source/ui/querydesign/TableWindow.cxx @@ -0,0 +1,589 @@ +/************************************************************************* + * + * $RCSfile: TableWindow.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:26:27 $ + * + * 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 +#include "TableWindow.hxx" +#endif +#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX +#include "TableWindowListBox.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif +#ifndef DBAUI_TABLEWINDOWDATA_HXX +#include "TableWindowData.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _SV_WALL_HXX +#include <vcl/wall.hxx> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XTablesSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_ +#include <com/sun/star/sdbcx/XKeysSupplier.hpp> +#endif +#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_ +#include <com/sun/star/sdbcx/KeyType.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 DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC +#include "dbustrings.hrc" +#endif +#ifndef DBAUI_QUERY_HRC +#include "Query.hrc" +#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; + +const long TABWIN_SIZING_AREA = 4; +const long LISTBOX_SCROLLING_AREA = 6; +const ULONG SCROLLING_TIMESPAN = 500; + + +TYPEINIT0(OTableWindow); +//======================================================================== +// class OTableWindow +//======================================================================== +DBG_NAME(OTableWindow); +//------------------------------------------------------------------------------ +OTableWindow::OTableWindow( Window* pParent, OTableWindowData* pTabWinData ) + :Window( pParent, WB_3DLOOK|WB_MOVEABLE ) + ,m_aTitle( this ) + ,m_nSizingFlags( SIZING_NONE ) + ,m_bActive( FALSE ) + ,m_pListBox(NULL) +{ + DBG_CTOR(OTableWindow,NULL); + // ich uebernehme nicht die Verantwortung fuer die Daten, ich merke mir nur den Zeiger darauf + m_pData = pTabWinData; + + // Position und Groesse bestimmen + if( GetData()->HasPosition() ) + SetPosPixel( GetData()->GetPosition() ); + + if( GetData()->HasSize() ) + SetSizePixel( GetData()->GetSize() ); + + // Hintergrund setzen + StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); + SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor()))); + // und Textfarbe (obwohl ich eigentlich keinen Text habe, aber wer weiss, was + // abgeleitete Klassen machen) + SetTextColor(aSystemStyle.GetButtonTextColor()); + + EnableClipSiblings(); +} + +//------------------------------------------------------------------------------ +OTableWindow::~OTableWindow() +{ + if (m_pListBox) + { + EmptyListBox(); + delete m_pListBox; + } + DBG_DTOR(OTableWindow,NULL); +} +// ----------------------------------------------------------------------------- +const OQueryTableView* OTableWindow::getTableView() const +{ + OSL_ENSURE(static_cast<OQueryTableView*>(GetParent()),"No OQueryTableView!"); + return static_cast<OQueryTableView*>(GetParent()); +} +// ----------------------------------------------------------------------------- +OQueryTableView* OTableWindow::getTableView() +{ + OSL_ENSURE(static_cast<OQueryTableView*>(GetParent()),"No OQueryTableView!"); + return static_cast<OQueryTableView*>(GetParent()); +} +// ----------------------------------------------------------------------------- +OQueryDesignView* OTableWindow::getDesignView() +{ + OSL_ENSURE(static_cast<OQueryDesignView*>(GetParent()->GetParent()->GetParent()),"No OQueryDesignView!"); + return static_cast<OQueryDesignView*>(GetParent()->GetParent()->GetParent()); +} +//------------------------------------------------------------------------------ +void OTableWindow::SetPosPixel( const Point& rNewPos ) +{ + Point aNewPosData = rNewPos + getTableView()->GetScrollOffset(); + GetData()->SetPosition( aNewPosData ); + Window::SetPosPixel( rNewPos ); +} + +//------------------------------------------------------------------------------ +void OTableWindow::SetSizePixel( const Size& rNewSize ) +{ + Size aOutSize(rNewSize); + if( aOutSize.Width() < TABWIN_WIDTH_MIN ) + aOutSize.Width() = TABWIN_WIDTH_MIN; + if( aOutSize.Height() < TABWIN_HEIGHT_MIN ) + aOutSize.Height() = TABWIN_HEIGHT_MIN; + + GetData()->SetSize( aOutSize ); + Window::SetSizePixel( aOutSize ); +} +//------------------------------------------------------------------------------ +void OTableWindow::SetPosSizePixel( const Point& rNewPos, const Size& rNewSize ) +{ + SetPosPixel( rNewPos ); + SetSizePixel( rNewSize ); +} + +//------------------------------------------------------------------------------ +OTableWindowListBox* OTableWindow::CreateListBox() +{ + return new OTableWindowListBox(this, GetComposedName(), GetTableName()); +} + +//------------------------------------------------------------------------------ +BOOL OTableWindow::FillListBox() +{ + // mark all primary keys with special image + ImageList aImageList(ModuleRes(IMG_JOINS)); + Image aPrimKeyImage = aImageList.GetImage(IMG_PRIMARY_KEY); + + if (GetData()->IsShowAll()) + m_pListBox->InsertEntry( ::rtl::OUString::createFromAscii("*") ); + + // first we need the keys from the table + Reference<XKeysSupplier> xKeys(m_xTable,UNO_QUERY); + Reference<XNameAccess> xPKeyColumns; + if(xKeys.is()) + { + Reference< XIndexAccess> xKeyIndex = xKeys->getKeys(); + Reference<XColumnsSupplier> xColumnsSupplier; + // search the one and only primary key + for(sal_Int32 i=0;i< xKeyIndex->getCount();++i) + { + Reference<XPropertySet> xProp; + xKeyIndex->getByIndex(i) >>= xProp; + sal_Int32 nKeyType = 0; + xProp->getPropertyValue(PROPERTY_TYPE) >>= nKeyType; + if(KeyType::PRIMARY == nKeyType) + { + xColumnsSupplier = Reference<XColumnsSupplier>(xProp,UNO_QUERY); + break; + } + } + if(xColumnsSupplier.is()) + xPKeyColumns = xColumnsSupplier->getColumns(); + } + Sequence< ::rtl::OUString> aColumns = m_xColumns->getElementNames(); + const ::rtl::OUString* pBegin = aColumns.getConstArray(); + const ::rtl::OUString* pEnd = pBegin + aColumns.getLength(); + + for (; pBegin != pEnd; ++pBegin) + { + // is this column in the primary key + if (xPKeyColumns.is() && xPKeyColumns->hasByName(*pBegin)) + m_pListBox->InsertEntry(*pBegin, aPrimKeyImage, aPrimKeyImage); + else + m_pListBox->InsertEntry(*pBegin); + } + + return TRUE; +} + +//------------------------------------------------------------------------------ +void OTableWindow::EmptyListBox() +{ + // da ich defaultmaessig keine USerData an die Items haenge, kann ich hier einfach loeschen + SvLBoxEntry* pEntry = m_pListBox->First(); + + while(pEntry) + { + SvLBoxEntry* pNextEntry = m_pListBox->Next(pEntry); + m_pListBox->GetModel()->Remove(pEntry); + pEntry = pNextEntry; + } +} + +//------------------------------------------------------------------------------ +BOOL OTableWindow::Init() +{ + // get the from the connection + OQueryDesignView* pParent = getDesignView(); + Reference<XConnection > xConnection = pParent->getController()->getConnection(); + Reference<XTablesSupplier> xSups(xConnection,UNO_QUERY); + OSL_ENSURE(xSups.is(),"The connection isn't a tablessupplier!"); + Reference<XNameAccess> xTables = xSups->getTables(); + + ::rtl::OUString aName = GetTableName(); + if(!xTables->hasByName(aName)) + return FALSE; + + xTables->getByName(aName) >>= m_xTable; + Reference<XColumnsSupplier> xColumnsSups(m_xTable,UNO_QUERY); + m_xColumns = xColumnsSups->getColumns(); + + + // ListBox anlegen, wenn notwendig + if (!m_pListBox) + { + m_pListBox = CreateListBox(); + DBG_ASSERT(m_pListBox != NULL, "OTableWindow::Init() : CreateListBox hat NULL geliefert !"); + m_pListBox->SetSelectionMode(MULTIPLE_SELECTION); + } + + // Titel setzen + m_aTitle.SetText( m_pData->GetWinName() ); + m_aTitle.Show(); + + m_pListBox->Show(); + + // die Felder in die ListBox eintragen + EmptyListBox(); + if (!FillListBox()) + return FALSE; + m_pListBox->SelectAll(FALSE); + return TRUE; +} + +//------------------------------------------------------------------------------ +void OTableWindow::DataChanged(const DataChangedEvent& rDCEvt) +{ + if (rDCEvt.GetType() == DATACHANGED_SETTINGS) + { + // nehmen wir den worst-case an : die Farben haben sich geaendert, also + // mich anpassen + StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); + SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor()))); + SetTextColor(aSystemStyle.GetButtonTextColor()); + } +} +//------------------------------------------------------------------------------ +void OTableWindow::Paint( const Rectangle& rRect ) +{ + Rectangle aRect( Point(0,0), GetOutputSizePixel() ); + Window::Paint( rRect ); + Draw3DBorder( aRect ); +} + +//------------------------------------------------------------------------------ +void OTableWindow::SetTitle( const ::rtl::OUString& rTit ) +{ + m_aTitle.SetText( rTit ); +} + +//------------------------------------------------------------------------------ +void OTableWindow::Draw3DBorder(const Rectangle& rRect) +{ + // die Style-Settings des Systems fuer meine Farben + StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); + + // Schwarze Linie unten und rechts + SetLineColor(aSystemStyle.GetDarkShadowColor()); + DrawLine( rRect.BottomLeft(), rRect.BottomRight() ); + DrawLine( rRect.BottomRight(), rRect.TopRight() ); + + // Dunkelgraue Linie ueber der schwarzen + SetLineColor(aSystemStyle.GetShadowColor()); + DrawLine( rRect.BottomLeft()+Point(1,-1), rRect.BottomRight()-Point(1,1) ); + DrawLine( rRect.BottomRight()-Point(1,1), rRect.TopRight()+Point(-1,1) ); + + // Hellgraue Linie links und oben + SetLineColor(aSystemStyle.GetLightColor()); + DrawLine( rRect.BottomLeft()+Point(1,-2), rRect.TopLeft()+Point(1,1) ); + DrawLine( rRect.TopLeft()+Point(1,1), rRect.TopRight()+Point(-2,1) ); +} + +//------------------------------------------------------------------------------ +void OTableWindow::MouseMove( const MouseEvent& rEvt ) +{ + Window::MouseMove(rEvt); + + OQueryTableView* pCont = getTableView(); + if (pCont->getDesignView()->getController()->isReadOnly()) + return; + + Point aPos = rEvt.GetPosPixel(); + Size aOutSize = GetOutputSizePixel(); + Pointer aPointer; + + ////////////////////////////////////////////////////////////////////// + // Flags anpassen, wenn Mauszeiger in sizingArea + m_nSizingFlags = SIZING_NONE; + + if( aPos.X() < TABWIN_SIZING_AREA ) + m_nSizingFlags |= SIZING_LEFT; + + if( aPos.Y() < TABWIN_SIZING_AREA ) + m_nSizingFlags |= SIZING_TOP; + + if( aPos.X() > aOutSize.Width()-TABWIN_SIZING_AREA ) + m_nSizingFlags |= SIZING_RIGHT; + + if( aPos.Y() > aOutSize.Height()-TABWIN_SIZING_AREA ) + m_nSizingFlags |= SIZING_BOTTOM; + + ////////////////////////////////////////////////////////////////////// + // Mauszeiger anpassen, wenn Mauszeiger in sizingArea + switch( m_nSizingFlags ) + { + case SIZING_TOP: + case SIZING_BOTTOM: + aPointer = Pointer( POINTER_SSIZE ); + break; + + case SIZING_LEFT: + case SIZING_RIGHT: + aPointer = Pointer( POINTER_ESIZE ); + break; + + case SIZING_LEFT+SIZING_TOP: + case SIZING_RIGHT+SIZING_BOTTOM: + aPointer = Pointer( POINTER_SESIZE ); + break; + + case SIZING_RIGHT+SIZING_TOP: + case SIZING_LEFT+SIZING_BOTTOM: + aPointer = Pointer( POINTER_NESIZE ); + break; + } + + SetPointer( aPointer ); +} + +//------------------------------------------------------------------------------ +void OTableWindow::MouseButtonDown( const MouseEvent& rEvt ) +{ + ////////////////////////////////////////////////////////////////////// + // Wenn sizing, dann bekommt Parent die Nachricht, + // dass jetzt die Fenstergroesse seines Childs veraendert wird + if( m_nSizingFlags ) + getTableView()->BeginChildSizing( this, GetPointer() ); + + Window::MouseButtonDown( rEvt ); +} + + + +//------------------------------------------------------------------------------ +void OTableWindow::Resize() +{ + ////////////////////////////////////////////////////////////////////// + // Modify Flag des Documents nicht beim ersten Resize setzen + if( IsVisible() ) + { + OQueryTableView* pTabWinCont = getTableView(); +// pTabWinCont->GetViewShell()->GetShell->SetModified( TRUE ); + } + + ////////////////////////////////////////////////////////////////////// + // Das Fenster darf nicht verschwinden, deshalb min. Groesse setzen + Size aOutSize = GetOutputSizePixel(); + aOutSize = Size(CalcZoom(aOutSize.Width()),CalcZoom(aOutSize.Height())); + Point aPos = GetPosPixel(); + + long nCharHeight = CalcZoom(GetTextHeight())+ CalcZoom(4); +// if( aOutSize.Width() < TABWIN_WIDTH_MIN ) +// { +// aOutSize.Width() = TABWIN_WIDTH_MIN; +// bChanged = sal_True; +// } +// if( aOutSize.Height() < TABWIN_HEIGHT_MIN ) +// { +// aOutSize.Height() = TABWIN_HEIGHT_MIN; +// nCharHeight = GetTextHeight() + 4; +// bChanged = sal_True; +// } +// if(bChanged) +// { +// SetPosSizePixel( aPos, aOutSize ); +// m_pData->SetSize( aOutSize ); +// } + + ////////////////////////////////////////////////////////////////////// + // Titel und ListBox anpassen + // long nCharHeight = GetTextHeight() + 4; + long n5Pos = CalcZoom(5); + long n10Pos = CalcZoom(10); + m_aTitle.SetPosSizePixel( Point(n5Pos,n5Pos), Size( aOutSize.Width()-n10Pos, nCharHeight) ); + m_pListBox->SetPosSizePixel( Point(n5Pos,nCharHeight+n5Pos), Size(aOutSize.Width()-n10Pos,aOutSize.Height()-nCharHeight-n10Pos) ); + + Window::Invalidate(); +} + +//------------------------------------------------------------------------------ +void OTableWindow::SetBoldTitle( BOOL bBold ) +{ + Font aFont = m_aTitle.GetFont(); + aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL ); + m_aTitle.SetFont( aFont ); + m_aTitle.Invalidate(); +} + +//------------------------------------------------------------------------------ +void OTableWindow::GetFocus() +{ + SetBoldTitle( TRUE ); + m_bActive = TRUE; +} + +//------------------------------------------------------------------------------ +void OTableWindow::LoseFocus() +{ + SetBoldTitle( FALSE ); + m_bActive = FALSE; +} + +//------------------------------------------------------------------------------ +void OTableWindow::Remove() +{ + ////////////////////////////////////////////////////////////////// + // Fenster loeschen + OQueryTableView* pTabWinCont = getTableView(); + pTabWinCont->RemoveTabWin( this ); + pTabWinCont->Invalidate(); +} + +//------------------------------------------------------------------------------ +void OTableWindow::KeyInput( const KeyEvent& rEvt ) +{ + USHORT nCode = rEvt.GetKeyCode().GetCode(); + BOOL bShift = rEvt.GetKeyCode().IsShift(); + BOOL bCtrl = rEvt.GetKeyCode().IsMod1(); + + if( !bCtrl && !bShift && (nCode==KEY_DELETE) ) + { + Remove(); + } + else + Window::KeyInput( rEvt ); +} + +//------------------------------------------------------------------------------ +void OTableWindow::InvalidateLines() +{ + getTableView()->InvalidateConnections(); +} + +//------------------------------------------------------------------------------ +BOOL OTableWindow::ExistsAConn() const +{ + return getTableView()->ExistsAConn(this); +} +//------------------------------------------------------------------------------ +void OTableWindow::EnumValidFields(::std::vector< ::rtl::OUString>& arrstrFields) +{ + arrstrFields.clear(); + // diese Default-Implementierung zaehlt einfach alles auf, was es in der ListBox gibt ... fuer anderes Verhalten ueberschreiben + if (!m_pListBox) + return; + + SvLBoxEntry* pEntryLoop = m_pListBox->First(); + while (pEntryLoop) + { + arrstrFields.push_back(m_pListBox->GetEntryText(pEntryLoop)); + pEntryLoop = m_pListBox->Next(pEntryLoop); + } +} +// ----------------------------------------------------------------------------- +void OTableWindow::StateChanged( StateChangedType nType ) +{ + Window::StateChanged( nType ); + + if ( nType == STATE_CHANGE_ZOOM ) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + Font aFont = rStyleSettings.GetGroupFont(); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + + m_aTitle.SetZoom(GetZoom()); + m_pListBox->SetZoom(GetZoom()); + Resize(); + Invalidate(); + } +} +// ----------------------------------------------------------------------------- + + + diff --git a/dbaccess/source/ui/querydesign/TableWindowData.cxx b/dbaccess/source/ui/querydesign/TableWindowData.cxx new file mode 100644 index 000000000000..1eb37c6695cf --- /dev/null +++ b/dbaccess/source/ui/querydesign/TableWindowData.cxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * $RCSfile: TableWindowData.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:22: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_TABLEWINDOWDATA_HXX +#include "TableWindowData.hxx" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _COMPHELPER_STREAMSECTION_HXX_ +#include <comphelper/streamsection.hxx> +#endif +#ifndef _COMPHELPER_BASIC_IO_HXX_ +#include <comphelper/basicio.hxx> +#endif + + +using namespace dbaui; +using namespace comphelper; +using namespace ::com::sun::star::io; +using namespace ::com::sun::star::uno; + +TYPEINIT0(OTableWindowData); + +//================================================================== +// class OTableWindowData +//================================================================== +DBG_NAME(OTableWindowData); +//------------------------------------------------------------------------------ +OTableWindowData::OTableWindowData() + :m_aPosition( Point(-1,-1) ) + ,m_aSize( Size(-1,-1) ) + ,m_bShowAll( TRUE ) +{ + DBG_CTOR(OTableWindowData,NULL); +} + +//------------------------------------------------------------------------------ +OTableWindowData::OTableWindowData( const ::rtl::OUString& _rComposedName, const ::rtl::OUString& rTableName, const ::rtl::OUString& rWinName ) + :m_sComposedName(_rComposedName) + ,m_aTableName( rTableName ) + ,m_aWinName( rWinName ) + ,m_aPosition( Point(-1,-1) ) + ,m_aSize( Size(-1,-1) ) + ,m_bShowAll( TRUE ) +{ + DBG_CTOR(OTableWindowData,NULL); + if( !m_aWinName.getLength() ) + m_aWinName = m_aTableName; +} + +//------------------------------------------------------------------------------ +OTableWindowData::~OTableWindowData() +{ + DBG_DTOR(OTableWindowData,NULL); +} + +//------------------------------------------------------------------------------ +BOOL OTableWindowData::HasPosition() const +{ + return ( (m_aPosition.X() != -1) && (m_aPosition.Y() != -1) ); +} + +//------------------------------------------------------------------------------ +BOOL OTableWindowData::HasSize() const +{ + return ( (m_aSize.Width() != -1) && (m_aSize.Height() !=-1) ); +} + +//------------------------------------------------------------------------------ +void OTableWindowData::Load(const Reference<XObjectInputStream>& _rxIn) +{ + OStreamSection aSection(_rxIn.get()); + _rxIn >> m_aTableName; + _rxIn >> m_aWinName; + _rxIn >> m_aPosition.X(); + _rxIn >> m_aPosition.Y(); + _rxIn >> m_aSize.Width(); + _rxIn >> m_aSize.Height(); +} +//------------------------------------------------------------------------------ +void OTableWindowData::Save(const Reference<XObjectOutputStream>& _rxOut) +{ + OStreamSection aSection(_rxOut.get()); + _rxOut << m_aTableName; + _rxOut << m_aWinName; + _rxOut << m_aPosition.X(); + _rxOut << m_aPosition.Y(); + _rxOut << m_aSize.Width(); + _rxOut << m_aSize.Height(); +}
\ No newline at end of file diff --git a/dbaccess/source/ui/querydesign/TableWindowTitle.cxx b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx new file mode 100644 index 000000000000..0490ce54a917 --- /dev/null +++ b/dbaccess/source/ui/querydesign/TableWindowTitle.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * $RCSfile: TableWindowTitle.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:26:47 $ + * + * 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 +#include "TableWindowTitle.hxx" +#endif +#ifndef DBAUI_TABLEWINDOW_HXX +#include "TableWindow.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif +#ifndef _SV_HELP_HXX +#include <vcl/help.hxx> +#endif +#ifndef _SV_MENU_HXX +#include <vcl/menu.hxx> +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC +#include "dbustrings.hrc" +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef _CNTIDS_HRC +#include <sfx2/cntidS.hrc> +#endif +#ifndef DBAUI_TABLEWINDOWLISTBOX_HXX +#include "TableWindowListBox.hxx" +#endif +#ifndef DBAUI_TABLECONNECTION_HXX +#include "TableConnection.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#include "QueryDesignView.hxx" +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif + +using namespace dbaui; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::uno; +//================================================================== +// class OTableWindowTitle +//================================================================== +DBG_NAME(OTableWindowTitle); +//------------------------------------------------------------------------------ +OTableWindowTitle::OTableWindowTitle( OTableWindow* pParent ) : + Control( pParent, WB_3DLOOK ) + ,m_pTabWin( pParent ) +{ + DBG_CTOR(OTableWindowTitle,NULL); + // Hintergrund- und Textfarbe setzen + StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); + SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor()))); + SetTextColor(aSystemStyle.GetButtonTextColor()); + + Font aFont( GetFont() ); + aFont.SetTransparent( TRUE ); + SetFont( aFont ); +} + +//------------------------------------------------------------------------------ +OTableWindowTitle::~OTableWindowTitle() +{ + DBG_DTOR(OTableWindowTitle,NULL); +} + +//------------------------------------------------------------------------------ +void OTableWindowTitle::GetFocus() +{ + m_pTabWin->GetFocus(); +} + +//------------------------------------------------------------------------------ +void OTableWindowTitle::LoseFocus() +{ + m_pTabWin->LoseFocus(); +} +//------------------------------------------------------------------------------ +void OTableWindowTitle::RequestHelp( const HelpEvent& rHEvt ) +{ + Reference<XPropertySet> xProp(m_pTabWin->GetTable(),UNO_QUERY); + + if(xProp.is()) + { + ::rtl::OUString aTableName; + xProp->getPropertyValue(PROPERTY_NAME) >>= aTableName; + String aHelpText = aTableName.getStr(); + if( aHelpText.Len()) + { + // Hilfe anzeigen + Rectangle aItemRect(Point(0,0),GetSizePixel()); + aItemRect = LogicToPixel( aItemRect ); + Point aPt = OutputToScreenPixel( aItemRect.TopLeft() ); + aItemRect.Left() = aPt.X(); + aItemRect.Top() = aPt.Y(); + aPt = OutputToScreenPixel( aItemRect.BottomRight() ); + aItemRect.Right() = aPt.X(); + aItemRect.Bottom() = aPt.Y(); + if( rHEvt.GetMode() == HELPMODE_BALLOON ) + Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aHelpText); + else + Help::ShowQuickHelp( this, aItemRect, aHelpText ); + } + } +} + +//------------------------------------------------------------------------------ +void OTableWindowTitle::Command( const CommandEvent& rEvt ) +{ + if( !m_pTabWin->IsActive() ) + return; + + switch( rEvt.GetCommand() ) + { + case COMMAND_CONTEXTMENU: + { + OQueryTableView* pView = static_cast<OQueryTableView*>(m_pTabWin->getTableView()); + OSL_ENSURE(pView,"No OQueryTableView!"); + if (!pView->getDesignView()->getController()->isReadOnly()) + { + Point aPoint = rEvt.GetMousePosPixel(); + PopupMenu aContextMenu( ModuleRes(RID_QUERYCOLPOPUPMENU) ); + switch (aContextMenu.Execute(this, aPoint)) + { + case SID_DELETE: + m_pTabWin->Remove(); + + break; + default: + Control::Command(rEvt); + } + } + } + } +} + +//------------------------------------------------------------------------------ +void OTableWindowTitle::Paint( const Rectangle& rRect ) +{ + ////////////////////////////////////////////////////////////////////// + // Ausgabe des Textes in der Titelzeile + Rectangle aWinRect( Point(0,0), GetSizePixel() ); + DrawText( aWinRect, GetText(), TEXT_DRAW_CENTER|TEXT_DRAW_VCENTER|TEXT_DRAW_ENDELLIPSIS ); +} + +//------------------------------------------------------------------------------ +void OTableWindowTitle::KeyInput( const KeyEvent& rEvt ) +{ + m_pTabWin->KeyInput( rEvt ); +} + +//------------------------------------------------------------------------------ +void OTableWindowTitle::MouseButtonDown( const MouseEvent& rEvt ) +{ + if( rEvt.IsLeft() ) + { + if( rEvt.GetClicks() == 2) + { + Size aSize(GetTextWidth(GetText()) + 20, + m_pTabWin->GetSizePixel().Height() - m_pTabWin->GetListBox()->GetSizePixel().Height()); + + aSize.Height() += (m_pTabWin->GetListBox()->GetEntryCount() + 2) * m_pTabWin->GetListBox()->GetEntryHeight(); + m_pTabWin->SetSizePixel(aSize); + + OQueryTableView* pView = static_cast<OQueryTableView*>(m_pTabWin->getTableView()); + OSL_ENSURE(pView,"No OQueryTableView!"); + ::std::vector<OTableConnection*>* pConns = pView->GetTabConnList(); + for(::std::vector<OTableConnection*>::iterator aIter = pConns->begin();aIter != pConns->end();++aIter) + (*aIter)->RecalcLines(); + + pView->InvalidateConnections(); + } + else + { + Point aPos = rEvt.GetPosPixel(); + aPos = OutputToScreenPixel( aPos ); + OQueryTableView* pView = static_cast<OQueryTableView*>(m_pTabWin->getTableView()); + OSL_ENSURE(pView,"No OQueryTableView!"); + pView->NotifyTitleClicked( static_cast<OTableWindow*>(GetParent()), aPos ); + } + GrabFocus(); + } + else + Control::MouseButtonDown( rEvt ); +} + + +//------------------------------------------------------------------------------ +void OTableWindowTitle::DataChanged(const DataChangedEvent& rDCEvt) +{ + if (rDCEvt.GetType() == DATACHANGED_SETTINGS) + { + // nehmen wir den worst-case an : die Farben haben sich geaendert, also + // mich anpassen + StyleSettings aSystemStyle = Application::GetSettings().GetStyleSettings(); + SetBackground(Wallpaper(Color(aSystemStyle.GetFaceColor()))); + SetTextColor(aSystemStyle.GetButtonTextColor()); + } +} +// ----------------------------------------------------------------------------- +void OTableWindowTitle::StateChanged( StateChangedType nType ) +{ + Window::StateChanged( nType ); + + if ( nType == STATE_CHANGE_ZOOM ) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + Font aFont = rStyleSettings.GetGroupFont(); + if ( IsControlFont() ) + aFont.Merge( GetControlFont() ); + SetZoomedPointFont( aFont ); + + Resize(); + } +} + + + + diff --git a/dbaccess/source/ui/querydesign/query.src b/dbaccess/source/ui/querydesign/query.src new file mode 100644 index 000000000000..383ab034005d --- /dev/null +++ b/dbaccess/source/ui/querydesign/query.src @@ -0,0 +1,1366 @@ +/************************************************************************* + * + * $RCSfile: query.src,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20:30 $ + * + * 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 DBAUI_QUERY_HRC +#include "Query.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 + +Menu RID_QUERYCOLPOPUPMENU +{ + ItemList = + { + MenuItem + { + ITEM_EDIT_DELETE + }; + }; +}; +ImageList IMG_JOINS +{ + ImageBitmap = Bitmap { File = "joins.bmp"; }; + MaskColor = Color { + Red = 0xffff; + Green = 0x0000; + Blue = 0xffff; + }; + IdList = { + IMG_PRIMARY_KEY; IMG_FOREIGN_KEY; + }; + IdCount = { 2; }; +}; + +String STR_QUERY_UNDO_TABWINSHOW +{ + /* ### ACHTUNG: Neuer Text in Resource? Tabellenfenster hinzufgen : Tabellenfenster hinzufgen */ + Text = "Tabellenfenster hinzufgen" ; + Text [ ENGLISH ] = "Add Tablewindow" ; + Text [ english_us ] = "Add Table" ; + Text [ portuguese_brazilian ] = "Tabellenfenster hinzufgen" ; + Text [ swedish ] = "Lgg till tabellfnster" ; + Text [ danish ] = "Tilfj tabelvindue" ; + Text [ italian ] = "Aggiungi finestra di tabella" ; + Text [ spanish ] = "Aadir ventana de tabla" ; + Text [ french ] = "Ajouter une fentre de table" ; + Text [ dutch ] = "Tabelvenster toevoegen" ; + Text [ portuguese ] = "Adicionar janela de tabela" ; + Text[ chinese_simplified ] = "Ӵ"; + Text[ russian ] = " "; + Text[ polish ] = "Dodaj okno tabeli"; + Text[ japanese ] = "ðٳ̒lj"; + Text[ chinese_traditional ] = "sW"; + Text[ dutch ] = "Tabelvenster toevoegen"; + Text[ chinese_simplified ] = "Ӵ"; + Text[ greek ] = " "; + Text[ korean ] = "̺ "; + Text[ arabic ] = " "; + Text[ turkish ] = "Tablo penceresi ekle"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_UNDO_MOVETABWIN +{ + Text = "Tabellenfenster verschieben" ; + Text [ ENGLISH ] = "move table window" ; + Text [ english_us ] = "Move table window" ; + Text [ portuguese_brazilian ] = "Tabellenfenster verschieben" ; + Text [ swedish ] = "Flytta tabellfnster" ; + Text [ danish ] = "Flyt tabelvindue" ; + Text [ italian ] = "Sposta finestra di tabella" ; + Text [ spanish ] = "Desplazar ventana de tabla" ; + Text [ french ] = "Dplacer une fentre de table" ; + Text [ dutch ] = "Tabelvenster verplaatsen" ; + Text [ portuguese ] = "Mover janela da tabela" ; + Text[ chinese_simplified ] = "ƶӴ"; + Text[ russian ] = " "; + Text[ polish ] = "Przenie okno tabeli"; + Text[ japanese ] = "ðٳ̈ړ"; + Text[ chinese_traditional ] = "ʪ"; + Text[ dutch ] = "Tabelvenster verplaatsen"; + Text[ chinese_simplified ] = "ƶӴ"; + Text[ greek ] = " "; + Text[ korean ] = "̺â ̵"; + Text[ arabic ] = " "; + Text[ turkish ] = "Tablo penceresini ta"; + Text[ language_user1 ] = " "; +}; +String STR_QUERY_UNDO_INSERTCONNECTION +{ + Text = "Verbindung einfgen" ; + Text [ ENGLISH ] = "insert connection" ; + Text [ english_us ] = "Insert Join" ; + Text [ portuguese_brazilian ] = "Verbindung einfgen" ; + Text [ swedish ] = "Infoga frbindelse" ; + Text [ danish ] = "Tilfj forbindelse" ; + Text [ italian ] = "Inserisci collegamento" ; + Text [ spanish ] = "Insertar conexin" ; + Text [ french ] = "Insrer un lien" ; + Text [ dutch ] = "Verbinding invoegen" ; + Text [ portuguese ] = "Inserir ligao" ; + Text[ chinese_simplified ] = ""; + Text[ russian ] = " "; + Text[ polish ] = "Wstaw sprzenie"; + Text[ japanese ] = "̑}"; + Text[ chinese_traditional ] = "Js"; + Text[ dutch ] = "Verbinding invoegen"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ arabic ] = " "; + Text[ turkish ] = "Balant ekle"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_UNDO_REMOVECONNECTION +{ + Text = "Verbindung lschen" ; + Text [ ENGLISH ] = "delete connection" ; + Text [ english_us ] = "Delete Join" ; + Text [ portuguese_brazilian ] = "Verbindung lschen" ; + Text [ swedish ] = "Radera frbindelse" ; + Text [ danish ] = "Slet forbindelse" ; + Text [ italian ] = "Termina collegamento" ; + Text [ spanish ] = "Eliminar conexin" ; + Text [ french ] = "Supprimer un lien" ; + Text [ dutch ] = "Verbinding wissen" ; + Text [ portuguese ] = "Eliminar ligao" ; + Text[ chinese_simplified ] = "ɾ"; + Text[ russian ] = " "; + Text[ polish ] = "Usu sprzenie"; + Text[ japanese ] = "̍폜"; + Text[ chinese_traditional ] = "Rs"; + Text[ dutch ] = "Verbinding wissen"; + Text[ chinese_simplified ] = "ɾ"; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ arabic ] = " "; + Text[ turkish ] = "Balanty sil"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_UNDO_SIZETABWIN +{ + Text = "Tabellenfenster - Gre aendern" ; + Text [ ENGLISH ] = "size table window" ; + Text [ english_us ] = "Resize table window" ; + Text [ portuguese_brazilian ] = "Tabellenfenster - Gre aendern" ; + Text [ swedish ] = "Tabellfnster - ndra storlek" ; + Text [ danish ] = "Tabelvindue - modificer strrelse" ; + Text [ italian ] = "Finestra di tabella - cambia dimensione" ; + Text [ spanish ] = "Ventana de tabla - Modificar tamao" ; + Text [ french ] = "Modifier la taille d'une fentre de table" ; + Text [ dutch ] = "Tabelvenster - Grootte veranderen" ; + Text [ portuguese ] = "Janela da tabela - modificar tamanho" ; + Text[ chinese_simplified ] = "ıӴС"; + Text[ russian ] = " "; + Text[ polish ] = "Zmie wielko okna tabeli"; + Text[ japanese ] = "ðٳ̑傫ύX"; + Text[ chinese_traditional ] = "ܧjp"; + Text[ dutch ] = "Tabelvenster - Grootte veranderen"; + Text[ chinese_simplified ] = "ıӴС"; + Text[ greek ] = " - "; + Text[ korean ] = "̺â- ũ "; + Text[ arabic ] = " "; + Text[ turkish ] = "Tablo penceresini yeniden boyutlandr"; + Text[ language_user1 ] = " "; +}; +String STR_QUERY_UNDO_TABFIELDDELETE +{ + /* ### ACHTUNG: Neuer Text in Resource? Spalte lschen : Spalte lschen */ + Text = "Spalte lschen" ; + Text [ ENGLISH ] = "Delete Column" ; + Text [ english_us ] = "Delete Column" ; + Text [ portuguese_brazilian ] = "Spalte lschen" ; + Text [ swedish ] = "Radera kolumn" ; + Text [ danish ] = "Slet kolonne" ; + Text [ italian ] = "Elimina colonna" ; + Text [ spanish ] = "Eliminar columna" ; + Text [ french ] = "Supprimer la colonne" ; + Text [ dutch ] = "Kolom wissen" ; + Text [ portuguese ] = "Eliminar coluna" ; + Text[ chinese_simplified ] = "ɾ"; + Text[ russian ] = " "; + Text[ polish ] = "Usu kolumn"; + Text[ japanese ] = "̍폜"; + Text[ chinese_traditional ] = "R"; + Text[ dutch ] = "Kolom wissen"; + Text[ chinese_simplified ] = "ɾ"; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ arabic ] = " "; + Text[ turkish ] = "Stunu sil"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_UNDO_TABFIELDCREATE +{ + /* ### ACHTUNG: Neuer Text in Resource? Spalte hinzufgen : Spalte hinzufgen */ + Text = "Spalte hinzufgen" ; + Text [ ENGLISH ] = "Add Column" ; + Text [ english_us ] = "Add Column" ; + Text [ portuguese_brazilian ] = "Spalte hinzufgen" ; + Text [ swedish ] = "Lgg till kolumn" ; + Text [ danish ] = "Tilfj kolonne" ; + Text [ italian ] = "Aggiungi colonna" ; + Text [ spanish ] = "Aadir columna" ; + Text [ french ] = "Ajouter une colonne" ; + Text [ dutch ] = "Kolom toevoegen" ; + Text [ portuguese ] = "Adicionar coluna" ; + Text[ chinese_simplified ] = ""; + Text[ russian ] = " "; + Text[ polish ] = "Dodaj kolumn"; + Text[ japanese ] = "̒lj"; + Text[ chinese_traditional ] = "sW"; + Text[ dutch ] = "Kolom toevoegen"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = " "; + Text[ korean ] = " ߰"; + Text[ arabic ] = " "; + Text[ turkish ] = "Stun ekle"; + Text[ language_user1 ] = " "; +}; +String RID_STR_TABLE_DOESNT_EXIST +{ + Text = "Der Ausdruck ist ungueltig, da keine Tabelle '$name$' existiert !"; + Text [ ENGLISH ] = "The expression is invalid because table '$name$' doesn't exist !"; + Text[ english_us ] = "Invalid statement, table '$name$' does not exist !"; + Text[ portuguese ] = "A expresso no vlida, porque a tabela '$name$' no existe!"; + Text[ russian ] = " , .. '$name$' !"; + Text[ dutch ] = "De uitdrukking is ongeldig daar de tabel '$name$' niet bestaat !"; + Text[ french ] = "Expression incorrecte : la table '$name$' n'existe pas !"; + Text[ spanish ] = "La expresin no es vlida porque no existe ninguna tabla '$name$'!"; + Text[ italian ] = "L'espressione non valida in quanto la tabella '$name$' non esiste !"; + Text[ danish ] = "Udtrykket er ugyldigt, tabel '$name$' eksisterer ikke !"; + Text[ swedish ] = "Uttrycket r ogiltigt d det inte existerar ngon tabell med namnet '$name$'!"; + Text[ polish ] = "Wyraenie jest nieprawidowe, poniewa nie istnieje tabela '$name$'!"; + Text[ portuguese_brazilian ] = "The expression is invalid because table '$name$' doesn't exist !"; + Text[ japanese ] = "ð'$O$'Ȃ߁A̕\\͖ł!"; + Text[ chinese_simplified ] = "ʽЧΪ '$name$' ڣ"; + Text[ chinese_traditional ] = "oӪFLġA]W '$name$' sbI"; + Text[ dutch ] = "De uitdrukking is ongeldig daar de tabel '$name$' niet bestaat !"; + Text[ chinese_simplified ] = "ʽЧΪ '$name$' ڣ"; + Text[ greek ] = " , '$name$' !"; + Text[ korean ] = "̺ '$name$' Ƿ ȿ Դϴ !"; + Text[ arabic ] = " ɡ '$name$'!"; + Text[ turkish ] = "Geersiz deyim. Tablo '$name$' mevcut deil !"; + Text[ language_user1 ] = " "; +}; + +String RID_STR_FIELD_DOESNT_EXIST +{ + Text = "Der Ausdruck ist ungueltig, da der Feldname '$name$' nicht zugerordnet werden kann !"; + Text [ ENGLISH ] = "The expression is invalid because the field name '$name$' kann nicht zugeordnet werden !"; + Text[ english_us ] = "Statement invalid, field name '$name$' cannot be assigned !"; + Text[ portuguese ] = "A expresso no vlida, porque foi impossvel atribuir o nome do campo '$name$'!"; + Text[ russian ] = " , '$name$' !"; + Text[ dutch ] = "De uitdrukking is ongeldig omdat de veldnaam '$name$' niet kan worden ondergebracht !"; + Text[ french ] = "Expression incorrecte : impossible d'attribuer le nom de champ '$name$' !"; + Text[ spanish ] = "La expresin no es vlida porque el nombre de campo '$name$' no puede ser asignado!"; + Text[ italian ] = "L'espressione non valida in quanto non possibile correlare il nome di campo '$name$'!"; + Text[ danish ] = "Udtrykket er ugyldigt, feltnavnet '$name$' kan ikke tildeles!"; + Text[ swedish ] = "Uttrycket r ogiltigt d fltnamnet '$name$' inte kan tilldelas!"; + Text[ polish ] = "Wyraenie jest nieprawidowe, poniewa nie mona byo przypisa nazwy pola '$name$'!"; + Text[ portuguese_brazilian ] = "The expression is invalid because the field name '$name$' kann nicht zugeordnet werden !"; + Text[ japanese ] = "̨ޖ'$O$'ނłȂ ̕\\͖ł!"; + Text[ chinese_simplified ] = "ʽЧΪֶ '$name$' ȷϣ"; + Text[ chinese_traditional ] = "]LkT{쪺W '$name$' AoӪFLġT"; + Text[ dutch ] = "De uitdrukking is ongeldig omdat de veldnaam '$name$' niet kan worden ondergebracht !"; + Text[ chinese_simplified ] = "ʽЧΪֶ '$name$' ȷϣ"; + Text[ greek ] = " , '$name$' !"; + Text[ korean ] = "ʵ'$name$' Ƿ ȿ ʽϴ!"; + Text[ arabic ] = " '$name$' !"; + Text[ turkish ] = "Geersiz deyim. Alan ad '$name$' atanamyor !"; + Text[ language_user1 ] = " "; +}; +String RID_STR_TOMUCHTABLES +{ + Text = "Die Abfrage enthlt #num# Tabellen. Der aktuelle Datenbanktyp kann aber maximal #maxnum# Tabelle(n) pro Statement verarbeiten !"; + Text [ ENGLISH ] = "Die Abfrage enthlt #num# Tabellen. Der aktuelle Datenbanktyp kann aber maximal #maxnum# Tabelle(n) pro Statement verarbeiten !"; + Text[ italian ] = "La ricerca contiene #num# tabelle. Il tipo attuale di dati riesce a elaborare #maxnum# tabella/e massimo per indicazione!"; + Text[ portuguese_brazilian ] = "Die Abfrage enthlt #num# Tabellen. Der aktuelle Datenbanktyp kann aber maximal #maxnum# Tabelle(n) pro Statement verarbeiten !"; + Text[ portuguese ] = "A consulta tem #num# tabelas. O tipo da base de dados actual admite apenas um mximo de #maxnum# tabela(s)por instruo!"; + Text[ danish ] = "Foresprgslen indeholder #num# tabeller. Denne databasetype kan dog kun behandle maksimalt #maxnum# tabel(ler) per stning !"; + Text[ french ] = "La requte contient #num# tables. Or le type de base de donnes actif peut traiter au maximum #maxnum# table(s) par instruction !"; + Text[ swedish ] = "Skningen innehller #num# tabeller. Den aktuella databastypen kan dock bara bearbeta max #maxnum# tabell(er) per statement!"; + Text[ dutch ] = "Query bevat #num# tabellen. Het actuele databastype kan echter maximaal #maxnum# tabel(len) per statement verwerken !"; + Text[ spanish ] = "La consulta contiene #num# Tablas. El tipo actual de base de datos admite cmo mximo solo #maxnum# tabla(s) por instruccin!"; + Text[ english_us ] = "The query covers #num# tables. The selected database type, however, can only process a maximum of #maxnum# table(s) per statement!"; + Text[ chinese_simplified ] = "ѯ #num# ݿڴһʱֻܹѯ #maxnum# "; + Text[ language_user1 ] = " "; + Text[ russian ] = " #num# (,). , #maxnum# (,) !"; + Text[ polish ] = "Kwerenda zawiera #num# tabele. Aktualny typ bazy danych moe przetworzy tylko maksymalnie #maxnum# tabele (-) na instrukcj!"; + Text[ japanese ] = "ذ́Aðق #num#܂݂܂Bƒްް̎ނ́AȂЂƂ̽ðĂɂőðق#maxnum# ł܂!"; + Text[ chinese_traditional ] = "dߧt #num# CoӸƮwbBz@ӻyyɳ̦hud #maxnum# T"; + Text[ dutch ] = "Query bevat #num# tabellen. Het actuele databastype kan echter maximaal #maxnum# tabel(len) per statement verwerken !"; + Text[ chinese_simplified ] = "ѯ #num# ݿڴһʱֻܹѯ #maxnum# "; + Text[ greek ] = " #num# . #maxnum# /- !"; + Text[ korean ] = "Ǵ #num#̺ մϴ. ͺ̽ ִ #maxnum#̺ ۾ ֽϴ!"; + Text[ arabic ] = " #num# /. #maxnum# / !"; + Text[ turkish ] = "Sorgu #num# tablo ieriyor. Ancak seili veritaban tipi her deyim iin en fazla #maxnum# tablo ileyebilmektedir !"; +}; + +String STR_QUERY_UNDO_TABWINDELETE +{ + /* ### ACHTUNG: Neuer Text in Resource? Tabellenfenster lschen : Tabellenfenster lschen */ + Text = "Tabellenfenster lschen" ; + Text [ ENGLISH ] = "Delete Tablewindow" ; + Text [ english_us ] = "Delete Sheet Window" ; + Text [ portuguese_brazilian ] = "Tabellenfenster lschen" ; + Text [ swedish ] = "Radera tabellfnster" ; + Text [ danish ] = "Slet tabelvindue" ; + Text [ italian ] = "Elimina finestra di tabella" ; + Text [ spanish ] = "Eliminar ventana de tabla" ; + Text [ french ] = "Supprimer une fentre de table" ; + Text [ dutch ] = "Tabelvenster wissen" ; + Text [ portuguese ] = "Eliminar janela de tabela" ; + Text[ chinese_simplified ] = "ɾӴ"; + Text[ russian ] = " "; + Text[ polish ] = "Usu okno tabeli"; + Text[ japanese ] = "ðٳ̍폜"; + Text[ chinese_traditional ] = "R"; + Text[ dutch ] = "Tabelvenster wissen"; + Text[ chinese_simplified ] = "ɾӴ"; + Text[ greek ] = " "; + Text[ korean ] = "̺ "; + Text[ arabic ] = " "; + Text[ turkish ] = "Tablo penceresini sil"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_UNDO_MODIFY_CELL +{ + Text = "Spaltenbeschreibung ndern" ; + Text [ ENGLISH ] = "Spaltenbeschreibung ndern" ; + Text[ italian ] = "Cambia descrizione colonna"; + Text[ portuguese_brazilian ] = "Spaltenbeschreibung ndern"; + Text[ portuguese ] = "Modificar descrio das colunas"; + Text[ danish ] = "Modificer kolonnebeskrivelse"; + Text[ french ] = "Modifier la description des colonnes"; + Text[ swedish ] = "ndra kolumnbeskrivning"; + Text[ dutch ] = "Kolombeschrijving wijzigen"; + Text[ spanish ] = "Modificar descripcin de columnas"; + Text[ english_us ] = "Edit column description"; + Text[ chinese_simplified ] = "б"; + Text[ russian ] = " "; + Text[ polish ] = "Zmie opis kolumn"; + Text[ japanese ] = "Lq̕ύX"; + Text[ chinese_traditional ] = "ܧD"; + Text[ dutch ] = "Kolombeschrijving wijzigen"; + Text[ chinese_simplified ] = "б"; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ arabic ] = " "; + Text[ turkish ] = "Stun aklamasn deitir"; + Text[ language_user1 ] = " "; +}; +String STR_QUERY_UNDO_SIZE_COLUMN +{ + Text = "Spaltenbreite ndern" ; + Text [ ENGLISH ] = "Spaltenbreite ndern" ; + Text[ italian ] = "Cambia larghezza colonna"; + Text[ portuguese_brazilian ] = "Spaltenbreite ndern"; + Text[ portuguese ] = "Ajustar largura das colunas"; + Text[ danish ] = "Modificer kolonnebredde"; + Text[ french ] = "Modifier la largeur des colonnes"; + Text[ swedish ] = "ndra kolumnbredd"; + Text[ dutch ] = "Kolombreedte wijzigen"; + Text[ spanish ] = "Modificar ancho de columnas"; + Text[ english_us ] = "Adjust column width"; + Text[ chinese_simplified ] = "п"; + Text[ russian ] = " "; + Text[ polish ] = "Zmie szeroko kolumn"; + Text[ japanese ] = "̕̕ύX"; + Text[ chinese_traditional ] = "ܧe"; + Text[ dutch ] = "Kolombreedte wijzigen"; + Text[ chinese_simplified ] = "п"; + Text[ greek ] = " "; + Text[ korean ] = " ʺ "; + Text[ arabic ] = " "; + Text[ turkish ] = "Stun geniliini deitir"; + Text[ language_user1 ] = " "; +}; +String STR_QUERY_SORTTEXT +{ + Text = "(nicht sortiert);aufsteigend;absteigend" ; + Text [ ENGLISH ] = "(not sorted);ascending;descending" ; + Text [ english_us ] = "(not sorted);ascending;descending" ; + Text [ swedish ] = "(icke sorterad);stigande;fallande" ; + Text [ danish ] = "(ikke sorteret);stigende;faldende" ; + Text [ italian ] = "(non ordinato);crescente;decrescente" ; + Text [ spanish ] = "(sin ordenar);ascendente;descendente" ; + Text [ french ] = "(Sans tri);Tri croissant;Tri dcroissant" ; + Text [ dutch ] = "(niet gesorteerd);oplopend;aflopend" ; + Text [ portuguese_brazilian ] = "(nicht sortiert);aufsteigend;absteigend" ; + Text [ portuguese ] = "(no classificado);ascendente; descendente" ; + Text[ chinese_simplified ] = "();;"; + Text[ russian ] = "( ); ; "; + Text[ polish ] = "(bez sortowania);rosnco;malejco"; + Text[ japanese ] = "(בւȂ);;~"; + Text[ chinese_traditional ] = "(Ƨ);VW;VU"; + Text[ dutch ] = "(niet gesorteerd);oplopend;aflopend"; + Text[ chinese_simplified ] = "();;"; + Text[ greek ] = "( );, "; + Text[ korean ] = "(ľȵ);;"; + Text[ arabic ] = "( )"; + Text[ turkish ] = "(sralanmam);artan;azalan"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_FUNCTIONS +{ + /* Gleiche Textreihenfolge fuer die Funtkionen wie in common.src */ + Text = "(keine Funktion);Durchschnitt;Anzahl;Maximum;Minimum;Summe;Gruppierung"; + Text [ ENGLISH ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ english_us ] = "(no function);Average;Count;Maximum;Minimum;Sum;Group"; + Text[ portuguese ] = "(sem funo);Mdia;Quantidade;Mximo; Mnimo;Soma;Agrupar"; + Text[ russian ] = "( );;;;;;"; + Text[ dutch ] = "(geen functie);Gemiddelde;Aantal;Maximum;Minimum;Som;Groep"; + Text[ french ] = "(aucune fonction);Moyenne;Nombre;Maximum;Minimum;Somme;Groupement"; + Text[ spanish ] = "(sin funcin);Promedio;Cantidad;Mximo;Mnimo;Suma;Agrupar"; + Text[ italian ] = "(nessuna funzione);Media;Quantit;Massimo;Minimo;Somma;Gruppo"; + Text[ danish ] = "(ingen funktion);Middeltal;Antal;Maksimum;Minimum;Sum;Gruppering"; + Text[ swedish ] = "(ingen funktion);Genomsnitt;Antal;Maximum;Minimum;Summa;Gruppering"; + Text[ polish ] = "(brak funkcji);rednia;Liczba;Maksimum;Minimum;Suma;Grupowanie"; + Text[ portuguese_brazilian ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ japanese ] = "(Ȃ);;;ő;ŏ;v;ٰ"; + Text[ chinese_simplified ] = "();ƽֵ;Ŀ;;С;;"; + Text[ chinese_traditional ] = "(L\\);;ƥ;̤j;̤p;`;"; + Text[ dutch ] = "(geen functie);Gemiddelde;Aantal;Maximum;Minimum;Som;Groep"; + Text[ chinese_simplified ] = "();ƽֵ;Ŀ;;С;;"; + Text[ greek ] = "( )- ,,,,,"; + Text[ korean ] = "( );;;ִ;ּ;հ;"; + Text[ arabic ] = "( )Ϻں"; + Text[ turkish ] = "(ilevsiz);Ortalama;Adet;Azami;Asgari;Toplam;Grup"; + Text[ language_user1 ] = " "; +}; +String STR_QUERY_NOTABLE +{ + Text = "(keine Tabelle)"; + Text [ ENGLISH ] = "(no table)"; + Text[ english_us ] = "(no table)"; + Text[ portuguese ] = "(nenhuma tabela)"; + Text[ greek ] = "( )"; + Text[ dutch ] = "(geen tabel)"; + Text[ french ] = "(aucune table)"; + Text[ spanish ] = "(ninguna tabla)"; + Text[ swedish ] = "(ingen tabell)"; + Text[ language_user1 ] = "nk26.10.99: was bedeutet das?"; + Text[ russian ] = "( )"; + Text[ italian ] = "(nessuna tabella)"; + Text[ danish ] = "(ingen tabel)"; + Text[ polish ] = "(bez tabeli)"; + Text[ portuguese_brazilian ] = "(no table)"; + Text[ japanese ] = "(ðقȂ)"; + Text[ korean ] = "(ǥ)"; + Text[ chinese_simplified ] = "(ޱ)"; + Text[ chinese_traditional ] = "(L)"; + Text[ arabic ] = "( )"; + Text[ turkish ] = "(tablo yok)"; +}; +String STR_QRY_ORDERBY_UNRELATED +{ + Text = "Die Datenbank untersttzt die Sortierung nur fr sichtbare Felder."; + Text[ENGLISH] = "Die Datenbank untersttzt die Sortierung nur fr sichtbare Felder."; + Text[ english_us ] = "The database only supports sorting for visible fields."; + Text[ portuguese ] = "A base de dados s suporta a ordem de campos visveis."; + Text[ russian ] = " ."; + Text[ dutch ] = "De database ondersteunt alleen de sortering voor zichtbare velden."; + Text[ french ] = "La base de donnes ne supporte le tri que pour les champs visibles."; + Text[ spanish ] = "La base de datos apoya la clasificacin solo para campos visibles."; + Text[ italian ] = "Il database supporta solo la classificazione soltanto dei campi visibili."; + Text[ danish ] = "Databasen understtter sortering kun for synlige felter."; + Text[ swedish ] = "Databasen stder endast sorteringen av synliga flt."; + Text[ polish ] = "Baza danych obsuguje sortowanie tylko dla widocznych pl."; + Text[ portuguese_brazilian ] = "Die Datenbank untersttzt die Sortierung nur fr sichtbare Felder."; + Text[ japanese ] = "ްްͤ\\Ą̆ނ̕ёւ݂̂߰Ă܂B"; + Text[ chinese_simplified ] = "ݿֻֿ֧ɼ"; + Text[ chinese_traditional ] = "Ʈwui쪺ƧǡC"; + Text[ dutch ] = "De database ondersteunt alleen de sortering voor zichtbare velden."; + Text[ chinese_simplified ] = "ݿֻֿ֧ɼ"; + Text[ greek ] = " ."; + Text[ korean ] = "ͺ̽ ̴ ʵ ĸ մϴ."; + Text[ arabic ] = " ."; + Text[ turkish ] = "Veritaban yalnzca grnr alanlar iin sralamay destekler."; + Text[ language_user1 ] = " "; +}; +Menu RID_QUERYFUNCTION_POPUPMENU +{ + ItemList = + { + MenuItem + { + Identifier = ID_QUERY_FUNCTION ; + HelpID = HID_QUERY_FUNCTION; + Text = "Funktionen" ; + Text [ ENGLISH ] = "Functions" ; + Text[ english_us ] = "Functions"; + Text[ portuguese ] = "Funes"; + Text[ russian ] = ""; + Text[ dutch ] = "Functies"; + Text[ french ] = "Fonctions"; + Text[ spanish ] = "Funciones"; + Text[ italian ] = "Funzioni"; + Text[ danish ] = "Funktioner"; + Text[ swedish ] = "Funktioner"; + Text[ polish ] = "Funkcje"; + Text[ portuguese_brazilian ] = "Functions"; + Text[ japanese ] = ""; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = ""; + Text[ dutch ] = "Functies"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = ""; + Text[ korean ] = ""; + Text[ arabic ] = ""; + Text[ turkish ] = "levler"; + Text[ language_user1 ] = " "; + }; + MenuItem + { + Separator = TRUE ; + }; + MenuItem + { + Identifier = ID_QUERY_TABLENAME ; + HelpID = HID_QUERY_TABLENAME ; + Text = "Tabellenname" ; + Text [ ENGLISH ] = "Table name" ; + Text[ english_us ] = "Table Name"; + Text[ portuguese ] = "Nome da tabela"; + Text[ russian ] = " "; + Text[ dutch ] = "Tabelnaam"; + Text[ french ] = "Nom de la table"; + Text[ spanish ] = "Nombre de la tabla"; + Text[ italian ] = "Nome tabella"; + Text[ danish ] = "Tabelnavn"; + Text[ swedish ] = "Tabellnamn"; + Text[ polish ] = "Nazwa tabeli"; + Text[ portuguese_brazilian ] = "Table name"; + Text[ japanese ] = "ðٖ"; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = "W"; + Text[ dutch ] = "Tabelnaam"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = " "; + Text[ korean ] = "̺"; + Text[ arabic ] = " "; + Text[ turkish ] = "Tablo ad"; + Text[ language_user1 ] = " "; + }; + MenuItem + { + Identifier = ID_QUERY_ALIASNAME ; + HelpID = HID_QUERY_ALIASNAME ; + Text = "Aliasname" ; + Text [ ENGLISH ] = "Alias name" ; + Text[ english_us ] = "Alias name"; + Text[ portuguese ] = "Nome alias"; + Text[ russian ] = " "; + Text[ dutch ] = "Alias naam"; + Text[ french ] = "Alias"; + Text[ spanish ] = "Alias"; + Text[ italian ] = "Alias"; + Text[ danish ] = "Aliasnavn"; + Text[ swedish ] = "Aliasnamn"; + Text[ polish ] = "Nazwa aliasu"; + Text[ portuguese_brazilian ] = "Alias name"; + Text[ japanese ] = "ر"; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = "NΦW"; + Text[ dutch ] = "Alias naam"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = ""; + Text[ korean ] = "˸ƽ ̸"; + Text[ arabic ] = " "; + Text[ turkish ] = "Dier ad"; + Text[ language_user1 ] = " "; + }; + MenuItem + { + Separator = TRUE; + }; + MenuItem + { + Identifier = ID_QUERY_DISTINCT ; + HelpID = HID_QUERY_DISTINCT ; + Text = "Eindeutige Werte" ; + Text [ ENGLISH ] = "Distinct values" ; + Text[ english_us ] = "Distinct Values"; + Text[ portuguese ] = "Valores distintos"; + Text[ russian ] = " "; + Text[ dutch ] = "Duidelijke waarden"; + Text[ french ] = "Valeurs distinctes"; + Text[ spanish ] = "Valores unvocos"; + Text[ italian ] = "Valori distinti"; + Text[ danish ] = "Entydige vrdier"; + Text[ swedish ] = "Entydiga vrden"; + Text[ polish ] = "Jednoznaczne wartoci"; + Text[ portuguese_brazilian ] = "Distinct values"; + Text[ japanese ] = "Ēl"; + Text[ chinese_simplified ] = "ȷֵ"; + Text[ chinese_traditional ] = "Tƭ"; + Text[ dutch ] = "Duidelijke waarden"; + Text[ chinese_simplified ] = "ȷֵ"; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ arabic ] = " "; + Text[ turkish ] = "Benzersiz deerler"; + Text[ language_user1 ] = " "; + }; + }; +}; +String STR_QUERY_HANDLETEXT +{ + Text = "Feld;Alias;Tabelle;Sortierung;Sichtbar;Funktion;Kriterium;oder;oder" ; + Text [ ENGLISH ] = "Field;Alias;Table;Order;Visible;Function;Criteria;or;or" ; + Text[ english_us ] = "Field;Alias;Table;Sort;Visible;Function;Criterion;Or;Or"; + Text[ portuguese ] = "Campo;Alias;Tabela;Ordem;Visvel;Funo;Critrio;ou;ou"; + Text[ russian ] = ";;;;;;;;"; + Text[ dutch ] = "Veld;Alias;Tabel;Volgorde;Zichtbaar;Functie;Criterium;of;of"; + Text[ french ] = "Champ;Alias;Table;Tri;Visible;Fonction;Critre;Ou;Ou"; + Text[ spanish ] = "Campo;Alias;Tabla;Orden;Visible;Funcin;Criterio;o;o"; + Text[ italian ] = "Campo;Alias;Tabella;Ordine;Visibile;Funzione;Criteri;o;o"; + Text[ danish ] = "Felt;Alias;Tabel;Sortering;Synlig;Funktion;Kriterium;eller;eller"; + Text[ swedish ] = "Flt;Alias;Tabell;Sortering;Synlig;Funktion;Kriterium;eller;eller"; + Text[ polish ] = "Pole;Alias;Tabela;Sortowanie;Widoczny;Funkcja;Kryterium;lub;lub"; + Text[ portuguese_brazilian ] = "Campo;Tabela;Ordem;Visvel;Critrios;ou;ou"; + Text[ japanese ] = "̨;ر;ð;בւ;\\;@\\;;;"; + Text[ chinese_simplified ] = "ֶ;;;;ɼ;;;;"; + Text[ chinese_traditional ] = ";NW;;Ƨ;i;Wh;Ϊ;Ϊ"; + Text[ dutch ] = "Veld;Alias;Tabel;Volgorde;Zichtbaar;Functie;Criterium;of;of"; + Text[ chinese_simplified ] = "ֶ;;;;ɼ;;;;"; + Text[ greek ] = ";;;;;;;;"; + Text[ korean ] = "ʵ:˸ƽ;ǥ;;;;;Ǵ;Ǵ"; + Text[ arabic ] = "; ;;;;;;;"; + Text[ turkish ] = "Alan;Dier ad;Tablo;Sralama;Grnr;lev;lt;ya da;ya da"; + Text[ language_user1 ] = " "; +}; + +ErrorBox ERR_QRY_TOO_MANY_COLUMNS +{ + Message = "Es sind zu viele Spalten vorhanden." ; + Message [ ENGLISH ] = "There are too many columns." ; + Message[ italian ] = "Esistono troppe colonne."; + Message[ portuguese_brazilian ] = "There are too many columns."; + Message[ portuguese ] = "Existem demasiadas colunas."; + Message[ danish ] = "Der er for mange kolonner."; + Message[ french ] = "Il y a trop de colonnes."; + Message[ swedish ] = "Det finns fr mnga kolumner."; + Message[ dutch ] = "Er zijn teveel kolommen"; + Message[ spanish ] = "Existen demasiadas columnas."; + Message[ english_us ] = "Too many columns enclosed in query."; + Message[ chinese_simplified ] = "̫С"; + Message[ russian ] = " ."; + Message[ polish ] = "Jest za duo kolumn."; + Message[ japanese ] = "܂B"; + Message[ chinese_traditional ] = "ӦhC"; + Message[ dutch ] = "Er zijn teveel kolommen"; + Message[ chinese_simplified ] = "̫С"; + Message[ greek ] = " ."; + Message[ korean ] = "ǿ ʹ ֽϴ."; + Message[ arabic ] = " ."; + Message[ turkish ] = "Mevcut stun says ok fazla."; + Message[ language_user1 ] = " "; +}; + +ErrorBox ERR_QRY_CRITERIA_ON_ASTERISK +{ + /* ### ACHTUNG: Neuer Text in Resource? Eine Bedingung fr Feld [*] ist nicht mglich : Eine Bedingung fr Feld [*] ist nicht mglich */ + Message = "Eine Bedingung fr Feld [*] ist nicht mglich" ; + Message [ ENGLISH ] = "Criteria for field [*] is impossible" ; + Message [ portuguese ] = "Condio para o campo [*] no possvel." ; + Message [ english_us ] = "A condition cannot be applied to field [*]" ; + Message [ portuguese_brazilian ] = "Eine Bedingung fr Feld [*] ist nicht mglich" ; + Message [ swedish ] = "Ett villkor r omjligt fr flt [*]" ; + Message [ danish ] = "En betingelse for felt [*] er ikke mulig" ; + Message [ italian ] = "Non possibile nessuna condizione per il campo [*" ; + Message [ spanish ] = "No es posible una condicin para el campo [*]" ; + Message [ french ] = "Aucune condition possible pour le champ [*]" ; + Message [ dutch ] = "Een voorwaarde voor veld [*] is niet mogelijk" ; + Message[ chinese_simplified ] = "ֶ [*]"; + Message[ russian ] = " [*] "; + Message[ polish ] = "Warunek dla pola [*] nie jest moliwy"; + Message[ japanese ] = "̨ [*] ւ͓̏Ă͂܂܂B"; + Message[ greek ] = " [*]"; + Message[ korean ] = "ʵ[*] ƹ ǵ "; + Message[ chinese_traditional ] = "쪺[*]LġC"; + Message[ arabic ] = " [*]"; + Message[ turkish ] = "[*] alan iin koul belirlenemiyor"; +}; +ErrorBox ERR_QRY_TOO_LONG_STATEMENT +{ + Message = "Der erzeugte SQL Ausdruck ist zu lang." ; + Message [ ENGLISH ] = "The created sql expression ist too long." ; + Message[ italian ] = "L'espressione SQL creata troppo lunga."; + Message[ portuguese_brazilian ] = "The created sql expression ist too long."; + Message[ portuguese ] = "A expresso sql criada demasiado extensa."; + Message[ danish ] = "Det frembragte SQL-udtryk er for langt."; + Message[ french ] = "L'expression SQL cre est trop longue."; + Message[ swedish ] = "Det skapade SQL-uttrycket r fr lngt."; + Message[ dutch ] = "SQL-uitdrukking is te lang."; + Message[ spanish ] = "La expresin creada SQL es demasiado larga."; + Message[ english_us ] = "The created SQL statement is too long."; + Message[ chinese_simplified ] = "ɵ SQL ʽ̫"; + Message[ russian ] = " SQL ."; + Message[ polish ] = "Utworzone wyraenie SQL jest za dugie."; + Message[ japanese ] = "쐬ꂽSQL̽ðĂ܂B"; + Message[ chinese_traditional ] = "ͦ SQL FӪC"; + Message[ dutch ] = "SQL-uitdrukking is te lang."; + Message[ chinese_simplified ] = "ɵ SQL ʽ̫"; + Message[ greek ] = " SQL ."; + Message[ korean ] = "ۼ SQL ʹ ϴ."; + Message[ arabic ] = " SQL ."; + Message[ turkish ] = "Yaratlan SQL deyimi ok uzun."; + Message[ language_user1 ] = " "; +}; +ErrorBox ERR_QRY_TOOCOMPLEX +{ + Message = "Anfrage ist zu komplex" ; + Message [ ENGLISH ] = "Query too complex" ; + Message [ norwegian ] = "Query too complex" ; + Message [ italian ] = "Ricerca troppo complessa" ; + Message [ portuguese_brazilian ] = "Consulta muito complexa" ; + Message [ portuguese ] = "Consulta demasiado complexa" ; + Message [ finnish ] = "Kysely on liian monimutkainen" ; + Message [ danish ] = "Foresprgslen er for kompleks" ; + Message [ french ] = "Cette requte est trop complexe" ; + Message [ swedish ] = "Frgan r alltfr komplex" ; + Message [ dutch ] = "Query te complex" ; + Message [ spanish ] = "Consulta demasiado compleja" ; + Message [ english_us ] = "Query is too complex" ; + Message[ chinese_simplified ] = "ѯ̫"; + Message[ russian ] = " "; + Message[ polish ] = "Kwerenda jest zbyt zoona"; + Message[ japanese ] = "ذG܂B"; + Message[ chinese_traditional ] = "dߤeӽƦX"; + Message[ dutch ] = "Query te complex"; + Message[ chinese_simplified ] = "ѯ̫"; + Message[ greek ] = " "; + Message[ korean ] = "ǰ ʹ "; + Message[ arabic ] = " "; + Message[ turkish ] = "Sorgu ok karmak"; + Message[ language_user1 ] = " "; +}; +ErrorBox ERR_QRY_NOSELECT +{ + Message = "Es fehlt eine Selektion" ; + Message [ ENGLISH ] = "Missing selection" ; + Message [ norwegian ] = "Missing selection" ; + Message [ italian ] = "Selezione mancante" ; + Message [ portuguese_brazilian ] = "Falta seleo" ; + Message [ portuguese ] = "Falta seleco" ; + Message [ finnish ] = "Valinta puuttuu" ; + Message [ danish ] = "Manglende markering" ; + Message [ french ] = "Vous n'avez opr aucune slection" ; + Message [ swedish ] = "Markering saknas" ; + Message [ dutch ] = "Selectie ontbreekt" ; + Message [ spanish ] = "Falta una seleccin" ; + Message [ english_us ] = "Nothing selected" ; + Message[ chinese_simplified ] = "ȱһѡ"; + Message[ russian ] = " "; + Message[ polish ] = "Nic nie wybrano"; + Message[ japanese ] = "I܂B"; + Message[ chinese_traditional ] = "ʤ֤@ӿ"; + Message[ dutch ] = "Selectie ontbreekt"; + Message[ chinese_simplified ] = "ȱһѡ"; + Message[ greek ] = " "; + Message[ korean ] = "ƹ õ Ǿ "; + Message[ arabic ] = " "; + Message[ turkish ] = "Seim yaplmad"; + Message[ language_user1 ] = " "; +}; +ErrorBox ERR_QRY_TOOMANYCOND +{ + Message = "Zu viele Suchkriterien" ; + Message [ ENGLISH ] = "Too many search criteria" ; + Message [ norwegian ] = "Too many search criteria" ; + Message [ italian ] = "Troppi criteri di ricerca" ; + Message [ portuguese_brazilian ] = "Excesso de critrios de procura" ; + Message [ portuguese ] = "Excesso de critrios de procura" ; + Message [ finnish ] = "Liian monta hakuehtoa" ; + Message [ danish ] = "For mange sgekriterier" ; + Message [ french ] = "Trop de critres de recherche" ; + Message [ swedish ] = "Fr mnga skkriterier" ; + Message [ dutch ] = "Teveel zoekcriteria" ; + Message [ spanish ] = "Demasiados criterios de bsqueda" ; + Message [ english_us ] = "Too many search criteria" ; + Message[ chinese_simplified ] = "Ѱ̫"; + Message[ russian ] = " "; + Message[ polish ] = "Za duo kryteriw wyszukiwania"; + Message[ japanese ] = "܂B"; + Message[ chinese_traditional ] = "jMWhӦh"; + Message[ dutch ] = "Teveel zoekcriteria"; + Message[ chinese_simplified ] = "Ѱ̫"; + Message[ greek ] = " "; + Message[ korean ] = "˻ ʹ "; + Message[ arabic ] = " "; + Message[ turkish ] = "Arama lt says ok fazla"; + Message[ language_user1 ] = " "; +}; +ErrorBox ERR_QRY_SYNTAX +{ + Message = "Fehler in der SQL Syntax" ; + Message [ ENGLISH ] = "SQL syntax error" ; + Message [ norwegian ] = "SQL syntax error" ; + Message [ italian ] = "Errore di sintassi SQL" ; + Message [ portuguese_brazilian ] = "Erro de sintaxe SQL" ; + Message [ portuguese ] = "Erro de sintaxe SQL" ; + Message [ finnish ] = "SQL-kielioppivirhe" ; + Message [ danish ] = "SQL syntaksfejl" ; + Message [ french ] = "Erreur de syntaxe SQL" ; + Message [ swedish ] = "Fel i SQL-syntax" ; + Message [ dutch ] = "SQL-syntaxisfout" ; + Message [ spanish ] = "Error en la sintaxis SQL" ; + Message [ english_us ] = "SQL syntax error" ; + Message[ chinese_simplified ] = "SQL "; + Message[ russian ] = " SQL"; + Message[ polish ] = "Bd skadniowy SQL"; + Message[ japanese ] = "SQLװ"; + Message[ chinese_traditional ] = "SQL yk~"; + Message[ dutch ] = "SQL-syntaxisfout"; + Message[ chinese_simplified ] = "SQL "; + Message[ greek ] = " SQL"; + Message[ korean ] = "SQL "; + Message[ arabic ] = "SQL "; + Message[ turkish ] = "SQL szdizimi hatas"; + Message[ language_user1 ] = " "; +}; +ErrorBox ERR_QRY_ORDERBY_ON_ASTERISK +{ + Message = "Nach [*] kann nicht sortiert werden."; + Message [ ENGLISH ] = "Order by for field [*] is impossible." ; + Message[ italian ] = "Non possibile ordinare per [*]."; + Message[ portuguese_brazilian ] = "Order by for field [*] is impossible."; + Message[ portuguese ] = "[*] no pode ser usado como critrio de ordem."; + Message[ danish ] = "Det er ikke muligt at sortere efter [*]."; + Message[ french ] = "Tri en fonction de [*] impossible !"; + Message[ swedish ] = "Det gr inte att sortera efter [*]"; + Message[ dutch ] = "Na [*] kan niet worden gesorteerd."; + Message[ spanish ] = "No se puede ordenar segn [*]."; + Message[ english_us ] = "[*]-cannot be used as a sort criterion."; + Message[ chinese_simplified ] = " [*] "; + Message[ russian ] = " [*] ."; + Message[ polish ] = "Sortowanie wedug [*] nie jest moliwe."; + Message[ japanese ] = "[*]ɕבւł܂B"; + Message[ greek ] = " [*]"; + Message[ arabic ] = " [*]."; + Message[ chinese_traditional ] = "Lk[*]sơC"; + Message[ korean ] = "[*] "; + Message[ turkish ] = "[*] sralama lt olarak kullanlamaz."; + Message[ language_user1 ] = " "; +}; +String STR_QUERY_TRUE +{ + Text = "WAHR" ; + Text [ ENGLISH ] = "TRUE" ; + Text [ dutch ] = "WAAR" ; + Text [ english_us ] = "TRUE" ; + Text [ italian ] = "VERO" ; + Text [ spanish ] = "VERDADERO" ; + Text [ french ] = "VRAI" ; + Text [ swedish ] = "SANN" ; + Text [ danish ] = "SAND" ; + Text [ portuguese ] = "VERDADEIRO" ; + Text [ portuguese_brazilian ] = "WAHR" ; + Text[ chinese_simplified ] = "TRUE"; + Text[ russian ] = ""; + Text[ polish ] = "PRAWDA"; + Text[ japanese ] = "TRUE"; + Text[ chinese_traditional ] = "TRUE"; + Text[ arabic ] = ""; + Text[ dutch ] = "WAAR"; + Text[ chinese_simplified ] = "TRUE"; + Text[ greek ] = ""; + Text[ korean ] = ""; + Text[ turkish ] = "DORU"; +}; +String STR_QUERY_FALSE +{ + Text = "FALSCH" ; + Text [ ENGLISH ] = "FALSE" ; + Text [ dutch ] = "ONWAAR" ; + Text [ english_us ] = "FALSE" ; + Text [ italian ] = "FALSO" ; + Text [ spanish ] = "FALSO" ; + Text [ french ] = "FAUX" ; + Text [ swedish ] = "FALSK" ; + Text [ danish ] = "FALSK" ; + Text [ portuguese ] = "FALSO" ; + Text [ portuguese_brazilian ] = "FALSCH" ; + Text[ chinese_simplified ] = "FALSE"; + Text[ russian ] = ""; + Text[ polish ] = "FASZ"; + Text[ japanese ] = "FALSE"; + Text[ chinese_traditional ] = "FALSE"; + Text[ arabic ] = ""; + Text[ dutch ] = "ONWAAR"; + Text[ chinese_simplified ] = "FALSE"; + Text[ greek ] = "FALSE"; + Text[ korean ] = ""; + Text[ turkish ] = "YANLI"; +}; +ErrorBox ERR_QRY_TOO_MANY_TABLES +{ + Message = "Es sind zu viele Tabellen vorhanden." ; + Message [ ENGLISH ] = "There are too many tables." ; + Message[ italian ] = "Esistono troppe tabelle."; + Message[ portuguese_brazilian ] = "There are too many tables."; + Message[ portuguese ] = "Existem demasiadas tabelas."; + Message[ danish ] = "Der er for mange tabeller."; + Message[ french ] = "Il y a trop de tables."; + Message[ swedish ] = "Det finns fr mnga tabeller."; + Message[ dutch ] = "Er zijn teveel tabellen"; + Message[ spanish ] = "Existen demasiadas tablas."; + Message[ english_us ] = "Too many tables enclosed."; + Message[ chinese_simplified ] = "̫ı"; + Message[ russian ] = " ."; + Message[ polish ] = "Jest za duo tabel."; + Message[ japanese ] = "ðق̐܂B"; + Message[ chinese_traditional ] = "ӦhC"; + Message[ dutch ] = "Er zijn teveel tabellen"; + Message[ chinese_simplified ] = "̫ı"; + Message[ greek ] = " ."; + Message[ korean ] = "̺ ʹ ϴ."; + Message[ arabic ] = " ."; + Message[ turkish ] = "Mevcut tablo says ok fazla."; + Message[ language_user1 ] = " "; +}; + +WarningBox WARN_QRY_NATIVE +{ + Buttons = WB_OK_CANCEL ; + /* ### ACHTUNG: Neuer Text in Resource? Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen : Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen */ + Message = "Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen" ; + Message [ ENGLISH ] = "Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen" ; + Message [ norwegian ] = "Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen" ; + Message [ italian ] = "Con una ricerca nel dialetto SQL del database lo statement non viene accettato" ; + Message [ portuguese_brazilian ] = "Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen" ; + Message [ portuguese ] = "A instruo no ser executada se efectuar a consulta no dialecto SQL da base de dados" ; + Message [ french ] = "En cas de requte dans le langage SQL de la base de donnes, l'instruction ne sera pas applique." ; + Message [ dutch ] = "Bij query in SQL-dialect van database wordt statement de niet overgenomen." ; + Message [ spanish ] = "Al consultar en el dialecto SQL de la base de datos no se acepta la instruccin" ; + Message [ danish ] = "Ved foresprgsel i databasens SQL-dialekt bliver stningen ikke overtaget" ; + Message [ swedish ] = "Vid frga i databasens SQL-dialekt kommer inte statement att vertas" ; + Message [ finnish ] = "Bei Anfrage im SQL-Dialekt der Datenbank wird das Statement nicht bernommen" ; + Message [ english_us ] = "The statement will not be applied when querying in the SQL dialect of the database." ; + Message[ chinese_simplified ] = "ݿ SGL Բѯָ"; + Message[ russian ] = " SQL "; + Message[ polish ] = "W kwerendzie w dialekcie bazy danych SQL nie bdzie moliwe wykonanie instrukcji."; + Message[ japanese ] = "ްްSQLڸĂɂ鸴ذ̎sͽðĂ͓Kpł܂B"; + Message[ chinese_traditional ] = "Ʈw SGL 訥d߫OC"; + Message[ dutch ] = "Bij query in SQL-dialect van database wordt statement de niet overgenomen."; + Message[ chinese_simplified ] = "ݿ SGL Բѯָ"; + Message[ greek ] = " SQL "; + Message[ korean ] = "ͺ̽ SQL ʽϴ"; + Message[ arabic ] = " ɡ SQL "; + Message[ turkish ] = "Deyim, sorgunun bu veritabannn SQL dilinde yaplmas halinde kullanlmayacaktr"; + Message[ language_user1 ] = " "; +}; +ErrorBox ERR_QRY_AMB_FIELD +{ + Message = "Feldname nicht gefunden oder eindeutig" ; + Message [ ENGLISH ] = "Field name not found or not unique" ; + Message [ norwegian ] = "Field name not found or not unique" ; + Message [ italian ] = "Nome del campo non trovato o non univoco" ; + Message [ portuguese_brazilian ] = "Nome de campo no encontrado ou no exclusivo" ; + Message [ portuguese ] = "Nome de campo no encontrado ou no exclusivo" ; + Message [ finnish ] = "Kentn nimi puuttuu tai ei ole yksiksitteinen" ; + Message [ danish ] = "Feltnavn ikke fundet eller ikke entydigt" ; + Message [ french ] = "Nom de champ introuvable ou ambigu" ; + Message [ swedish ] = "Fltnamn hittades inte eller r inte entydigt" ; + Message [ dutch ] = "Veldnaam niet gevonden of niet duidelijk" ; + Message [ spanish ] = "El nombre del campo no se encontr o no es nico" ; + Message [ english_us ] = "Field name not found or not unique" ; + Message[ chinese_simplified ] = "ûҵֶƻ߲ȷ"; + Message[ russian ] = " "; + Message[ polish ] = "Nazwy pola nie znaleziono lub jest ona nie jednoznaczna"; + Message[ japanese ] = "̨ޖ܂B́Amł܂B"; + Message[ language_user1 ] = " "; + Message[ chinese_traditional ] = "SW٩Ϊ̦W٤TC"; + Message[ dutch ] = "Veldnaam niet gevonden of niet duidelijk"; + Message[ chinese_simplified ] = "ûҵֶƻ߲ȷ"; + Message[ greek ] = " "; + Message[ korean ] = "ʵ ã ߰ų Һи"; + Message[ arabic ] = " "; + Message[ turkish ] = "Alan ad bulunamad ya da benzersiz deil"; +}; +ErrorBox ERR_QRY_ILLEGAL_JOIN +{ + /* ### ACHTUNG: Neuer Text in Resource? Verknpfung konnte nicht ausgefhrt werden : Verknpfung konnte nicht ausgefhrt werden */ + Message = "Verknpfung konnte nicht ausgefhrt werden" ; + Message [ ENGLISH ] = "Could not create link" ; + Message [ norwegian ] = "Could not create link" ; + Message [ italian ] = "Impossibile creare il collegamento" ; + Message [ portuguese_brazilian ] = "No pude criar ligao" ; + Message [ portuguese ] = "Impossvel criar ligao" ; + Message [ finnish ] = "Linkki ei voi luoda" ; + Message [ danish ] = "Det var ikke muligt at oprette en kde" ; + Message [ french ] = "Le lien n'a pas pu tre cr" ; + Message [ swedish ] = "Lnk kunde inte utfras" ; + Message [ dutch ] = "Koppeling kon niet tot stand worden gebracht" ; + Message [ spanish ] = "No se pudo ejecutar el vnculo." ; + Message [ english_us ] = "A join can not be processed" ; + Message[ chinese_simplified ] = "ִӹ"; + Message[ russian ] = " "; + Message[ polish ] = "Sprzenia nie mona byo wykona"; + Message[ japanese ] = "ݸ̍쐬͏o܂B"; + Message[ chinese_traditional ] = "Lks\\"; + Message[ dutch ] = "Koppeling kon niet tot stand worden gebracht"; + Message[ chinese_simplified ] = "ִӹ"; + Message[ greek ] = " "; + Message[ korean ] = " "; + Message[ arabic ] = " "; + Message[ turkish ] = "Balant oluturulamad"; + Message[ language_user1 ] = " "; +}; +ToolBox RID_BRW_QUERYDESIGN_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_QUERYDESIGN ; + + ItemList = + { + ToolBoxItem + { + Identifier = ID_BROWSER_EDITDOC ; + HelpId = ID_BROWSER_EDITDOC ; + Text = "Bearbeiten" ; + Text [ ENGLISH ] = "Bearbeiten" ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = SID_NEWDOC ; + HelpId = SID_NEWDOC ; + Hide = TRUE; + Text = "Bearbeiten" ; + Text [ ENGLISH ] = "Bearbeiten" ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_SAVEDOC ; + HelpId = ID_BROWSER_SAVEDOC ; + Text = "Speichern" ; + Text [ ENGLISH ] = "Save" ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_SAVEASDOC ; + HelpId = ID_BROWSER_SAVEASDOC ; + Text = "Speichern als" ; + Text [ ENGLISH ] = "Save as" ; + }; + ToolBoxItem + { + Identifier = SID_PRINTDOCDIRECT ; + HelpId = SID_PRINTDOCDIRECT ; + Hide = TRUE; + Text = "Drucken" ; + Text [ ENGLISH ] = "Print" ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_CUT ; + HelpId = ID_BROWSER_CUT ; + MID_SBA_QRY_CUT + }; + ToolBoxItem + { + Identifier = ID_BROWSER_COPY ; + HelpId = ID_BROWSER_COPY ; + MID_SBA_QRY_COPY + }; + ToolBoxItem + { + Identifier = ID_BROWSER_PASTE ; + HelpId = ID_BROWSER_PASTE ; + MID_SBA_QRY_PASTE + }; + 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_QUERY_EXECUTE; + HelpId = ID_BROWSER_QUERY_EXECUTE ; + Text = "Ausfhren" ; + Text [ ENGLISH ] = "Execute" ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_ESACPEPROCESSING; + HelpId = ID_BROWSER_ESACPEPROCESSING ; + Text = "SQL-Kommando direkt ausfhren" ; + Text [ ENGLISH ] = "Native sql command" ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_CLEAR_QUERY; + HelpId = ID_BROWSER_CLEAR_QUERY ; + Text = "Abfrage lschen" ; + Text [ ENGLISH ] = "clear query" ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_SQL; + HelpId = ID_BROWSER_SQL ; + Text = "Design Ansicht an-, ausschalten" ; + Text [ ENGLISH ] = "switch design view on/off" ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_ADDTABLE; + HelpId = ID_BROWSER_ADDTABLE ; + Text = "Tabellen hinzufgen" ; + Text [ ENGLISH ] = "Add tables" ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_QUERY_VIEW_FUNCTIONS; + HelpId = ID_BROWSER_QUERY_VIEW_FUNCTIONS ; + Text = "Funktionen" ; + Text [ ENGLISH ] = "Functions" ; + Text[ english_us ] = "Functions"; + Text[ portuguese ] = "Funes"; + Text[ russian ] = ""; + Text[ dutch ] = "Functies"; + Text[ french ] = "Fonctions"; + Text[ spanish ] = "Funciones"; + Text[ italian ] = "Funzioni"; + Text[ danish ] = "Funktioner"; + Text[ swedish ] = "Funktioner"; + Text[ polish ] = "Funkcje"; + Text[ portuguese_brazilian ] = "Functions"; + Text[ japanese ] = ""; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = ""; + Text[ dutch ] = "Functies"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = ""; + Text[ korean ] = ""; + Text[ arabic ] = ""; + Text[ turkish ] = "levler"; + Text[ language_user1 ] = " "; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_QUERY_VIEW_TABLES; + HelpId = ID_BROWSER_QUERY_VIEW_TABLES ; + Text = "Tabellenname" ; + Text [ ENGLISH ] = "Table name" ; + Text[ english_us ] = "Table Name"; + Text[ portuguese ] = "Nome da tabela"; + Text[ russian ] = " "; + Text[ dutch ] = "Tabelnaam"; + Text[ french ] = "Nom de la table"; + Text[ spanish ] = "Nombre de la tabla"; + Text[ italian ] = "Nome tabella"; + Text[ danish ] = "Tabelnavn"; + Text[ swedish ] = "Tabellnamn"; + Text[ polish ] = "Nazwa tabeli"; + Text[ portuguese_brazilian ] = "Table name"; + Text[ japanese ] = "ðٖ"; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = "W"; + Text[ dutch ] = "Tabelnaam"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = " "; + Text[ korean ] = "̺"; + Text[ arabic ] = " "; + Text[ turkish ] = "Tablo ad"; + Text[ language_user1 ] = " "; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_QUERY_VIEW_ALIASES; + HelpId = ID_BROWSER_QUERY_VIEW_ALIASES ; + Text = "Aliasname" ; + Text [ ENGLISH ] = "Alias name" ; + Text[ english_us ] = "Alias name"; + Text[ portuguese ] = "Nome alias"; + Text[ russian ] = " "; + Text[ dutch ] = "Alias naam"; + Text[ french ] = "Alias"; + Text[ spanish ] = "Alias"; + Text[ italian ] = "Alias"; + Text[ danish ] = "Aliasnavn"; + Text[ swedish ] = "Aliasnamn"; + Text[ polish ] = "Nazwa aliasu"; + Text[ portuguese_brazilian ] = "Alias name"; + Text[ japanese ] = "ر"; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = "NΦW"; + Text[ dutch ] = "Alias naam"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = ""; + Text[ korean ] = "˸ƽ ̸"; + Text[ arabic ] = " "; + Text[ turkish ] = "Dier ad"; + Text[ language_user1 ] = " "; + }; + ToolBoxItem + { + Identifier = ID_BROWSER_QUERY_DISTINCT_VALUES; + HelpId = ID_BROWSER_QUERY_DISTINCT_VALUES ; + Text = "Eindeutige Werte" ; + Text [ ENGLISH ] = "Distinct values" ; + Text[ english_us ] = "Distinct Values"; + Text[ portuguese ] = "Valores distintos"; + Text[ russian ] = " "; + Text[ dutch ] = "Duidelijke waarden"; + Text[ french ] = "Valeurs distinctes"; + Text[ spanish ] = "Valores unvocos"; + Text[ italian ] = "Valori distinti"; + Text[ danish ] = "Entydige vrdier"; + Text[ swedish ] = "Entydiga vrden"; + Text[ polish ] = "Jednoznaczne wartoci"; + Text[ portuguese_brazilian ] = "Distinct values"; + Text[ japanese ] = "Ēl"; + Text[ chinese_simplified ] = "ȷֵ"; + Text[ chinese_traditional ] = "Tƭ"; + Text[ dutch ] = "Duidelijke waarden"; + Text[ chinese_simplified ] = "ȷֵ"; + Text[ greek ] = " "; + Text[ korean ] = " "; + Text[ arabic ] = " "; + Text[ turkish ] = "Benzersiz deerler"; + Text[ language_user1 ] = " "; + }; +/* ToolBoxItem + { + Identifier = SID_ZOOM_OUT ; + HelpId = SID_ZOOM_OUT ; + }; + ToolBoxItem + { + Identifier = SID_ZOOM_IN ; + HelpId = SID_ZOOM_IN ; + }; + ToolBoxItem + { + Identifier = SID_EXPLORER_CONTENT ; + }; + ToolBoxItem + { + Type = TOOLBOXITEM_SEPARATOR ; + }; +*/ + }; +}; + + diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx new file mode 100644 index 000000000000..3751cbcd07b7 --- /dev/null +++ b/dbaccess/source/ui/querydesign/querydlg.cxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * $RCSfile: querydlg.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20: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_QUERYDLG_HXX +#include "querydlg.hxx" +#endif +#ifndef _DBU_RESOURCE_HRC_ +#include "dbu_resource.hrc" +#endif +#ifndef DBAUI_QUERYDLG_HRC +#include "querydlg.hrc" +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef DBAUI_QTABLECONNECTIONDATA_HXX +#include "QTableConnectionData.hxx" +#endif +#ifndef _DBAUI_MODULE_DBU_HXX_ +#include "moduledbu.hxx" +#endif +#ifndef DBAUI_QUERYCONTROLLER_HXX +#include "querycontroller.hxx" +#endif +#ifndef DBAUI_QUERYTABLEVIEW_HXX +#include "QueryTableView.hxx" +#endif +#ifndef DBAUI_QUERYDESIGNVIEW_HXX +#include "QueryDesignView.hxx" +#endif + +using namespace dbaui; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::sdbc; + +DBG_NAME(DlgQryJoin); +DlgQryJoin::DlgQryJoin( Window * pParent,OQueryTableConnectionData* pData, + const Reference< XDatabaseMetaData >& _rxMetaData) + : ModalDialog( pParent, ModuleRes(DLG_QRY_JOIN) ), + aGB_Join( this, ResId( GB_JOIN ) ), + aRB_Inner( this, ResId( RB_INNER ) ), + aRB_Left( this, ResId( RB_LEFT ) ), + aRB_Right( this, ResId( RB_RIGHT ) ), + aRB_Full( this, ResId( RB_FULL ) ), + aML_HelpText( this, ResId(ML_HELPTEXT) ), + + aPB_OK( this, ResId( PB_OK ) ), + aPB_CANCEL( this, ResId( PB_CANCEL ) ), + aPB_HELP( this, ResId( PB_HELP ) ), + eJoinType(pData->GetJoinType()), + pConnData(pData) + +{ + DBG_CTOR(DlgQryJoin,NULL); + + aRB_Left.Disable(); + aRB_Right.Disable(); + aRB_Full.Disable(); + + if(_rxMetaData->supportsFullOuterJoins()) + { + aRB_Left.Enable(); + aRB_Right.Enable(); + aRB_Full.Enable(); + } + else if(_rxMetaData->supportsOuterJoins()) + { + aRB_Left.Enable(); + aRB_Right.Enable(); + } + + switch(eJoinType) + { + case INNER_JOIN: + aRB_Inner.Check(sal_True); + RBTogleHdl(&aRB_Inner); + break; + case LEFT_JOIN: + aRB_Left.Check(sal_True); + RBTogleHdl(&aRB_Left); + break; + case RIGHT_JOIN: + aRB_Right.Check(sal_True); + RBTogleHdl(&aRB_Right); + break; + case FULL_JOIN: + aRB_Full.Check(sal_True); + RBTogleHdl(&aRB_Full); + break; + } + + aPB_OK.SetClickHdl( LINK(this, DlgQryJoin, OKClickHdl) ); + + aRB_Inner.SetToggleHdl(LINK(this,DlgQryJoin,RBTogleHdl)); + aRB_Left.SetToggleHdl(LINK(this,DlgQryJoin,RBTogleHdl)); + aRB_Right.SetToggleHdl(LINK(this,DlgQryJoin,RBTogleHdl)); + aRB_Full.SetToggleHdl(LINK(this,DlgQryJoin,RBTogleHdl)); + + if (static_cast<OQueryTableView*>(pParent)->getDesignView()->getController()->isReadOnly()) + { + aRB_Inner.Disable(); + aRB_Left.Disable(); + aRB_Right.Disable(); + aRB_Full.Disable(); + } + + FreeResource(); +} + +//------------------------------------------------------------------------ +DlgQryJoin::~DlgQryJoin() +{ + DBG_DTOR(DlgQryJoin,NULL); +} +IMPL_LINK( DlgQryJoin, RBTogleHdl, RadioButton*, pButton ) +{ + DBG_CHKTHIS(DlgQryJoin,NULL); + aML_HelpText.SetText(String()); + String aStr; + if(pButton == &aRB_Inner) + { + aStr = String(ModuleRes(STR_QUERY_INNER_JOIN)); + } + else if(pButton == &aRB_Left) + { + aStr = String(ModuleRes(STR_QUERY_LEFTRIGHT_JOIN)); + aStr.SearchAndReplace(String::CreateFromAscii("%1"),pConnData->GetSourceWinName()); + aStr.SearchAndReplace(String::CreateFromAscii("%2"),pConnData->GetDestWinName()); + } + else if(pButton == &aRB_Right) + { + aStr = String(ModuleRes(STR_QUERY_LEFTRIGHT_JOIN)); + aStr.SearchAndReplace(String::CreateFromAscii("%1"),pConnData->GetDestWinName()); + aStr.SearchAndReplace(String::CreateFromAscii("%2"),pConnData->GetSourceWinName()); + } + else if(pButton == &aRB_Full) + { + aStr = String(ModuleRes(STR_QUERY_FULL_JOIN)); + aStr.SearchAndReplace(String::CreateFromAscii("%1"),pConnData->GetDestWinName()); + aStr.SearchAndReplace(String::CreateFromAscii("%2"),pConnData->GetSourceWinName()); + } + aML_HelpText.SetText(aStr); + return 1; +} + +IMPL_LINK( DlgQryJoin, OKClickHdl, Button*, pButton ) +{ + DBG_CHKTHIS(DlgQryJoin,NULL); + if( aRB_Inner.IsChecked() ) + eJoinType = INNER_JOIN; + else if( aRB_Left.IsChecked() ) + eJoinType = LEFT_JOIN; + else if( aRB_Right.IsChecked() ) + eJoinType = RIGHT_JOIN; + else if( aRB_Full.IsChecked() ) + eJoinType = FULL_JOIN; + EndDialog(); + return 1; +} + + diff --git a/dbaccess/source/ui/querydesign/querydlg.hrc b/dbaccess/source/ui/querydesign/querydlg.hrc new file mode 100644 index 000000000000..3242cf8e227b --- /dev/null +++ b/dbaccess/source/ui/querydesign/querydlg.hrc @@ -0,0 +1,82 @@ +/************************************************************************* + * + * $RCSfile: querydlg.hrc,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:24: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_QUERYDLG_HRC +#define DBAUI_QUERYDLG_HRC + +#define GB_JOIN 1 + +#define RB_INNER 1 +#define RB_LEFT 2 +#define RB_RIGHT 3 +#define RB_FULL 4 + +#define GB_FIELDS 1 + +#define PB_OK 1 +#define PB_CANCEL 2 +#define PB_HELP 3 +#define ML_HELPTEXT 4 + +#endif // DBAUI_QUERYDLG_HRC + + + diff --git a/dbaccess/source/ui/querydesign/querydlg.src b/dbaccess/source/ui/querydesign/querydlg.src new file mode 100644 index 000000000000..ab2ce5b232cb --- /dev/null +++ b/dbaccess/source/ui/querydesign/querydlg.src @@ -0,0 +1,359 @@ +/************************************************************************* + * + * $RCSfile: querydlg.src,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: oj $ $Date: 2001-02-05 09:20:58 $ + * + * 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 DBAUI_QUERYDLG_HRC +#include "querydlg.hrc" +#endif +#include "dbaccess_helpid.hrc" + +ModalDialog DLG_QRY_JOIN +{ + OutputSize = TRUE ; + SVLook = TRUE ; + HelpId = HID_DLG_QRY_JOIN ; + Size = MAP_APPFONT ( 203, 107 ) ; + Text = "Verbundeigenschaften" ; + Text [ ENGLISH ] = "Join properties" ; + + Moveable = TRUE ; + Closeable = TRUE ; + + GroupBox GB_JOIN + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 191 , 78 ) ; + Text = "Optionen" ; + Text [ ENGLISH ] = "Options" ; + Text[ english_us ] = "Options"; + Text[ portuguese ] = "Opes"; + Text[ russian ] = ""; + Text[ dutch ] = "Opties"; + Text[ french ] = "Options"; + Text[ spanish ] = "Opciones"; + Text[ italian ] = "Opzioni"; + Text[ danish ] = "Indstillinger"; + Text[ swedish ] = "Alternativ"; + Text[ polish ] = "Opcje"; + Text[ portuguese_brazilian ] = "Options"; + Text[ japanese ] = ""; + Text[ chinese_simplified ] = "ѡ"; + Text[ chinese_traditional ] = "ﶵ"; + Text[ dutch ] = "Opties"; + Text[ chinese_simplified ] = "ѡ"; + Text[ greek ] = ""; + Text[ korean ] = "ɼ"; + Text[ arabic ] = ""; + Text[ turkish ] = "Seenekler"; + Text[ language_user1 ] = " "; + }; + + RadioButton RB_INNER + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 63 , 10 ) ; + HelpId = HID_DLG_QRY_INNER ; + Text = "~Innerer" ; + Text [ ENGLISH ] = "~Inner" ; + Text[ english_us ] = "~Inner Join"; + Text[ portuguese ] = "~Interior"; + Text[ russian ] = " "; + Text[ dutch ] = "~Binnenste"; + Text[ french ] = "~Interne"; + Text[ spanish ] = "~Interior"; + Text[ italian ] = "Relazione interna"; + Text[ danish ] = "~Indre"; + Text[ swedish ] = "~Inre"; + Text[ polish ] = "Wewntrzne sprzenie"; + Text[ portuguese_brazilian ] = "~Inner"; + Text[ japanese ] = "(~I)"; + Text[ chinese_simplified ] = "(~I)"; + Text[ chinese_traditional ] = "(~I)"; + Text[ dutch ] = "~Binnenste"; + Text[ chinese_simplified ] = "(~I)"; + Text[ greek ] = ""; + Text[ korean ] = "̳ (~I)"; + Text[ arabic ] = " "; + Text[ turkish ] = "~"; + Text[ language_user1 ] = " "; + }; + RadioButton RB_LEFT + { + Pos = MAP_APPFONT ( 12 , 30 ) ; + Size = MAP_APPFONT ( 63 , 10 ) ; + HelpId = HID_DLG_QRY_LEFT ; + Text = "~Linker" ; + Text [ ENGLISH ] = "~Left" ; + Text[ english_us ] = "~Left Join"; + Text[ portuguese ] = "~Esquerda"; + Text[ russian ] = " "; + Text[ dutch ] = "~Linker"; + Text[ french ] = "~Gauche"; + Text[ spanish ] = "~Izquierda"; + Text[ italian ] = "Relazione sinistra"; + Text[ danish ] = "~Venstre"; + Text[ swedish ] = "~Vnstra"; + Text[ polish ] = "Lewe sprzenie"; + Text[ portuguese_brazilian ] = "~Left"; + Text[ japanese ] = "(~L)"; + Text[ chinese_simplified ] = "(~L)"; + Text[ chinese_traditional ] = "(~L)"; + Text[ dutch ] = "~Linker"; + Text[ chinese_simplified ] = "(~L)"; + Text[ greek ] = ""; + Text[ korean ] = "Ʈ (~L)"; + Text[ arabic ] = " "; + Text[ turkish ] = "~Sol"; + Text[ language_user1 ] = " "; + }; + RadioButton RB_RIGHT + { + Pos = MAP_APPFONT ( 12 , 46 ) ; + Size = MAP_APPFONT ( 63 , 10 ) ; + HelpId = HID_DLG_QRY_RIGHT ; + Text = "~Rechter" ; + Text [ ENGLISH ] = "~Right" ; + Text[ english_us ] = "~Right Join"; + Text[ portuguese ] = "~Direita"; + Text[ russian ] = " "; + Text[ dutch ] = "~Rechter"; + Text[ french ] = "~Droite"; + Text[ spanish ] = "~Derecha"; + Text[ italian ] = "Relazione destra"; + Text[ danish ] = "~Hjre"; + Text[ swedish ] = "~Hgra"; + Text[ polish ] = "Prawe sprzenie"; + Text[ portuguese_brazilian ] = "~Right"; + Text[ japanese ] = "E(~R)"; + Text[ chinese_simplified ] = "(~R)"; + Text[ chinese_traditional ] = "k(~R)"; + Text[ dutch ] = "~Rechter"; + Text[ chinese_simplified ] = "(~R)"; + Text[ greek ] = ""; + Text[ korean ] = "Ʈ (~R)"; + Text[ arabic ] = " "; + Text[ turkish ] = "~Sa"; + Text[ language_user1 ] = " "; + }; + RadioButton RB_FULL + { + Pos = MAP_APPFONT ( 12 , 62 ) ; + Size = MAP_APPFONT ( 63 , 10 ) ; + HelpId = HID_DLG_QRY_FULL ; + Text = "~Vollstndiger" ; + Text [ ENGLISH ] = "~Full" ; + Text[ english_us ] = "~Full (Outer) Join"; + Text[ portuguese ] = "Co~mpleto"; + Text[ russian ] = " "; + Text[ dutch ] = "~Volledige"; + Text[ french ] = "~Complte"; + Text[ spanish ] = "~Completa"; + Text[ italian ] = "Relazione completa"; + Text[ danish ] = "~Fuldstndig"; + Text[ swedish ] = "~Fullstndig"; + Text[ polish ] = "Pene sprzenie"; + Text[ portuguese_brazilian ] = "~Full"; + Text[ japanese ] = "S(~F)"; + Text[ chinese_simplified ] = "(~F)"; + Text[ chinese_traditional ] = "㪺(~F)"; + Text[ language_user1 ] = " "; + Text[ dutch ] = "~Volledige"; + Text[ chinese_simplified ] = "(~F)"; + Text[ greek ] = ""; + Text[ korean ] = "Ǯ (~F)"; + Text[ arabic ] = " "; + Text[ turkish ] = "Tam"; + }; + + MultiLineEdit ML_HELPTEXT + { + Pos = MAP_APPFONT ( 81 , 14 ) ; + Size = MAP_APPFONT ( 110 , 58 ) ; + HelpId = HID_DLG_QRY_HELPTEXT ; + ReadOnly = TRUE; + SVLook = TRUE; + Border = TRUE; + }; + + OKButton PB_OK + { + Pos = MAP_APPFONT ( 6 , 87 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + DefButton = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 59 , 87 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 147 , 87 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + Text[ english_us ] = "Join Properties"; + Text[ portuguese ] = "Propriedades relacionais"; + Text[ russian ] = " "; + Text[ dutch ] = "Verbindingseigenschappen"; + Text[ french ] = "Proprits de la jointure"; + Text[ spanish ] = "Propiedades de unin"; + Text[ italian ] = "Propriet relazioni"; + Text[ danish ] = "Forbindelsesegenskaber"; + Text[ swedish ] = "Frbindelseegenskaper"; + Text[ polish ] = "Waciowoci sprzenia"; + Text[ portuguese_brazilian ] = "Join properties"; + Text[ japanese ] = ""; + Text[ chinese_simplified ] = ""; + Text[ chinese_traditional ] = "sݩ"; + Text[ dutch ] = "Verbindingseigenschappen"; + Text[ chinese_simplified ] = ""; + Text[ greek ] = " "; + Text[ korean ] = " Ӽ"; + Text[ arabic ] = " "; + Text[ turkish ] = "Birleme zellikleri"; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_INNER_JOIN +{ + Text = "Beinhaltet nur die Datenstze, bei denen die Inhalte der verknpften Felder beider Tabellen gleich sind."; + Text [ ENGLISH ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ english_us ] = "Only includes records for which the contents of both related tables are identical."; + Text[ portuguese ] = "Contm apenas os registos de dados, cujos contedos dos campos ligados sejam iguais em ambas as tabelas."; + Text[ russian ] = " , ."; + Text[ dutch ] = "Bevat alleen records waarbij de de inhoud van de gekoppelde velden van beide tabellen gelijk zijn."; + Text[ french ] = "Contient uniquement les enregistrements pour lesquels les contenus des champs lis des deux tables sont identiques."; + Text[ spanish ] = "Contiene solo los registros en los que los contenidos de los campos vinculados de ambas tablas con iguales"; + Text[ italian ] = "Contiene solamente i record di dati in cui i contenuti dei campi collegati di entrambe le tabelle sono uguali."; + Text[ danish ] = "Indeholder kun dataposter for hvilke indholdet af de sammenkdede felter i begge tabeller er ens."; + Text[ swedish ] = "Innehller bara de dataposter vars innehll i de lnkade flten r lika i bda tabellerna."; + Text[ polish ] = "Zawiera tylko te rekordy, ktrych zawartoci w poczonych polach s takie same w obydwu tabelach."; + Text[ portuguese_brazilian ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ japanese ] = "ðقݸ̨ނ̓evںނ݂̂܂݂܂B"; + Text[ chinese_simplified ] = "ֻͬĿ"; + Text[ chinese_traditional ] = "ȥ]tӪ椤ޥۦPƶءC"; + Text[ dutch ] = "Bevat alleen records waarbij de de inhoud van de gekoppelde velden van beide tabellen gelijk zijn."; + Text[ chinese_simplified ] = "ֻͬĿ"; + Text[ greek ] = " ."; + Text[ korean ] = " ̺ ʵ ̰ ڵ常 մϴ."; + Text[ arabic ] = " ."; + Text[ turkish ] = "Yalnzca her iki tablodaki ilikili alan ieriklerinin ayn olduu kaytlar ierir."; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_LEFTRIGHT_JOIN +{ + Text = "Beinhaltet ALLE Datenstze aus '%1' und nur die Datenstze aus '%2', bei denen die Inhalte der verknpften Felder beider Tabellen gleich sind."; + Text [ ENGLISH ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ english_us ] = "Contains ALL records from table '%1' but only records from table '%2' where the values in the related field are matching."; + Text[ portuguese ] = "Contm TODOS os registos de dados de '%1' e apenas os registos de dados de '%2', cujos contedos dos campos ligados sejam iguais em ambas as tabelas."; + Text[ russian ] = " '%1', '%2', ."; + Text[ dutch ] = "Bevat ALLE records uit '%1' en alleen de records uit '%2' waarbij de inhoud van de gekoppelde velden in beide tabellen gelijk zijn."; + Text[ french ] = "Contient TOUS les enregistrements de '%1' et uniquement les enregistrements de '%2' pour lesquels les contenus des champs lis des deux tables sont identiques."; + Text[ spanish ] = "Contiene TODOS los registros de datos de '%1' y solo los registros de '%2' en los que los contenidos de los campos vinculados de ambas tablas son iguales."; + Text[ italian ] = "Contiene TUTTI i record di dati da '%1' e soltanto i record di dati da '%2' in cui i campi collegati di entrambe le caselle sono uguali."; + Text[ danish ] = "Indeholder alle dataposter fra '%1' og kun de dataposter fra '%2', for hvilke indholdet af de sammenkdede felter i begge tabeller ens."; + Text[ swedish ] = "Innehller ALLA dataposter ur '%1' och bara de dataposter ur '%2' vars innehll i de lnkade flten r lika i bda tabellerna."; + Text[ polish ] = "Zawiera WSZYSTKIE rekordy z %1 i tylko te rekordy z %2, przy ktrych wartoci poczonych pl obu tabel s rwne."; + Text[ portuguese_brazilian ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ japanese ] = "'%1' ðقׂ̂ĂںށA '%2' ðقںނŗðقݸ̨ނ̓evںނ݂̂܂݂܂B"; + Text[ chinese_simplified ] = "'%1'еĿ'%2ͬĿ"; + Text[ chinese_traditional ] = "t'%1'ҦƶةM'%2Ӫ檺ޥۦPƶءC"; + Text[ dutch ] = "Bevat ALLE records uit '%1' en alleen de records uit '%2' waarbij de inhoud van de gekoppelde velden in beide tabellen gelijk zijn."; + Text[ chinese_simplified ] = "'%1'еĿ'%2ͬĿ"; + Text[ greek ] = " '%1' '%2' ."; + Text[ korean ] = "̺'%1' ڵ, ̺ '%2' ̺ ʵ ڵ常 մϴ ."; + Text[ arabic ] = " '%1' '%2' ."; + Text[ turkish ] = "'%1' tablosundaki kaytlarn TAMAMINI ve '%2' tablosundaki kaytlardan yalnzca her iki tablodaki ilikili alan ierikleri ayn olan kaytlar ierir."; + Text[ language_user1 ] = " "; +}; + +String STR_QUERY_FULL_JOIN +{ + Text = "Beinhaltet ALLE Datenstze aus '%1' und aus '%2'."; + Text [ ENGLISH ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ english_us ] = "Contains ALL records from both tables, i.e., '%1' and '%2'."; + Text[ portuguese ] = "Contm TODOS os registos de dados de '%1' e de '%2'."; + Text[ russian ] = " '%1' '%2'."; + Text[ dutch ] = "Bevat ALLE records uit '%1' en uit '%2'."; + Text[ french ] = "Contient TOUS les enregistrements de '%1' et de '%2'."; + Text[ spanish ] = "Contiene TODOS los registros de datos de '%1' y de '%2'"; + Text[ italian ] = "Contiene TUTTI i record di dati da '%1' e da '%2'."; + Text[ danish ] = "Indeholder ALLE dataposter fra '%1' og fra '%2'."; + Text[ swedish ] = "Innehller ALLA dataposterna ur '%1' och ur '%2'."; + Text[ polish ] = "Zawiera WSZYSTKIE rekordy z %1' i z %2'."; + Text[ portuguese_brazilian ] = "(no function);Average;Count;Maximum;Minimum;Sum;Grouping"; + Text[ japanese ] = "'%1' '%2' ׂ̂Ăںނ܂݂܂B"; + Text[ chinese_simplified ] = " '%1''%2'ȫĿ"; + Text[ chinese_traditional ] = "t '%1'M'%2'ƶ"; + Text[ dutch ] = "Bevat ALLE records uit '%1' en uit '%2'."; + Text[ chinese_simplified ] = " '%1''%2'ȫĿ"; + Text[ greek ] = " '%1' '%2'."; + Text[ korean ] = "̺'%1' '%2' ڵ带 մϴ."; + Text[ arabic ] = " '%1' '%2'."; + Text[ turkish ] = "'%1' ve '%2' tablolarndaki TM kaytlar ierir."; + Text[ language_user1 ] = " "; +}; + |