21#include <core_resource.hxx>
23#include <com/sun/star/sdb/CommandType.hpp>
24#include <com/sun/star/sdbc/XRow.hpp>
43 if (m_aChecker.checkString(rTest, sCorrected))
53 FGetMetaStrings GetAll,
const OUString& _rCurrent )
61 while ( xRes->next() ) {
62 sValue = xRow->getString( 1 );
63 if ( !xRow->wasNull() )
72 }
catch(
const Exception& ) {
82 const OUString& rDefault,
85 : GenericDialogController(pParent,
"dbaccess/ui/savedialog.ui",
"SaveDialog")
88 , m_rObjectNameCheck( _rObjectNameCheck )
91 , m_aChecker(OUString())
92 , m_xDescription(m_xBuilder->weld_label(
"descriptionft"))
93 , m_xCatalogLbl(m_xBuilder->weld_label(
"catalogft"))
94 , m_xCatalog(m_xBuilder->weld_combo_box(
"catalog"))
95 , m_xSchemaLbl(m_xBuilder->weld_label(
"schemaft"))
96 , m_xSchema(m_xBuilder->weld_combo_box(
"schema"))
97 ,
m_xLabel(m_xBuilder->weld_label(
"titleft"))
98 , m_xTitle(m_xBuilder->weld_entry(
"title"))
99 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
101 if ( _xConnection.is() )
102 m_xMetaData = _xConnection->getMetaData();
104 if (m_xMetaData.is())
106 OUString sExtraNameChars(m_xMetaData->getExtraNameCharacters());
107 m_aChecker.setAllowedChars(sExtraNameChars);
110 m_xTitle->connect_insert_text(
LINK(
this,
OSaveAsDlg, TextFilterHdl));
111 m_xSchema->connect_entry_insert_text(
LINK(
this,
OSaveAsDlg, TextFilterHdl));
112 m_xCatalog->connect_entry_insert_text(
LINK(
this,
OSaveAsDlg, TextFilterHdl));
116 implInitOnlyTitle(
DBA_RES(STR_QRY_LABEL));
120 OSL_ENSURE( m_xMetaData.is(),
"OSaveAsDlg::OSaveAsDlg: no meta data for entering table names: this will crash!" );
123 if(m_xMetaData.is() && !m_xMetaData->supportsCatalogsInTableDefinitions()) {
124 m_xCatalogLbl->hide();
128 lcl_fillComboList( *m_xCatalog, _xConnection,
129 &XDatabaseMetaData::getCatalogs, _xConnection->getCatalog() );
132 if ( !m_xMetaData->supportsSchemasInTableDefinitions()) {
133 m_xSchemaLbl->hide();
136 lcl_fillComboList( *m_xSchema, _xConnection,
137 &XDatabaseMetaData::getSchemas, m_xMetaData->getUserName() );
140 OSL_ENSURE(m_xMetaData.is(),
"The metadata can not be null!");
141 if(
m_aName.indexOf(
'.') != -1) {
143 ::dbtools::qualifiedNameComponents(m_xMetaData,
148 ::dbtools::EComposeRule::InDataManipulation);
152 m_xCatalog->set_active(nPos);
157 m_xSchema->set_active(nPos);
159 m_xTitle->set_text(sTable);
161 m_xTitle->set_text(m_aName);
162 m_xTitle->select_region(0, -1);
164 sal_Int32
nLength = m_xMetaData.is() ? m_xMetaData->getMaxTableNameLength() : 0;
167 m_xTitle->set_max_length(nLength);
168 m_xSchema->set_entry_max_length(nLength);
169 m_xCatalog->set_entry_max_length(nLength);
173 m_aChecker.setCheck(bCheck);
178 OSL_FAIL(
"OSaveAsDlg::OSaveAsDlg: Type not supported yet!" );
186 const OUString& rDefault,
187 const OUString& _sLabel,
190 : GenericDialogController(pParent,
"dbaccess/ui/savedialog.ui",
"SaveDialog")
193 , m_rObjectNameCheck( _rObjectNameCheck )
196 , m_aChecker(OUString())
197 , m_xDescription(m_xBuilder->weld_label(
"descriptionft"))
198 , m_xCatalogLbl(m_xBuilder->weld_label(
"catalogft"))
199 , m_xCatalog(m_xBuilder->weld_combo_box(
"catalog"))
200 , m_xSchemaLbl(m_xBuilder->weld_label(
"schemaft"))
201 , m_xSchema(m_xBuilder->weld_combo_box(
"schema"))
202 ,
m_xLabel(m_xBuilder->weld_label(
"titleft"))
203 , m_xTitle(m_xBuilder->weld_entry(
"title"))
204 , m_xPB_OK(m_xBuilder->weld_button(
"ok"))
206 m_xTitle->connect_insert_text(
LINK(
this,
OSaveAsDlg, TextFilterHdl));
207 m_xSchema->connect_entry_insert_text(
LINK(
this,
OSaveAsDlg, TextFilterHdl));
208 m_xCatalog->connect_entry_insert_text(
LINK(
this,
OSaveAsDlg, TextFilterHdl));
209 implInitOnlyTitle(_sLabel);
213OSaveAsDlg::~OSaveAsDlg()
219 m_aName = m_xTitle->get_text();
221 OUString sNameToCheck(
m_aName );
224 sNameToCheck = ::dbtools::composeTableName(
230 ::dbtools::EComposeRule::InDataManipulation
235 if ( m_rObjectNameCheck.isNameValid( sNameToCheck, aNameError ) )
239 m_xTitle->grab_focus();
244 m_xPB_OK->set_sensitive(!m_xTitle->get_text().isEmpty());
Reference< XExecutableDialog > m_xDialog
interface encapsulating the check for the validity of an object name
void setCheck(bool _bCheck)
std::unique_ptr< weld::Label > m_xDescription
std::unique_ptr< weld::Label > m_xLabel
std::unique_ptr< weld::Entry > m_xTitle
const OUString & getName() const
std::unique_ptr< weld::Label > m_xSchemaLbl
std::unique_ptr< weld::ComboBox > m_xSchema
OUString getSchema() const
std::unique_ptr< weld::Button > m_xPB_OK
void implInitOnlyTitle(const OUString &_rLabel)
std::unique_ptr< weld::Label > m_xCatalogLbl
OUString getCatalog() const
std::unique_ptr< weld::ComboBox > m_xCatalog
OSQLNameChecker m_aChecker
std::unique_ptr< weld::Label > m_xLabel
virtual int find_text(const OUString &rStr) const=0
virtual void set_active(int pos)=0
void append_text(const OUString &rStr)
std::shared_ptr< weld::Dialog > m_xDialog
Reference< XComponentContext > m_xContext
#define DBG_UNHANDLED_EXCEPTION(...)
IMPL_LINK(OSaveAsDlg, TextFilterHdl, OUString &, rTest, bool)
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
bool isSQL92CheckEnabled(const css::uno::Reference< css::sdbc::XConnection > &_xConnection)
check if SQL92 name checking is enabled