summaryrefslogtreecommitdiffstats
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.cxx21
-rw-r--r--dbaccess/source/ui/misc/HtmlReader.cxx4
-rw-r--r--dbaccess/source/ui/misc/RowSetDrop.cxx21
-rw-r--r--dbaccess/source/ui/misc/TableCopyHelper.cxx43
-rw-r--r--dbaccess/source/ui/misc/TokenWriter.cxx253
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx204
-rw-r--r--dbaccess/source/ui/misc/WCPage.cxx5
-rw-r--r--dbaccess/source/ui/misc/WColumnSelect.cxx23
-rw-r--r--dbaccess/source/ui/misc/WCopyTable.cxx87
-rw-r--r--dbaccess/source/ui/misc/WNameMatch.cxx8
-rw-r--r--dbaccess/source/ui/misc/WTypeSelect.cxx22
-rw-r--r--dbaccess/source/ui/misc/asyncmodaldialog.cxx2
-rw-r--r--dbaccess/source/ui/misc/charsets.cxx11
-rw-r--r--dbaccess/source/ui/misc/controllerframe.cxx3
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx31
-rw-r--r--dbaccess/source/ui/misc/datasourceconnector.cxx19
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx19
-rw-r--r--dbaccess/source/ui/misc/defaultobjectnamecheck.cxx44
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx31
-rw-r--r--dbaccess/source/ui/misc/imageprovider.cxx40
-rw-r--r--dbaccess/source/ui/misc/indexcollection.cxx46
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx27
-rw-r--r--dbaccess/source/ui/misc/singledoccontroller.cxx20
23 files changed, 437 insertions, 547 deletions
diff --git a/dbaccess/source/ui/misc/DExport.cxx b/dbaccess/source/ui/misc/DExport.cxx
index 72838e83cabf..fa618fb11b32 100644
--- a/dbaccess/source/ui/misc/DExport.cxx
+++ b/dbaccess/source/ui/misc/DExport.cxx
@@ -40,7 +40,7 @@
#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>
@@ -655,16 +655,16 @@ 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,
ODatabaseExport::TColumns(m_aDestColumns),
m_vDestVector,
@@ -689,7 +689,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);
}
@@ -778,7 +778,7 @@ void ODatabaseExport::ensureFormatter()
}
}
-Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const Reference<XDatabaseMetaData>& _xMetaData
+Reference< XPreparedStatement > ODatabaseExport::createPreparedStatement( const Reference<XDatabaseMetaData>& _xMetaData
,const Reference<XPropertySet>& _xDestTable
,const TPositions& _rvColumns)
{
@@ -803,9 +803,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
{
return Reference< XPreparedStatement > ();
}
- const OUString* pIter = aDestColumnNames.getConstArray();
- std::vector< OUString> aInsertList;
- aInsertList.resize(aDestColumnNames.getLength()+1);
+ std::vector<OUString> aInsertList(aDestColumnNames.getLength() + 1);
for(size_t j=0; j < aInsertList.size(); ++j)
{
ODatabaseExport::TPositions::const_iterator aFind = std::find_if(_rvColumns.begin(),_rvColumns.end(),
@@ -814,7 +812,7 @@ Reference< XPreparedStatement > ODatabaseExport::createPreparedStatment( const R
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));
+ aInsertList[aFind->first] = ::dbtools::quoteName(aQuote, aDestColumnNames[j]);
}
}
@@ -823,8 +821,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 56eade49356d..c2917a6300e0 100644
--- a/dbaccess/source/ui/misc/HtmlReader.cxx
+++ b/dbaccess/source/ui/misc/HtmlReader.cxx
@@ -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..a7dd0e817cfc 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,
@@ -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/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index a51e1a124f51..5d22c90468c8 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()));
@@ -182,16 +180,15 @@ void OTableCopyHelper::pasteTable( SotClipboardFormatId _nFormatId
try
{
DropDescriptor aTrans;
- bool bOk;
if ( _nFormatId != SotClipboardFormatId::RTF )
- bOk = _rTransData.GetSotStorageStream(SotClipboardFormatId::HTML ,aTrans.aHtmlRtfStorage);
+ aTrans.aHtmlRtfStorage = _rTransData.GetSotStorageStream(SotClipboardFormatId::HTML);
else
- bOk = _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) )
+ if ( !aTrans.aHtmlRtfStorage || !copyTagTable(aTrans,false,_xConnection) )
m_pController->showError(SQLException(DBA_RES(STR_NO_TABLE_FORMAT_INSIDE), *m_pController, "S1000", 0, Any()));
}
catch(const SQLException&)
@@ -256,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 = _aDroppedData.GetSotStorageStream(SotClipboardFormatId::HTML ,_rAsyncDrop.aHtmlRtfStorage);
- else
- bOk = _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;
@@ -286,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;
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 7b2ff6d8f6f7..fb25922e6804 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>
@@ -94,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)
@@ -134,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 )
@@ -259,9 +262,9 @@ void ODatabaseImportExport::initialize()
{
m_xResultSet.set( m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.sdb.RowSet", 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();
}
@@ -318,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 );
@@ -342,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;
@@ -391,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]);
@@ -410,11 +412,10 @@ bool ORTFImportExport::Write()
sColumnName = m_xResultSetMetaData->getColumnName(i);
else
{
- sColumnName = *pIter;
+ sColumnName = aNames[i];
Reference<XPropertySet> xColumn;
xColumns->getByName(sColumnName) >>= xColumn;
xColumn->getPropertyValue(PROPERTY_ALIGN) >>= nAlign;
- ++pIter;
}
const char* pChar;
@@ -428,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
@@ -486,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);
}
@@ -494,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 );
@@ -514,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
{
@@ -541,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;
}
@@ -579,7 +577,7 @@ OHTMLImportExport::OHTMLImportExport(const svx::ODataAccessDescriptor& _aDataDes
#endif
{
// set HTML configuration
- m_eDestEnc = SvxHtmlOptions::GetTextEncoding();
+ m_eDestEnc = RTL_TEXTENCODING_UTF8;
strncpy( sIndent, sIndentSource ,std::min(sizeof(sIndent),sizeof(sIndentSource)));
sIndent[0] = 0;
}
@@ -589,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_doctype5 ).WriteChar( '>' ).WriteCharPtr( SAL_NEWLINE_STRING ).WriteCharPtr( SAL_NEWLINE_STRING );
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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();
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteBody();
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_html, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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);
}
@@ -627,52 +625,52 @@ void OHTMLImportExport::WriteHeader()
}
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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() );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ xDocProps, sIndent );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(-1);
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_head, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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( "<!-- " );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- 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( '}' );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- m_pStream->WriteCharPtr( " -->" );
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
+ m_pStream->WriteOString( " -->" );
IncIndent(-1);
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_style, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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( '>' );
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
WriteTables();
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_body, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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;
@@ -719,7 +717,7 @@ void OHTMLImportExport::WriteTables()
"=1";
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut.getStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrOut);
FontOn();
@@ -732,14 +730,14 @@ void OHTMLImportExport::WriteTables()
HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_caption, false);
FontOff();
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
// </FONT>
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
IncIndent(1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
if(m_xObject.is())
{
@@ -752,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;
@@ -763,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));
@@ -779,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);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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())
@@ -821,24 +814,24 @@ void OHTMLImportExport::WriteTables()
}
WriteCell(pFormat[i-1],pColWidth[i-1],nHeight,pHorJustify[i-1],aValue,OOO_STRING_SVTOOLS_HTML_tabledata);
}
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
}
else
{
IncIndent(-1);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tablerow, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_thead, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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);
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
IncIndent(-1);
- m_pStream->WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_tbody, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ 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,
@@ -883,7 +876,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
}
}
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD.getStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, aStrTD);
FontOn();
@@ -900,7 +893,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
if ( rValue.isEmpty() )
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 ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_strike, false);
if ( bUnderline ) HTMLOutFuncs::Out_AsciiTag(*m_pStream, OOO_STRING_SVTOOLS_HTML_underline, false);
@@ -909,7 +902,7 @@ void OHTMLImportExport::WriteCell( sal_Int32 nFormat, sal_Int32 nWidthPixel, sal
FontOff();
- HTMLOutFuncs::Out_AsciiTag(*m_pStream, pHtmlTag, false).WriteCharPtr(SAL_NEWLINE_STRING).WriteCharPtr(GetIndentStr());
+ HTMLOutFuncs::Out_AsciiTag(*m_pStream, pHtmlTag, false).WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
}
void OHTMLImportExport::FontOn()
@@ -938,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()
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index fca7026cf9e2..b8efb2fb60c0 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -83,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>
@@ -106,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;
@@ -395,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)
{
@@ -489,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);
@@ -610,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)
@@ -739,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::mapTextAlign(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));
}
}
@@ -751,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,
@@ -761,32 +785,15 @@ 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_INFO, true },
- { SID_ATTR_NUMBERFORMAT_ONE_AREA, true }
- };
static const auto aAttrMap = svl::Items<
SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY,
SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO,
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 SvxNumberInfoItem(SID_ATTR_NUMBERFORMAT_INFO),
- new SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, false)
- };
-
- rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties", SBA_DEF_RANGEFORMAT, SBA_ATTR_ALIGN_HOR_JUSTIFY, aItemInfos, &pDefaults));
+ rtl::Reference<SfxItemPool> pPool(new SfxItemPool("GridBrowserProperties"));
+ pPool->registerItemInfoPackage(getItemInfoPackageColumnFormatDialog());
pPool->SetDefaultMetric( MapUnit::MapTwip ); // ripped, don't understand why
- pPool->FreezeIdRanges(); // the same
std::optional<SfxItemSet> pFormatDescriptor(SfxItemSet(*pPool, aAttrMap));
// fill it
@@ -852,8 +859,6 @@ bool callColumnFormatDialog(weld::Widget* _pParent,
pFormatDescriptor.reset();
pPool.clear();
- for (SfxPoolItem* pDefault : pDefaults)
- delete pDefault;
return bRet;
}
@@ -881,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)
{
@@ -907,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));
}
}
}
@@ -928,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 ) );
@@ -1046,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 ? pFallback : queryTypeInfoByType(DataType::VARCHAR, _rTypeInfo);
OSL_ENSURE(pTypeInfo,"checkColumns: can't find a type which is usable as a key!");
return pTypeInfo;
@@ -1203,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())
@@ -1323,11 +1339,11 @@ bool insertHierarchyElement(weld::Window* pParent, const Reference< XComponentCo
{"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 738c85124708..6176c19700ef 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;
@@ -106,8 +105,8 @@ IMPL_LINK(OCopyTable, RadioChangeHdl, weld::Toggleable&, rButton, void)
SetAppendDataRadio();
return;
}
- m_pParent->EnableNextButton(m_xRB_View->get_active());
- bool bKey = m_bPKeyAllowed && m_xRB_View->get_active();
+ 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);
diff --git a/dbaccess/source/ui/misc/WColumnSelect.cxx b/dbaccess/source/ui/misc/WColumnSelect.cxx
index 544b79d03267..28f4d50e4a81 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)
@@ -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 03458111fc73..756f60f857a1 100644
--- a/dbaccess/source/ui/misc/WCopyTable.cxx
+++ b/dbaccess/source/ui/misc/WCopyTable.cxx
@@ -53,9 +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;
@@ -133,7 +134,7 @@ 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)
+ PROPERTY_FONT, PROPERTY_ROW_HEIGHT, PROPERTY_TEXTCOLOR,PROPERTY_TEXTLINECOLOR,PROPERTY_TEXTEMPHASIS,PROPERTY_TEXTRELIEF
};
for (const auto & aCopyProperty : aCopyProperties)
{
@@ -167,7 +168,7 @@ void ObjectCopySource::copyFilterAndSortingTo( const Reference< XConnection >& _
{
sStatement.append(aProperty.second);
sFilter = sFilter.replaceFirst(sSourceName,sTargetNameTemp);
- _rxObject->setPropertyValue( aProperty.first, makeAny(sFilter) );
+ _rxObject->setPropertyValue( aProperty.first, Any(sFilter) );
sStatement.append(sFilter);
}
}
@@ -212,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 " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
+ aSQL.append( " FROM " + ::dbtools::composeTableNameForSelect( m_xConnection, m_xObject ) );
sSelectStatement = aSQL.makeStringAndClear();
}
@@ -250,10 +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_sTableName(std::move( _sTableName ))
{
::dbtools::qualifiedNameComponents( m_xMetaData, m_sTableName, m_sTableCatalog, m_sTableSchema, m_sTableBareName, ::dbtools::EComposeRule::Complete );
impl_ensureColumnInfo_throw();
@@ -269,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() );
@@ -341,7 +336,7 @@ 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() )
{
@@ -578,12 +573,12 @@ 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,
+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 )
@@ -598,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)
@@ -651,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, ';');
@@ -737,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);
@@ -842,9 +838,8 @@ 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 );
xRequest->addContinuation( new ::comphelper::OInteractionDisapprove );
@@ -992,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;
@@ -1026,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 );
@@ -1075,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;
@@ -1110,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())
@@ -1202,9 +1189,9 @@ Reference< XPropertySet > OCopyTableWizard::createTable()
}
}
- 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
@@ -1248,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() )
{
@@ -1270,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();
@@ -1359,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;
diff --git a/dbaccess/source/ui/misc/WNameMatch.cxx b/dbaccess/source/ui/misc/WNameMatch.cxx
index 75ff6e3372f1..a6bb59da8eea 100644
--- a/dbaccess/source/ui/misc/WNameMatch.cxx
+++ b/dbaccess/source/ui/misc/WNameMatch.cxx
@@ -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 6f3fbd79d22c..f27dcc921168 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);
}
@@ -205,7 +204,6 @@ 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"))
, m_xTypeControl(new OWizTypeSelectControl(m_xControlContainer.get(), this))
, m_xAutoType(m_xBuilder->weld_label("autotype"))
@@ -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;
}
@@ -374,7 +372,7 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
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.
@@ -390,13 +388,13 @@ IMPL_LINK(OWizTypeSelectList, CommandHdl, const CommandEvent&, rCEvt, bool)
if (bCheckOk)
xContextMenu->set_active("primarykey", true);
- OString sCommand(xContextMenu->popup_at_rect(m_xControl.get(), tools::Rectangle(rCEvt.GetMousePosPixel(), Size(1,1))));
+ 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)
{
- OFieldDescription* pFieldDescr = reinterpret_cast<OFieldDescription*>(m_xControl->get_id(j).toInt64());
+ OFieldDescription* pFieldDescr = weld::fromId<OFieldDescription*>(m_xControl->get_id(j));
if (pFieldDescr)
{
if(!bCheckOk && m_xControl->is_selected(j))
diff --git a/dbaccess/source/ui/misc/asyncmodaldialog.cxx b/dbaccess/source/ui/misc/asyncmodaldialog.cxx
index 3c59a58f8b85..8323d47dba6f 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
{
diff --git a/dbaccess/source/ui/misc/charsets.cxx b/dbaccess/source/ui/misc/charsets.cxx
index 546d21cb0859..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
{
@@ -61,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 );
@@ -86,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 3634a56eb7e3..365e144390c0 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;
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index e59622276433..47c3932ca21a 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,11 +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_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!" );
@@ -71,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,
@@ -159,7 +160,7 @@ namespace dbaui
// 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 )
{
}
@@ -188,7 +189,7 @@ namespace dbaui
// 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 )
{
}
@@ -242,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)
{
}
@@ -252,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( PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName );
i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false );
if ( m_bTable )
{
+ 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..a170d02963f9 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 ))
{
}
@@ -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;
}
}
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
index e736e365aea9..0d3676db5d80 100644
--- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -42,7 +42,7 @@
#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>
@@ -152,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 );
}
@@ -176,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 );
@@ -210,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();
}
@@ -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 286ce63aace2..f098a95900c9 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -28,7 +28,6 @@
namespace dbaui
{
- using namespace dbaccess;
using namespace ::com::sun::star;
namespace {
@@ -116,13 +115,10 @@ namespace dbaui
{
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);
+ const ::comphelper::NamedValueCollection& aMetaData = aDriverConfig.getMetaData(url);
if ( aMetaData.has("Authentication") )
{
OUString sAuth;
@@ -132,7 +128,7 @@ namespace dbaui
else if ( sAuth == "Password" )
aInit = FeatureSupport(AuthPwd);
}
- tmp.insert(std::make_pair(*pIter,aInit));
+ tmp.insert(std::make_pair(url, aInit));
}
return tmp;
}();
@@ -140,26 +136,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 )
{
}
@@ -169,7 +148,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 b69ec70e6a80..388df30e271f 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& )
{
@@ -127,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;
}
}
@@ -138,7 +128,7 @@ 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;
}
diff --git a/dbaccess/source/ui/misc/indexcollection.cxx b/dbaccess/source/ui/misc/indexcollection.cxx
index 8a5448e623f9..dd275b80fda4 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("IsUnique", 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("IsAscending", css::uno::Any(field.bSortAscending));
+ xColDescriptor->setPropertyValue(s_sNamePropertyName, Any(field.sFieldName));
xAppendCols->appendByDescriptor(xColDescriptor);
}
}
@@ -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("IsAscending")) });
}
-
- _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 192331ced226..d1f7fa6aa1a1 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
{
@@ -88,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!");
@@ -117,15 +115,15 @@ namespace dbaui
OUString sOpenMode;
switch ( _eOpenMode )
{
- case E_OPEN_NORMAL:
+ case ElementOpenMode::Normal:
sOpenMode = "open";
break;
- case E_OPEN_FOR_MAIL:
+ case ElementOpenMode::Mail:
aArguments.put( "Hidden", true );
[[fallthrough]];
- case E_OPEN_DESIGN:
+ case ElementOpenMode::Design:
sOpenMode = "openDesign";
break;
@@ -302,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
@@ -329,9 +324,7 @@ 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
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 28b0c9e774bd..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