22#include <com/sun/star/sdbc/KeyRule.hpp>
23#include <com/sun/star/sdbc/SQLException.hpp>
38using namespace ::
dbaui;
42 const TTableConnectionData::value_type& pConnectionData,
43 bool bAllowTableSelect )
45 "dbaccess/ui/relationdialog.ui",
"RelationDialog")
47 , m_pOrigConnData(pConnectionData)
48 , m_bTriedOneUpdate(false)
49 , m_xRB_NoCascUpd(m_xBuilder->weld_radio_button(
"addaction"))
50 , m_xRB_CascUpd(m_xBuilder->weld_radio_button(
"addcascade"))
51 , m_xRB_CascUpdNull(m_xBuilder->weld_radio_button(
"addnull"))
52 , m_xRB_CascUpdDefault(m_xBuilder->weld_radio_button(
"adddefault"))
53 , m_xRB_NoCascDel(m_xBuilder->weld_radio_button(
"delaction"))
54 , m_xRB_CascDel(m_xBuilder->weld_radio_button(
"delcascade"))
55 , m_xRB_CascDelNull(m_xBuilder->weld_radio_button(
"delnull"))
56 , m_xRB_CascDelDefault(m_xBuilder->weld_radio_button(
"deldefault"))
57 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
69 if ( bAllowTableSelect )
89 case KeyRule::NO_ACTION:
90 case KeyRule::RESTRICT:
94 case KeyRule::CASCADE:
98 case KeyRule::SET_NULL:
101 case KeyRule::SET_DEFAULT:
109 case KeyRule::NO_ACTION:
110 case KeyRule::RESTRICT:
114 case KeyRule::CASCADE:
118 case KeyRule::SET_NULL:
121 case KeyRule::SET_DEFAULT:
130 sal_uInt16 nAttrib = 0;
133 if( m_xRB_NoCascDel->get_active() )
134 nAttrib |= KeyRule::NO_ACTION;
135 if( m_xRB_CascDel->get_active() )
136 nAttrib |= KeyRule::CASCADE;
137 if( m_xRB_CascDelNull->get_active() )
138 nAttrib |= KeyRule::SET_NULL;
139 if( m_xRB_CascDelDefault->get_active() )
140 nAttrib |= KeyRule::SET_DEFAULT;
142 ORelationTableConnectionData* pConnData =
static_cast<ORelationTableConnectionData*
>(m_pConnData.get());
143 pConnData->SetDeleteRules( nAttrib );
147 if( m_xRB_NoCascUpd->get_active() )
148 nAttrib |= KeyRule::NO_ACTION;
149 if( m_xRB_CascUpd->get_active() )
150 nAttrib |= KeyRule::CASCADE;
151 if( m_xRB_CascUpdNull->get_active() )
152 nAttrib |= KeyRule::SET_NULL;
153 if( m_xRB_CascUpdDefault->get_active() )
154 nAttrib |= KeyRule::SET_DEFAULT;
155 pConnData->SetUpdateRules( nAttrib );
157 m_xTableControl->SaveModified();
167 ORelationTableConnectionData* pOrigConnData =
static_cast<ORelationTableConnectionData*
>(m_pOrigConnData.get());
168 if ( *pConnData == *pOrigConnData || pConnData->Update())
170 m_pOrigConnData->CopyFrom( *m_pConnData );
175 catch(
const SQLException& )
177 ::dbtools::showError(SQLExceptionInfo(::cppu::getCaughtException()),
179 m_pParent->getDesignView()->getController().getORB());
186 m_bTriedOneUpdate =
true;
192 m_xTableControl->Init( m_pConnData );
193 m_xTableControl->lateInit();
198 short nResult = GenericDialogController::run();
Reference< XExecutableDialog > m_xDialog
OTableWindowMap & GetTabWinMap()
std::unique_ptr< weld::RadioButton > m_xRB_CascUpd
std::unique_ptr< weld::RadioButton > m_xRB_CascDel
std::unique_ptr< OTableListBoxControl > m_xTableControl
virtual ~ORelationDialog() override
std::unique_ptr< weld::RadioButton > m_xRB_CascUpdNull
std::unique_ptr< weld::RadioButton > m_xRB_NoCascUpd
std::unique_ptr< weld::Button > m_xPB_OK
void Init(const TTableConnectionData::value_type &_pConnectionData)
virtual void setValid(bool _bValid) override
setValid set the valid inside, can be used for OK buttons
std::unique_ptr< weld::RadioButton > m_xRB_CascDelNull
virtual void notifyConnectionChange() override
notifyConnectionChange is callback which is called when the table selection has changed and a new con...
virtual short run() override
TTableConnectionData::value_type m_pConnData
std::unique_ptr< weld::RadioButton > m_xRB_CascDelDefault
std::unique_ptr< weld::RadioButton > m_xRB_CascUpdDefault
std::unique_ptr< weld::RadioButton > m_xRB_NoCascDel
sal_Int32 GetUpdateRules() const
sal_Int32 GetDeleteRules() const
std::unique_ptr< weld::Builder > m_xBuilder
#define DBG_UNHANDLED_EXCEPTION(...)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)