26#include <core_resource.hxx>
28#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
29#include <com/sun/star/sdbc/SQLException.hpp>
32#define ID_INNER_JOIN 1
34#define ID_RIGHT_JOIN 3
36#define ID_CROSS_JOIN 5
44 const TTableConnectionData::value_type& _pData,
47 bool _bAllowTableSelect)
48 : GenericDialogController(pParent->
GetFrameWeld(),
"dbaccess/ui/joindialog.ui",
"JoinDialog")
50 , m_pOrigConnData(_pData)
52 , m_xML_HelpText(m_xBuilder->weld_label(
"helptext"))
53 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
54 , m_xLB_JoinType(m_xBuilder->weld_combo_box(
"type"))
55 , m_xCBNatural(m_xBuilder->weld_check_button(
"natural"))
71 if( _bAllowTableSelect )
84 bool bSupportFullJoin =
false;
90 bSupportFullJoin = xMeta->supportsFullOuterJoins();
95 bool bSupportOuterJoin =
false;
99 bSupportOuterJoin= xMeta->supportsOuterJoins();
142 if (!m_xLB_JoinType->get_value_changed_from_saved())
145 m_xLB_JoinType->save_value();
146 m_xML_HelpText->set_label(OUString());
148 m_xTableControl->enableRelation(
true);
150 OUString sFirstWinName = m_pConnData->getReferencingTable()->GetWinName();
151 OUString sSecondWinName = m_pConnData->getReferencedTable()->GetWinName();
152 const EJoinType eOldJoinType = eJoinType;
154 const sal_Int32
nPos = m_xLB_JoinType->get_active();
155 const sal_Int32 nJoinType = m_xLB_JoinType->get_id(
nPos).toInt32();
156 bool bAddHint =
true;
161 pResId = STR_QUERY_INNER_JOIN;
166 pResId = STR_QUERY_LEFTRIGHT_JOIN;
170 pResId = STR_QUERY_LEFTRIGHT_JOIN;
172 std::swap( sFirstWinName, sSecondWinName );
175 pResId = STR_QUERY_FULL_JOIN;
180 pResId = STR_QUERY_CROSS_JOIN;
183 m_pConnData->ResetConnLines();
184 m_xTableControl->lateInit();
185 m_xCBNatural->set_active(
false);
186 m_xTableControl->enableRelation(
false);
187 m_pConnData->AppendConnLine(
"",
"");
188 m_xPB_OK->set_sensitive(
true);
193 m_xCBNatural->set_sensitive(eJoinType !=
CROSS_JOIN);
195 if ( eJoinType != eOldJoinType && eOldJoinType ==
CROSS_JOIN )
197 m_pConnData->ResetConnLines();
201 m_xTableControl->NotifyCellChange();
202 NaturalToggleHdl(*m_xCBNatural);
205 m_xTableControl->Invalidate();
207 OUString sHelpText =
DBA_RES(pResId);
210 sHelpText = sHelpText.replaceFirst(
"%1", sFirstWinName );
211 sHelpText = sHelpText.replaceFirst(
"%2", sSecondWinName );
215 sHelpText +=
"\n" +
DBA_RES( STR_JOIN_TYPE_HINT );
218 m_xML_HelpText->set_label( sHelpText );
223 m_pConnData->Update();
224 m_pOrigConnData->CopyFrom( *m_pConnData );
231 bool bChecked = m_xCBNatural->get_active();
233 m_xTableControl->enableRelation(!bChecked);
242 const OUString* pIter =
aSeq.getConstArray();
243 const OUString* pEnd = pIter +
aSeq.getLength();
244 for(;pIter != pEnd;++pIter)
246 if ( xReferencedTableColumns->hasByName(*pIter) )
247 m_pConnData->AppendConnLine(*pIter,*pIter);
254 m_xTableControl->NotifyCellChange();
255 m_xTableControl->Invalidate();
275 sal_Int32 nJoinType = 0;
Reference< XExecutableDialog > m_xDialog
constexpr tools::Long Height() const
constexpr tools::Long Width() const
std::unique_ptr< weld::Label > m_xML_HelpText
void setJoinType(EJoinType _eNewJoinType)
setJoinType enables and set the new join type
virtual ~DlgQryJoin() override
std::unique_ptr< OTableListBoxControl > m_xTableControl
virtual void notifyConnectionChange() override
notifyConnectionChange is callback which is called when the table selection has changed and a new con...
std::unique_ptr< weld::ComboBox > m_xLB_JoinType
css::uno::Reference< css::sdbc::XConnection > m_xConnection
TTableConnectionData::value_type m_pConnData
std::unique_ptr< weld::CheckButton > m_xCBNatural
virtual void setValid(bool _bValid) override
setValid set the valid inside, can be used for OK buttons
std::unique_ptr< weld::Button > m_xPB_OK
OJoinController & getController() const
std::map< OUString, VclPtr< OTableWindow > > OTableWindowMap
OJoinDesignView * getDesignView() const
EJoinType GetJoinType() const
void ResetConnLines()
Deletes list of ConnLines.
std::unique_ptr< weld::Builder > m_xBuilder
#define DBG_UNHANDLED_EXCEPTION(...)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define LINK(Instance, Class, Member)
Sequence< sal_Int8 > aSeq
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Reference< XConnection > m_xConnection