Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "QTableConnectionData.hxx"
21 : #include <tools/debug.hxx>
22 : #include "QTableWindow.hxx"
23 :
24 : using namespace dbaui;
25 :
26 : //========================================================================
27 : // class OQueryTableConnectionData
28 : //========================================================================
29 : DBG_NAME(OQueryTableConnectionData)
30 : //------------------------------------------------------------------------
31 0 : OQueryTableConnectionData::OQueryTableConnectionData()
32 : :OTableConnectionData()
33 : ,m_eJoinType (INNER_JOIN)
34 0 : ,m_bNatural(false)
35 : {
36 : DBG_CTOR(OQueryTableConnectionData,NULL);
37 0 : }
38 :
39 : //------------------------------------------------------------------------
40 0 : OQueryTableConnectionData::OQueryTableConnectionData( const OQueryTableConnectionData& rConnData )
41 0 : :OTableConnectionData( rConnData )
42 : {
43 : DBG_CTOR(OQueryTableConnectionData,NULL);
44 0 : m_nFromEntryIndex = rConnData.m_nFromEntryIndex;
45 0 : m_nDestEntryIndex = rConnData.m_nDestEntryIndex;
46 :
47 0 : m_eFromType = rConnData.m_eFromType;
48 0 : m_eDestType = rConnData.m_eDestType;
49 0 : m_eJoinType = rConnData.m_eJoinType;
50 0 : m_bNatural = rConnData.m_bNatural;
51 0 : }
52 :
53 : //------------------------------------------------------------------------
54 0 : OQueryTableConnectionData::OQueryTableConnectionData(const TTableWindowData::value_type& _pReferencingTable
55 : ,const TTableWindowData::value_type& _pReferencedTable
56 : ,const ::rtl::OUString& rConnName)
57 : :OTableConnectionData( _pReferencingTable,_pReferencedTable, rConnName )
58 : ,m_nFromEntryIndex(0)
59 : ,m_nDestEntryIndex(0)
60 : ,m_eJoinType (INNER_JOIN)
61 : ,m_bNatural(false)
62 : ,m_eFromType(TAB_NORMAL_FIELD)
63 0 : ,m_eDestType(TAB_NORMAL_FIELD)
64 : {
65 : DBG_CTOR(OQueryTableConnectionData,NULL);
66 0 : }
67 :
68 : //------------------------------------------------------------------------
69 0 : OQueryTableConnectionData::~OQueryTableConnectionData()
70 : {
71 : DBG_DTOR(OQueryTableConnectionData,NULL);
72 0 : }
73 :
74 : //------------------------------------------------------------------------
75 0 : OConnectionLineDataRef OQueryTableConnectionData::CreateLineDataObj()
76 : {
77 : DBG_CHKTHIS(OQueryTableConnectionData,NULL);
78 : // no specializing of LineDatas, so it is an instance of standard class
79 0 : return new OConnectionLineData();
80 : }
81 :
82 : //------------------------------------------------------------------------
83 0 : OConnectionLineDataRef OQueryTableConnectionData::CreateLineDataObj( const OConnectionLineData& rConnLineData )
84 : {
85 : DBG_CHKTHIS(OQueryTableConnectionData,NULL);
86 0 : return new OConnectionLineData( rConnLineData );
87 : }
88 :
89 : //------------------------------------------------------------------------
90 0 : void OQueryTableConnectionData::CopyFrom(const OTableConnectionData& rSource)
91 : {
92 : DBG_CHKTHIS(OQueryTableConnectionData,NULL);
93 : // same as in base class, use of (non-virtual) operator=
94 0 : *this = (const OQueryTableConnectionData&)rSource;
95 0 : }
96 :
97 : //------------------------------------------------------------------------
98 0 : OQueryTableConnectionData& OQueryTableConnectionData::operator=(const OQueryTableConnectionData& rConnData)
99 : {
100 : DBG_CHKTHIS(OQueryTableConnectionData,NULL);
101 0 : if (&rConnData == this)
102 0 : return *this;
103 :
104 0 : OTableConnectionData::operator=(rConnData);
105 :
106 0 : m_nFromEntryIndex = rConnData.m_nFromEntryIndex;
107 0 : m_nDestEntryIndex = rConnData.m_nDestEntryIndex;
108 :
109 0 : m_eFromType = rConnData.m_eFromType;
110 0 : m_eDestType = rConnData.m_eDestType;
111 0 : m_eJoinType = rConnData.m_eJoinType;
112 0 : m_bNatural = rConnData.m_bNatural;
113 :
114 0 : return *this;
115 : }
116 :
117 : //------------------------------------------------------------------------------
118 0 : ::rtl::OUString OQueryTableConnectionData::GetAliasName(EConnectionSide nWhich) const
119 : {
120 : DBG_CHKTHIS(OQueryTableConnectionData,NULL);
121 0 : return nWhich == JTCS_FROM ? m_pReferencingTable->GetWinName() : m_pReferencedTable->GetWinName();
122 : }
123 :
124 : //------------------------------------------------------------------------------
125 0 : void OQueryTableConnectionData::InitFromDrag(const OTableFieldDescRef& rDragLeft, const OTableFieldDescRef& rDragRight)
126 : {
127 : DBG_CHKTHIS(OQueryTableConnectionData,NULL);
128 : // convert Information in rDrag into parameters for the base class init
129 0 : OQueryTableWindow* pSourceWin = static_cast<OQueryTableWindow*>(rDragLeft->GetTabWindow());
130 0 : OQueryTableWindow* pDestWin = static_cast<OQueryTableWindow*>(rDragRight->GetTabWindow());
131 : OSL_ENSURE(pSourceWin,"NO Source window found!");
132 : OSL_ENSURE(pDestWin,"NO Dest window found!");
133 0 : m_pReferencingTable = pSourceWin->GetData();
134 0 : m_pReferencedTable = pDestWin->GetData();
135 :
136 : // set members
137 0 : SetFieldIndex(JTCS_FROM, rDragLeft->GetFieldIndex());
138 0 : SetFieldIndex(JTCS_TO, rDragRight->GetFieldIndex());
139 :
140 0 : SetFieldType(JTCS_FROM, rDragLeft->GetFieldType());
141 0 : SetFieldType(JTCS_TO, rDragRight->GetFieldType());
142 :
143 0 : AppendConnLine((::rtl::OUString)rDragLeft->GetField(),(::rtl::OUString)rDragRight->GetField());
144 0 : }
145 : // -----------------------------------------------------------------------------
146 0 : OTableConnectionData* OQueryTableConnectionData::NewInstance() const
147 : {
148 0 : return new OQueryTableConnectionData();
149 : }
150 : // -----------------------------------------------------------------------------
151 0 : sal_Bool OQueryTableConnectionData::Update()
152 : {
153 0 : return sal_True;
154 : }
155 : // -----------------------------------------------------------------------------
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|