summaryrefslogtreecommitdiffstats
path: root/dbaccess/source/ui/tabledesign/TableController.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/tabledesign/TableController.cxx')
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx41
1 files changed, 17 insertions, 24 deletions
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index 17ad5ed2f28d..924d9010b362 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -50,9 +50,10 @@
#include <connectivity/dbtools.hxx>
#include <connectivity/dbmetadata.hxx>
#include <cppuhelper/exc_hlp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
+#include <o3tl/string_view.hxx>
#include <algorithm>
#include <functional>
@@ -67,7 +68,6 @@ org_openoffice_comp_dbu_OTableDesign_get_implementation(
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::io;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
@@ -75,7 +75,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::ui;
using namespace ::com::sun::star::util;
using namespace ::dbtools;
using namespace ::dbaui;
@@ -314,9 +313,9 @@ bool OTableController::doSaveDoc(bool _bSaveAs)
xTable = xFact->createDataDescriptor();
OSL_ENSURE(xTable.is(),"OTableController::doSaveDoc: Create query failed!");
// to set the name is only allowed when the query is new
- xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xTable->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xTable->setPropertyValue(PROPERTY_NAME,makeAny(m_sName));
+ xTable->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xTable->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xTable->setPropertyValue(PROPERTY_NAME,Any(m_sName));
// now append the columns
Reference<XColumnsSupplier> xColSup(xTable,UNO_QUERY);
@@ -454,13 +453,11 @@ void OTableController::doEditIndexes()
}
-void OTableController::impl_initialize()
+void OTableController::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
try
{
- OTableController_BASE::impl_initialize();
-
- const NamedValueCollection& rArguments( getInitParams() );
+ OTableController_BASE::impl_initialize(rArguments);
rArguments.get_ensureType( PROPERTY_CURRENTTABLE, m_sName );
@@ -662,7 +659,7 @@ void OTableController::appendColumns(Reference<XColumnsSupplier> const & _rxColS
if(!_bKeyColumns)
::dbaui::setColumnProperties(xColumn,pField);
else
- xColumn->setPropertyValue(PROPERTY_NAME,makeAny(pField->GetName()));
+ xColumn->setPropertyValue(PROPERTY_NAME,Any(pField->GetName()));
xAppend->appendByDescriptor(xColumn);
xColumn = nullptr;
@@ -721,7 +718,7 @@ void OTableController::appendPrimaryKey(Reference<XKeysSupplier> const & _rxSup,
Reference<XPropertySet> xKey = xKeyFactory->createDataDescriptor();
OSL_ENSURE(xKey.is(),"Key is null!");
- xKey->setPropertyValue(PROPERTY_TYPE,makeAny(KeyType::PRIMARY));
+ xKey->setPropertyValue(PROPERTY_TYPE,Any(KeyType::PRIMARY));
Reference<XColumnsSupplier> xColSup(xKey,UNO_QUERY);
if(xColSup.is())
@@ -902,15 +899,15 @@ bool OTableController::checkColumns(bool _bNew)
{
case RET_YES:
{
- auto pNewRow = std::make_shared<OTableRow>();
TOTypeInfoSP pTypeInfo = ::dbaui::queryPrimaryKeyType(m_aTypeInfo);
if ( !pTypeInfo )
break;
+ auto pNewRow = std::make_shared<OTableRow>();
pNewRow->SetFieldType( pTypeInfo );
OFieldDescription* pActFieldDescr = pNewRow->GetActFieldDescr();
- pActFieldDescr->SetAutoIncrement(false);
+ pActFieldDescr->SetAutoIncrement(pTypeInfo->bAutoIncrement);
pActFieldDescr->SetIsNullable(ColumnValue::NO_NULLS);
pActFieldDescr->SetName( createUniqueName("ID" ));
@@ -1120,14 +1117,14 @@ void OTableController::alterColumns()
xColumns->getByName(pField->GetName()) >>= xColumn;
Reference<XPropertySetInfo> xInfo = xColumn->getPropertySetInfo();
if ( xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
- xColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(pField->GetHelpText()));
+ xColumn->setPropertyValue(PROPERTY_HELPTEXT,Any(pField->GetHelpText()));
if(xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
xColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,pField->GetControlDefault());
if(xInfo->hasPropertyByName(PROPERTY_FORMATKEY))
- xColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(pField->GetFormatKey()));
+ xColumn->setPropertyValue(PROPERTY_FORMATKEY,Any(pField->GetFormatKey()));
if(xInfo->hasPropertyByName(PROPERTY_ALIGN))
- xColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAlign(pField->GetHorJustify())));
+ xColumn->setPropertyValue(PROPERTY_ALIGN,Any(dbaui::mapTextAlign(pField->GetHorJustify())));
}
}
// second drop all columns which could be found by name
@@ -1163,15 +1160,11 @@ void OTableController::alterColumns()
}
catch (const SQLException&)
{
+ const auto caughtException = ::cppu::getCaughtException();
OUString sError( DBA_RES( STR_TABLEDESIGN_COULD_NOT_DROP_COL ) );
sError = sError.replaceFirst( "$column$", rColumnName );
- SQLException aNewException;
- aNewException.Message = sError;
- aNewException.SQLState = "S1000";
- aNewException.NextException = ::cppu::getCaughtException();
-
- throw aNewException;
+ throw SQLException(sError, {}, "S1000", 0, caughtException);
}
}
}
@@ -1443,7 +1436,7 @@ OUString OTableController::getPrivateTitle() const
if ( sTitle.isEmpty() )
{
OUString aName = DBA_RES(STR_TBL_TITLE);
- sTitle = aName.getToken(0,' ') + OUString::number(getCurrentStartNumber());
+ sTitle = o3tl::getToken(aName,0,' ') + OUString::number(getCurrentStartNumber());
}
}
catch( const Exception& )