21#include <bitmaps.hlst>
23#include <osl/diagnose.h>
31#include <core_resource.hxx>
34using namespace ::
dbaui;
44 , m_pParentTabPage(pParentTabPage)
82 OSL_ENSURE(nRow == -1,
"nRow must be -1!");
89 pCurFieldDescr = weld::fromId<OFieldDescription*>(pListBox->
get_id(
nPos));
90 OSL_ENSURE( pCurFieldDescr,
"OWizTypeSelectControl::CellModified: Columnname/type not found in the listbox!" );
91 if ( !pCurFieldDescr )
107 bool bDoubleName =
false;
113 for (sal_Int32
i=0 ; !bDoubleName &&
i <
nCount ; ++
i)
116 bDoubleName = sNewName.equalsIgnoreAsciiCase(sEntry);
123 bDoubleName = ((pListBox->
find_text(sNewName) != -1)
129 OUString strMessage =
DBA_RES(STR_TABLEDESIGN_DUPLICATE_NAME);
130 strMessage = strMessage.replaceFirst(
"$column$", sNewName);
138 OUString sOldName = pCurFieldDescr->
GetName();
139 pCurFieldDescr->
SetName(sNewName);
147 if ( aCase(elem.second,
sName) )
149 elem.second = sNewName;
206 :
OWizardPage(pPage, pWizard,
"dbaccess/ui/typeselectpage.ui",
"TypeSelect")
208 , m_xControlContainer(m_xBuilder->weld_container(
"control_container"))
210 , m_xAutoType(m_xBuilder->weld_label(
"autotype"))
211 , m_xAutoFt(m_xBuilder->weld_label(
"autolabel"))
212 , m_xAutoEt(m_xBuilder->weld_spin_button(
"auto"))
213 , m_xAutoPb(m_xBuilder->weld_button(
"autobutton"))
214 , m_pParserStream(pStream)
216 , m_bAutoIncrementEnabled(false)
217 , m_bDuplicateName(false)
245 return DBA_RES(STR_WIZ_TYPE_SELECT_TITLE);
250 OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
252 m_xTypeControl->DisplayData(pField);
254 m_xTypeControl->Enable(m_xColumnNames->count_selected_rows() == 1);
261 sal_Int32
nCount(0), nBreakPos;
262 m_pParent->CheckColumns(nBreakPos);
265 for (
auto const& column : rDestColumns)
269 if (column->second->IsPrimaryKey())
273 m_bFirstTime =
false;
278 bool bOldFirstTime = m_bFirstTime;
280 m_bFirstTime = bOldFirstTime;
289 bool bDuplicateName =
false;
296 return !bDuplicateName;
310 m_pParent->CheckColumns(nBreakPos);
313 sal_uInt32 nRows = m_xAutoEt->get_text().toInt32();
316 sal_uInt64
const nTell = m_pParserStream->Tell();
318 createReaderAndCallParser(nRows);
319 m_pParserStream->Seek(nTell);
335 std::sort(aRows.begin(), aRows.end());
337 const sal_Int32
nCount = aRows.size();
342 if(!pField || pField->
getTypeInfo()->nSearchType == ColumnSearch::NONE)
364 if (rCEvt.GetCommand() != CommandEventId::ContextMenu)
366 if (!IsPrimaryKeyAllowed())
370 auto xContextMenu = xBuilder->weld_menu(
"menu");
373 bool bCheckOk =
false;
374 for(sal_Int32 j = 0 ; j <
nCount ; ++j)
376 OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(
m_xControl->get_id(j));
380 if( pFieldDescr && pFieldDescr->IsPrimaryKey() !=
m_xControl->is_selected(j) )
390 xContextMenu->set_active(
"primarykey",
true);
393 if (sCommand !=
"primarykey")
396 for (sal_Int32 j = 0 ; j <
nCount; ++j)
398 OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(
m_xControl->get_id(j));
403 setPrimaryKey(pFieldDescr,j,
true);
407 setPrimaryKey(pFieldDescr,j);
#define FIELD_PROPERTY_COLUMNNAME
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
const OUString & getPrimaryKeyName() const
returns the name of the primary key
void replaceColumn(sal_Int32 _nPos, OFieldDescription *_pField, const OUString &_sOldName)
replaces a field description with another one.
TNameMapping m_mNameMapping
bool shouldCreatePrimaryKey() const
returns whether a primary key should be created in the target database
void showError(const OUString &_sErrorMessage)
std::vector< TColumns::const_iterator > TColumnVector
virtual void ActivateAggregate(EControlType eType)
OFieldDescription * getCurrentFieldDescData()
void saveCurrentFieldDescData()
void DisplayData(OFieldDescription *pFieldDescr)
void setCurrentFieldDescData(OFieldDescription *_pDesc)
const OPropColumnEditCtrl * getColumnCtrl() const
virtual void DeactivateAggregate(EControlType eType)
void SetControlDefault(const css::uno::Any &_rControlDefault)
const TOTypeInfoSP & getTypeInfo() const
void SetPrimaryKey(bool _bPKey)
void SetName(const OUString &_rName)
OUString get_text() const
virtual css::lang::Locale GetLocale() const override
virtual bool isAutoIncrementValueEnabled() const override
OWizTypeSelect * m_pParentTabPage
virtual ~OWizTypeSelectControl() override
virtual css::uno::Reference< css::sdbc::XDatabaseMetaData > getMetaData() override
virtual void DeactivateAggregate(EControlType eType) override
virtual css::uno::Reference< css::util::XNumberFormatter > GetFormatter() const override
virtual OUString getAutoIncrementValue() const override
virtual void ActivateAggregate(EControlType eType) override
virtual void CellModified(sal_Int32 nRow, sal_uInt16 nColId) override
virtual const OTypeInfoMap * getTypeInfo() const override
virtual css::uno::Reference< css::sdbc::XConnection > getConnection() override
OWizTypeSelectList(std::unique_ptr< weld::TreeView > xControl)
void setPrimaryKey(OFieldDescription *_pFieldDescr, sal_uInt16 _nPos, bool _bSet=false)
std::unique_ptr< weld::TreeView > m_xControl
bool IsPrimaryKeyAllowed() const
std::unique_ptr< weld::Label > m_xAutoType
bool m_bAutoIncrementEnabled
std::unique_ptr< OWizTypeSelectControl > m_xTypeControl
void setDuplicateName(bool _bDuplicateName)
virtual void Reset() override
std::unique_ptr< weld::Label > m_xAutoFt
std::unique_ptr< weld::SpinButton > m_xAutoEt
OWizTypeSelect(weld::Container *pParent, OCopyTableWizard *pWizard, SvStream *pStream=nullptr)
void EnableAuto(bool bEnable)
OUString m_sAutoIncrementValue
virtual ~OWizTypeSelect() override
std::unique_ptr< weld::Button > m_xAutoPb
std::unique_ptr< OWizTypeSelectList > m_xColumnNames
virtual void Activate() override
virtual OUString GetTitle() const override
virtual bool LeavePage() override
virtual int find_text(const OUString &rText) const=0
virtual OUString get_text(int row, int col=-1) const=0
virtual int n_children() const=0
void insert_text(int pos, const OUString &rStr)
virtual void remove(int pos)=0
virtual void set_id(int row, const OUString &rId)=0
virtual OUString get_id(int pos) const=0
#define DBG_UNHANDLED_EXCEPTION(...)
#define LINK(Instance, Class, Member)
std::multimap< DataTypeEnum, OExtendedTypeInfo * > OTypeInfoMap
IMPL_LINK_NOARG(OApplicationController, OnClipboardChanged, TransferableDataHelper *, void)
void fillAutoIncrementValue(const css::uno::Reference< css::beans::XPropertySet > &_xDatasource, bool &_rAutoIncrementValueEnabled, OUString &_rsAutoIncrementValue)
fills the bool and string value with information out of the datasource info property
IMPL_LINK(OApplicationController, OnSelectContainer, void *, _pType, void)
std::shared_ptr< OTypeInfo > TOTypeInfoSP
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
OUString toId(const void *pValue)