summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/misc
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source/ui/misc')
-rw-r--r--dbaccess/source/ui/misc/DExport.cxx96
-rw-r--r--dbaccess/source/ui/misc/HtmlReader.cxx8
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx23
-rw-r--r--dbaccess/source/ui/misc/RtfReader.cxx4
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx55
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx307
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx276
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx54
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx37
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx148
-rw-r--r--dbaccess/source/ui/misc/WExtendPages.cxx4
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx34
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx68
-rw-r--r--dbaccess/source/ui/misc/asyncmodaldialog.cxx4
-rw-r--r--dbaccess/source/ui/misc/charsets.cxx14
-rw-r--r--dbaccess/source/ui/misc/controllerframe.cxx8
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx77
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx23
-rw-r--r--dbaccess/source/ui/misc/dbaundomanager.cxx5
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx35
-rw-r--r--dbaccess/source/ui/misc/defaultobjectnamecheck.cxx44
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx104
-rw-r--r--dbaccess/source/ui/misc/imageprovider.cxx78
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx52
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx99
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx26
26 files changed, 749 insertions, 934 deletions
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index cc24fe114c63..1cba0dee6943 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -40,11 +40,11 @@
#include <TypeInfo.hxx>
#include <FieldDescriptions.hxx>
#include <UITools.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <WCopyTable.hxx>
#include <unotools/syslocale.hxx>
-#include <svl/zforlist.hxx>
+#include <svl/numformat.hxx>
#include <connectivity/dbexception.hxx>
#include <connectivity/FValue.hxx>
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
@@ -68,20 +68,19 @@ namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOper
// ODatabaseExport
ODatabaseExport::ODatabaseExport(sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&&_rColumnPositions,
const Reference< XNumberFormatter >& _rxNumberF,
const Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* pList,
const OTypeInfoMap* _pInfoMap,
bool _bAutoIncrementEnabled,
SvStream& _rInputStream)
- :m_vColumnPositions(_rColumnPositions)
- ,m_aDestColumns(true)
+ :m_vColumnPositions(std::move(_rColumnPositions))
+ ,m_aDestColumns(comphelper::UStringMixLess(true))
,m_xFormatter(_rxNumberF)
,m_xContext(_rxContext)
,m_pFormatter(nullptr)
,m_rInputStream( _rInputStream )
- ,m_pTypeInfo()
,m_pColumnList(pList)
,m_pInfoMap(_pInfoMap)
,m_nColumnPos(0)
@@ -126,13 +125,12 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
const Reference< XNumberFormatter >& _rxNumberF,
const Reference< css::uno::XComponentContext >& _rxContext,
SvStream& _rInputStream)
- :m_aDestColumns(_rxConnection->getMetaData().is() && _rxConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ :m_aDestColumns(comphelper::UStringMixLess(_rxConnection->getMetaData().is() && _rxConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()))
,m_xConnection(_rxConnection)
,m_xFormatter(_rxNumberF)
,m_xContext(_rxContext)
,m_pFormatter(nullptr)
,m_rInputStream( _rInputStream )
- ,m_pTypeInfo()
,m_pColumnList(nullptr)
,m_pInfoMap(nullptr)
,m_nColumnPos(0)
@@ -190,11 +188,11 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
sal_Int32 nPos = 1;
OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector");
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- OUString sTypeName = aValue;
+ OUString sTypeName = aValue.getString();
++nPos;
OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector");
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- sal_Int32 nType = aValue;
+ sal_Int32 nType = aValue.getInt32();
++nPos;
if( nType == DataType::VARCHAR )
@@ -206,44 +204,44 @@ ODatabaseExport::ODatabaseExport(const SharedConnection& _rxConnection,
OSL_ENSURE((nPos) < static_cast<sal_Int32>(aTypes.size()),"aTypes: Illegal index for vector");
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nPrecision = aValue;
+ m_pTypeInfo->nPrecision = aValue.getInt32();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralPrefix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->aCreateParams = aValue;
+ m_pTypeInfo->aCreateParams = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE;
+ m_pTypeInfo->bNullable = aValue.getInt32() == ColumnValue::NULLABLE;
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bCaseSensitive
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nSearchType = aValue;
+ m_pTypeInfo->nSearchType = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bUnsigned
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->bCurrency = aValue;
+ m_pTypeInfo->bCurrency = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->bAutoIncrement = aValue;
+ m_pTypeInfo->bAutoIncrement = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->aLocalTypeName = aValue;
+ m_pTypeInfo->aLocalTypeName = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nMinimumScale = aValue;
+ m_pTypeInfo->nMinimumScale = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- m_pTypeInfo->nMaximumScale = aValue;
+ m_pTypeInfo->nMaximumScale = aValue.getInt16();
nPos = 18;
aValue.fill(nPos,aTypes[nPos],xRow);
- m_pTypeInfo->nNumPrecRadix = aValue;
+ m_pTypeInfo->nNumPrecRadix = aValue.getInt32();
// check if values are less than zero like it happens in a oracle jdbc driver
if( m_pTypeInfo->nPrecision < 0)
@@ -423,9 +421,6 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
case NumberFormat::ALL:
nNumberFormat = NumberFormat::ALL;
break;
- case NumberFormat::DEFINED:
- nNumberFormat = NumberFormat::TEXT;
- break;
case NumberFormat::DATE:
switch(_nOldNumberFormat)
{
@@ -461,12 +456,10 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
case NumberFormat::CURRENCY:
switch(_nOldNumberFormat)
{
- case NumberFormat::NUMBER:
- nNumberFormat = NumberFormat::CURRENCY;
- break;
case NumberFormat::CURRENCY:
nNumberFormat = _nOldNumberFormat;
break;
+ case NumberFormat::NUMBER:
case NumberFormat::ALL:
nNumberFormat = NumberFormat::CURRENCY;
break;
@@ -498,6 +491,7 @@ sal_Int16 ODatabaseExport::CheckString(const OUString& aCheckToken, sal_Int16 _n
case NumberFormat::TEXT:
case NumberFormat::UNDEFINED:
case NumberFormat::LOGICAL:
+ case NumberFormat::DEFINED:
nNumberFormat = NumberFormat::TEXT; // Text overwrites everything
break;
case NumberFormat::DATETIME:
@@ -550,13 +544,6 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
switch ( nType )
{
- case NumberFormat::ALL:
- nDataType = DataType::DOUBLE;
- break;
- case NumberFormat::DEFINED:
- nDataType = DataType::VARCHAR;
- nLength = ((m_vColumnSize[i] % 10 ) ? m_vColumnSize[i]/ 10 + 1: m_vColumnSize[i]/ 10) * 10;
- break;
case NumberFormat::DATE:
nDataType = DataType::DATE;
break;
@@ -571,12 +558,14 @@ void ODatabaseExport::SetColumnTypes(const TColumnVector* _pList,const OTypeInfo
nScale = 4;
nLength = 19;
break;
+ case NumberFormat::ALL:
case NumberFormat::NUMBER:
case NumberFormat::SCIENTIFIC:
case NumberFormat::FRACTION:
case NumberFormat::PERCENT:
nDataType = DataType::DOUBLE;
break;
+ case NumberFormat::DEFINED:
case NumberFormat::TEXT:
case NumberFormat::UNDEFINED:
case NumberFormat::LOGICAL:
@@ -657,18 +646,18 @@ void ODatabaseExport::CreateDefaultColumn(const OUString& _rColumnName)
void ODatabaseExport::createRowSet()
{
- m_pUpdateHelper = std::make_shared<OParameterUpdateHelper>(createPreparedStatment(m_xConnection->getMetaData(),m_xTable,m_vColumnPositions));
+ m_pUpdateHelper = std::make_shared<OParameterUpdateHelper>(createPreparedStatement(m_xConnection->getMetaData(),m_xTable,m_vColumnPositions));
}
bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTextColor, const FontDescriptor& _rFont)
{
bool bHaveDefaultTable = !m_sDefaultTableName.isEmpty();
- OUString sTableName( bHaveDefaultTable ? m_sDefaultTableName : _rTableName );
+ const OUString& rTableName(bHaveDefaultTable ? m_sDefaultTableName : _rTableName);
OCopyTableWizard aWizard(
nullptr,
- sTableName,
+ rTableName,
bHaveDefaultTable ? CopyTableOperation::AppendData : CopyTableOperation::CopyDefinitionAndData,
- m_aDestColumns,
+ ODatabaseExport::TColumns(m_aDestColumns),
m_vDestVector,
m_xConnection,
m_xFormatter,
@@ -691,7 +680,7 @@ bool ODatabaseExport::executeWizard(const OUString& _rTableName, const Any& _aTe
bError = !m_xTable.is();
if(m_xTable.is())
{
- m_xTable->setPropertyValue(PROPERTY_FONT,makeAny(_rFont));
+ m_xTable->setPropertyValue(PROPERTY_FONT,Any(_rFont));
if(_aTextColor.hasValue())
m_xTable->setPropertyValue(PROPERTY_TEXTCOLOR,_aTextColor);
}
@@ -773,14 +762,14 @@ void ODatabaseExport::ensureFormatter()
if ( !m_pFormatter )
{
Reference< XNumberFormatsSupplier > xSupplier = m_xFormatter->getNumberFormatsSupplier();
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
m_pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr;
Reference<XPropertySet> xNumberFormatSettings = xSupplier->getNumberFormatSettings();
- xNumberFormatSettings->getPropertyValue("NullDate") >>= m_aNullDate;
+ xNumberFormatSettings->getPropertyValue(u"NullDate"_ustr) >>= m_aNullDate;
}
}
-Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const Reference<XDatabaseMetaData>& _xMetaData
+Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const Reference<XDatabaseMetaData>& _xMetaData
,const Reference<XPropertySet>& _xDestTable
,const TPositions& _rvColumns)
{
@@ -805,19 +794,17 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
{
return Reference< XPreparedStatement > ();
}
- const OUString* pIter = aDestColumnNames.getConstArray();
- std::vector< OUString> aInsertList;
- aInsertList.resize(aDestColumnNames.getLength()+1);
- for(size_t j=0; j < aInsertList.size(); ++j)
+
+ std::vector<OUString> aInsertList;
+ auto sortedColumns = _rvColumns;
+ std::sort(sortedColumns.begin(), sortedColumns.end());
+ aInsertList.reserve(_rvColumns.size());
+ for (const auto& [nSrc, nDest] : sortedColumns)
{
- ODatabaseExport::TPositions::const_iterator aFind = std::find_if(_rvColumns.begin(),_rvColumns.end(),
- [j] (const ODatabaseExport::TPositions::value_type& tPos)
- { return tPos.second == static_cast<sal_Int32>(j+1); });
- if ( _rvColumns.end() != aFind && aFind->second != COLUMN_POSITION_NOT_FOUND && aFind->first != COLUMN_POSITION_NOT_FOUND )
- {
- OSL_ENSURE((aFind->first) < static_cast<sal_Int32>(aInsertList.size()),"aInsertList: Illegal index for vector");
- aInsertList[aFind->first] = ::dbtools::quoteName( aQuote,*(pIter+j));
- }
+ if (nSrc == COLUMN_POSITION_NOT_FOUND || nDest == COLUMN_POSITION_NOT_FOUND)
+ continue;
+ assert(nDest > 0 && nDest <= aDestColumnNames.getLength());
+ aInsertList.push_back(dbtools::quoteName(aQuote, aDestColumnNames[nDest - 1]));
}
// create the sql string
@@ -825,8 +812,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
{
if ( !elem.isEmpty() )
{
- aSql.append(elem);
- aSql.append(",");
+ aSql.append(elem + ",");
aValues.append("?,");
}
}
diff --git a/dbaccess/source/ui/misc/HtmlReader.cxx b/dbaccess/source/ui/misc/HtmlReader.cxx
index 6e3d329e3ef2..c2917a6300e0 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -64,14 +64,14 @@ OHTMLReader::OHTMLReader(SvStream& rIn,const SharedConnection& _rxConnection,
OHTMLReader::OHTMLReader(SvStream& rIn,
sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&& _rColumnPositions,
const Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* pList,
const OTypeInfoMap* _pInfoMap,
bool _bAutoIncrementEnabled)
: HTMLParser(rIn)
- , ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
+ , ODatabaseExport( nRows, std::move(_rColumnPositions), _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
, m_nTableCount(0)
, m_nColumnWidth(87)
{
@@ -312,7 +312,7 @@ void OHTMLReader::TableFontOn(FontDescriptor& _rFont, Color &_rTextColor)
while( nPos != -1 )
{
// list of fonts, VCL: semicolon as separator, HTML: comma
- OUString aFName = rFace.getToken( 0, ',', nPos );
+ std::u16string_view aFName = o3tl::getToken(rFace, 0, ',', nPos );
aFName = comphelper::string::strip(aFName, ' ');
if( !aFontName.isEmpty() )
aFontName.append(";");
@@ -465,7 +465,7 @@ bool OHTMLReader::CreateTable(HtmlTokenId nToken)
if ( isCheckEnabled() )
return true;
- return !executeWizard(aTableName,makeAny(nTextColor),aFont) && m_xTable.is();
+ return !executeWizard(aTableName,Any(nTextColor),aFont) && m_xTable.is();
}
void OHTMLReader::setTextEncoding()
diff --git a/dbaccess/source/ui/misc/RowSetDrop.cxx b/dbaccess/source/ui/misc/RowSetDrop.cxx
index 065fee9ce9c0..2efbe1cf414d 100644
--- a/dbaccess/source/ui/misc/RowSetDrop.cxx
+++ b/dbaccess/source/ui/misc/RowSetDrop.cxx
@@ -33,11 +33,7 @@
using namespace dbaui;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdb;
-using namespace ::com::sun::star::lang;
// export data
ORowSetImportExport::ORowSetImportExport(weld::Window* pParent,
@@ -62,7 +58,7 @@ void ORowSetImportExport::initialize()
m_xTargetResultSetMetaData = Reference<XResultSetMetaDataSupplier>(m_xTargetResultSetUpdate,UNO_QUERY_THROW)->getMetaData();
if(!m_xTargetResultSetMetaData.is() || !xColumnLocate.is() || !m_xResultSetMetaData.is() )
- throw SQLException(DBA_RES(STR_UNEXPECTED_ERROR),*this,"S1000",0,Any());
+ throw SQLException(DBA_RES(STR_UNEXPECTED_ERROR),*this,u"S1000"_ustr,0,Any());
sal_Int32 nCount = m_xTargetResultSetMetaData->getColumnCount();
m_aColumnMapping.reserve(nCount);
@@ -99,21 +95,21 @@ bool ORowSetImportExport::Write()
bool ORowSetImportExport::Read()
{
+ if (!m_xResultSet)
+ return false;
// check if there is any column to copy
if(std::none_of(m_aColumnMapping.begin(),m_aColumnMapping.end(),
[](sal_Int32 n) { return n > 0; }))
return false;
- bool bContinue = true;
if(m_aSelection.hasElements())
{
- const Any* pBegin = m_aSelection.getConstArray();
- const Any* pEnd = pBegin + m_aSelection.getLength();
- for(;pBegin != pEnd && bContinue;++pBegin)
+ for (auto& any : m_aSelection)
{
sal_Int32 nPos = -1;
- *pBegin >>= nPos;
+ any >>= nPos;
OSL_ENSURE(nPos != -1,"Invalid position!");
- bContinue = (m_xResultSet.is() && m_xResultSet->absolute(nPos) && insertNewRow());
+ if (!m_xResultSet->absolute(nPos) || !insertNewRow())
+ break;
}
}
else
@@ -135,10 +131,11 @@ bool ORowSetImportExport::Read()
}
OSL_ENSURE(nRowCount,"RowCount is 0!");
m_xResultSet->beforeFirst();
- while(m_xResultSet.is() && m_xResultSet->next() && bContinue && nRowCount )
+ while(m_xResultSet.is() && m_xResultSet->next() && nRowCount )
{
--nRowCount;
- bContinue = insertNewRow();
+ if (!insertNewRow())
+ break;
}
}
return true;
diff --git a/dbaccess/source/ui/misc/RtfReader.cxx b/dbaccess/source/ui/misc/RtfReader.cxx
index 1a247ca88b06..8895d494f817 100644
--- a/dbaccess/source/ui/misc/RtfReader.cxx
+++ b/dbaccess/source/ui/misc/RtfReader.cxx
@@ -57,14 +57,14 @@ ORTFReader::ORTFReader( SvStream& rIn,
ORTFReader::ORTFReader(SvStream& rIn,
sal_Int32 nRows,
- const TPositions &_rColumnPositions,
+ TPositions&& _rColumnPositions,
const Reference< css::util::XNumberFormatter >& _rxNumberF,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const TColumnVector* pList,
const OTypeInfoMap* _pInfoMap,
bool _bAutoIncrementEnabled)
:SvRTFParser(rIn)
- ,ODatabaseExport( nRows, _rColumnPositions, _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
+ ,ODatabaseExport( nRows, std::move(_rColumnPositions), _rxNumberF, _rxContext, pList, _pInfoMap, _bAutoIncrementEnabled, rIn )
{
m_bAppendFirstLine = false;
}
diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index e5c3f529b4a1..75be554a1cd1 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -35,7 +35,7 @@
#include <svx/dbaexchange.hxx>
#include <unotools/ucbhelper.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <sal/log.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <unotools/tempfile.hxx>
@@ -48,12 +48,10 @@ using namespace ::svx;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::ucb;
OTableCopyHelper::OTableCopyHelper(OGenericUnoController* _pController)
@@ -89,15 +87,15 @@ void OTableCopyHelper::insertTable( std::u16string_view i_rSourceDataSource, con
Reference< XDataAccessDescriptorFactory > xFactory( DataAccessDescriptorFactory::get( aContext ) );
Reference< XPropertySet > xSource( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
- xSource->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( i_nCommandType ) );
- xSource->setPropertyValue( PROPERTY_COMMAND, makeAny( i_rCommand ) );
- xSource->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xSrcConnection ) );
- xSource->setPropertyValue( PROPERTY_RESULT_SET, makeAny( i_rSourceRows ) );
- xSource->setPropertyValue( PROPERTY_SELECTION, makeAny( i_rSelection ) );
- xSource->setPropertyValue( PROPERTY_BOOKMARK_SELECTION, makeAny( i_bBookmarkSelection ) );
+ xSource->setPropertyValue( PROPERTY_COMMAND_TYPE, Any( i_nCommandType ) );
+ xSource->setPropertyValue( PROPERTY_COMMAND, Any( i_rCommand ) );
+ xSource->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( xSrcConnection ) );
+ xSource->setPropertyValue( PROPERTY_RESULT_SET, Any( i_rSourceRows ) );
+ xSource->setPropertyValue( PROPERTY_SELECTION, Any( i_rSelection ) );
+ xSource->setPropertyValue( PROPERTY_BOOKMARK_SELECTION, Any( i_bBookmarkSelection ) );
Reference< XPropertySet > xDest( xFactory->createDataAccessDescriptor(), UNO_SET_THROW );
- xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( i_rDestConnection ) );
+ xDest->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( i_rDestConnection ) );
auto xInteractionHandler = InteractionHandler::createWithParent(aContext, VCLUnoHelper::GetInterface(m_pController->getView()));
@@ -109,7 +107,7 @@ void OTableCopyHelper::insertTable( std::u16string_view i_rSourceDataSource, con
bool bAppendToExisting = !sTableNameForAppend.isEmpty();
xWizard->setOperation( bAppendToExisting ? CopyTableOperation::AppendData : CopyTableOperation::CopyDefinitionAndData );
- xWizard->execute();
+ (void)xWizard->execute();
}
catch( const SQLException& )
{
@@ -182,17 +180,16 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
try
{
DropDescriptor aTrans;
- bool bOk;
if ( _nFormatId != SotClipboardFormatId::RTF )
- bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SotClipboardFormatId::HTML ,aTrans.aHtmlRtfStorage);
+ aTrans.aHtmlRtfStorage = _rTransData.GetSotStorageStream(SotClipboardFormatId::HTML);
else
- bOk = const_cast<TransferableDataHelper&>(_rTransData).GetSotStorageStream(SotClipboardFormatId::RTF,aTrans.aHtmlRtfStorage);
+ aTrans.aHtmlRtfStorage = _rTransData.GetSotStorageStream(SotClipboardFormatId::RTF);
aTrans.nType = E_TABLE;
aTrans.bHtml = SotClipboardFormatId::HTML == _nFormatId;
aTrans.sDefaultTableName = GetTableNameForAppend();
- if ( !bOk || !copyTagTable(aTrans,false,_xConnection) )
- m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
+ if ( !aTrans.aHtmlRtfStorage || !copyTagTable(aTrans,false,_xConnection) )
+ m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, u"S1000"_ustr, 0, Any()));
}
catch(const SQLException&)
{
@@ -204,7 +201,7 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
}
}
else
- m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
+ m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, u"S1000"_ustr, 0, Any()));
}
void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData
@@ -221,14 +218,12 @@ void OTableCopyHelper::pasteTable( const TransferableDataHelper& _rTransData
bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor const & _rDesc, bool _bCheck, const SharedConnection& _xConnection)
{
- Reference<XEventListener> xEvt;
- ODatabaseImportExport* pImport = nullptr;
+ rtl::Reference<ODatabaseImportExport> pImport;
if ( _rDesc.bHtml )
pImport = new OHTMLImportExport(_xConnection,getNumberFormatter(_xConnection, m_pController->getORB()),m_pController->getORB());
else
pImport = new ORTFImportExport(_xConnection,getNumberFormatter(_xConnection, m_pController->getORB()),m_pController->getORB());
- xEvt = pImport;
SvStream* pStream = _rDesc.aHtmlRtfStorage.get();
if ( _bCheck )
pImport->enableCheckOnly();
@@ -258,25 +253,21 @@ bool OTableCopyHelper::copyTagTable(const TransferableDataHelper& _aDroppedData
bool bHtml = _aDroppedData.HasFormat(SotClipboardFormatId::HTML);
if ( bHtml || _aDroppedData.HasFormat(SotClipboardFormatId::RTF) )
{
- bool bOk;
- if ( bHtml )
- bOk = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SotClipboardFormatId::HTML ,_rAsyncDrop.aHtmlRtfStorage);
- else
- bOk = const_cast<TransferableDataHelper&>(_aDroppedData).GetSotStorageStream(SotClipboardFormatId::RTF,_rAsyncDrop.aHtmlRtfStorage);
+ _rAsyncDrop.aHtmlRtfStorage = _aDroppedData.GetSotStorageStream(bHtml ? SotClipboardFormatId::HTML : SotClipboardFormatId::RTF);
_rAsyncDrop.bHtml = bHtml;
_rAsyncDrop.bError = !copyTagTable(_rAsyncDrop,true,_xConnection);
- bRet = ( !_rAsyncDrop.bError && bOk && _rAsyncDrop.aHtmlRtfStorage.is() );
+ bRet = ( !_rAsyncDrop.bError && _rAsyncDrop.aHtmlRtfStorage );
if ( bRet )
{
// now we need to copy the stream
- ::utl::TempFile aTmp;
+ ::utl::TempFileNamed aTmp;
_rAsyncDrop.aUrl = aTmp.GetURL();
- ::tools::SvRef<SotTempStream> aNew = new SotTempStream( aTmp.GetFileName() );
+ std::unique_ptr<SvStream> aNew = SotTempStream::Create( aTmp.GetFileName() );
_rAsyncDrop.aHtmlRtfStorage->Seek(STREAM_SEEK_TO_BEGIN);
- _rAsyncDrop.aHtmlRtfStorage->CopyTo( aNew.get() );
- _rAsyncDrop.aHtmlRtfStorage = aNew;
+ aNew->WriteStream(*_rAsyncDrop.aHtmlRtfStorage);
+ _rAsyncDrop.aHtmlRtfStorage = std::move(aNew);
}
else
_rAsyncDrop.aHtmlRtfStorage = nullptr;
@@ -288,7 +279,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
,std::u16string_view i_rDestDataSource
,const SharedConnection& _xConnection)
{
- if ( _rDesc.aHtmlRtfStorage.is() )
+ if ( _rDesc.aHtmlRtfStorage )
{
copyTagTable(_rDesc,false,_xConnection);
_rDesc.aHtmlRtfStorage = nullptr;
@@ -300,7 +291,7 @@ void OTableCopyHelper::asyncCopyTagTable( DropDescriptor& _rDesc
else if ( !_rDesc.bError )
pasteTable(_rDesc.aDroppedData,i_rDestDataSource,_xConnection);
else
- m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
+ m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, u"S1000"_ustr, 0, Any()));
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 174a2d4e4ea7..17db6b7cdd5d 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -18,7 +18,7 @@
*/
#include <TokenWriter.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <tools/stream.hxx>
#include <osl/diagnose.h>
#include <rtl/tencinfo.h>
@@ -48,6 +48,7 @@
#include <svtools/htmlout.hxx>
#include <sfx2/frmhtmlw.hxx>
#include <svl/numuno.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <UITools.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -55,6 +56,7 @@
#include <vcl/settings.hxx>
#include <svtools/rtfout.hxx>
#include <svtools/htmlcfg.hxx>
+#include <o3tl/string_view.hxx>
#include <connectivity/formattedcolumnvalue.hxx>
#include <memory>
@@ -72,12 +74,13 @@ using namespace ::com::sun::star::sdbcx;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::util;
-#define CELL_X 1437
+constexpr sal_Int32 CELL_X = 1437;
ODatabaseImportExport::ODatabaseImportExport(const svx::ODataAccessDescriptor& _aDataDescriptor,
const Reference< XComponentContext >& _rM,
const Reference< css::util::XNumberFormatter >& _rxNumberF)
:m_bBookmarkSelection( false )
+ ,m_pStream(nullptr)
,m_xFormatter(_rxNumberF)
,m_xContext(_rM)
,m_nCommandType(CommandType::TABLE)
@@ -93,11 +96,11 @@ ODatabaseImportExport::ODatabaseImportExport(const svx::ODataAccessDescriptor& _
}
// import data
-ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& _rxConnection,
+ODatabaseImportExport::ODatabaseImportExport( ::dbtools::SharedConnection _xConnection,
const Reference< XNumberFormatter >& _rxNumberF, const Reference< XComponentContext >& _rM )
:m_bBookmarkSelection( false )
,m_pStream(nullptr)
- ,m_xConnection(_rxConnection)
+ ,m_xConnection(std::move(_xConnection))
,m_xFormatter(_rxNumberF)
,m_xContext(_rM)
,m_nCommandType(css::sdb::CommandType::TABLE)
@@ -120,7 +123,7 @@ void ODatabaseImportExport::dispose()
Reference< XComponent > xComponent(m_xConnection, UNO_QUERY);
if (xComponent.is())
{
- Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ Reference< XEventListener> xEvt(this);
xComponent->removeEventListener(xEvt);
}
m_xConnection.clear();
@@ -133,6 +136,7 @@ void ODatabaseImportExport::dispose()
m_xRow.clear();
m_xRowLocate.clear();
m_xFormatter.clear();
+ m_xRowSetColumns.clear();
}
void SAL_CALL ODatabaseImportExport::disposing( const EventObject& Source )
@@ -163,7 +167,7 @@ void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor
{
Reference< XConnection > xPureConn( _aDataDescriptor[DataAccessDescriptorProperty::Connection], UNO_QUERY );
m_xConnection.reset( xPureConn, SharedConnection::NoTakeOwnership );
- Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ Reference< XEventListener> xEvt(this);
Reference< XComponent > xComponent(m_xConnection, UNO_QUERY);
if (xComponent.is() && xEvt.is())
xComponent->addEventListener(xEvt);
@@ -212,7 +216,7 @@ void ODatabaseImportExport::initialize()
{ // we need a connection
OSL_ENSURE(!m_sDataSourceName.isEmpty(),"There must be a datsource name!");
Reference<XNameAccess> xDatabaseContext( DatabaseContext::create(m_xContext), UNO_QUERY_THROW);
- Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY);
+ Reference< XEventListener> xEvt(this);
Reference< XConnection > xConnection;
SQLExceptionInfo aInfo = ::dbaui::createConnection( m_sDataSourceName, xDatabaseContext, m_xContext, xEvt, xConnection );
@@ -256,11 +260,11 @@ void ODatabaseImportExport::initialize()
// the result set may be already set with the datadescriptor
if ( !m_xResultSet.is() )
{
- m_xResultSet.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", m_xContext), UNO_QUERY );
+ m_xResultSet.set( m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.sdb.RowSet"_ustr, m_xContext), UNO_QUERY );
Reference< XPropertySet > xProp( m_xResultSet, UNO_QUERY_THROW );
- xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( m_xConnection.getTyped() ) );
- xProp->setPropertyValue( PROPERTY_COMMAND_TYPE, makeAny( m_nCommandType ) );
- xProp->setPropertyValue( PROPERTY_COMMAND, makeAny( m_sName ) );
+ xProp->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, Any( m_xConnection.getTyped() ) );
+ xProp->setPropertyValue( PROPERTY_COMMAND_TYPE, Any( m_nCommandType ) );
+ xProp->setPropertyValue( PROPERTY_COMMAND, Any( m_sName ) );
Reference< XRowSet > xRowSet( xProp, UNO_QUERY );
xRowSet->execute();
}
@@ -317,13 +321,13 @@ bool ODatabaseImportExport::Read()
bool ORTFImportExport::Write()
{
ODatabaseImportExport::Write();
- m_pStream->WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RTF );
- m_pStream->WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI);
+ m_pStream->WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_RTF );
+ m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSI);
if (sal_uInt32 nCpg = rtl_getWindowsCodePageFromTextEncoding(m_eDestEnc); nCpg && nCpg != 65001)
{
- m_pStream->WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteUInt32AsString(nCpg);
+ m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteNumberAsString(nCpg);
}
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING);
+ m_pStream->WriteOString(SAL_NEWLINE_STRING);
bool bBold = ( css::awt::FontWeight::BOLD == m_aFont.Weight );
bool bItalic = ( css::awt::FontSlant_ITALIC == m_aFont.Slant );
@@ -341,44 +345,43 @@ bool ORTFImportExport::Write()
aFonts = OUStringToOString(aName, RTL_TEXTENCODING_MS_1252);
}
- m_pStream->WriteCharPtr( "{\\fonttbl" );
+ m_pStream->WriteOString( "{\\fonttbl" );
if (!aFonts.isEmpty())
{
sal_Int32 nIdx{0};
sal_Int32 nTok{-1}; // to compensate pre-increment
do {
- m_pStream->WriteCharPtr( "\\f" );
- m_pStream->WriteInt32AsString(++nTok);
- m_pStream->WriteCharPtr( "\\fcharset0\\fnil " );
- m_pStream->WriteOString( aFonts.getToken(0, ';', nIdx) );
+ m_pStream->WriteOString( "\\f" );
+ m_pStream->WriteNumberAsString(++nTok);
+ m_pStream->WriteOString( "\\fcharset0\\fnil " );
+ m_pStream->WriteOString( o3tl::getToken(aFonts, 0, ';', nIdx) );
m_pStream->WriteChar( ';' );
} while (nIdx>=0);
}
m_pStream->WriteChar( '}' ) ;
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
// write the rtf color table
- m_pStream->WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_COLORTBL ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RED );
- m_pStream->WriteUInt32AsString(aColor.GetRed());
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_GREEN );
- m_pStream->WriteUInt32AsString(aColor.GetGreen());
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_BLUE );
- m_pStream->WriteUInt32AsString(aColor.GetBlue());
+ m_pStream->WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_COLORTBL ).WriteOString( OOO_STRING_SVTOOLS_RTF_RED );
+ m_pStream->WriteNumberAsString(aColor.GetRed());
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_GREEN );
+ m_pStream->WriteNumberAsString(aColor.GetGreen());
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_BLUE );
+ m_pStream->WriteNumberAsString(aColor.GetBlue());
- m_pStream->WriteCharPtr( ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" )
- .WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" )
+ .WriteOString( SAL_NEWLINE_STRING );
static char const aCell1[] = "\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx";
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH );
- m_pStream->WriteInt32AsString(40);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( OOO_STRING_SVTOOLS_RTF_TRGAPH );
+ m_pStream->WriteOString("40");
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
if(m_xObject.is())
{
Reference<XColumnsSupplier> xColSup(m_xObject,UNO_QUERY);
Reference<XNameAccess> xColumns = xColSup->getColumns();
Sequence< OUString> aNames(xColumns->getElementNames());
- const OUString* pIter = aNames.getConstArray();
sal_Int32 nCount = aNames.getLength();
bool bUseResultMetaData = false;
@@ -390,14 +393,14 @@ bool ORTFImportExport::Write()
for( sal_Int32 i=1; i<=nCount; ++i )
{
- m_pStream->WriteCharPtr( aCell1 );
- m_pStream->WriteInt32AsString(i*CELL_X);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( aCell1 );
+ m_pStream->WriteNumberAsString(i*CELL_X);
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
}
// column description
- m_pStream->WriteChar( '{' ).WriteCharPtr( SAL_NEWLINE_STRING );
- m_pStream->WriteCharPtr( "\\trrh-270\\pard\\intbl" );
+ m_pStream->WriteChar( '{' ).WriteOString( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( "\\trrh-270\\pard\\intbl" );
std::unique_ptr<OString[]> pHorzChar(new OString[nCount]);
@@ -409,11 +412,10 @@ bool ORTFImportExport::Write()
sColumnName = m_xResultSetMetaData->getColumnName(i);
else
{
- sColumnName = *pIter;
+ sColumnName = aNames[i - 1];
Reference<XPropertySet> xColumn;
xColumns->getByName(sColumnName) >>= xColumn;
xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
- ++pIter;
}
const char* pChar;
@@ -427,52 +429,49 @@ bool ORTFImportExport::Write()
pHorzChar[i-1] = pChar; // to avoid to always rummage in the ITEMSET later on
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteChar( '{' );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_QC ); // column header always centered
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_QC ); // column header always centered
- if ( bBold ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_B );
- if ( bItalic ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_I );
- if ( bUnderline ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_UL );
- if ( bStrikeout ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_STRIKE );
+ if ( bBold ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_B );
+ if ( bItalic ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_I );
+ if ( bUnderline ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_UL );
+ if ( bStrikeout ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_STRIKE );
- m_pStream->WriteCharPtr( "\\fs20\\f0\\cf0\\cb2" );
+ m_pStream->WriteOString( "\\fs20\\f0\\cf0\\cb2" );
m_pStream->WriteChar( ' ' );
RTFOutFuncs::Out_String(*m_pStream, sColumnName, m_eDestEnc);
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_CELL );
m_pStream->WriteChar( '}' );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PARD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_INTBL );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_PARD ).WriteOString( OOO_STRING_SVTOOLS_RTF_INTBL );
}
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ROW );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ).WriteChar( '}' );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_ROW );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING ).WriteChar( '}' );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
sal_Int32 k=1;
sal_Int32 kk=0;
if ( m_aSelection.hasElements() )
{
- const Any* pSelIter = m_aSelection.getConstArray();
- const Any* pEnd = pSelIter + m_aSelection.getLength();
-
- bool bContinue = true;
- for( ; pSelIter != pEnd && bContinue; ++pSelIter )
+ for (auto& any : m_aSelection)
{
if ( m_bBookmarkSelection )
{
- bContinue = m_xRowLocate->moveToBookmark( *pSelIter );
+ if (!m_xRowLocate->moveToBookmark(any))
+ break;
}
else
{
sal_Int32 nPos = -1;
- OSL_VERIFY( *pSelIter >>= nPos );
- bContinue = ( m_xResultSet->absolute( nPos ) );
+ OSL_VERIFY(any >>= nPos);
+ if (!m_xResultSet->absolute(nPos))
+ break;
}
- if ( bContinue )
- appendRow( pHorzChar.get(), nCount, k, kk );
+ appendRow(pHorzChar.get(), nCount, k, kk);
}
}
else
@@ -485,7 +484,7 @@ bool ORTFImportExport::Write()
}
}
- m_pStream->WriteChar( '}' ).WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteChar( '}' ).WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteUChar( 0 );
return ((*m_pStream).GetError() == ERRCODE_NONE);
}
@@ -493,17 +492,17 @@ bool ORTFImportExport::Write()
void ORTFImportExport::appendRow(OString const * pHorzChar,sal_Int32 _nColumnCount,sal_Int32& k,sal_Int32& kk)
{
++kk;
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH );
- m_pStream->WriteInt32AsString(40);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( OOO_STRING_SVTOOLS_RTF_TRGAPH );
+ m_pStream->WriteOString("40");
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
static char const aCell2[] = "\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx";
for ( sal_Int32 i=1; i<=_nColumnCount; ++i )
{
- m_pStream->WriteCharPtr( aCell2 );
- m_pStream->WriteInt32AsString(i*CELL_X);
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( aCell2 );
+ m_pStream->WriteNumberAsString(i*CELL_X);
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
}
const bool bBold = ( css::awt::FontWeight::BOLD == m_aFont.Weight );
@@ -513,19 +512,19 @@ void ORTFImportExport::appendRow(OString const * pHorzChar,sal_Int32 _nColumnCou
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
m_pStream->WriteChar( '{' );
- m_pStream->WriteCharPtr( "\\trrh-270\\pard\\intbl" );
+ m_pStream->WriteOString( "\\trrh-270\\pard\\intbl" );
for ( sal_Int32 i=1; i <= _nColumnCount; ++i )
{
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteChar( '{' );
m_pStream->WriteOString( pHorzChar[i-1] );
- if ( bBold ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_B );
- if ( bItalic ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_I );
- if ( bUnderline ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_UL );
- if ( bStrikeout ) m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_STRIKE );
+ if ( bBold ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_B );
+ if ( bItalic ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_I );
+ if ( bUnderline ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_UL );
+ if ( bStrikeout ) m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_STRIKE );
- m_pStream->WriteCharPtr( "\\fs20\\f1\\cf0\\cb1 " );
+ m_pStream->WriteOString( "\\fs20\\f1\\cf0\\cb1 " );
try
{
@@ -540,12 +539,12 @@ void ORTFImportExport::appendRow(OString const * pHorzChar,sal_Int32 _nColumnCou
SAL_WARN("dbaccess.ui","RTF WRITE!");
}
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_CELL );
m_pStream->WriteChar( '}' );
- m_pStream->WriteCharPtr( SAL_NEWLINE_STRING );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_PARD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_INTBL );
+ m_pStream->WriteOString( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_PARD ).WriteOString( OOO_STRING_SVTOOLS_RTF_INTBL );
}
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ROW ).WriteCharPtr( SAL_NEWLINE_STRING );
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_ROW ).WriteOString( SAL_NEWLINE_STRING );
m_pStream->WriteChar( '}' );
++k;
}
@@ -568,13 +567,6 @@ bool ORTFImportExport::Read()
const sal_Int16 OHTMLImportExport::nCellSpacing = 0;
const char OHTMLImportExport::sIndentSource[nIndentMax+1] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
-// Macros for HTML-Export
-#define TAG_ON( tag ) HTMLOutFuncs::Out_AsciiTag( (*m_pStream), tag )
-#define TAG_OFF( tag ) HTMLOutFuncs::Out_AsciiTag( (*m_pStream), tag, false )
-#define OUT_LF() m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() )
-#define TAG_ON_LF( tag ) (TAG_ON( tag ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() ))
-#define TAG_OFF_LF( tag ) (TAG_OFF( tag ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( GetIndentStr() ))
-
OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDescriptor,
const Reference< XComponentContext >& _rM,
const Reference< css::util::XNumberFormatter >& _rxNumberF)
@@ -585,8 +577,7 @@ OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDes
#endif
{
// set HTML configuration
- SvxHtmlOptions& rHtmlOptions = SvxHtmlOptions::Get();
- m_eDestEnc = rHtmlOptions.GetTextEncoding();
+ m_eDestEnc = RTL_TEXTENCODING_UTF8;
strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource)));
sIndent[0] = 0;
}
@@ -596,13 +587,13 @@ bool OHTMLImportExport::Write()
ODatabaseImportExport::Write();
if(m_xObject.is())
{
- m_pStream->WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_doctype ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_doctype40 ).WriteChar( '>' ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( SAL_NEWLINE_STRING );
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_html );
+ m_pStream->WriteChar( '<' ).WriteOString( OOO_STRING_SVTOOLS_HTML_doctype ).WriteChar( ' ' ).WriteOString( OOO_STRING_SVTOOLS_HTML_doctype5 ).WriteChar( '>' ).WriteOString( SAL_NEWLINE_STRING ).WriteOString( SAL_NEWLINE_STRING );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteHeader();
- OUT_LF();
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteBody();
- OUT_LF();
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_html );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
return ((*m_pStream).GetError() == ERRCODE_NONE);
}
@@ -633,46 +624,53 @@ void OHTMLImportExport::WriteHeader()
xDocProps->setTitle(m_sName);
}
- IncIndent(1); TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_head );
+ IncIndent(1);
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
SfxFrameHTMLWriter::Out_DocInfo( (*m_pStream), OUString(),
- xDocProps, sIndent, osl_getThreadTextEncoding() );
- OUT_LF();
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_head );
+ xDocProps, sIndent );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ IncIndent(-1);
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteBody()
{
IncIndent(1);
- m_pStream->WriteCharPtr( "<" ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_style ).WriteCharPtr( " " ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_type ).WriteCharPtr( "=\"text/css\">" );
+ m_pStream->WriteOString( "<" ).WriteOString( OOO_STRING_SVTOOLS_HTML_style ).WriteOString( " " ).WriteOString( OOO_STRING_SVTOOLS_HTML_O_type ).WriteOString( "=\"text/css\">" );
- m_pStream->WriteCharPtr( "<!-- " ); OUT_LF();
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteCharPtr( " { " ).WriteCharPtr( "font-family: " ).WriteChar( '"' ).WriteOString( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()) ).WriteChar( '\"' );
+ m_pStream->WriteOString( "<!-- " );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString( OOO_STRING_SVTOOLS_HTML_body ).WriteOString( " { " ).WriteOString( "font-family: " ).WriteChar( '"' ).WriteOString( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()) ).WriteChar( '\"' );
// TODO : think about the encoding of the font name
- m_pStream->WriteCharPtr( "; " ).WriteCharPtr( "font-size: " );
- m_pStream->WriteInt32AsString(m_aFont.Height);
+ m_pStream->WriteOString( "; " ).WriteOString( "font-size: " );
+ m_pStream->WriteNumberAsString(m_aFont.Height);
m_pStream->WriteChar( '}' );
- OUT_LF();
- m_pStream->WriteCharPtr( " -->" );
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_style );
- OUT_LF();
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString( " -->" );
+ IncIndent(-1);
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_style, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// default Textcolour black
- m_pStream->WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_text ).WriteChar( '=' );
+ m_pStream->WriteChar( '<' ).WriteOString( OOO_STRING_SVTOOLS_HTML_body ).WriteChar( ' ' ).WriteOString( OOO_STRING_SVTOOLS_HTML_O_text ).WriteChar( '=' );
::Color aColor;
if(m_xObject.is())
m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
- m_pStream->WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" );
+ m_pStream->WriteOString( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" );
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
- m_pStream->WriteChar( '>' ); OUT_LF();
+ m_pStream->WriteChar( '>' );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteTables();
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_body );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_body, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteTables()
@@ -681,7 +679,7 @@ void OHTMLImportExport::WriteTables()
" "
OOO_STRING_SVTOOLS_HTML_frame
"="
- OOO_STRING_SVTOOLS_HTML_TF_void;
+ OOO_STRING_SVTOOLS_HTML_TF_void ""_ostr;
Sequence< OUString> aNames;
Reference<XNameAccess> xColumns;
@@ -695,8 +693,9 @@ void OHTMLImportExport::WriteTables()
{
sal_Int32 nCount = m_xResultSetMetaData->getColumnCount();
aNames.realloc(nCount);
+ auto aNamesRange = asNonConstRange(aNames);
for (sal_Int32 i= 0; i < nCount; ++i)
- aNames[i] = m_xResultSetMetaData->getColumnName(i+1);
+ aNamesRange[i] = m_xResultSetMetaData->getColumnName(i+1);
bUseResultMetaData = true;
}
}
@@ -718,27 +717,27 @@ void OHTMLImportExport::WriteTables()
"=1";
IncIndent(1);
- TAG_ON( aStrOut.getStr() );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut);
FontOn();
- TAG_ON( OOO_STRING_SVTOOLS_HTML_caption );
- TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_caption);
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold);
m_pStream->WriteOString( OUStringToOString(m_sName, osl_getThreadTextEncoding()) );
// TODO : think about the encoding of the name
- TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
- TAG_OFF( OOO_STRING_SVTOOLS_HTML_caption );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold, false);
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_caption, false);
FontOff();
- OUT_LF();
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// </FONT>
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_thead );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
if(m_xObject.is())
{
@@ -751,10 +750,7 @@ void OHTMLImportExport::WriteTables()
m_xObject->getPropertyValue(PROPERTY_ROW_HEIGHT) >>= nHeight;
// 1. writing the column description
- const OUString* pIter = aNames.getConstArray();
- const OUString* pEnd = pIter + aNames.getLength();
-
- for( sal_Int32 i=0;pIter != pEnd; ++pIter,++i )
+ for (sal_Int32 i = 0; i < aNames.getLength(); ++i)
{
sal_Int32 nAlign = 0;
pFormat[i] = 0;
@@ -762,7 +758,7 @@ void OHTMLImportExport::WriteTables()
if ( !bUseResultMetaData )
{
Reference<XPropertySet> xColumn;
- xColumns->getByName(*pIter) >>= xColumn;
+ xColumns->getByName(aNames[i]) >>= xColumn;
xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
pFormat[i] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_FORMATKEY));
pColWidth[i] = ::comphelper::getINT32(xColumn->getPropertyValue(PROPERTY_WIDTH));
@@ -778,26 +774,24 @@ void OHTMLImportExport::WriteTables()
if(i == aNames.getLength()-1)
IncIndent(-1);
- WriteCell(pFormat[i],pColWidth[i],nHeight,pHorJustify[i],*pIter,OOO_STRING_SVTOOLS_HTML_tableheader);
+ WriteCell(pFormat[i],pColWidth[i],nHeight,pHorJustify[i],aNames[i],OOO_STRING_SVTOOLS_HTML_tableheader);
}
IncIndent(-1);
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_thead );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// 2. and now the data
Reference< XRowSet > xRowSet(m_xRow,UNO_QUERY);
- sal_Int32 kk=0;
m_xResultSet->beforeFirst(); // set back before the first row
while(m_xResultSet->next())
{
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
- ++kk;
for(sal_Int32 i=1;i<=aNames.getLength();++i)
{
if(i == aNames.getLength())
@@ -820,21 +814,24 @@ void OHTMLImportExport::WriteTables()
}
WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
}
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
}
else
{
IncIndent(-1);
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tablerow );
- TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_thead );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_tbody );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
- IncIndent(-1); OUT_LF(); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_tbody );
- IncIndent(-1); TAG_OFF_LF( OOO_STRING_SVTOOLS_HTML_table );
+ IncIndent(-1);
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ IncIndent(-1);
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_table, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal_Int32 nHeightPixel, const char* pChar,
@@ -862,7 +859,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
"=" +
pChar;
- SvNumberFormatsSupplierObj* pSupplierImpl = m_xFormatter.is() ? comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(m_xFormatter->getNumberFormatsSupplier()) : nullptr;
+ SvNumberFormatsSupplierObj* pSupplierImpl = m_xFormatter.is() ? comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(m_xFormatter->getNumberFormatsSupplier()) : nullptr;
SvNumberFormatter* pFormatter = pSupplierImpl ? pSupplierImpl->GetNumberFormatter() : nullptr;
if(pFormatter)
{
@@ -879,7 +876,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
}
}
- TAG_ON( aStrTD.getStr() );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD);
FontOn();
@@ -888,24 +885,24 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
bool bUnderline = ( css::awt::FontUnderline::NONE != m_aFont.Underline );
bool bStrikeout = ( css::awt::FontStrikeout::NONE != m_aFont.Strikeout );
- if ( bBold ) TAG_ON( OOO_STRING_SVTOOLS_HTML_bold );
- if ( bItalic ) TAG_ON( OOO_STRING_SVTOOLS_HTML_italic );
- if ( bUnderline ) TAG_ON( OOO_STRING_SVTOOLS_HTML_underline );
- if ( bStrikeout ) TAG_ON( OOO_STRING_SVTOOLS_HTML_strike );
+ if ( bBold ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold);
+ if ( bItalic ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_italic);
+ if ( bUnderline ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_underline);
+ if ( bStrikeout ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_strike);
if ( rValue.isEmpty() )
- TAG_ON( OOO_STRING_SVTOOLS_HTML_linebreak ); // no completely empty cell
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_linebreak); // no completely empty cell
else
- HTMLOutFuncs::Out_String( (*m_pStream), rValue ,m_eDestEnc);
+ HTMLOutFuncs::Out_String( (*m_pStream), rValue );
- if ( bStrikeout ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_strike );
- if ( bUnderline ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_underline );
- if ( bItalic ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_italic );
- if ( bBold ) TAG_OFF( OOO_STRING_SVTOOLS_HTML_bold );
+ if ( bStrikeout ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_strike, false);
+ if ( bUnderline ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_underline, false);
+ if ( bItalic ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_italic, false);
+ if ( bBold ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_bold, false);
FontOff();
- TAG_OFF_LF( pHtmlTag );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, pHtmlTag, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::FontOn()
@@ -934,7 +931,7 @@ void OHTMLImportExport::FontOn()
m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor;
HTMLOutFuncs::Out_Color( (*m_pStream), aColor );
- m_pStream->WriteCharPtr( ">" );
+ m_pStream->WriteOString( ">" );
}
inline void OHTMLImportExport::FontOff()
@@ -942,7 +939,7 @@ inline void OHTMLImportExport::FontOff()
#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE(m_bCheckFont,"No FontOn() called");
#endif
- TAG_OFF( OOO_STRING_SVTOOLS_HTML_font );
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_font, false);
#if OSL_DEBUG_LEVEL > 0
m_bCheckFont = false;
#endif
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 5147ab3271df..831116797646 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -64,6 +64,7 @@
#include <svx/svxids.hrc>
#include <sal/log.hxx>
+#include <svl/numformat.hxx>
#include <svl/itempool.hxx>
#include <helpids.h>
#include <svl/itemset.hxx>
@@ -82,7 +83,7 @@
#include <dlgsize.hxx>
#include <svtools/editbrowsebox.hxx>
#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <svl/numuno.hxx>
#include <svl/filenotation.hxx>
#include <connectivity/FValue.hxx>
@@ -105,7 +106,6 @@ using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ui::dialogs;
using namespace ::svt;
using ::com::sun::star::ucb::InteractiveIOException;
using ::com::sun::star::ucb::IOErrorCode_NO_FILE;
@@ -195,7 +195,6 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
Reference< XDatabaseContext > xDatabaseContext = DatabaseContext::create(_rxContext);
Reference< XDataSource > xDatasource;
- Any aError;
SQLExceptionInfo aSQLError;
try
{
@@ -218,8 +217,6 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
else
{
aSQLError = SQLExceptionInfo( e.TargetException );
- if ( !aSQLError.isValid() )
- aError = e.TargetException;
}
}
catch( const Exception& )
@@ -234,7 +231,7 @@ Reference< XDataSource > getDataSourceByName( const OUString& _rDataSourceName,
{
if ( _pErrorInfo )
{
- *_pErrorInfo = aSQLError;
+ *_pErrorInfo = std::move(aSQLError);
}
else
{
@@ -397,7 +394,7 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo,
}
void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
- const OUString& _rsTypeNames,
+ std::u16string_view _rsTypeNames,
OTypeInfoMap& _rTypeInfoMap,
std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters)
{
@@ -434,52 +431,52 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
}
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aTypeName = aValue;
+ pInfo->aTypeName = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nType = aValue;
+ pInfo->nType = aValue.getInt32();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nPrecision = aValue;
+ pInfo->nPrecision = aValue.getInt32();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); // LiteralPrefix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow); //LiteralSuffix
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aCreateParams = aValue;
+ pInfo->aCreateParams = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bNullable = static_cast<sal_Int32>(aValue) == ColumnValue::NULLABLE;
+ pInfo->bNullable = aValue.getInt32() == ColumnValue::NULLABLE;
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bCaseSensitive
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nSearchType = aValue;
+ pInfo->nSearchType = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
// bUnsigned
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bCurrency = static_cast<bool>(aValue);
+ pInfo->bCurrency = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->bAutoIncrement = static_cast<bool>(aValue);
+ pInfo->bAutoIncrement = aValue.getBool();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->aLocalTypeName = aValue;
+ pInfo->aLocalTypeName = aValue.getString();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nMinimumScale = aValue;
+ pInfo->nMinimumScale = aValue.getInt16();
++nPos;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nMaximumScale = aValue;
+ pInfo->nMaximumScale = aValue.getInt16();
assert(nPos == 15);
// 16 and 17 are unused
nPos = 18;
aValue.fill(nPos,aTypes[nPos],aNullable[nPos],xRow);
- pInfo->nNumPrecRadix = aValue;
+ pInfo->nNumPrecRadix = aValue.getInt32();
// check if values are less than zero like it happens in a oracle jdbc driver
if( pInfo->nPrecision < 0)
@@ -491,108 +488,108 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
if( pInfo->nNumPrecRadix <= 1)
pInfo->nNumPrecRadix = 10;
- OUString aName;
+ std::u16string_view aName;
switch(pInfo->nType)
{
case DataType::CHAR:
- aName = _rsTypeNames.getToken(TYPE_CHAR, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_CHAR, ';');
break;
case DataType::VARCHAR:
- aName = _rsTypeNames.getToken(TYPE_TEXT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_TEXT, ';');
break;
case DataType::DECIMAL:
- aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DECIMAL, ';');
break;
case DataType::NUMERIC:
- aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_NUMERIC, ';');
break;
case DataType::BIGINT:
- aName = _rsTypeNames.getToken(TYPE_BIGINT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BIGINT, ';');
break;
case DataType::FLOAT:
- aName = _rsTypeNames.getToken(TYPE_FLOAT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_FLOAT, ';');
break;
case DataType::DOUBLE:
- aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DOUBLE, ';');
break;
case DataType::LONGVARCHAR:
- aName = _rsTypeNames.getToken(TYPE_MEMO, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_MEMO, ';');
break;
case DataType::LONGVARBINARY:
- aName = _rsTypeNames.getToken(TYPE_IMAGE, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_IMAGE, ';');
break;
case DataType::DATE:
- aName = _rsTypeNames.getToken(TYPE_DATE, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DATE, ';');
break;
case DataType::TIME:
- aName = _rsTypeNames.getToken(TYPE_TIME, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_TIME, ';');
break;
case DataType::TIMESTAMP:
- aName = _rsTypeNames.getToken(TYPE_DATETIME, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DATETIME, ';');
break;
case DataType::BIT:
if ( !pInfo->aCreateParams.isEmpty() )
{
- aName = _rsTypeNames.getToken(TYPE_BIT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BIT, ';');
break;
}
[[fallthrough]];
case DataType::BOOLEAN:
- aName = _rsTypeNames.getToken(TYPE_BOOL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BOOL, ';');
break;
case DataType::TINYINT:
- aName = _rsTypeNames.getToken(TYPE_TINYINT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_TINYINT, ';');
break;
case DataType::SMALLINT:
- aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_SMALLINT, ';');
break;
case DataType::INTEGER:
- aName = _rsTypeNames.getToken(TYPE_INTEGER, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_INTEGER, ';');
break;
case DataType::REAL:
- aName = _rsTypeNames.getToken(TYPE_REAL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_REAL, ';');
break;
case DataType::BINARY:
- aName = _rsTypeNames.getToken(TYPE_BINARY, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BINARY, ';');
break;
case DataType::VARBINARY:
- aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_VARBINARY, ';');
break;
case DataType::SQLNULL:
- aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_SQLNULL, ';');
break;
case DataType::OBJECT:
- aName = _rsTypeNames.getToken(TYPE_OBJECT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_OBJECT, ';');
break;
case DataType::DISTINCT:
- aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_DISTINCT, ';');
break;
case DataType::STRUCT:
- aName = _rsTypeNames.getToken(TYPE_STRUCT, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_STRUCT, ';');
break;
case DataType::ARRAY:
- aName = _rsTypeNames.getToken(TYPE_ARRAY, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_ARRAY, ';');
break;
case DataType::BLOB:
- aName = _rsTypeNames.getToken(TYPE_BLOB, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_BLOB, ';');
break;
case DataType::CLOB:
- aName = _rsTypeNames.getToken(TYPE_CLOB, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_CLOB, ';');
break;
case DataType::REF:
- aName = _rsTypeNames.getToken(TYPE_REF, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_REF, ';');
break;
case DataType::OTHER:
- aName = _rsTypeNames.getToken(TYPE_OTHER, ';');
+ aName = o3tl::getToken(_rsTypeNames, TYPE_OTHER, ';');
break;
}
- if ( !aName.isEmpty() )
+ if ( !aName.empty() )
{
pInfo->aUIName = aName;
pInfo->aUIName += " [ ";
}
pInfo->aUIName += pInfo->aTypeName;
- if ( !aName.isEmpty() )
+ if ( !aName.empty() )
pInfo->aUIName += " ]";
// Now that we have the type info, save it in the multimap
_rTypeInfoMap.emplace(pInfo->nType,pInfo);
@@ -612,20 +609,20 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection,
void setColumnProperties(const Reference<XPropertySet>& _rxColumn,const OFieldDescription* _pFieldDesc)
{
- _rxColumn->setPropertyValue(PROPERTY_NAME,makeAny(_pFieldDesc->GetName()));
- _rxColumn->setPropertyValue(PROPERTY_TYPENAME,makeAny(_pFieldDesc->getTypeInfo()->aTypeName));
- _rxColumn->setPropertyValue(PROPERTY_TYPE,makeAny(_pFieldDesc->GetType()));
- _rxColumn->setPropertyValue(PROPERTY_PRECISION,makeAny(_pFieldDesc->GetPrecision()));
- _rxColumn->setPropertyValue(PROPERTY_SCALE,makeAny(_pFieldDesc->GetScale()));
- _rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, makeAny(_pFieldDesc->GetIsNullable()));
- _rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT, css::uno::makeAny(_pFieldDesc->IsAutoIncrement()));
- _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,makeAny(_pFieldDesc->GetDescription()));
+ _rxColumn->setPropertyValue(PROPERTY_NAME,Any(_pFieldDesc->GetName()));
+ _rxColumn->setPropertyValue(PROPERTY_TYPENAME,Any(_pFieldDesc->getTypeInfo()->aTypeName));
+ _rxColumn->setPropertyValue(PROPERTY_TYPE,Any(_pFieldDesc->GetType()));
+ _rxColumn->setPropertyValue(PROPERTY_PRECISION,Any(_pFieldDesc->GetPrecision()));
+ _rxColumn->setPropertyValue(PROPERTY_SCALE,Any(_pFieldDesc->GetScale()));
+ _rxColumn->setPropertyValue(PROPERTY_ISNULLABLE, Any(_pFieldDesc->GetIsNullable()));
+ _rxColumn->setPropertyValue(PROPERTY_ISAUTOINCREMENT, css::uno::Any(_pFieldDesc->IsAutoIncrement()));
+ _rxColumn->setPropertyValue(PROPERTY_DESCRIPTION,Any(_pFieldDesc->GetDescription()));
if ( _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_ISCURRENCY) && _pFieldDesc->IsCurrency() )
- _rxColumn->setPropertyValue(PROPERTY_ISCURRENCY, css::uno::makeAny(_pFieldDesc->IsCurrency()));
+ _rxColumn->setPropertyValue(PROPERTY_ISCURRENCY, css::uno::Any(_pFieldDesc->IsCurrency()));
// set autoincrement value when available
// and only set when the entry is not empty, that lets the value in the column untouched
if ( _pFieldDesc->IsAutoIncrement() && !_pFieldDesc->GetAutoIncrementValue().isEmpty() && _rxColumn->getPropertySetInfo()->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
- _rxColumn->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,makeAny(_pFieldDesc->GetAutoIncrementValue()));
+ _rxColumn->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,Any(_pFieldDesc->GetAutoIncrementValue()));
}
OUString createDefaultName(const Reference< XDatabaseMetaData>& _xMetaData,const Reference<XNameAccess>& _xTables,const OUString& _sName)
@@ -688,7 +685,7 @@ bool checkDataSourceAvailable(const OUString& _sDataSourceName,const Reference<
return bRet;
}
-sal_Int32 mapTextAllign(const SvxCellHorJustify& _eAlignment)
+sal_Int32 mapTextAlign(const SvxCellHorJustify& _eAlignment)
{
sal_Int32 nAlignment = css::awt::TextAlign::LEFT;
switch (_eAlignment)
@@ -741,9 +738,9 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
if(callColumnFormatDialog(_pParent,_pFormatter,nDataType,nFormatKey,eJustify,bHasFormat))
{
- xAffectedCol->setPropertyValue(PROPERTY_ALIGN, makeAny(static_cast<sal_Int16>(dbaui::mapTextAllign(eJustify))));
+ xAffectedCol->setPropertyValue(PROPERTY_ALIGN, Any(static_cast<sal_Int16>(dbaui::mapTextAlign(eJustify))));
if (bHasFormat)
- xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, makeAny(nFormatKey));
+ xAffectedCol->setPropertyValue(PROPERTY_FORMATKEY, Any(nFormatKey));
}
}
@@ -753,6 +750,31 @@ void callColumnFormatDialog(const Reference<XPropertySet>& xAffectedCol,
}
}
+static ItemInfoPackage& getItemInfoPackageColumnFormatDialog()
+{
+ class ItemInfoPackageColumnFormatDialog : public ItemInfoPackage
+ {
+ typedef std::array<ItemInfoStatic, SBA_ATTR_ALIGN_HOR_JUSTIFY - SBA_DEF_RANGEFORMAT + 1> ItemInfoArrayColumnFormatDialog;
+ ItemInfoArrayColumnFormatDialog maItemInfos {{
+ // m_nWhich, m_pItem, m_nSlotID, m_nItemInfoFlags
+ { SBA_DEF_RANGEFORMAT, new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY), 0, SFX_ITEMINFOFLAG_NONE },
+ { SBA_DEF_FMTVALUE, new SfxUInt32Item(SBA_DEF_FMTVALUE), SID_ATTR_NUMBERFORMAT_VALUE, SFX_ITEMINFOFLAG_NONE },
+ { SBA_ATTR_ALIGN_HOR_JUSTIFY, new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY), SID_ATTR_ALIGN_HOR_JUSTIFY, SFX_ITEMINFOFLAG_NONE },
+ }};
+
+ virtual const ItemInfoStatic& getItemInfoStatic(size_t nIndex) const override { return maItemInfos[nIndex]; }
+
+ public:
+ virtual size_t size() const override { return maItemInfos.size(); }
+ virtual const ItemInfo& getItemInfo(size_t nIndex, SfxItemPool& /*rPool*/) override { return maItemInfos[nIndex]; }
+ };
+
+ static std::unique_ptr<ItemInfoPackageColumnFormatDialog> g_aItemInfoPackageColumnFormatDialog;
+ if (!g_aItemInfoPackageColumnFormatDialog)
+ g_aItemInfoPackageColumnFormatDialog.reset(new ItemInfoPackageColumnFormatDialog);
+ return *g_aItemInfoPackageColumnFormatDialog;
+}
+
bool callColumnFormatDialog(weld::Widget* _pParent,
SvNumberFormatter* _pFormatter,
sal_Int32 _nDataType,
@@ -763,36 +785,17 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
bool bRet = false;
// UNO->ItemSet
- static SfxItemInfo aItemInfos[] =
- {
- { 0, false },
- { SID_ATTR_NUMBERFORMAT_VALUE, true },
- { SID_ATTR_ALIGN_HOR_JUSTIFY, true },
- { SID_ATTR_NUMBERFORMAT_ONE_AREA, true },
- { SID_ATTR_NUMBERFORMAT_INFO, true }
- };
- static const sal_uInt16 aAttrMap[] =
- {
+ static const auto aAttrMap = svl::Items<
SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY,
- SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
- 0
- };
+ SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA
+ >;
- std::vector<SfxPoolItem*> pDefaults
- {
- new SfxRangeItem(SBA_DEF_RANGEFORMAT, SBA_DEF_FMTVALUE, SBA_ATTR_ALIGN_HOR_JUSTIFY),
- new SfxUInt32Item(SBA_DEF_FMTVALUE),
- new SvxHorJustifyItem(SvxCellHorJustify::Standard, SBA_ATTR_ALIGN_HOR_JUSTIFY),
- new SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false),
- new SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO)
- };
-
- SfxItemPool* pPool = new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults);
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool(u"GridBrowserProperties"_ustr));
+ pPool->registerItemInfoPackage(getItemInfoPackageColumnFormatDialog());
pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
- std::unique_ptr<SfxItemSet> pFormatDescriptor(new SfxItemSet(*pPool, aAttrMap));
+ std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap));
// fill it
pFormatDescriptor->Put(SvxHorJustifyItem(_eJustify, SBA_ATTR_ALIGN_HOR_JUSTIFY));
bool bText = false;
@@ -818,7 +821,7 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
}
{ // want the dialog to be destroyed before our set
- SbaSbAttrDlg aDlg(_pParent, pFormatDescriptor.get(), _pFormatter, _bHasFormat);
+ SbaSbAttrDlg aDlg(_pParent, &*pFormatDescriptor, _pFormatter, _bHasFormat);
if (RET_OK == aDlg.run())
{
// ItemSet->UNO
@@ -855,16 +858,14 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
}
pFormatDescriptor.reset();
- SfxItemPool::Free(pPool);
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
+ pPool.clear();
return bRet;
}
std::shared_ptr<const SfxFilter> getStandardDatabaseFilter()
{
- std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
+ std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName(u"StarOffice XML (Base)"_ustr);
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
return pFilter;
}
@@ -885,7 +886,7 @@ bool appendToFilter(const Reference<XConnection>& _xConnection,
xProp->getPropertyValue(PROPERTY_TABLEFILTER) >>= aFilter;
// first check if we have something like SCHEMA.%
bool bHasToInsert = true;
- for (const OUString& rItem : std::as_const(aFilter))
+ for (const OUString& rItem : aFilter)
{
if(rItem.indexOf('%') != -1)
{
@@ -911,7 +912,7 @@ bool appendToFilter(const Reference<XConnection>& _xConnection,
{
aFilter.realloc(aFilter.getLength()+1);
aFilter.getArray()[aFilter.getLength()-1] = _sName;
- xProp->setPropertyValue(PROPERTY_TABLEFILTER,makeAny(aFilter));
+ xProp->setPropertyValue(PROPERTY_TABLEFILTER,Any(aFilter));
}
}
}
@@ -932,7 +933,7 @@ void notifySystemWindow(vcl::Window const * _pWindow, vcl::Window* _pToRegister,
void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId )
{
sal_Int32 nColSize = -1;
- sal_uInt32 nDefaultWidth = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
+ ::tools::Long nDefaultWidth = _pBox->GetDefaultColumnWidth( _pBox->GetColumnTitle( _nColId ) );
if ( nDefaultWidth != _pBox->GetColumnWidth( _nColId ) )
{
Size aSizeMM = _pBox->PixelToLogic( Size( _pBox->GetColumnWidth( _nColId ), 0 ), MapMode( MapUnit::MapMM ) );
@@ -986,17 +987,17 @@ void fillAutoIncrementValue(const Reference<XPropertySet>& _xDatasource,
_xDatasource->getPropertyValue(PROPERTY_INFO) >>= aInfo;
// search the right propertyvalue
- const PropertyValue* pValue =std::find_if(aInfo.begin(), aInfo.end(),
+ const PropertyValue* pValue =std::find_if(std::cbegin(aInfo), std::cend(aInfo),
[](const PropertyValue& lhs)
{return lhs.Name == PROPERTY_AUTOINCREMENTCREATION;} );
- if ( pValue != aInfo.end() )
+ if ( pValue != std::cend(aInfo) )
pValue->Value >>= _rsAutoIncrementValue;
- pValue =std::find_if(aInfo.begin(), aInfo.end(),
+ pValue =std::find_if(std::cbegin(aInfo), std::cend(aInfo),
[](const PropertyValue& lhs)
{return lhs.Name == "IsAutoRetrievingEnabled";} );
- if ( pValue != aInfo.end() )
+ if ( pValue != std::cend(aInfo) )
pValue->Value >>= _rAutoIncrementValueEnabled;
}
@@ -1040,7 +1041,7 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons
Reference< css::util::XNumberFormatsSupplier > xSupplier = _rxFormatter->getNumberFormatsSupplier();
- auto pSupplierImpl = comphelper::getUnoTunnelImplementation<SvNumberFormatsSupplierObj>(xSupplier);
+ auto pSupplierImpl = comphelper::getFromUnoTunnel<SvNumberFormatsSupplierObj>(xSupplier);
OSL_ENSURE(pSupplierImpl,"No Supplier!");
if ( pSupplierImpl )
@@ -1050,29 +1051,40 @@ void setEvalDateFormatForFormatter(Reference< css::util::XNumberFormatter > cons
}
}
+static bool TypeIsGreater(const TOTypeInfoSP& lhs, const TOTypeInfoSP& rhs)
+{
+ assert(lhs);
+ if (!rhs)
+ return true;
+ if (lhs->nNumPrecRadix == rhs->nNumPrecRadix)
+ return lhs->nPrecision > rhs->nPrecision;
+ if (lhs->nPrecision == rhs->nPrecision)
+ return lhs->nNumPrecRadix > rhs->nNumPrecRadix;
+ if ((lhs->nNumPrecRadix > rhs->nNumPrecRadix) == (lhs->nPrecision > rhs->nPrecision))
+ return lhs->nPrecision > rhs->nPrecision;
+ return std::pow(lhs->nNumPrecRadix, lhs->nPrecision)
+ > std::pow(rhs->nNumPrecRadix, rhs->nPrecision);
+}
+
TOTypeInfoSP queryPrimaryKeyType(const OTypeInfoMap& _rTypeInfo)
{
- TOTypeInfoSP pTypeInfo;
- // first we search for a type which supports autoIncrement
+ TOTypeInfoSP pTypeInfo, pFallback;
+ // first we search for a largest type which supports autoIncrement
for (auto const& elem : _rTypeInfo)
{
- // OJ: we don't want to set an autoincrement column to be key
- // because we don't have the possibility to know how to create
- // such auto increment column later on
- // so until we know how to do it, we create a column without autoincrement
- // therefore we have searched
- if ( elem.second->nType == DataType::INTEGER )
- {
- pTypeInfo = elem.second; // alternative
- break;
- }
- else if ( !pTypeInfo && elem.second->nType == DataType::DOUBLE )
- pTypeInfo = elem.second; // alternative
- else if ( !pTypeInfo && elem.second->nType == DataType::REAL )
- pTypeInfo = elem.second; // alternative
+ if (elem.second->bAutoIncrement && TypeIsGreater(elem.second, pTypeInfo))
+ pTypeInfo = elem.second;
+ if (pTypeInfo)
+ continue;
+ if (elem.second->nType == DataType::INTEGER)
+ pFallback = elem.second; // default alternative
+ else if (!pFallback && elem.second->nType == DataType::DOUBLE)
+ pFallback = elem.second; // alternative
+ else if (!pFallback && elem.second->nType == DataType::REAL)
+ pFallback = elem.second; // alternative
}
if ( !pTypeInfo ) // just a fallback
- pTypeInfo = queryTypeInfoByType(DataType::VARCHAR,_rTypeInfo);
+ pTypeInfo = pFallback ? std::move(pFallback) : queryTypeInfoByType(DataType::VARCHAR, _rTypeInfo);
OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!");
return pTypeInfo;
@@ -1144,13 +1156,13 @@ TOTypeInfoSP queryTypeInfoByType(sal_Int32 _nDataType,const OTypeInfoMap& _rType
if ( !pTypeInfo )
{
bool bForce = true;
- pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,OUString(),"x",50,0,false,bForce);
+ pTypeInfo = ::dbaui::getTypeInfoFromType(_rTypeInfo,DataType::VARCHAR,OUString(),u"x"_ustr,50,0,false,bForce);
}
OSL_ENSURE(pTypeInfo,"Wrong DataType supplied!");
return pTypeInfo;
}
-sal_Int32 askForUserAction(weld::Window* pParent, const char* pTitle, const char* pText, bool _bAll, std::u16string_view _sName)
+sal_Int32 askForUserAction(weld::Window* pParent, TranslateId pTitle, TranslateId pText, bool _bAll, std::u16string_view _sName)
{
SolarMutexGuard aGuard;
OUString aMsg = DBA_RES(pText);
@@ -1207,11 +1219,11 @@ Reference< XPropertySet > createView( const OUString& _rName, const Reference< X
sTable,
::dbtools::EComposeRule::InDataManipulation);
- xView->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xView->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xView->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
+ xView->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xView->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xView->setPropertyValue(PROPERTY_NAME,Any(sTable));
- xView->setPropertyValue( PROPERTY_COMMAND, makeAny( _rCommand ) );
+ xView->setPropertyValue( PROPERTY_COMMAND, Any( _rCommand ) );
Reference<XAppend> xAppend(xViews,UNO_QUERY);
if(xAppend.is())
@@ -1253,7 +1265,7 @@ Reference<XPropertySet> createView( const OUString& _rName, const Reference< XCo
return createView( _rName, _rxConnection, sCommand );
}
-bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentContext >& _rxContext,
+bool insertHierarchyElement(weld::Window* pParent, const Reference< XComponentContext >& _rxContext,
const Reference<XHierarchicalNameContainer>& _xNames,
const OUString& _sParentFolder,
bool _bForm,
@@ -1261,7 +1273,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
const Reference<XContent>& _xContent,
bool _bMove)
{
- OSL_ENSURE( _xNames.is(), "insertHierachyElement: illegal name container!" );
+ OSL_ENSURE( _xNames.is(), "insertHierarchyElement: illegal name container!" );
if ( !_xNames.is() )
return false;
@@ -1274,7 +1286,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
xNameAccess.set(xChild->getParent(),UNO_QUERY);
}
- OSL_ENSURE( xNameAccess.is(), "insertHierachyElement: could not find the proper name container!" );
+ OSL_ENSURE( xNameAccess.is(), "insertHierarchyElement: could not find the proper name container!" );
if ( !xNameAccess.is() )
return false;
@@ -1296,7 +1308,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
sTargetName = ::dbtools::createUniqueName(xNameAccess,sTargetName);
// here we have everything needed to create a new query object ...
- HierarchicalNameCheck aNameChecker( _xNames.get(), _sParentFolder );
+ HierarchicalNameCheck aNameChecker( _xNames, _sParentFolder );
// ... ehm, except a new name
OSaveAsDlg aAskForName(pParent,
_rxContext,
@@ -1315,7 +1327,7 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
{
OUString sError(DBA_RES(STR_NAME_ALREADY_EXISTS));
sError = sError.replaceFirst("#",sNewName);
- throw SQLException(sError,nullptr,"S1000",0,Any());
+ throw SQLException(sError,nullptr,u"S1000"_ustr,0,Any());
}
try
@@ -1327,11 +1339,11 @@ bool insertHierachyElement(weld::Window* pParent, const Reference< XComponentCon
{"Parent", uno::Any(xNameAccess)},
{PROPERTY_EMBEDDEDOBJECT, uno::Any(_xContent)},
}));
- OUString sServiceName(_bCollection ? (_bForm ? OUString(SERVICE_NAME_FORM_COLLECTION) : OUString(SERVICE_NAME_REPORT_COLLECTION)) : OUString(SERVICE_SDB_DOCUMENTDEFINITION));
+ OUString sServiceName(_bCollection ? (_bForm ? SERVICE_NAME_FORM_COLLECTION : SERVICE_NAME_REPORT_COLLECTION) : SERVICE_SDB_DOCUMENTDEFINITION);
Reference<XContent > xNew( xORB->createInstanceWithArguments( sServiceName, aArguments ), UNO_QUERY_THROW );
Reference< XNameContainer > xNameContainer( xNameAccess, UNO_QUERY_THROW );
- xNameContainer->insertByName( sNewName, makeAny( xNew ) );
+ xNameContainer->insertByName( sNewName, Any( xNew ) );
}
catch( const IllegalArgumentException& e )
{
diff --git a/dbaccess/source/ui/misc/WCPage.cxx b/dbaccess/source/ui/misc/WCPage.cxx
index 35c8a7fe0f18..123db5efc548 100644
--- a/dbaccess/source/ui/misc/WCPage.cxx
+++ b/dbaccess/source/ui/misc/WCPage.cxx
@@ -34,7 +34,6 @@ using namespace ::dbtools;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdbcx;
@@ -42,19 +41,19 @@ using namespace ::com::sun::star::sdbcx;
namespace CopyTableOperation = css::sdb::application::CopyTableOperation;
OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/copytablepage.ui", "CopyTablePage")
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/copytablepage.ui"_ustr, u"CopyTablePage"_ustr)
, m_bPKeyAllowed(false)
, m_bUseHeaderAllowed(true)
, m_nOldOperation(0)
- , m_xEdTableName(m_xBuilder->weld_entry("name"))
- , m_xRB_DefData(m_xBuilder->weld_radio_button("defdata"))
- , m_xRB_Def(m_xBuilder->weld_radio_button("def"))
- , m_xRB_View(m_xBuilder->weld_radio_button("view"))
- , m_xRB_AppendData(m_xBuilder->weld_radio_button("data"))
- , m_xCB_UseHeaderLine(m_xBuilder->weld_check_button("firstline"))
- , m_xCB_PrimaryColumn(m_xBuilder->weld_check_button("primarykey"))
- , m_xFT_KeyName(m_xBuilder->weld_label("keynamelabel"))
- , m_xEdKeyName(m_xBuilder->weld_entry("keyname"))
+ , m_xEdTableName(m_xBuilder->weld_entry(u"name"_ustr))
+ , m_xRB_DefData(m_xBuilder->weld_radio_button(u"defdata"_ustr))
+ , m_xRB_Def(m_xBuilder->weld_radio_button(u"def"_ustr))
+ , m_xRB_View(m_xBuilder->weld_radio_button(u"view"_ustr))
+ , m_xRB_AppendData(m_xBuilder->weld_radio_button(u"data"_ustr))
+ , m_xCB_UseHeaderLine(m_xBuilder->weld_check_button(u"firstline"_ustr))
+ , m_xCB_PrimaryColumn(m_xBuilder->weld_check_button(u"primarykey"_ustr))
+ , m_xFT_KeyName(m_xBuilder->weld_label(u"keynamelabel"_ustr))
+ , m_xEdKeyName(m_xBuilder->weld_entry(u"keyname"_ustr))
{
if ( m_pParent->m_xDestConnection.is() )
{
@@ -66,17 +65,16 @@ OCopyTable::OCopyTable(weld::Container* pPage, OCopyTableWizard* pWizard)
m_xCB_PrimaryColumn->set_sensitive(m_bPKeyAllowed);
- m_xRB_AppendData->connect_clicked( LINK( this, OCopyTable, AppendDataClickHdl ) );
+ m_xRB_AppendData->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_DefData->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_Def->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
+ m_xRB_View->connect_toggled( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_xRB_DefData->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_xRB_Def->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
- m_xRB_View->connect_clicked( LINK( this, OCopyTable, RadioChangeHdl ) );
-
- m_xCB_PrimaryColumn->connect_clicked(LINK( this, OCopyTable, KeyClickHdl ) );
+ m_xCB_PrimaryColumn->connect_toggled(LINK( this, OCopyTable, KeyClickHdl ) );
m_xFT_KeyName->set_sensitive(false);
m_xEdKeyName->set_sensitive(false);
- m_xEdKeyName->set_text(m_pParent->createUniqueName("ID"));
+ m_xEdKeyName->set_text(m_pParent->createUniqueName(u"ID"_ustr));
const sal_Int32 nMaxLen = m_pParent->getMaxColumnNameLength();
m_xEdKeyName->set_max_length(nMaxLen);
@@ -89,11 +87,6 @@ OCopyTable::~OCopyTable()
{
}
-IMPL_LINK_NOARG( OCopyTable, AppendDataClickHdl, weld::Button&, void )
-{
- SetAppendDataRadio();
-}
-
void OCopyTable::SetAppendDataRadio()
{
m_pParent->EnableNextButton(true);
@@ -103,10 +96,17 @@ void OCopyTable::SetAppendDataRadio()
m_pParent->setOperation(CopyTableOperation::AppendData);
}
-IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Button&, rButton, void)
+IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Toggleable&, rButton, void)
{
- m_pParent->EnableNextButton(&rButton != m_xRB_View.get());
- bool bKey = m_bPKeyAllowed && &rButton != m_xRB_View.get();
+ if (!rButton.get_active())
+ return;
+ if (m_xRB_AppendData->get_active())
+ {
+ SetAppendDataRadio();
+ return;
+ }
+ m_pParent->EnableNextButton(!m_xRB_View->get_active());
+ bool bKey = m_bPKeyAllowed && !m_xRB_View->get_active();
m_xFT_KeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active());
m_xEdKeyName->set_sensitive(bKey && m_xCB_PrimaryColumn->get_active());
m_xCB_PrimaryColumn->set_sensitive(bKey);
@@ -121,7 +121,7 @@ IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Button&, rButton, void)
m_pParent->setOperation( CopyTableOperation::CreateAsView );
}
-IMPL_LINK_NOARG( OCopyTable, KeyClickHdl, weld::Button&, void )
+IMPL_LINK_NOARG( OCopyTable, KeyClickHdl, weld::Toggleable&, void )
{
m_xEdKeyName->set_sensitive(m_xCB_PrimaryColumn->get_active());
m_xFT_KeyName->set_sensitive(m_xCB_PrimaryColumn->get_active());
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 544b79d03267..8cc8868760cd 100644
--- a/dbaccess/source/ui/misc/WColumnSelect.cxx
+++ b/dbaccess/source/ui/misc/WColumnSelect.cxx
@@ -26,17 +26,14 @@
#include <com/sun/star/sdb/application/CopyTableOperation.hpp>
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::container;
using namespace ::com::sun::star::sdbc;
-using namespace ::com::sun::star::sdbcx;
using namespace dbaui;
namespace CopyTableOperation = ::com::sun::star::sdb::application::CopyTableOperation;
OUString OWizColumnSelect::GetTitle() const { return DBA_RES(STR_WIZ_COLUMN_SELECT_TITLE); }
-OWizardPage::OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OString& rID)
+OWizardPage::OWizardPage(weld::Container* pPage, OCopyTableWizard* pWizard, const OUString& rUIXMLDescription, const OUString& rID)
: ::vcl::OWizardPage(pPage, pWizard, rUIXMLDescription, rID)
, m_pParent(pWizard)
, m_bFirstTime(true)
@@ -49,13 +46,13 @@ OWizardPage::~OWizardPage()
// OWizColumnSelect
OWizColumnSelect::OWizColumnSelect(weld::Container* pPage, OCopyTableWizard* pWizard)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/applycolpage.ui", "ApplyColPage")
- , m_xOrgColumnNames(m_xBuilder->weld_tree_view("from"))
- , m_xColumn_RH(m_xBuilder->weld_button("colrh"))
- , m_xColumns_RH(m_xBuilder->weld_button("colsrh"))
- , m_xColumn_LH(m_xBuilder->weld_button("collh"))
- , m_xColumns_LH(m_xBuilder->weld_button("colslh"))
- , m_xNewColumnNames(m_xBuilder->weld_tree_view("to"))
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/applycolpage.ui"_ustr, u"ApplyColPage"_ustr)
+ , m_xOrgColumnNames(m_xBuilder->weld_tree_view(u"from"_ustr))
+ , m_xColumn_RH(m_xBuilder->weld_button(u"colrh"_ustr))
+ , m_xColumns_RH(m_xBuilder->weld_button(u"colsrh"_ustr))
+ , m_xColumn_LH(m_xBuilder->weld_button(u"collh"_ustr))
+ , m_xColumns_LH(m_xBuilder->weld_button(u"colslh"_ustr))
+ , m_xNewColumnNames(m_xBuilder->weld_tree_view(u"to"_ustr))
{
m_xColumn_RH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
m_xColumn_LH->connect_clicked(LINK(this,OWizColumnSelect,ButtonClickHdl));
@@ -73,7 +70,7 @@ OWizColumnSelect::~OWizColumnSelect()
{
while (m_xNewColumnNames->n_children())
{
- delete reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(0).toInt64());
+ delete weld::fromId<OFieldDescription*>(m_xNewColumnNames->get_id(0));
m_xNewColumnNames->remove(0);
}
}
@@ -90,7 +87,7 @@ void OWizColumnSelect::Reset()
for (auto const& column : rSrcColumns)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ OUString sId(weld::toId(column->second));
m_xOrgColumnNames->append(sId, column->first);
}
@@ -121,7 +118,7 @@ void OWizColumnSelect::Activate( )
{
if (rSrcColumns.find(column->first) != rSrcColumns.end())
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(new OFieldDescription(*(column->second)))));
+ OUString sId(weld::toId(new OFieldDescription(*(column->second))));
m_xNewColumnNames->append(sId, column->first);
int nRemove = m_xOrgColumnNames->find_text(column->first);
if (nRemove != -1)
@@ -140,7 +137,7 @@ bool OWizColumnSelect::LeavePage()
for(sal_Int32 i=0 ; i< m_xNewColumnNames->n_children();++i)
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xNewColumnNames->get_id(i).toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xNewColumnNames->get_id(i));
OSL_ENSURE(pField,"The field information can not be null!");
m_pParent->insertColumn(i,pField);
}
@@ -275,7 +272,7 @@ void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
OFieldDescription const * _pSrcField,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase)
{
@@ -290,7 +287,7 @@ void OWizColumnSelect::createNewColumn( weld::TreeView* _pListbox,
if ( !m_pParent->supportsPrimaryKey() )
pNewField->SetPrimaryKey(false);
- _pListbox->append(OUString::number(reinterpret_cast<sal_Int64>(pNewField)), sConvertedName);
+ _pListbox->append(weld::toId(pNewField), sConvertedName);
_rRightColumns.push_back(sConvertedName);
if ( !bNotConvert )
@@ -301,14 +298,14 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
weld::TreeView const * _pLeft,
std::vector< OUString>& _rRightColumns,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen,
const ::comphelper::UStringMixEqual& _aCase)
{
if(_pRight == m_xNewColumnNames.get())
{
// we copy the column into the new format for the dest
- OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)).toInt64());
+ OFieldDescription* pSrcField = weld::fromId<OFieldDescription*>(_pLeft->get_id(_pLeft->find_text(_sColumnName)));
createNewColumn(_pRight,pSrcField,_rRightColumns,_sColumnName,_sExtraChars,_nMaxNameLen,_aCase);
}
else
@@ -332,7 +329,7 @@ void OWizColumnSelect::moveColumn( weld::TreeView* _pRight,
OSL_ENSURE( aPos != rSrcVector.end(),"Invalid position for the iterator here!");
ODatabaseExport::TColumnVector::size_type nPos = (aPos - rSrcVector.begin()) - adjustColumnPosition(_pLeft, _sColumnName, (aPos - rSrcVector.begin()), _aCase);
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(aSrcIter->second)));
+ OUString sId(weld::toId(aSrcIter->second));
const OUString& rStr = (*aIter).first;
_pRight->insert(nullptr, nPos, &rStr, &sId, nullptr, nullptr, false, nullptr);
_rRightColumns.push_back(rStr);
diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx
index 9c92f1301c71..7825c1af26c8 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -53,7 +53,10 @@
#include <o3tl/safeint.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+
+#include <algorithm>
+#include <utility>
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
@@ -130,21 +133,21 @@ bool ObjectCopySource::isView() const
void ObjectCopySource::copyUISettingsTo( const Reference< XPropertySet >& _rxObject ) const
{
- const OUString aCopyProperties[] = {
- OUString(PROPERTY_FONT), OUString(PROPERTY_ROW_HEIGHT), OUString(PROPERTY_TEXTCOLOR),OUString(PROPERTY_TEXTLINECOLOR),OUString(PROPERTY_TEXTEMPHASIS),OUString(PROPERTY_TEXTRELIEF)
+ static constexpr OUString aCopyProperties[] {
+ PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF
};
- for (const auto & aCopyPropertie : aCopyProperties)
+ for (const auto & aCopyProperty : aCopyProperties)
{
- if ( m_xObjectPSI->hasPropertyByName( aCopyPropertie ) )
- _rxObject->setPropertyValue( aCopyPropertie, m_xObject->getPropertyValue( aCopyPropertie ) );
+ if ( m_xObjectPSI->hasPropertyByName( aCopyProperty ) )
+ _rxObject->setPropertyValue( aCopyProperty, m_xObject->getPropertyValue( aCopyProperty ) );
}
}
void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _xConnection,const Reference< XPropertySet >& _rxObject ) const
{
- std::pair< OUString, OUString > aProperties[] = {
- std::pair< OUString, OUString >(PROPERTY_FILTER,OUString(" AND "))
- ,std::pair< OUString, OUString >(PROPERTY_ORDER,OUString(" ORDER BY "))
+ static constexpr std::pair< OUString, OUString > aProperties[] {
+ std::pair< OUString, OUString >(PROPERTY_FILTER,u" AND "_ustr)
+ ,std::pair< OUString, OUString >(PROPERTY_ORDER,u" ORDER BY "_ustr)
};
try
@@ -155,17 +158,17 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _
OUStringBuffer sStatement = "SELECT * FROM " + sTargetName + " WHERE 0=1";
- for (const std::pair<OUString,OUString> & aPropertie : aProperties)
+ for (const std::pair<OUString,OUString> & aProperty : aProperties)
{
- if ( m_xObjectPSI->hasPropertyByName( aPropertie.first ) )
+ if ( m_xObjectPSI->hasPropertyByName( aProperty.first ) )
{
OUString sFilter;
- m_xObject->getPropertyValue( aPropertie.first ) >>= sFilter;
+ m_xObject->getPropertyValue( aProperty.first ) >>= sFilter;
if ( !sFilter.isEmpty() )
{
- sStatement.append(aPropertie.second);
+ sStatement.append(aProperty.second);
sFilter = sFilter.replaceFirst(sSourceName,sTargetNameTemp);
- _rxObject->setPropertyValue( aPropertie.first, makeAny(sFilter) );
+ _rxObject->setPropertyValue( aProperty.first, Any(sFilter) );
sStatement.append(sFilter);
}
}
@@ -210,27 +213,21 @@ OUString ObjectCopySource::getSelectStatement() const
}
else
{ // table
- OUStringBuffer aSQL;
- aSQL.append( "SELECT " );
+ OUStringBuffer aSQL( "SELECT " );
// we need to create the sql stmt with column names
// otherwise it is possible that names don't match
const OUString sQuote = m_xMetaData->getIdentifierQuoteString();
Sequence< OUString > aColumnNames = getColumnNames();
- const OUString* pColumnName = aColumnNames.getConstArray();
- const OUString* pEnd = pColumnName + aColumnNames.getLength();
- for ( ; pColumnName != pEnd; )
+ for (sal_Int32 i = 0; i < aColumnNames.getLength(); ++i)
{
- aSQL.append( ::dbtools::quoteName( sQuote, *pColumnName++ ) );
-
- if ( pColumnName == pEnd )
- aSQL.append( " " );
- else
- aSQL.append( ", " );
+ if (i > 0)
+ aSQL.append(", ");
+ aSQL.append(::dbtools::quoteName(sQuote, aColumnNames[i]));
}
- aSQL.append( "FROM " ).append( ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
+ aSQL.append( " FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
sSelectStatement = aSQL.makeStringAndClear();
}
@@ -248,11 +245,10 @@ OUString ObjectCopySource::getSelectStatement() const
}
// NamedTableCopySource
-NamedTableCopySource::NamedTableCopySource( const Reference< XConnection >& _rxConnection, const OUString& _rTableName )
+NamedTableCopySource::NamedTableCopySource( const Reference< XConnection >& _rxConnection, OUString _sTableName )
:m_xConnection( _rxConnection, UNO_SET_THROW )
,m_xMetaData( _rxConnection->getMetaData(), UNO_SET_THROW )
- ,m_sTableName( _rTableName )
- ,m_aColumnInfo()
+ ,m_sTableName(std::move( _sTableName ))
{
::dbtools::qualifiedNameComponents( m_xMetaData, m_sTableName, m_sTableCatalog, m_sTableSchema, m_sTableBareName, ::dbtools::EComposeRule::Complete );
impl_ensureColumnInfo_throw();
@@ -268,7 +264,7 @@ bool NamedTableCopySource::isView() const
OUString sTableType;
try
{
- Reference< XResultSet > xTableDesc( m_xMetaData->getTables( makeAny( m_sTableCatalog ), m_sTableSchema, m_sTableBareName,
+ Reference< XResultSet > xTableDesc( m_xMetaData->getTables( Any( m_sTableCatalog ), m_sTableSchema, m_sTableBareName,
Sequence< OUString >() ) );
Reference< XRow > xTableDescRow( xTableDesc, UNO_QUERY_THROW );
OSL_VERIFY( xTableDesc->next() );
@@ -328,9 +324,8 @@ void NamedTableCopySource::impl_ensureColumnInfo_throw()
Sequence< OUString > NamedTableCopySource::getColumnNames() const
{
Sequence< OUString > aNames( m_aColumnInfo.size() );
- size_t nPos = 0;
- for (auto const& elem : m_aColumnInfo)
- aNames[ nPos++ ] = elem.GetName();
+ std::transform(m_aColumnInfo.begin(), m_aColumnInfo.end(), aNames.getArray(),
+ [](const auto& elem) { return elem.GetName(); });
return aNames;
}
@@ -341,13 +336,13 @@ Sequence< OUString > NamedTableCopySource::getPrimaryKeyColumnNames() const
try
{
- Reference< XResultSet > xPKDesc( m_xMetaData->getPrimaryKeys( makeAny( m_sTableCatalog ), m_sTableSchema, m_sTableBareName ) );
+ Reference< XResultSet > xPKDesc( m_xMetaData->getPrimaryKeys( Any( m_sTableCatalog ), m_sTableSchema, m_sTableBareName ) );
Reference< XRow > xPKDescRow( xPKDesc, UNO_QUERY_THROW );
while ( xPKDesc->next() )
{
sal_Int32 len( aPKColNames.getLength() );
aPKColNames.realloc( len + 1 );
- aPKColNames[ len ] = xPKDescRow->getString( 4 ); // COLUMN_NAME
+ aPKColNames.getArray()[ len ] = xPKDescRow->getString( 4 ); // COLUMN_NAME
}
}
catch( const Exception& )
@@ -369,12 +364,8 @@ OFieldDescription* NamedTableCopySource::createFieldDescription( const OUString&
OUString NamedTableCopySource::getSelectStatement() const
{
- OUStringBuffer aSQL;
- aSQL.append( "SELECT * FROM " );
-
- aSQL.append( ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName ) );
-
- return aSQL.makeStringAndClear();
+ return "SELECT * FROM " +
+ ::dbtools::composeTableNameForSelect( m_xConnection, m_sTableCatalog, m_sTableSchema, m_sTableBareName );
}
::utl::SharedUNOComponent< XPreparedStatement > NamedTableCopySource::getPreparedSelectStatement() const
@@ -490,7 +481,7 @@ OCopyTableWizard::OCopyTableWizard(weld::Window* pParent, const OUString& _rDefa
const Reference< XConnection >& _xConnection, const Reference< XComponentContext >& _rxContext,
const Reference< XInteractionHandler>& _xInteractionHandler)
: vcl::RoadmapWizardMachine(pParent)
- , m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ , m_mNameMapping(comphelper::UStringMixLess(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()))
, m_xDestConnection( _xConnection )
, m_rSourceObject( _rSourceObject )
, m_xFormatter( getNumberFormatter( _xConnection, _rxContext ) )
@@ -582,18 +573,18 @@ OCopyTableWizard::OCopyTableWizard(weld::Window* pParent, const OUString& _rDefa
weld::Container* OCopyTableWizard::CreatePageContainer()
{
- OString sIdent(OString::number(m_nPageCount));
+ OUString sIdent(OUString::number(m_nPageCount));
weld::Container* pPageContainer = m_xAssistant->append_page(sIdent);
return pPageContainer;
}
-OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, const OUString& _rDefaultName, sal_Int16 _nOperation,
- const ODatabaseExport::TColumns& _rSourceColumns, const ODatabaseExport::TColumnVector& _rSourceColVec,
+OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, OUString _sDefaultName, sal_Int16 _nOperation,
+ ODatabaseExport::TColumns&& _rSourceColumns, const ODatabaseExport::TColumnVector& _rSourceColVec,
const Reference< XConnection >& _xConnection, const Reference< XNumberFormatter >& _xFormatter,
TypeSelectionPageFactory _pTypeSelectionPageFactory, SvStream& _rTypeSelectionPageArg, const Reference< XComponentContext >& _rxContext )
: vcl::RoadmapWizardMachine(pParent)
- , m_vSourceColumns(_rSourceColumns)
- , m_mNameMapping(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
+ , m_vSourceColumns(std::move(_rSourceColumns))
+ , m_mNameMapping(comphelper::UStringMixLess(_xConnection->getMetaData().is() && _xConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers()))
, m_xDestConnection( _xConnection )
, m_rSourceObject( DummyCopySource::Instance() )
, m_xFormatter(_xFormatter)
@@ -602,7 +593,7 @@ OCopyTableWizard::OCopyTableWizard( weld::Window* pParent, const OUString& _rDef
, m_nPageCount(0)
, m_bDeleteSourceColumns(false)
, m_bInterConnectionCopy( false )
- , m_sName(_rDefaultName)
+ , m_sName(std::move(_sDefaultName))
, m_nOperation( _nOperation )
, m_ePressed( WIZARD_NONE )
, m_bCreatePrimaryKeyColumn(false)
@@ -655,9 +646,9 @@ void OCopyTableWizard::construct()
if (!m_vDestColumns.empty())
// source is a html or rtf table
- m_xNextPage->set_has_default(true);
+ m_xAssistant->change_default_widget(nullptr, m_xNextPage.get());
else
- m_xFinish->set_has_default(true);
+ m_xAssistant->change_default_widget(nullptr, m_xFinish.get());
m_pTypeInfo = std::make_shared<OTypeInfo>();
m_pTypeInfo->aUIName = m_sTypeNames.getToken(TYPE_OTHER, ';');
@@ -675,6 +666,7 @@ OCopyTableWizard::~OCopyTableWizard()
m_aTypeInfoIndex.clear();
m_aTypeInfo.clear();
m_aDestTypeInfoIndex.clear();
+ m_aDestTypeInfo.clear();
}
IMPL_LINK_NOARG(OCopyTableWizard, ImplPrevHdl, weld::Button&, void)
@@ -740,6 +732,7 @@ bool OCopyTableWizard::CheckColumns(sal_Int32& _rnBreakPos)
OFieldDescription* pField = new OFieldDescription();
pField->SetName(m_aKeyName);
pField->FillFromTypeInfo(pTypeInfo,true,true);
+ pField->SetAutoIncrement(pTypeInfo->bAutoIncrement);
pField->SetPrimaryKey(true);
m_bAddPKFirstTime = false;
insertColumn(0,pField);
@@ -845,16 +838,15 @@ IMPL_LINK_NOARG(OCopyTableWizard, ImplOKHdl, weld::Button&, void)
{
OUString sMsg(DBA_RES(STR_TABLEDESIGN_NO_PRIM_KEY));
- SQLContext aError;
- aError.Message = sMsg;
- ::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( makeAny( aError ) ) );
+ SQLContext aError(sMsg, {}, {}, 0, {}, {});
+ ::rtl::Reference xRequest( new ::comphelper::OInteractionRequest( Any( aError ) ) );
::rtl::Reference xYes = new ::comphelper::OInteractionApprove;
- xRequest->addContinuation( xYes.get() );
+ xRequest->addContinuation( xYes );
xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
::rtl::Reference< ::comphelper::OInteractionAbort > xAbort = new ::comphelper::OInteractionAbort;
- xRequest->addContinuation( xAbort.get() );
+ xRequest->addContinuation( xAbort );
- m_xInteractionHandler->handle( xRequest.get() );
+ m_xInteractionHandler->handle( xRequest );
if ( xYes->wasSelected() )
{
@@ -995,19 +987,15 @@ void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject,
_rColumns.clear();
OFieldDescription* pActFieldDescr = nullptr;
- OUString const sCreateParam("x");
+ static constexpr OUStringLiteral sCreateParam(u"x");
// ReadOnly-Flag
// On drop no line must be editable.
// On add only empty lines must be editable.
// On Add and Drop all lines can be edited.
- Sequence< OUString > aColumns( _rSourceObject.getColumnNames() );
- const OUString* pColumn = aColumns.getConstArray();
- const OUString* pColumnEnd = pColumn + aColumns.getLength();
-
- for ( ; pColumn != pColumnEnd; ++pColumn )
+ for (auto& column : _rSourceObject.getColumnNames())
{
// get the properties of the column
- pActFieldDescr = _rSourceObject.createFieldDescription( *pColumn );
+ pActFieldDescr = _rSourceObject.createFieldDescription(column);
OSL_ENSURE( pActFieldDescr, "OCopyTableWizard::loadData: illegal field description!" );
if ( !pActFieldDescr )
continue;
@@ -1029,13 +1017,9 @@ void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject,
}
// determine which columns belong to the primary key
- Sequence< OUString > aPrimaryKeyColumns( _rSourceObject.getPrimaryKeyColumnNames() );
- const OUString* pKeyColName = aPrimaryKeyColumns.getConstArray();
- const OUString* pKeyColEnd = pKeyColName + aPrimaryKeyColumns.getLength();
-
- for( ; pKeyColName != pKeyColEnd; ++pKeyColName )
+ for (auto& keyColName : _rSourceObject.getPrimaryKeyColumnNames())
{
- ODatabaseExport::TColumns::const_iterator keyPos = _rColumns.find( *pKeyColName );
+ ODatabaseExport::TColumns::const_iterator keyPos = _rColumns.find(keyColName);
if ( keyPos != _rColumns.end() )
{
keyPos->second->SetPrimaryKey( true );
@@ -1078,7 +1062,7 @@ void OCopyTableWizard::appendColumns( Reference<XColumnsSupplier> const & _rxCol
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;
@@ -1113,7 +1097,7 @@ void OCopyTableWizard::appendKey( Reference<XKeysSupplier> const & _rxSup, const
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())
@@ -1198,16 +1182,16 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
if(xMetaData->getDatabaseProductName() == "MySQL")
{
Reference< XStatement > xSelect = m_xDestConnection->createStatement();
- Reference< XResultSet > xRs = xSelect->executeQuery("select database()");
+ Reference< XResultSet > xRs = xSelect->executeQuery(u"select database()"_ustr);
(void)xRs->next(); // first and only result
Reference< XRow > xRow( xRs, UNO_QUERY_THROW );
sSchema = xRow->getString(1);
}
}
- xTable->setPropertyValue(PROPERTY_CATALOGNAME,makeAny(sCatalog));
- xTable->setPropertyValue(PROPERTY_SCHEMANAME,makeAny(sSchema));
- xTable->setPropertyValue(PROPERTY_NAME,makeAny(sTable));
+ xTable->setPropertyValue(PROPERTY_CATALOGNAME,Any(sCatalog));
+ xTable->setPropertyValue(PROPERTY_SCHEMANAME,Any(sSchema));
+ xTable->setPropertyValue(PROPERTY_NAME,Any(sTable));
Reference< XColumnsSupplier > xSuppDestinationColumns( xTable, UNO_QUERY );
// now append the columns
@@ -1251,12 +1235,10 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
// set column mappings
Reference<XNameAccess> xNameAccess = xSuppDestinationColumns->getColumns();
Sequence< OUString> aSeq = xNameAccess->getElementNames();
- const OUString* pIter = aSeq.getConstArray();
- const OUString* pEnd = pIter + aSeq.getLength();
- for(sal_Int32 nNewPos=1;pIter != pEnd;++pIter,++nNewPos)
+ for (sal_Int32 i = 0; i < aSeq.getLength(); ++i)
{
- ODatabaseExport::TColumns::const_iterator aDestIter = m_vDestColumns.find(*pIter);
+ ODatabaseExport::TColumns::const_iterator aDestIter = m_vDestColumns.find(aSeq[i]);
if ( aDestIter != m_vDestColumns.end() )
{
@@ -1273,7 +1255,7 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
if ( m_vColumnPositions.end() != aPosFind )
{
- aPosFind->second = nNewPos;
+ aPosFind->second = i + 1;
OSL_ENSURE( m_vColumnTypes.size() > o3tl::make_unsigned( aPosFind - m_vColumnPositions.begin() ),
"Invalid index for vector!" );
m_vColumnTypes[ aPosFind - m_vColumnPositions.begin() ] = (*aFind)->second->GetType();
@@ -1362,7 +1344,7 @@ void OCopyTableWizard::setOperation( const sal_Int16 _nOperation )
OUString OCopyTableWizard::convertColumnName(const TColumnFindFunctor& _rCmpFunctor,
const OUString& _sColumnName,
- const OUString& _sExtraChars,
+ std::u16string_view _sExtraChars,
sal_Int32 _nMaxNameLen)
{
OUString sAlias = _sColumnName;
@@ -1495,7 +1477,7 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType, bool& _bN
if ( !pType )
{
_bNotConvert = false;
- pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,"x",50,0,false,bForce);
+ pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,u"x"_ustr,50,0,false,bForce);
if ( !pType )
pType = m_pTypeInfo;
}
@@ -1545,7 +1527,7 @@ void OCopyTableWizard::showError(const Any& _aError)
try
{
::rtl::Reference< ::comphelper::OInteractionRequest > xRequest( new ::comphelper::OInteractionRequest( _aError ) );
- m_xInteractionHandler->handle( xRequest.get() );
+ m_xInteractionHandler->handle( xRequest );
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/misc/WExtendPages.cxx b/dbaccess/source/ui/misc/WExtendPages.cxx
index f34661cabd7d..c7eac9181e00 100644
--- a/dbaccess/source/ui/misc/WExtendPages.cxx
+++ b/dbaccess/source/ui/misc/WExtendPages.cxx
@@ -31,7 +31,7 @@ void OWizHTMLExtend::createReaderAndCallParser(sal_Int32 _nRows)
{
tools::SvRef<OHTMLReader> xParser = new OHTMLReader(*m_pParserStream,
_nRows,
- m_pParent->GetColumnPositions(),
+ std::vector(m_pParent->GetColumnPositions()),
m_pParent->GetFormatter(),
m_pParent->GetComponentContext(),
&m_pParent->getDestVector(),
@@ -44,7 +44,7 @@ void OWizRTFExtend::createReaderAndCallParser(sal_Int32 _nRows)
{
tools::SvRef<ORTFReader> xParser = new ORTFReader(*m_pParserStream,
_nRows,
- m_pParent->GetColumnPositions(),
+ std::vector(m_pParent->GetColumnPositions()),
m_pParent->GetFormatter(),
m_pParent->GetComponentContext(),
&m_pParent->getDestVector(),
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 75ff6e3372f1..5eba2844b625 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -30,17 +30,17 @@ using namespace ::dbaui;
// OWizColumnSelect
OWizNameMatching::OWizNameMatching(weld::Container* pPage, OCopyTableWizard* pWizard)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/namematchingpage.ui", "NameMatching")
- , m_xTABLE_LEFT(m_xBuilder->weld_label("leftlabel"))
- , m_xTABLE_RIGHT(m_xBuilder->weld_label("rightlabel"))
- , m_xCTRL_LEFT(m_xBuilder->weld_tree_view("left"))
- , m_xCTRL_RIGHT(m_xBuilder->weld_tree_view("right"))
- , m_xColumn_up(m_xBuilder->weld_button("up"))
- , m_xColumn_down(m_xBuilder->weld_button("down"))
- , m_xColumn_up_right(m_xBuilder->weld_button("up_right"))
- , m_xColumn_down_right(m_xBuilder->weld_button("down_right"))
- , m_xAll(m_xBuilder->weld_button("all"))
- , m_xNone(m_xBuilder->weld_button("none"))
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/namematchingpage.ui"_ustr, u"NameMatching"_ustr)
+ , m_xTABLE_LEFT(m_xBuilder->weld_label(u"leftlabel"_ustr))
+ , m_xTABLE_RIGHT(m_xBuilder->weld_label(u"rightlabel"_ustr))
+ , m_xCTRL_LEFT(m_xBuilder->weld_tree_view(u"left"_ustr))
+ , m_xCTRL_RIGHT(m_xBuilder->weld_tree_view(u"right"_ustr))
+ , m_xColumn_up(m_xBuilder->weld_button(u"up"_ustr))
+ , m_xColumn_down(m_xBuilder->weld_button(u"down"_ustr))
+ , m_xColumn_up_right(m_xBuilder->weld_button(u"up_right"_ustr))
+ , m_xColumn_down_right(m_xBuilder->weld_button(u"down_right"_ustr))
+ , m_xAll(m_xBuilder->weld_button(u"all"_ustr))
+ , m_xNone(m_xBuilder->weld_button(u"none"_ustr))
{
OUString aImgUp(BMP_UP);
OUString aImgDown(BMP_DOWN);
@@ -60,8 +60,8 @@ OWizNameMatching::OWizNameMatching(weld::Container* pPage, OCopyTableWizard* pWi
m_xCTRL_LEFT->enable_toggle_buttons(weld::ColumnToggleType::Check);
- m_xCTRL_LEFT->connect_changed(LINK(this,OWizNameMatching,TableListClickHdl));
- m_xCTRL_RIGHT->connect_changed(LINK(this,OWizNameMatching,TableListRightSelectHdl));
+ m_xCTRL_LEFT->connect_selection_changed(LINK(this, OWizNameMatching, TableListClickHdl));
+ m_xCTRL_RIGHT->connect_selection_changed(LINK(this, OWizNameMatching, TableListRightSelectHdl));
m_sSourceText = m_xTABLE_LEFT->get_label() + "\n";
m_sDestText = m_xTABLE_RIGHT->get_label() + "\n";
@@ -119,7 +119,7 @@ bool OWizNameMatching::LeavePage()
bool bRightEntry = m_xCTRL_RIGHT->get_iter_first(*xRightEntry);
while (bLeftEntry && bRightEntry)
{
- OFieldDescription* pSrcField = reinterpret_cast<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry).toInt64());
+ OFieldDescription* pSrcField = weld::fromId<OFieldDescription*>(m_xCTRL_LEFT->get_id(*xLeftEntry));
OSL_ENSURE(pSrcField,"OWizNameMatching: OColumn can not be null!");
sal_Int32 nPos = 0;
@@ -132,7 +132,7 @@ bool OWizNameMatching::LeavePage()
if (m_xCTRL_LEFT->get_toggle(*xLeftEntry) == TRISTATE_TRUE)
{
- OFieldDescription* pDestField = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry).toInt64());
+ OFieldDescription* pDestField = weld::fromId<OFieldDescription*>(m_xCTRL_RIGHT->get_id(*xRightEntry));
OSL_ENSURE(pDestField,"OWizNameMatching: OColumn can not be null!");
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
sal_Int32 nPosDest = 1;
@@ -268,7 +268,7 @@ IMPL_LINK_NOARG( OWizNameMatching, TableListRightSelectHdl, weld::TreeView&, voi
if (nPos == -1)
return;
- OFieldDescription* pColumn = reinterpret_cast<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos).toInt64());
+ OFieldDescription* pColumn = weld::fromId<OFieldDescription*>(m_xCTRL_RIGHT->get_id(nPos));
if (pColumn->IsAutoIncrement())
{
m_xCTRL_RIGHT->unselect(nPos);
@@ -319,7 +319,7 @@ void OWizNameMatching::FillListBox(weld::TreeView& rTreeView, const ODatabaseExp
rTreeView.set_toggle(nRow, bChecked ? TRISTATE_TRUE : TRISTATE_FALSE);
}
rTreeView.set_text(nRow, elem->first, 0);
- rTreeView.set_id(nRow, OUString::number(reinterpret_cast<sal_Int64>(elem->second)));
+ rTreeView.set_id(nRow, weld::toId(elem->second));
++nRow;
}
diff --git a/dbaccess/source/ui/misc/WTypeSelect.cxx b/dbaccess/source/ui/misc/WTypeSelect.cxx
index 245e6281ed87..4224ea66b9f8 100644
--- a/dbaccess/source/ui/misc/WTypeSelect.cxx
+++ b/dbaccess/source/ui/misc/WTypeSelect.cxx
@@ -19,7 +19,7 @@
#include <WTypeSelect.hxx>
#include <bitmaps.hlst>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <osl/diagnose.h>
#include <FieldDescriptions.hxx>
#include <WCopyTable.hxx>
@@ -33,7 +33,6 @@
using namespace ::dbaui;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::sdbc;
@@ -86,7 +85,7 @@ void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
OFieldDescription* pCurFieldDescr = getCurrentFieldDescData();
const sal_Int32 nPos = pListBox->find_text(pCurFieldDescr->GetName());
- pCurFieldDescr = reinterpret_cast< OFieldDescription* >( pListBox->get_id(nPos).toInt64() );
+ pCurFieldDescr = weld::fromId<OFieldDescription*>(pListBox->get_id(nPos));
OSL_ENSURE( pCurFieldDescr, "OWizTypeSelectControl::CellModified: Columnname/type not found in the listbox!" );
if ( !pCurFieldDescr )
return;
@@ -153,7 +152,7 @@ void OWizTypeSelectControl::CellModified(sal_Int32 nRow, sal_uInt16 nColId )
pListBox->remove(nPos);
pListBox->insert_text(nPos, pCurFieldDescr->GetName());
- pListBox->set_id(nPos, OUString::number(reinterpret_cast<sal_Int64>(pCurFieldDescr)));
+ pListBox->set_id(nPos, weld::toId(pCurFieldDescr));
pWiz->replaceColumn(nPos,pCurFieldDescr,sOldName);
}
@@ -203,15 +202,14 @@ OUString OWizTypeSelectControl::getAutoIncrementValue() const
}
OWizTypeSelect::OWizTypeSelect(weld::Container* pPage, OCopyTableWizard* pWizard, SvStream* pStream)
- : OWizardPage(pPage, pWizard, "dbaccess/ui/typeselectpage.ui", "TypeSelect")
- , m_xColumnNames(new OWizTypeSelectList(m_xBuilder->weld_tree_view("columnnames")))
- , m_xColumns(m_xBuilder->weld_label("columns"))
- , m_xControlContainer(m_xBuilder->weld_container("control_container"))
+ : OWizardPage(pPage, pWizard, u"dbaccess/ui/typeselectpage.ui"_ustr, u"TypeSelect"_ustr)
+ , m_xColumnNames(new OWizTypeSelectList(m_xBuilder->weld_tree_view(u"columnnames"_ustr)))
+ , m_xControlContainer(m_xBuilder->weld_container(u"control_container"_ustr))
, m_xTypeControl(new OWizTypeSelectControl(m_xControlContainer.get(), this))
- , m_xAutoType(m_xBuilder->weld_label("autotype"))
- , m_xAutoFt(m_xBuilder->weld_label("autolabel"))
- , m_xAutoEt(m_xBuilder->weld_spin_button("auto"))
- , m_xAutoPb(m_xBuilder->weld_button("autobutton"))
+ , m_xAutoType(m_xBuilder->weld_label(u"autotype"_ustr))
+ , m_xAutoFt(m_xBuilder->weld_label(u"autolabel"_ustr))
+ , m_xAutoEt(m_xBuilder->weld_spin_button(u"auto"_ustr))
+ , m_xAutoPb(m_xBuilder->weld_button(u"autobutton"_ustr))
, m_pParserStream(pStream)
, m_nDisplayRow(0)
, m_bAutoIncrementEnabled(false)
@@ -221,7 +219,7 @@ OWizTypeSelect::OWizTypeSelect(weld::Container* pPage, OCopyTableWizard* pWizard
m_xTypeControl->Init();
- m_xAutoEt->set_text("10");
+ m_xAutoEt->set_text(u"10"_ustr);
m_xAutoEt->set_digits(0);
m_xAutoPb->connect_clicked(LINK(this,OWizTypeSelect,ButtonClickHdl));
m_xColumnNames->set_selection_mode(SelectionMode::Multiple);
@@ -248,7 +246,7 @@ OUString OWizTypeSelect::GetTitle() const
IMPL_LINK_NOARG(OWizTypeSelect, ColumnSelectHdl, weld::TreeView&, void)
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
if (pField)
m_xTypeControl->DisplayData(pField);
@@ -265,7 +263,7 @@ void OWizTypeSelect::Reset()
const ODatabaseExport::TColumnVector& rDestColumns = m_pParent->getDestVector();
for (auto const& column : rDestColumns)
{
- OUString sId(OUString::number(reinterpret_cast<sal_Int64>(column->second)));
+ OUString sId(weld::toId(column->second));
m_xColumnNames->append(sId, column->first);
if (column->second->IsPrimaryKey())
m_xColumnNames->set_image(nCount, BMP_PRIMARY_KEY);
@@ -288,7 +286,7 @@ void OWizTypeSelect::Activate( )
bool OWizTypeSelect::LeavePage()
{
bool bDuplicateName = false;
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xColumnNames->get_selected_id().toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xColumnNames->get_selected_id());
if ( pField )
{
m_xTypeControl->SaveData(pField);
@@ -339,7 +337,7 @@ bool OWizTypeSelectList::IsPrimaryKeyAllowed() const
for( sal_Int32 j = 0; m_bPKey && j < nCount; ++j )
{
- OFieldDescription* pField = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(aRows[j]).toInt64());
+ OFieldDescription* pField = weld::fromId<OFieldDescription*>(m_xControl->get_id(aRows[j]));
if(!pField || pField->getTypeInfo()->nSearchType == ColumnSearch::NONE)
return false;
}
@@ -367,14 +365,14 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
if (!IsPrimaryKeyAllowed())
return false;
- std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xControl.get(), "dbaccess/ui/keymenu.ui"));
- auto xContextMenu = xBuilder->weld_menu("menu");
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(m_xControl.get(), u"dbaccess/ui/keymenu.ui"_ustr));
+ auto xContextMenu = xBuilder->weld_menu(u"menu"_ustr);
// Should primary key checkbox be checked?
const sal_Int32 nCount = m_xControl->n_children();
bool bCheckOk = false;
for(sal_Int32 j = 0 ; j < nCount ; ++j)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
// if at least one of the fields is selected but not in the primary key,
// or is in the primary key but not selected, then don't check the
// primary key checkbox.
@@ -388,28 +386,28 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
}
if (bCheckOk)
- xContextMenu->set_active("primarykey", true);
+ xContextMenu->set_active(u"primarykey"_ustr, true);
- OString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
- if (sCommand == "primarykey")
+ OUString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+ if (sCommand != "primarykey")
+ return true;
+
+ for (sal_Int32 j = 0 ; j < nCount; ++j)
{
- for (sal_Int32 j = 0 ; j < nCount; ++j)
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
+ if (pFieldDescr)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
- if (pFieldDescr)
+ if(!bCheckOk && m_xControl->is_selected(j))
{
- if(!bCheckOk && m_xControl->is_selected(j))
- {
- setPrimaryKey(pFieldDescr,j,true);
- }
- else
- {
- setPrimaryKey(pFieldDescr,j);
- }
+ setPrimaryKey(pFieldDescr,j,true);
+ }
+ else
+ {
+ setPrimaryKey(pFieldDescr,j);
}
}
- m_aChangeHdl.Call(*m_xControl);
}
+ m_aChangeHdl.Call(*m_xControl);
return true;
}
diff --git a/dbaccess/source/ui/misc/asyncmodaldialog.cxx b/dbaccess/source/ui/misc/asyncmodaldialog.cxx
index 3c59a58f8b85..2c7db57be16e 100644
--- a/dbaccess/source/ui/misc/asyncmodaldialog.cxx
+++ b/dbaccess/source/ui/misc/asyncmodaldialog.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <vcl/svapp.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaui
{
@@ -65,7 +65,7 @@ namespace dbaui
{
try
{
- m_xDialog->execute();
+ (void)m_xDialog->execute();
}
catch( const Exception& )
{
diff --git a/dbaccess/source/ui/misc/charsets.cxx b/dbaccess/source/ui/misc/charsets.cxx
index 86e55b226df0..5224e65d3c63 100644
--- a/dbaccess/source/ui/misc/charsets.cxx
+++ b/dbaccess/source/ui/misc/charsets.cxx
@@ -23,6 +23,7 @@
#include <strings.hrc>
#include <rtl/tencinfo.h>
#include <svx/txenctab.hxx>
+#include <utility>
namespace dbaui
{
@@ -30,8 +31,7 @@ namespace dbaui
// OCharsetDisplay
OCharsetDisplay::OCharsetDisplay()
- : OCharsetMap()
- , m_aSystemDisplayName(DBA_RES( STR_RSC_CHARSETS ))
+ : m_aSystemDisplayName(DBA_RES( STR_RSC_CHARSETS ))
{
}
@@ -62,7 +62,7 @@ namespace dbaui
return const_iterator( this, aBaseIter );
}
- OCharsetDisplay::const_iterator OCharsetDisplay::findIanaName(const OUString& _rIanaName) const
+ OCharsetDisplay::const_iterator OCharsetDisplay::findIanaName(std::u16string_view _rIanaName) const
{
OCharsetMap::const_iterator aBaseIter = OCharsetMap::findIanaName(_rIanaName);
return const_iterator( this, aBaseIter );
@@ -87,17 +87,17 @@ namespace dbaui
{
}
- CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, const OUString& _rDisplayName)
+ CharsetDisplayDerefHelper::CharsetDisplayDerefHelper(const ::dbtools::CharsetIteratorDerefHelper& _rBase, OUString _sDisplayName)
:CharsetDisplayDerefHelper_Base(_rBase)
- ,m_sDisplayName(_rDisplayName)
+ ,m_sDisplayName(std::move(_sDisplayName))
{
OSL_ENSURE( !m_sDisplayName.isEmpty(), "CharsetDisplayDerefHelper::CharsetDisplayDerefHelper: invalid display name!" );
}
// OCharsetDisplay::ExtendedCharsetIterator
- OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, const base_iterator& _rPosition )
+ OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator( const OCharsetDisplay* _pContainer, base_iterator _aPosition )
:m_pContainer(_pContainer)
- ,m_aPosition(_rPosition)
+ ,m_aPosition(std::move(_aPosition))
{
OSL_ENSURE(m_pContainer, "OCharsetDisplay::ExtendedCharsetIterator::ExtendedCharsetIterator : invalid container!");
}
diff --git a/dbaccess/source/ui/misc/controllerframe.cxx b/dbaccess/source/ui/misc/controllerframe.cxx
index 599398e5d00f..cfca8f73413e 100644
--- a/dbaccess/source/ui/misc/controllerframe.cxx
+++ b/dbaccess/source/ui/misc/controllerframe.cxx
@@ -29,7 +29,7 @@
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
#include <sfx2/objsh.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/window.hxx>
@@ -42,7 +42,6 @@ namespace dbaui
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
using ::com::sun::star::uno::Any;
using ::com::sun::star::frame::XFrame;
using ::com::sun::star::frame::FrameAction;
@@ -104,9 +103,6 @@ namespace dbaui
{
explicit ControllerFrame_Data( IController& _rController )
:m_rController( _rController )
- ,m_xFrame()
- ,m_xDocEventBroadcaster()
- ,m_pListener()
,m_bActive( false )
,m_bIsTopLevelDocumentWindow( false )
{
@@ -212,7 +208,7 @@ namespace dbaui
{
if ( _rData.m_xDocEventBroadcaster.is() )
{
- OUString sEventName = _bActive ? OUString("OnFocus") : OUString("OnUnfocus");
+ OUString sEventName = _bActive ? u"OnFocus"_ustr : u"OnUnfocus"_ustr;
Reference< XController2 > xController( _rData.m_rController.getXController(), UNO_QUERY_THROW );
_rData.m_xDocEventBroadcaster->notifyDocumentEvent( sEventName, xController, Any() );
}
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 49d3cfe5591a..112c79947393 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -31,7 +31,8 @@
#include <connectivity/dbtools.hxx>
#include <osl/diagnose.h>
#include <toolkit/helper/vclunohelper.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
+#include <utility>
#include <vcl/window.hxx>
namespace dbaui
@@ -51,12 +52,11 @@ namespace dbaui
DatabaseObjectView::DatabaseObjectView( const Reference< XComponentContext >& _rxORB,
const Reference< XDatabaseDocumentUI >& _rxApplication,
const Reference< XFrame >& _rxParentFrame,
- const OUString& _rComponentURL )
+ OUString _sComponentURL )
:m_xORB ( _rxORB )
,m_xParentFrame ( _rxParentFrame )
- ,m_xFrameLoader ( )
,m_xApplication ( _rxApplication )
- ,m_sComponentURL ( _rComponentURL )
+ ,m_sComponentURL (std::move( _sComponentURL ))
{
OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" );
OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" );
@@ -72,7 +72,7 @@ namespace dbaui
Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs )
{
- return doCreateView( makeAny( _xDataSource ), OUString(), i_rDispatchArgs );
+ return doCreateView( Any( _xDataSource ), OUString(), i_rDispatchArgs );
}
Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const OUString& _rName,
@@ -104,21 +104,10 @@ namespace dbaui
if ( !m_xFrameLoader.is() )
{
Reference< XSingleServiceFactory > xFact = TaskCreator::create(m_xORB);
- Sequence< Any > lArgs(3);
- NamedValue aProp;
- sal_Int32 nArg = 0;
-
- aProp.Name = "ParentFrame";
- aProp.Value <<= m_xParentFrame;
- lArgs[nArg++] <<= aProp;
-
- aProp.Name = "TopWindow";
- aProp.Value <<= true;
- lArgs[nArg++] <<= aProp;
-
- aProp.Name = "SupportPersistentWindowState";
- aProp.Value <<= true;
- lArgs[nArg++] <<= aProp;
+ Sequence< Any > lArgs{ Any(NamedValue(u"ParentFrame"_ustr, Any(m_xParentFrame))),
+ Any(NamedValue(u"TopWindow"_ustr, Any(true))),
+ Any(NamedValue(u"SupportPersistentWindowState"_ustr,
+ Any(true))) };
m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW);
@@ -135,7 +124,7 @@ namespace dbaui
Reference< XComponentLoader > xFrameLoader( m_xFrameLoader, UNO_SET_THROW );
xReturn = xFrameLoader->loadComponentFromURL(
m_sComponentURL,
- "_self",
+ u"_self"_ustr,
0,
i_rDispatchArgs.getPropertyValues()
);
@@ -158,20 +147,20 @@ namespace dbaui
Reference<XDataSource> xDataSource;
if ( _aDataSource >>= sDataSource )
{
- i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCENAME), sDataSource );
+ i_rDispatchArgs.put( PROPERTY_DATASOURCENAME, sDataSource );
}
else if ( _aDataSource >>= xDataSource )
{
- i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCE), xDataSource );
+ i_rDispatchArgs.put( PROPERTY_DATASOURCE, xDataSource );
}
- i_rDispatchArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), getConnection() );
+ i_rDispatchArgs.put( PROPERTY_ACTIVE_CONNECTION, getConnection() );
}
// QueryDesigner
QueryDesigner::QueryDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication,
const Reference< XFrame >& _rxParentFrame, bool _bCreateView )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? OUString(URL_COMPONENT_VIEWDESIGN) : OUString(URL_COMPONENT_QUERYDESIGN) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN )
,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY )
{
}
@@ -185,22 +174,22 @@ namespace dbaui
const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( PROPERTY_GRAPHICAL_DESIGN, true );
const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign;
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), m_nCommandType );
+ i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, m_nCommandType );
if ( bIncludeQueryName )
{
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rObjectName );
+ i_rDispatchArgs.put( PROPERTY_COMMAND, _rObjectName );
}
if ( bEditViewAsSQLCommand )
{
- i_rDispatchArgs.put( OUString(PROPERTY_ESCAPE_PROCESSING), false );
+ i_rDispatchArgs.put( PROPERTY_ESCAPE_PROCESSING, false );
}
}
// TableDesigner
TableDesigner::TableDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< OUString >( URL_COMPONENT_TABLEDESIGN ) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_TABLEDESIGN )
{
}
@@ -211,7 +200,7 @@ namespace dbaui
if ( !_rObjectName.isEmpty() )
{
- i_rDispatchArgs.put( OUString(PROPERTY_CURRENTTABLE), _rObjectName );
+ i_rDispatchArgs.put( PROPERTY_CURRENTTABLE, _rObjectName );
}
}
@@ -254,7 +243,7 @@ namespace dbaui
// ResultSetBrowser
ResultSetBrowser::ResultSetBrowser( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame,
bool _bTable )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast < OUString >( URL_COMPONENT_DATASOURCEBROWSER ) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_DATASOURCEBROWSER )
,m_bTable(_bTable)
{
}
@@ -264,27 +253,27 @@ namespace dbaui
{
DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName );
OSL_ENSURE( !_rQualifiedName.isEmpty(),"A Table name must be set");
- OUString sCatalog;
- OUString sSchema;
- OUString sTable;
- if ( m_bTable )
- ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation );
-
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
- i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rQualifiedName );
- i_rDispatchArgs.put( OUString(PROPERTY_ENABLE_BROWSER), false );
+ i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName );
+ i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false );
if ( m_bTable )
{
- i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_CATALOGNAME), sCatalog );
- i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_SCHEMANAME), sSchema );
- i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_TABLENAME), sTable );
+ OUString sCatalog;
+ OUString sSchema;
+ OUString sTable;
+ ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation );
+ i_rDispatchArgs.put( PROPERTY_UPDATE_CATALOGNAME, sCatalog );
+ i_rDispatchArgs.put( PROPERTY_UPDATE_SCHEMANAME, sSchema );
+ i_rDispatchArgs.put( PROPERTY_UPDATE_TABLENAME, sTable );
+ i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, CommandType::TABLE );
}
+ else
+ i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, CommandType::QUERY );
}
// RelationDesigner
RelationDesigner::RelationDesigner( const Reference< XComponentContext >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame )
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< OUString >( URL_COMPONENT_RELATIONDESIGN ) )
+ :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, URL_COMPONENT_RELATIONDESIGN )
{
}
} // namespace dbaui
diff --git a/dbaccess/source/ui/misc/datasourceconnector.cxx b/dbaccess/source/ui/misc/datasourceconnector.cxx
index 49053e569000..11fcf5ff6c1e 100644
--- a/dbaccess/source/ui/misc/datasourceconnector.cxx
+++ b/dbaccess/source/ui/misc/datasourceconnector.cxx
@@ -30,10 +30,12 @@
#include <connectivity/dbexception.hxx>
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <UITools.hxx>
+#include <utility>
+#include <vcl/mnemonic.hxx>
#include <vcl/outdev.hxx>
#include <vcl/stdtext.hxx>
#include <vcl/weld.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <strings.hrc>
#include <strings.hxx>
@@ -59,10 +61,10 @@ namespace dbaui
}
ODatasourceConnector::ODatasourceConnector( const Reference< XComponentContext >& _rxContext, weld::Window* _pMessageParent,
- const OUString& _rContextInformation )
+ OUString _sContextInformation )
:m_pErrorMessageParent(_pMessageParent)
,m_xContext(_rxContext)
- ,m_sContextInformation( _rContextInformation )
+ ,m_sContextInformation(std::move( _sContextInformation ))
{
}
@@ -118,7 +120,7 @@ namespace dbaui
Reference< XModel > xModel( getDataSourceOrModel( _xDataSource ), UNO_QUERY_THROW );
::comphelper::NamedValueCollection aArgs( xModel->getArgs() );
- Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
+ Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( u"InteractionHandler"_ustr, Reference< XInteractionHandler >() ) );
if ( !xHandler.is() )
{
@@ -155,11 +157,9 @@ namespace dbaui
{
OUString sMessage( DBA_RES( STR_WARNINGS_DURING_CONNECT ) );
sMessage = sMessage.replaceFirst( "$buttontext$", GetStandardText( StandardButtonType::More ) );
- sMessage = OutputDevice::GetNonMnemonicString( sMessage );
+ sMessage = removeMnemonicFromString( sMessage );
- SQLWarning aContext;
- aContext.Message = sMessage;
- aContext.NextException = aWarnings;
+ SQLWarning aContext(sMessage, {}, {}, 0, aWarnings);
aInfo = aContext;
}
xConnectionWarnings->clearWarnings();
@@ -174,10 +174,7 @@ namespace dbaui
{
if ( !m_sContextInformation.isEmpty() )
{
- SQLException aError;
- aError.Message = m_sContextInformation;
- aError.NextException = aInfo.get();
-
+ SQLException aError(m_sContextInformation, {}, {}, 0, aInfo.get());
aInfo = aError;
}
}
@@ -187,7 +184,7 @@ namespace dbaui
{
if ( _pErrorInfo )
{
- *_pErrorInfo = aInfo;
+ *_pErrorInfo = std::move(aInfo);
}
else
{
diff --git a/dbaccess/source/ui/misc/dbaundomanager.cxx b/dbaccess/source/ui/misc/dbaundomanager.cxx
index d8659ce6157d..9ed72bbdf477 100644
--- a/dbaccess/source/ui/misc/dbaundomanager.cxx
+++ b/dbaccess/source/ui/misc/dbaundomanager.cxx
@@ -47,7 +47,6 @@ namespace dbaui
,rParent( i_parent )
,rMutex( i_mutex )
,bDisposed( false )
- ,aUndoManager()
,aUndoHelper( *this )
{
}
@@ -166,12 +165,12 @@ namespace dbaui
return m_xImpl->aUndoManager;
}
- void SAL_CALL UndoManager::acquire( ) throw ()
+ void SAL_CALL UndoManager::acquire( ) noexcept
{
m_xImpl->rParent.acquire();
}
- void SAL_CALL UndoManager::release( ) throw ()
+ void SAL_CALL UndoManager::release( ) noexcept
{
m_xImpl->rParent.release();
}
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index 63e30d06ad3b..0d3676db5d80 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -37,12 +37,12 @@
#include <connectivity/dbexception.hxx>
#include <connectivity/dbmetadata.hxx>
#include <connectivity/dbtools.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
@@ -124,7 +124,7 @@ namespace dbaui
public:
::dbtools::SQLExceptionInfo m_aCurrentError;
- ::comphelper::OInterfaceContainerHelper2
+ ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener>
m_aModifyListeners;
// <properties>
@@ -141,8 +141,7 @@ namespace dbaui
bool m_bNotAttached;
explicit DBSubComponentController_Impl(osl::Mutex& i_rMutex)
- :m_aDocScriptSupport()
- ,m_aModifyListeners( i_rMutex )
+ :m_aModifyListeners( i_rMutex )
,m_nDocStartNumber(0)
,m_bSuspended( false )
,m_bEditable(true)
@@ -153,14 +152,14 @@ namespace dbaui
bool documentHasScriptSupport() const
{
- OSL_PRECOND( !!m_aDocScriptSupport,
+ OSL_PRECOND( m_aDocScriptSupport.has_value(),
"DBSubComponentController_Impl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
- return !!m_aDocScriptSupport && *m_aDocScriptSupport;
+ return m_aDocScriptSupport.has_value() && *m_aDocScriptSupport;
}
void setDocumentScriptSupport( const bool _bSupport )
{
- OSL_PRECOND( !m_aDocScriptSupport,
+ OSL_PRECOND( !m_aDocScriptSupport.has_value(),
"DBSubComponentController_Impl::setDocumentScriptSupport: already initialized!" );
m_aDocScriptSupport = ::std::optional< bool >( _bSupport );
}
@@ -177,11 +176,9 @@ namespace dbaui
{
}
- void DBSubComponentController::impl_initialize()
+ void DBSubComponentController::impl_initialize(const ::comphelper::NamedValueCollection& rArguments)
{
- OGenericUnoController::impl_initialize();
-
- const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
+ OGenericUnoController::impl_initialize(rArguments);
Reference< XConnection > xConnection;
xConnection = rArguments.getOrDefault( PROPERTY_ACTIVE_CONNECTION, xConnection );
@@ -211,7 +208,7 @@ namespace dbaui
if ( _rType.equals( cppu::UnoType<XScriptInvocationContext>::get() ) )
{
if ( m_pImpl->documentHasScriptSupport() )
- return makeAny( Reference< XScriptInvocationContext >( this ) );
+ return Any( Reference< XScriptInvocationContext >( this ) );
return Any();
}
@@ -223,11 +220,12 @@ namespace dbaui
Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() );
if ( !m_pImpl->documentHasScriptSupport() )
{
- auto newEnd = std::remove_if( aTypes.begin(), aTypes.end(),
+ auto [begin, end] = asNonConstRange(aTypes);
+ auto newEnd = std::remove_if( begin, end,
[](const Type& type)
{ return type == cppu::UnoType<XScriptInvocationContext>::get(); } );
- aTypes.realloc( std::distance(aTypes.begin(), newEnd) );
- }
+ aTypes.realloc( std::distance(begin, newEnd) );
+ }
return aTypes;
}
@@ -447,7 +445,7 @@ namespace dbaui
Reference< XWindow > xWindow = getTopMostContainerWindow();
vcl::Window* pWin = nullptr;
if ( xWindow.is() )
- pWin = VCLUnoHelper::GetWindow(xWindow).get();
+ pWin = VCLUnoHelper::GetWindow(xWindow);
if ( !pWin )
pWin = getView()->Window::GetParent();
@@ -535,8 +533,7 @@ namespace dbaui
Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
if ( xTitle.is() )
{
- sTitle.append( xTitle->getTitle() );
- sTitle.append(" : ");
+ sTitle.append( xTitle->getTitle() + " : ");
}
sTitle.append( getPrivateTitle() );
return sTitle.makeStringAndClear();
diff --git a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
index 53ef26fa3284..cc44de2bdee0 100644
--- a/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
+++ b/dbaccess/source/ui/misc/defaultobjectnamecheck.cxx
@@ -24,7 +24,6 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
-#include <com/sun/star/sdb/tools/XConnectionTools.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <connectivity/dbexception.hxx>
@@ -32,7 +31,7 @@
#include <rtl/ustrbuf.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <memory>
@@ -47,7 +46,6 @@ namespace dbaui
using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::sdbc::XConnection;
- using ::com::sun::star::sdb::tools::XObjectNames;
using ::com::sun::star::sdb::tools::XConnectionTools;
using ::com::sun::star::uno::UNO_QUERY;
@@ -60,29 +58,20 @@ namespace dbaui
{
void lcl_fillNameExistsError( std::u16string_view _rObjectName, SQLExceptionInfo& _out_rErrorToDisplay )
{
- SQLException aError;
OUString sErrorMessage = DBA_RES(STR_NAMED_OBJECT_ALREADY_EXISTS);
- aError.Message = sErrorMessage.replaceAll("$#$", _rObjectName);
+ SQLException aError(sErrorMessage.replaceAll("$#$", _rObjectName), {}, {}, 0, {});
_out_rErrorToDisplay = aError;
}
}
- // HierarchicalNameCheck_Impl
- struct HierarchicalNameCheck_Impl
- {
- Reference< XHierarchicalNameAccess > xHierarchicalNames;
- OUString sRelativeRoot;
- };
-
// HierarchicalNameCheck
HierarchicalNameCheck::HierarchicalNameCheck( const Reference< XHierarchicalNameAccess >& _rxNames, const OUString& _rRelativeRoot )
- :m_pImpl( new HierarchicalNameCheck_Impl )
{
- m_pImpl->xHierarchicalNames = _rxNames;
- m_pImpl->sRelativeRoot = _rRelativeRoot;
+ mxHierarchicalNames = _rxNames;
+ msRelativeRoot = _rRelativeRoot;
- if ( !m_pImpl->xHierarchicalNames.is() )
+ if ( !mxHierarchicalNames.is() )
throw IllegalArgumentException();
}
@@ -95,15 +84,14 @@ namespace dbaui
try
{
OUStringBuffer aCompleteName;
- if ( !m_pImpl->sRelativeRoot.isEmpty() )
+ if ( !msRelativeRoot.isEmpty() )
{
- aCompleteName.append( m_pImpl->sRelativeRoot );
- aCompleteName.append( "/" );
+ aCompleteName.append( msRelativeRoot + "/" );
}
aCompleteName.append( _rObjectName );
OUString sCompleteName( aCompleteName.makeStringAndClear() );
- if ( !m_pImpl->xHierarchicalNames->hasByHierarchicalName( sCompleteName ) )
+ if ( !mxHierarchicalNames->hasByHierarchicalName( sCompleteName ) )
return true;
}
catch( const Exception& )
@@ -115,26 +103,18 @@ namespace dbaui
return false;
}
- // DynamicTableOrQueryNameCheck_Impl
- struct DynamicTableOrQueryNameCheck_Impl
- {
- sal_Int32 nCommandType;
- Reference< XObjectNames > xObjectNames;
- };
-
// DynamicTableOrQueryNameCheck
DynamicTableOrQueryNameCheck::DynamicTableOrQueryNameCheck( const Reference< XConnection >& _rxSdbLevelConnection, sal_Int32 _nCommandType )
- :m_pImpl( new DynamicTableOrQueryNameCheck_Impl )
{
Reference< XConnectionTools > xConnTools( _rxSdbLevelConnection, UNO_QUERY );
if ( xConnTools.is() )
- m_pImpl->xObjectNames.set( xConnTools->getObjectNames() );
- if ( !m_pImpl->xObjectNames.is() )
+ mxObjectNames.set( xConnTools->getObjectNames() );
+ if ( !mxObjectNames.is() )
throw IllegalArgumentException();
if ( ( _nCommandType != CommandType::QUERY ) && ( _nCommandType != CommandType::TABLE ) )
throw IllegalArgumentException();
- m_pImpl->nCommandType = _nCommandType;
+ mnCommandType = _nCommandType;
}
DynamicTableOrQueryNameCheck::~DynamicTableOrQueryNameCheck()
@@ -145,7 +125,7 @@ namespace dbaui
{
try
{
- m_pImpl->xObjectNames->checkNameForCreate( m_pImpl->nCommandType, _rObjectName );
+ mxObjectNames->checkNameForCreate( mnCommandType, _rObjectName );
return true;
}
catch( const SQLException& )
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 58831f081185..c25fb8eda16a 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -21,6 +21,7 @@
#include <connectivity/DriversConfig.hxx>
#include <dsntypes.hxx>
#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
#include <map>
#include <utility>
@@ -28,7 +29,6 @@
namespace dbaui
{
- using namespace dbaccess;
using namespace ::com::sun::star;
namespace {
@@ -53,45 +53,39 @@ namespace dbaui
{
/// one of the items from dsitems.hxx
ItemID nItemID;
- const char* pAsciiFeatureName;
+ OUString pAsciiFeatureName;
};
- }
-
// global tables
- static const FeatureMapping* lcl_getFeatureMappings()
- {
- static const FeatureMapping s_aMappings[] = {
- { DSID_AUTORETRIEVEENABLED, "GeneratedValues" },
- { DSID_AUTOINCREMENTVALUE, "GeneratedValues" },
- { DSID_AUTORETRIEVEVALUE, "GeneratedValues" },
- { DSID_SQL92CHECK, "UseSQL92NamingConstraints" },
- { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" },
- { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" },
- { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" },
- { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" },
- { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" },
- { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" },
- { DSID_CATALOG, "UseCatalogInSelect" },
- { DSID_SCHEMA, "UseSchemaInSelect" },
- { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" },
- { DSID_DOSLINEENDS, "UseDOSLineEnds" },
- { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" },
- { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" },
- { DSID_IGNORECURRENCY, "IgnoreCurrency" },
- { DSID_ESCAPE_DATETIME, "EscapeDateTime" },
- { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
- { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" },
- { DSID_MAX_ROW_SCAN, "MaxRowScan" },
- { 0, nullptr }
- };
- return s_aMappings;
+ const FeatureMapping s_aMappings[] = {
+ { DSID_AUTORETRIEVEENABLED, u"GeneratedValues"_ustr },
+ { DSID_AUTOINCREMENTVALUE, u"GeneratedValues"_ustr },
+ { DSID_AUTORETRIEVEVALUE, u"GeneratedValues"_ustr },
+ { DSID_SQL92CHECK, u"UseSQL92NamingConstraints"_ustr },
+ { DSID_APPEND_TABLE_ALIAS, u"AppendTableAliasInSelect"_ustr },
+ { DSID_AS_BEFORE_CORRNAME, u"UseKeywordAsBeforeAlias"_ustr },
+ { DSID_ENABLEOUTERJOIN, u"UseBracketedOuterJoinSyntax"_ustr },
+ { DSID_IGNOREDRIVER_PRIV, u"IgnoreDriverPrivileges"_ustr },
+ { DSID_PARAMETERNAMESUBST, u"ParameterNameSubstitution"_ustr },
+ { DSID_SUPPRESSVERSIONCL, u"DisplayVersionColumns"_ustr },
+ { DSID_CATALOG, u"UseCatalogInSelect"_ustr },
+ { DSID_SCHEMA, u"UseSchemaInSelect"_ustr },
+ { DSID_INDEXAPPENDIX, u"UseIndexDirectionKeyword"_ustr },
+ { DSID_DOSLINEENDS, u"UseDOSLineEnds"_ustr },
+ { DSID_BOOLEANCOMPARISON, u"BooleanComparisonMode"_ustr },
+ { DSID_CHECK_REQUIRED_FIELDS, u"FormsCheckRequiredFields"_ustr },
+ { DSID_IGNORECURRENCY, u"IgnoreCurrency"_ustr },
+ { DSID_ESCAPE_DATETIME, u"EscapeDateTime"_ustr },
+ { DSID_PRIMARY_KEY_SUPPORT, u"PrimaryKeySupport"_ustr },
+ { DSID_RESPECTRESULTSETTYPE, u"RespectDriverResultSetType"_ustr },
+ { DSID_MAX_ROW_SCAN, u"MaxRowScan"_ustr },
+ };
}
static const FeatureSet& lcl_getFeatureSet( const OUString& _rURL )
{
typedef std::map< OUString, FeatureSet > FeatureSets;
- static FeatureSets s_aFeatureSets = [&]()
+ static FeatureSets s_aFeatureSets = []()
{
FeatureSets tmp;
::connectivity::DriversConfig aDriverConfig( ::comphelper::getProcessComponentContext() );
@@ -101,15 +95,13 @@ namespace dbaui
FeatureSet aCurrentSet;
const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( pattern ).getNamedValues() );
- const FeatureMapping* pFeatureMapping = lcl_getFeatureMappings();
- while ( pFeatureMapping->pAsciiFeatureName )
+ for ( const FeatureMapping& rFeatureMapping : s_aMappings )
{
- if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) )
- aCurrentSet.put( pFeatureMapping->nItemID );
- ++pFeatureMapping;
+ if ( aCurrentFeatures.has( rFeatureMapping.pAsciiFeatureName ) )
+ aCurrentSet.put( rFeatureMapping.nItemID );
}
- tmp[ pattern ] = aCurrentSet;
+ tmp[pattern] = std::move(aCurrentSet);
}
return tmp;
}();
@@ -120,27 +112,24 @@ namespace dbaui
static AuthenticationMode getAuthenticationMode( const OUString& _sURL )
{
- static std::map< OUString, FeatureSupport > s_aSupport = [&]()
+ static std::map< OUString, FeatureSupport > s_aSupport = []()
{
std::map< OUString, FeatureSupport > tmp;
::connectivity::DriversConfig aDriverConfig(::comphelper::getProcessComponentContext());
- const uno::Sequence< OUString > aURLs = aDriverConfig.getURLs();
- const OUString* pIter = aURLs.getConstArray();
- const OUString* pEnd = pIter + aURLs.getLength();
- for(;pIter != pEnd;++pIter)
+ for (auto& url : aDriverConfig.getURLs())
{
FeatureSupport aInit( AuthNone );
- const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(*pIter);
- if ( aMetaData.has("Authentication") )
+ const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(url);
+ if ( aMetaData.has(u"Authentication"_ustr) )
{
OUString sAuth;
- aMetaData.get("Authentication") >>= sAuth;
+ aMetaData.get(u"Authentication"_ustr) >>= sAuth;
if ( sAuth == "UserPassword" )
aInit = FeatureSupport(AuthUserPwd);
else if ( sAuth == "Password" )
aInit = FeatureSupport(AuthPwd);
}
- tmp.insert(std::make_pair(*pIter,aInit));
+ tmp.insert(std::make_pair(url, aInit));
}
return tmp;
}();
@@ -148,26 +137,9 @@ namespace dbaui
return s_aSupport[ _sURL ].eAuthentication;
}
- // DataSourceMetaData_Impl
- class DataSourceMetaData_Impl
- {
- public:
- explicit DataSourceMetaData_Impl(const OUString& rURL);
-
- const OUString& getType() const { return m_sURL; }
-
- private:
- const OUString m_sURL;
- };
-
- DataSourceMetaData_Impl::DataSourceMetaData_Impl( const OUString& _sURL )
- :m_sURL( _sURL )
- {
- }
-
// DataSourceMetaData
DataSourceMetaData::DataSourceMetaData( const OUString& _sURL )
- :m_pImpl( std::make_shared<DataSourceMetaData_Impl>( _sURL ) )
+ :m_sURL( _sURL )
{
}
@@ -177,7 +149,7 @@ namespace dbaui
const FeatureSet& DataSourceMetaData::getFeatureSet() const
{
- return lcl_getFeatureSet( m_pImpl->getType() );
+ return lcl_getFeatureSet( m_sURL );
}
AuthenticationMode DataSourceMetaData::getAuthentication( const OUString& _sURL )
diff --git a/dbaccess/source/ui/misc/imageprovider.cxx b/dbaccess/source/ui/misc/imageprovider.cxx
index 585b87bc9294..6cba1b80ca30 100644
--- a/dbaccess/source/ui/misc/imageprovider.cxx
+++ b/dbaccess/source/ui/misc/imageprovider.cxx
@@ -25,7 +25,7 @@
#include <com/sun/star/sdb/application/DatabaseObject.hpp>
#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
namespace dbaui
{
@@ -43,26 +43,16 @@ namespace dbaui
namespace GraphicColorMode = css::graphic::GraphicColorMode;
namespace DatabaseObject = css::sdb::application::DatabaseObject;
- // ImageProvider_Data
- struct ImageProvider_Data
- {
- /// the connection we work with
- Reference< XConnection > xConnection;
- /// the views of the connection, if the DB supports views
- Reference< XNameAccess > xViews;
- /// interface for providing table's UI
- Reference< XTableUIProvider > xTableUI;
- };
-
namespace
{
- void lcl_getConnectionProvidedTableIcon_nothrow( const ImageProvider_Data& _rData,
+ void lcl_getConnectionProvidedTableIcon_nothrow(
+ const css::uno::Reference< css::sdb::application::XTableUIProvider >& _xTableUI,
const OUString& _rName, Reference< XGraphic >& _out_rxGraphic )
{
try
{
- if ( _rData.xTableUI.is() )
- _out_rxGraphic = _rData.xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL );
+ if ( _xTableUI.is() )
+ _out_rxGraphic = _xTableUI->getTableIcon( _rName, GraphicColorMode::NORMAL );
}
catch( const Exception& )
{
@@ -70,13 +60,15 @@ namespace dbaui
}
}
- void lcl_getTableImageResourceID_nothrow( const ImageProvider_Data& _rData, const OUString& _rName,
+ void lcl_getTableImageResourceID_nothrow(
+ const css::uno::Reference< css::container::XNameAccess >& _xViews,
+ const OUString& _rName,
OUString& _out_rResourceID)
{
_out_rResourceID = OUString();
try
{
- bool bIsView = _rData.xViews.is() && _rData.xViews->hasByName( _rName );
+ bool bIsView = _xViews.is() && _xViews->hasByName( _rName );
if ( bIsView )
{
_out_rResourceID = VIEW_TREE_ICON;
@@ -94,21 +86,19 @@ namespace dbaui
}
// ImageProvider
ImageProvider::ImageProvider()
- :m_pData( std::make_shared<ImageProvider_Data>() )
{
}
ImageProvider::ImageProvider( const Reference< XConnection >& _rxConnection )
- :m_pData( std::make_shared<ImageProvider_Data>() )
+ : mxConnection(_rxConnection)
{
- m_pData->xConnection = _rxConnection;
try
{
- Reference< XViewsSupplier > xSuppViews( m_pData->xConnection, UNO_QUERY );
+ Reference< XViewsSupplier > xSuppViews( mxConnection, UNO_QUERY );
if ( xSuppViews.is() )
- m_pData->xViews.set( xSuppViews->getViews(), UNO_SET_THROW );
+ mxViews.set( xSuppViews->getViews(), UNO_SET_THROW );
- m_pData->xTableUI.set( _rxConnection, UNO_QUERY );
+ mxTableUI.set( _rxConnection, UNO_QUERY );
}
catch( const Exception& )
{
@@ -116,33 +106,6 @@ namespace dbaui
}
}
- void ImageProvider::getImages( const OUString& _rName, const sal_Int32 _nDatabaseObjectType, Image& _out_rImage )
- {
- if ( _nDatabaseObjectType != DatabaseObject::TABLE )
- {
- // for types other than tables, the icon does not depend on the concrete object
- _out_rImage = getDefaultImage( _nDatabaseObjectType );
- }
- else
- {
- // check whether the connection can give us an icon
- Reference< XGraphic > xGraphic;
- lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic );
- if ( xGraphic.is() )
- _out_rImage = Image( xGraphic );
-
- if ( !_out_rImage )
- {
- // no -> determine by type
- OUString sImageResourceID;
- lcl_getTableImageResourceID_nothrow( *m_pData, _rName, sImageResourceID );
-
- if (!sImageResourceID.isEmpty() && !_out_rImage)
- _out_rImage = Image(StockImage::Yes, sImageResourceID);
- }
- }
- }
-
OUString ImageProvider::getImageId(const OUString& _rName, const sal_Int32 _nDatabaseObjectType)
{
if (_nDatabaseObjectType != DatabaseObject::TABLE)
@@ -154,7 +117,7 @@ namespace dbaui
{
// no -> determine by type
OUString sImageResourceID;
- lcl_getTableImageResourceID_nothrow( *m_pData, _rName, sImageResourceID );
+ lcl_getTableImageResourceID_nothrow( mxViews, _rName, sImageResourceID );
return sImageResourceID;
}
}
@@ -165,20 +128,11 @@ namespace dbaui
if (_nDatabaseObjectType == DatabaseObject::TABLE)
{
// check whether the connection can give us an icon
- lcl_getConnectionProvidedTableIcon_nothrow( *m_pData, _rName, xGraphic );
+ lcl_getConnectionProvidedTableIcon_nothrow( mxTableUI, _rName, xGraphic );
}
return xGraphic;
}
- Image ImageProvider::getDefaultImage( sal_Int32 _nDatabaseObjectType )
- {
- Image aObjectImage;
- OUString sImageResourceID( getDefaultImageResourceID( _nDatabaseObjectType) );
- if (!sImageResourceID.isEmpty())
- aObjectImage = Image(StockImage::Yes, sImageResourceID);
- return aObjectImage;
- }
-
OUString ImageProvider::getDefaultImageResourceID( sal_Int32 _nDatabaseObjectType)
{
OUString sImageResourceID;
@@ -228,7 +182,7 @@ namespace dbaui
return sImageResourceID;
}
- OUString ImageProvider::getDatabaseImage()
+ const OUString & ImageProvider::getDatabaseImage()
{
return DATABASE_TREE_ICON;
}
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index 8a5448e623f9..f61c68452be8 100644
--- a/dbaccess/source/ui/misc/indexcollection.cxx
+++ b/dbaccess/source/ui/misc/indexcollection.cxx
@@ -18,7 +18,7 @@
*/
#include <indexcollection.hxx>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbcx/XAppend.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -122,10 +122,10 @@ namespace dbaui
}
// set the properties
- static constexpr OUStringLiteral s_sNamePropertyName = u"Name";
+ static constexpr OUString s_sNamePropertyName = u"Name"_ustr;
// the index' own props
- xIndexDescriptor->setPropertyValue("IsUnique", css::uno::makeAny(_rPos->bUnique));
- xIndexDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(_rPos->sName));
+ xIndexDescriptor->setPropertyValue(u"IsUnique"_ustr, css::uno::Any(_rPos->bUnique));
+ xIndexDescriptor->setPropertyValue(s_sNamePropertyName, Any(_rPos->sName));
// the fields
for (auto const& field : _rPos->aFields)
@@ -136,8 +136,8 @@ namespace dbaui
OSL_ENSURE(xColDescriptor.is(), "OIndexCollection::commitNewIndex: invalid column descriptor!");
if (xColDescriptor.is())
{
- xColDescriptor->setPropertyValue("IsAscending", css::uno::makeAny(field.bSortAscending));
- xColDescriptor->setPropertyValue(s_sNamePropertyName, makeAny(field.sFieldName));
+ xColDescriptor->setPropertyValue(u"IsAscending"_ustr, css::uno::Any(field.bSortAscending));
+ xColDescriptor->setPropertyValue(s_sNamePropertyName, Any(field.sFieldName));
xAppendCols->appendByDescriptor(xColDescriptor);
}
}
@@ -219,9 +219,9 @@ namespace dbaui
void OIndexCollection::implFillIndexInfo(OIndex& _rIndex, const Reference< XPropertySet >& _rxDescriptor)
{
- _rIndex.bPrimaryKey = ::cppu::any2bool(_rxDescriptor->getPropertyValue("IsPrimaryKeyIndex"));
- _rIndex.bUnique = ::cppu::any2bool(_rxDescriptor->getPropertyValue("IsUnique"));
- _rxDescriptor->getPropertyValue("Catalog") >>= _rIndex.sDescription;
+ _rIndex.bPrimaryKey = ::cppu::any2bool(_rxDescriptor->getPropertyValue(u"IsPrimaryKeyIndex"_ustr));
+ _rIndex.bUnique = ::cppu::any2bool(_rxDescriptor->getPropertyValue(u"IsUnique"_ustr));
+ _rxDescriptor->getPropertyValue(u"Catalog"_ustr) >>= _rIndex.sDescription;
// the columns
Reference< XColumnsSupplier > xSuppCols(_rxDescriptor, UNO_QUERY);
@@ -233,32 +233,25 @@ namespace dbaui
return;
Sequence< OUString > aFieldNames = xCols->getElementNames();
- _rIndex.aFields.resize(aFieldNames.getLength());
+ _rIndex.aFields.clear();
+ _rIndex.aFields.reserve(aFieldNames.getLength());
- const OUString* pFieldNames = aFieldNames.getConstArray();
- const OUString* pFieldNamesEnd = pFieldNames + aFieldNames.getLength();
- IndexFields::iterator aCopyTo = _rIndex.aFields.begin();
-
- Reference< XPropertySet > xIndexColumn;
- for (;pFieldNames < pFieldNamesEnd; ++pFieldNames, ++aCopyTo)
+ for (auto& fieldName : aFieldNames)
{
// extract the column
- xIndexColumn.clear();
- xCols->getByName(*pFieldNames) >>= xIndexColumn;
+ Reference<XPropertySet> xIndexColumn;
+ xCols->getByName(fieldName) >>= xIndexColumn;
if (!xIndexColumn.is())
{
OSL_FAIL("OIndexCollection::implFillIndexInfo: invalid index column!");
- --aCopyTo;
continue;
}
// get the relevant properties
- aCopyTo->sFieldName = *pFieldNames;
- aCopyTo->bSortAscending = ::cppu::any2bool(xIndexColumn->getPropertyValue("IsAscending"));
+ _rIndex.aFields.push_back({ .sFieldName = fieldName,
+ .bSortAscending = cppu::any2bool(
+ xIndexColumn->getPropertyValue(u"IsAscending"_ustr)) });
}
-
- _rIndex.aFields.resize(aCopyTo - _rIndex.aFields.begin());
- // (just in case some fields were invalid ...)
}
void OIndexCollection::resetIndex(const Indexes::iterator& _rPos)
@@ -302,14 +295,11 @@ namespace dbaui
return;
// loop through all the indexes
- Sequence< OUString > aNames = m_xIndexes->getElementNames();
- const OUString* pNames = aNames.getConstArray();
- const OUString* pEnd = pNames + aNames.getLength();
- for (; pNames < pEnd; ++pNames)
+ for (auto& name : m_xIndexes->getElementNames())
{
// extract the index object
Reference< XPropertySet > xIndex;
- m_xIndexes->getByName(*pNames) >>= xIndex;
+ m_xIndexes->getByName(name) >>= xIndex;
if (!xIndex.is())
{
OSL_FAIL("OIndexCollection::implConstructFrom: got an invalid index object ... ignoring!");
@@ -317,8 +307,8 @@ namespace dbaui
}
// fill the OIndex structure
- OIndex aCurrentIndex(*pNames);
- implFillIndexInfo(aCurrentIndex);
+ OIndex aCurrentIndex(name);
+ implFillIndexInfo(aCurrentIndex, xIndex);
m_aIndexes.push_back(aCurrentIndex);
}
}
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 13effe4ccd93..03b44d955de2 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -20,7 +20,7 @@
#include <core_resource.hxx>
#include <linkeddocuments.hxx>
#include <osl/diagnose.h>
-#include <tools/diagnose_ex.h>
+#include <comphelper/diagnose_ex.hxx>
#include <unotools/confignode.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/namedvaluecollection.hxx>
@@ -38,6 +38,7 @@
#include <browserids.hxx>
#include <com/sun/star/container/XHierarchicalNameContainer.hpp>
#include <comphelper/mimeconfighelper.hxx>
+#include <utility>
#include <vcl/weld.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -51,13 +52,10 @@ namespace dbaui
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::frame;
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::util;
using namespace ::com::sun::star::ucb;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb::application;
using namespace ::com::sun::star::task;
- using namespace ::svt;
namespace
{
@@ -65,24 +63,22 @@ namespace dbaui
sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 )
{
- Sequence< sal_Int8 > aResult( 16 );
- aResult[0] = static_cast<sal_Int8>(n1 >> 24);
- aResult[1] = static_cast<sal_Int8>(( n1 << 8 ) >> 24);
- aResult[2] = static_cast<sal_Int8>(( n1 << 16 ) >> 24);
- aResult[3] = static_cast<sal_Int8>(( n1 << 24 ) >> 24);
- aResult[4] = static_cast<sal_Int8>(n2 >> 8);
- aResult[5] = static_cast<sal_Int8>(( n2 << 8 ) >> 8);
- aResult[6] = static_cast<sal_Int8>(n3 >> 8);
- aResult[7] = static_cast<sal_Int8>(( n3 << 8 ) >> 8);
- aResult[8] = b8;
- aResult[9] = b9;
- aResult[10] = b10;
- aResult[11] = b11;
- aResult[12] = b12;
- aResult[13] = b13;
- aResult[14] = b14;
- aResult[15] = b15;
-
+ Sequence< sal_Int8 > aResult{ /* [ 0] */ static_cast<sal_Int8>(n1 >> 24),
+ /* [ 1] */ static_cast<sal_Int8>(( n1 << 8 ) >> 24),
+ /* [ 2] */ static_cast<sal_Int8>(( n1 << 16 ) >> 24),
+ /* [ 3] */ static_cast<sal_Int8>(( n1 << 24 ) >> 24),
+ /* [ 4] */ static_cast<sal_Int8>(n2 >> 8),
+ /* [ 5] */ static_cast<sal_Int8>(( n2 << 8 ) >> 8),
+ /* [ 6] */ static_cast<sal_Int8>(n3 >> 8),
+ /* [ 7] */ static_cast<sal_Int8>(( n3 << 8 ) >> 8),
+ /* [ 8] */ static_cast<sal_Int8>(b8),
+ /* [ 9] */ static_cast<sal_Int8>(b9),
+ /* [10] */ static_cast<sal_Int8>(b10),
+ /* [11] */ static_cast<sal_Int8>(b11),
+ /* [12] */ static_cast<sal_Int8>(b12),
+ /* [13] */ static_cast<sal_Int8>(b13),
+ /* [14] */ static_cast<sal_Int8>(b14),
+ /* [15] */ static_cast<sal_Int8>(b15) };
return aResult;
}
}
@@ -90,13 +86,13 @@ namespace dbaui
// OLinkedDocumentsAccess
OLinkedDocumentsAccess::OLinkedDocumentsAccess( weld::Window* pDialogParent, const Reference< XDatabaseDocumentUI >& i_rDocumentUI,
const Reference< XComponentContext >& _rxContext, const Reference< XNameAccess >& _rxContainer,
- const Reference< XConnection>& _xConnection, const OUString& _sDataSourceName )
+ const Reference< XConnection>& _xConnection, OUString _sDataSourceName )
:m_xContext(_rxContext)
,m_xDocumentContainer(_rxContainer)
,m_xConnection(_xConnection)
,m_xDocumentUI( i_rDocumentUI )
,m_pDialogParent(pDialogParent)
- ,m_sDataSourceName(_sDataSourceName)
+ ,m_sDataSourceName(std::move(_sDataSourceName))
{
OSL_ENSURE(m_xContext.is(), "OLinkedDocumentsAccess::OLinkedDocumentsAccess: invalid service factory!");
assert(m_pDialogParent && "OLinkedDocumentsAccess::OLinkedDocumentsAccess: really need a dialog parent!");
@@ -119,15 +115,15 @@ namespace dbaui
OUString sOpenMode;
switch ( _eOpenMode )
{
- case E_OPEN_NORMAL:
+ case ElementOpenMode::Normal:
sOpenMode = "open";
break;
- case E_OPEN_FOR_MAIL:
- aArguments.put( "Hidden", true );
+ case ElementOpenMode::Mail:
+ aArguments.put( u"Hidden"_ustr, true );
[[fallthrough]];
- case E_OPEN_DESIGN:
+ case ElementOpenMode::Design:
sOpenMode = "openDesign";
break;
@@ -135,9 +131,9 @@ namespace dbaui
OSL_FAIL( "OLinkedDocumentsAccess::implOpen: invalid open mode!" );
break;
}
- aArguments.put( "OpenMode", sOpenMode );
+ aArguments.put( u"OpenMode"_ustr, sOpenMode );
- aArguments.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection );
+ aArguments.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection );
Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY);
if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) )
@@ -157,18 +153,18 @@ namespace dbaui
try
{
::comphelper::NamedValueCollection aArgs;
- aArgs.put( "DataSourceName", m_sDataSourceName );
+ aArgs.put( u"DataSourceName"_ustr, m_sDataSourceName );
if ( m_xConnection.is() )
- aArgs.put( "ActiveConnection", m_xConnection );
+ aArgs.put( u"ActiveConnection"_ustr, m_xConnection );
if ( !_rObjectName.isEmpty() && ( _nCommandType != -1 ) )
{
- aArgs.put( "CommandType", _nCommandType );
- aArgs.put( "Command", _rObjectName );
+ aArgs.put( u"CommandType"_ustr, _nCommandType );
+ aArgs.put( u"Command"_ustr, _rObjectName );
}
- aArgs.put( "DocumentUI", m_xDocumentUI );
+ aArgs.put( u"DocumentUI"_ustr, m_xDocumentUI );
Reference< XJobExecutor > xWizard;
{
@@ -180,7 +176,7 @@ namespace dbaui
), UNO_QUERY_THROW );
}
- xWizard->trigger( "start" );
+ xWizard->trigger( u"start"_ustr );
::comphelper::disposeComponent( xWizard );
}
catch(const Exception&)
@@ -211,9 +207,9 @@ namespace dbaui
OSL_ENSURE(m_xDocumentContainer.is(), "OLinkedDocumentsAccess::newDocument: invalid document container!");
// determine the class ID to use for the new document
Sequence<sal_Int8> aClassId;
- if ( !i_rCreationArgs.has( "ClassID" )
- && !i_rCreationArgs.has( "MediaType" )
- && !i_rCreationArgs.has( "DocumentServiceName" )
+ if ( !i_rCreationArgs.has( u"ClassID"_ustr )
+ && !i_rCreationArgs.has( u"MediaType"_ustr )
+ && !i_rCreationArgs.has( u"DocumentServiceName"_ustr )
)
{
switch ( i_nActionID )
@@ -252,15 +248,15 @@ namespace dbaui
{
::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs );
if ( aClassId.hasElements() )
- aCreationArgs.put( "ClassID", aClassId );
- aCreationArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection );
+ aCreationArgs.put( u"ClassID"_ustr, aClassId );
+ aCreationArgs.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection );
// separate values which are real creation args from args relevant for opening the doc
::comphelper::NamedValueCollection aCommandArgs;
- if ( aCreationArgs.has( "Hidden" ) )
+ if ( aCreationArgs.has( u"Hidden"_ustr ) )
{
- aCommandArgs.put( "Hidden", aCreationArgs.get( "Hidden" ) );
- aCreationArgs.remove( "Hidden" );
+ aCommandArgs.put( u"Hidden"_ustr, aCreationArgs.get( u"Hidden"_ustr ) );
+ aCreationArgs.remove( u"Hidden"_ustr );
}
Reference< XCommandProcessor > xContent( xORB->createInstanceWithArguments(
@@ -274,7 +270,7 @@ namespace dbaui
// put the OpenMode into the OpenArgs
OpenCommandArgument aOpenModeArg;
aOpenModeArg.Mode = OpenMode::DOCUMENT;
- aCommandArgs.put( "OpenMode", aOpenModeArg );
+ aCommandArgs.put( u"OpenMode"_ustr, aOpenModeArg );
Command aCommand;
aCommand.Name = "openDesign";
@@ -304,16 +300,13 @@ namespace dbaui
OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC);
sMessage = sMessage.replaceFirst("$file$",_rLinkName);
- css::sdbc::SQLException aSQLException;
- aSQLException.Message = sMessage;
+ css::sdbc::SQLException aSQLException(sMessage, {}, {}, 0, {});
aInfo = dbtools::SQLExceptionInfo(aSQLException);
}
}
catch(const css::io::WrongFormatException &e)
{
- css::sdbc::SQLException aSQLException;
- aSQLException.Message = e.Message;
- aSQLException.Context = e.Context;
+ css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {});
aInfo = dbtools::SQLExceptionInfo(aSQLException);
// more like a hack, insert an empty message
@@ -331,13 +324,11 @@ namespace dbaui
css::sdbc::SQLException a;
if ( !(aAny >>= a) || (a.ErrorCode != dbtools::ParameterInteractionCancelled) )
{
- css::sdbc::SQLException aSQLException;
- aSQLException.Message = e.Message;
- aSQLException.Context = e.Context;
+ css::sdbc::SQLException aSQLException(e.Message, e.Context, {}, 0, {});
aInfo = dbtools::SQLExceptionInfo(aSQLException);
// more like a hack, insert an empty message
- aInfo.prepend(" \n");
+ aInfo.prepend(u" \n"_ustr);
OUString sMessage = DBA_RES(STR_COULDNOTOPEN_LINKEDDOC);
sMessage = sMessage.replaceFirst("$file$",_rLinkName);
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index c07da46c955f..6f58676629d0 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -35,22 +35,10 @@ namespace dbaui
using ::com::sun::star::document::XUndoManager;
using ::com::sun::star::beans::PropertyValue;
- // OSingleDocumentController_Data
- struct OSingleDocumentController_Data
- {
- // no Reference! see UndoManager::acquire
- std::unique_ptr<UndoManager> m_pUndoManager;
-
- OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
- : m_pUndoManager(new UndoManager(i_parent, i_mutex))
- {
- }
- };
-
// OSingleDocumentController
OSingleDocumentController::OSingleDocumentController( const Reference< XComponentContext >& _rxORB )
:OSingleDocumentController_Base( _rxORB )
- ,m_pData( new OSingleDocumentController_Data( *this, getMutex() ) )
+ ,m_pUndoManager(new UndoManager(*this, getMutex()))
{
}
@@ -62,7 +50,7 @@ namespace dbaui
{
OSingleDocumentController_Base::disposing();
ClearUndoManager();
- m_pData->m_pUndoManager->disposing();
+ m_pUndoManager->disposing();
}
void OSingleDocumentController::ClearUndoManager()
@@ -72,7 +60,7 @@ namespace dbaui
SfxUndoManager& OSingleDocumentController::GetUndoManager() const
{
- return m_pData->m_pUndoManager->GetSfxUndoManager();
+ return m_pUndoManager->GetSfxUndoManager();
}
void OSingleDocumentController::addUndoActionAndInvalidate(std::unique_ptr<SfxUndoAction> _pAction)
@@ -91,7 +79,7 @@ namespace dbaui
Reference< XUndoManager > SAL_CALL OSingleDocumentController::getUndoManager( )
{
// see UndoManager::acquire
- return m_pData->m_pUndoManager.get();
+ return m_pUndoManager.get();
}
FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const
@@ -123,8 +111,9 @@ namespace dbaui
{
size_t nCount(GetUndoManager().GetUndoActionCount());
Sequence<OUString> aSeq(nCount);
+ auto aSeqRange = asNonConstRange(aSeq);
for (size_t n = 0; n < nCount; ++n)
- aSeq[n] = GetUndoManager().GetUndoActionComment(n);
+ aSeqRange[n] = GetUndoManager().GetUndoActionComment(n);
aReturn.aValue <<= aSeq;
aReturn.bEnabled = true;
break;
@@ -134,8 +123,9 @@ namespace dbaui
{
size_t nCount(GetUndoManager().GetRedoActionCount());
Sequence<OUString> aSeq(nCount);
+ auto aSeqRange = asNonConstRange(aSeq);
for (size_t n = 0; n < nCount; ++n)
- aSeq[n] = GetUndoManager().GetRedoActionComment(n);
+ aSeqRange[n] = GetUndoManager().GetRedoActionComment(n);
aReturn.aValue <<= aSeq;
aReturn.bEnabled = true;
break;