diff options
Diffstat (limited to 'dbaccess/source/filter')
-rw-r--r-- | dbaccess/source/filter/hsqldb/fbcreateparser.cxx | 34 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/parseschema.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/filter/hsqldb/rowinputbinary.cxx | 66 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/dbloader2.cxx | 52 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlDataSourceInfo.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlDataSourceSetting.cxx | 34 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlDocuments.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlExport.cxx | 26 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlQuery.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/filter/xml/xmlfilter.cxx | 22 |
10 files changed, 122 insertions, 124 deletions
diff --git a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx index 5d4244f8085b..f19778f7439d 100644 --- a/dbaccess/source/filter/hsqldb/fbcreateparser.cxx +++ b/dbaccess/source/filter/hsqldb/fbcreateparser.cxx @@ -35,40 +35,40 @@ OUString lcl_DataTypetoFbTypeName(sal_Int32 eType) { case DataType::CHAR: case DataType::BINARY: - return "CHAR"; + return u"CHAR"_ustr; case DataType::VARCHAR: case DataType::VARBINARY: - return "VARCHAR"; + return u"VARCHAR"_ustr; case DataType::TINYINT: // no such type in Firebird case DataType::SMALLINT: - return "SMALLINT"; + return u"SMALLINT"_ustr; case DataType::INTEGER: - return "INTEGER"; + return u"INTEGER"_ustr; case DataType::BIGINT: - return "BIGINT"; + return u"BIGINT"_ustr; case DataType::NUMERIC: - return "NUMERIC"; + return u"NUMERIC"_ustr; case DataType::DECIMAL: - return "DECIMAL"; + return u"DECIMAL"_ustr; case DataType::BOOLEAN: - return "BOOLEAN"; + return u"BOOLEAN"_ustr; case DataType::LONGVARCHAR: case DataType::LONGVARBINARY: case DataType::CLOB: case DataType::BLOB: case DataType::OTHER: - return "BLOB"; + return u"BLOB"_ustr; case DataType::DATE: - return "DATE"; + return u"DATE"_ustr; case DataType::TIME: - return "TIME"; + return u"TIME"_ustr; case DataType::TIMESTAMP: - return "TIMESTAMP"; + return u"TIMESTAMP"_ustr; case DataType::DOUBLE: case DataType::REAL: - return "DOUBLE PRECISION"; + return u"DOUBLE PRECISION"_ustr; case DataType::FLOAT: - return "FLOAT"; + return u"FLOAT"_ustr; default: assert(false); return OUString(); @@ -83,12 +83,12 @@ OUString lcl_getTypeModifier(sal_Int32 eType) { case DataType::CLOB: case DataType::LONGVARCHAR: - return "SUB_TYPE 1"; + return u"SUB_TYPE 1"_ustr; case DataType::LONGVARBINARY: - return "SUB_TYPE -9546"; + return u"SUB_TYPE -9546"_ustr; case DataType::BINARY: case DataType::VARBINARY: - return "CHARACTER SET OCTETS"; + return u"CHARACTER SET OCTETS"_ustr; default: return OUString(); } diff --git a/dbaccess/source/filter/hsqldb/parseschema.cxx b/dbaccess/source/filter/hsqldb/parseschema.cxx index 5e512f067920..8dbeef741575 100644 --- a/dbaccess/source/filter/hsqldb/parseschema.cxx +++ b/dbaccess/source/filter/hsqldb/parseschema.cxx @@ -129,7 +129,7 @@ void SchemaParser::parseSchema() Reference<XComponentContext> rContext = comphelper::getProcessComponentContext(); Reference<XTextInputStream2> xTextInput = TextInputStream::create(rContext); - xTextInput->setEncoding("UTF-8"); + xTextInput->setEncoding(u"UTF-8"_ustr); xTextInput->setInputStream(xStream->getInputStream()); while (!xTextInput->isEOF()) diff --git a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx index 7aa11ed5f49c..c6d57a76b865 100644 --- a/dbaccess/source/filter/hsqldb/rowinputbinary.cxx +++ b/dbaccess/source/filter/hsqldb/rowinputbinary.cxx @@ -29,11 +29,12 @@ #include <com/sun/star/util/DateTime.hpp> #include <unotools/ucbstreamhelper.hxx> +#include <tools/datetime.hxx> +#include <tools/duration.hxx> #include <tools/stream.hxx> +#include <tools/time.hxx> #include <rtl/ustrbuf.hxx> -#include <boost/date_time/posix_time/posix_time.hpp> - namespace { /** @@ -115,18 +116,30 @@ OUString lcl_makeStringFromBigint(std::vector<sal_uInt8>&& aBytes) return sRet.makeStringAndClear(); } -OUString lcl_putDot(std::u16string_view sNum, sal_Int32 nScale) +OUString lcl_putDot(const OUString& sNum, sal_Int32 nScale) { // e.g. sNum = "0", nScale = 2 -> "0.00" + if (nScale <= 0) + return sNum; + OUStringBuffer sBuf{ sNum }; - sal_Int32 nNullsToAppend = nScale - sNum.size() + 1; + sal_Int32 nNullsToAppend = nScale - sNum.getLength() + 1; for (sal_Int32 i = 0; i < nNullsToAppend; ++i) sBuf.insert(0, "0"); - if (nScale > 0) - sBuf.insert(sBuf.getLength() - 1 - nScale, "."); + sBuf.insert(sBuf.getLength() - nScale, "."); return sBuf.makeStringAndClear(); } + +DateTime HsqlDateTime(sal_Int64 nanoseconds) +{ + const DateTime epoch(Date(1, 1, 1970)); + const bool negative = nanoseconds < 0; + tools::Duration duration(0, 0, 0, 0, negative ? -nanoseconds : nanoseconds); + if (negative) + duration = -duration; + return epoch + duration; +} } namespace dbahsql @@ -134,8 +147,6 @@ namespace dbahsql using namespace css::uno; using namespace css::sdbc; using namespace css::io; -using namespace boost::posix_time; -using namespace boost::gregorian; HsqlRowInputStream::HsqlRowInputStream() {} @@ -313,12 +324,8 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti { sal_Int64 value = 0; m_pStream->ReadInt64(value); // in millisec, from 1970 - ptime epoch = time_from_string("1970-01-01 00:00:00.000"); - ptime time = epoch + milliseconds(value); - date asDate = time.date(); - - css::util::Date loDate(asDate.day(), asDate.month(), - asDate.year()); // day, month, year + css::util::Date loDate( + HsqlDateTime(value * tools::Time::nanoPerMilli).GetUNODate()); aData.emplace_back(loDate); } break; @@ -326,18 +333,13 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti { sal_Int64 value = 0; m_pStream->ReadInt64(value); - auto valueInSecs = value / 1000; - /* Observed valueInSecs fall in the range from + /* Observed value fall in the range from negative one day to positive two days. Coerce - valueInSecs between zero and positive one day.*/ - const int secPerDay = 24 * 60 * 60; - valueInSecs = (valueInSecs + secPerDay) % secPerDay; - - auto nHours = valueInSecs / (60 * 60); - valueInSecs = valueInSecs % 3600; - const sal_uInt16 nMins = valueInSecs / 60; - const sal_uInt16 nSecs = valueInSecs % 60; - css::util::Time time((value % 1000) * 1000000, nSecs, nMins, nHours, true); + value between zero and positive one day.*/ + value = (value + tools::Time::milliSecPerDay) % tools::Time::milliSecPerDay; + tools::Duration duration(0, 0, 0, 0, value * tools::Time::nanoPerMilli); + + css::util::Time time(duration.GetTime().GetUNOTime()); aData.emplace_back(time); } break; @@ -345,22 +347,12 @@ std::vector<Any> HsqlRowInputStream::readOneRow(const std::vector<ColumnDefiniti { sal_Int64 nEpochMillis = 0; m_pStream->ReadInt64(nEpochMillis); - ptime epoch = time_from_string("1970-01-01 00:00:00.000"); - ptime time = epoch + milliseconds(nEpochMillis); - date asDate = time.date(); - sal_Int32 nNanos = 0; m_pStream->ReadInt32(nNanos); + DateTime result(HsqlDateTime(nEpochMillis * tools::Time::nanoPerMilli + nNanos)); // convert into LO internal representation of dateTime - css::util::DateTime dateTime; - dateTime.NanoSeconds = nNanos; - dateTime.Seconds = time.time_of_day().seconds(); - dateTime.Minutes = time.time_of_day().minutes(); - dateTime.Hours = time.time_of_day().hours(); - dateTime.Day = asDate.day(); - dateTime.Month = asDate.month(); - dateTime.Year = asDate.year(); + css::util::DateTime dateTime(result.GetUNODateTime()); aData.emplace_back(dateTime); } break; diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index 3942dab26801..2d722b8e8c9c 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -106,9 +106,9 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope { ::comphelper::NamedValueCollection aMedia( Descriptor ); bool bStreamFromDescr = false; - OUString sURL = aMedia.getOrDefault( "URL", OUString() ); + OUString sURL = aMedia.getOrDefault( u"URL"_ustr, OUString() ); - Reference< XInputStream > xInStream( aMedia.getOrDefault( "InputStream", Reference< XInputStream >() ) ); + Reference< XInputStream > xInStream( aMedia.getOrDefault( u"InputStream"_ustr, Reference< XInputStream >() ) ); Reference< XPropertySet > xStorageProperties; if ( xInStream.is() ) { @@ -118,7 +118,7 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope } else { - OUString sSalvagedURL( aMedia.getOrDefault( "SalvagedFile", OUString() ) ); + OUString sSalvagedURL( aMedia.getOrDefault( u"SalvagedFile"_ustr, OUString() ) ); OUString sFileLocation( sSalvagedURL.isEmpty() ? sURL : sSalvagedURL ); if ( !sFileLocation.isEmpty() ) @@ -138,8 +138,8 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope { // After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further // for now the file should be reopened to have read/write access - aMedia.remove( "InputStream" ); - aMedia.remove( "Stream" ); + aMedia.remove( u"InputStream"_ustr ); + aMedia.remove( u"Stream"_ustr ); aMedia >>= Descriptor; try { @@ -153,7 +153,7 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope } } - return "StarBase"; + return u"StarBase"_ustr; } ::comphelper::disposeComponent(xStorageProperties); } @@ -164,7 +164,7 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope // XServiceInfo OUString SAL_CALL DBTypeDetection::getImplementationName() { - return "org.openoffice.comp.dbflt.DBTypeDetection"; + return u"org.openoffice.comp.dbflt.DBTypeDetection"_ustr; } // XServiceInfo @@ -176,7 +176,7 @@ sal_Bool SAL_CALL DBTypeDetection::supportsService(const OUString& ServiceName) // XServiceInfo Sequence< OUString > SAL_CALL DBTypeDetection::getSupportedServiceNames() { - return { "com.sun.star.document.ExtendedTypeDetection" }; + return { u"com.sun.star.document.ExtendedTypeDetection"_ustr }; } } // namespace dbaxml @@ -197,7 +197,7 @@ class DBContentLoader : public ::cppu::WeakImplHelper< XFrameLoader, XServiceInf { private: const Reference< XComponentContext > m_aContext; - Reference< XFrameLoader > m_xMySelf; + rtl::Reference< DBContentLoader > m_xMySelf; OUString m_sCurrentURL; ImplSVEvent * m_nStartWizard; @@ -232,7 +232,7 @@ DBContentLoader::DBContentLoader(const Reference< XComponentContext >& _rxFactor // XServiceInfo OUString SAL_CALL DBContentLoader::getImplementationName() { - return "org.openoffice.comp.dbflt.DBContentLoader2"; + return u"org.openoffice.comp.dbflt.DBContentLoader2"_ustr; } // XServiceInfo @@ -244,7 +244,7 @@ sal_Bool SAL_CALL DBContentLoader::supportsService(const OUString& ServiceName) // XServiceInfo Sequence< OUString > SAL_CALL DBContentLoader::getSupportedServiceNames() { - return { "com.sun.star.frame.FrameLoader" }; + return { u"com.sun.star.frame.FrameLoader"_ustr }; } @@ -297,7 +297,7 @@ bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel > const & })); // create the dialog - Reference< XExecutableDialog > xAdminDialog( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.sdb.DatabaseWizardDialog", aWizardArgs, m_aContext), UNO_QUERY_THROW); + Reference< XExecutableDialog > xAdminDialog( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.sdb.DatabaseWizardDialog"_ustr, aWizardArgs, m_aContext), UNO_QUERY_THROW); // execute it if ( RET_OK != xAdminDialog->execute() ) @@ -305,8 +305,8 @@ bool DBContentLoader::impl_executeNewDatabaseWizard( Reference< XModel > const & Reference<XPropertySet> xProp(xAdminDialog,UNO_QUERY); bool bSuccess = false; - xProp->getPropertyValue("OpenDatabase") >>= bSuccess; - xProp->getPropertyValue("StartTableWizard") >>= _bShouldStartTableWizard; + xProp->getPropertyValue(u"OpenDatabase"_ustr) >>= bSuccess; + xProp->getPropertyValue(u"StartTableWizard"_ustr) >>= _bShouldStartTableWizard; return bSuccess; } @@ -316,7 +316,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU { // first check if preview is true, if so return without creating a controller. Preview is not supported ::comphelper::NamedValueCollection aMediaDesc( rArgs ); - bool bPreview = aMediaDesc.getOrDefault( "Preview", false ); + bool bPreview = aMediaDesc.getOrDefault( u"Preview"_ustr, false ); if ( bPreview ) { if (rListener.is()) @@ -324,8 +324,8 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU return; } - Reference< XModel > xModel = aMediaDesc.getOrDefault( "Model", Reference< XModel >() ); - OUString sSalvagedURL = aMediaDesc.getOrDefault( "SalvagedFile", _rURL ); + Reference< XModel > xModel = aMediaDesc.getOrDefault( u"Model"_ustr, Reference< XModel >() ); + OUString sSalvagedURL = aMediaDesc.getOrDefault( u"SalvagedFile"_ustr, _rURL ); bool bCreateNew = false; // does the URL denote the private:factory URL? bool bStartTableWizard = false; // start the table wizard after everything was loaded successfully? @@ -338,20 +338,20 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU // a default handler, we simply ensure there is one. // If a handler is present in the media descriptor, even if it is NULL, we will // not touch it. - if ( !aMediaDesc.has( "InteractionHandler" ) ) + if ( !aMediaDesc.has( u"InteractionHandler"_ustr ) ) { Reference< XInteractionHandler2 > xHandler( InteractionHandler::createWithParent(m_aContext, nullptr) ); - aMediaDesc.put( "InteractionHandler", xHandler ); + aMediaDesc.put( u"InteractionHandler"_ustr, xHandler ); } // it's allowed to pass an existing document Reference< XOfficeDatabaseDocument > xExistentDBDoc; - xModel.set( aMediaDesc.getOrDefault( "Model", xExistentDBDoc ), UNO_QUERY ); - aMediaDesc.remove( "Model" ); + xModel.set( aMediaDesc.getOrDefault( u"Model"_ustr, xExistentDBDoc ), UNO_QUERY ); + aMediaDesc.remove( u"Model"_ustr ); // also, it's allowed to specify the type of view which should be created - OUString sViewName = aMediaDesc.getOrDefault( "ViewName", OUString( "Default" ) ); - aMediaDesc.remove( "ViewName" ); + OUString sViewName = aMediaDesc.getOrDefault( u"ViewName"_ustr, u"Default"_ustr ); + aMediaDesc.remove( u"ViewName"_ustr ); // this needs to stay alive for duration of this method Reference< XDatabaseContext > xDatabaseContext; @@ -421,7 +421,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU bool bNeedLoad = xModel->getURL().isEmpty(); try { - aMediaDesc.put( "FileName", _rURL ); + aMediaDesc.put( u"FileName"_ustr, _rURL ); Sequence< PropertyValue > aResource( aMediaDesc.getPropertyValues() ); if ( bNeedLoad ) @@ -509,9 +509,9 @@ IMPL_LINK_NOARG( DBContentLoader, OnStartTableWizard, void*, void ) {"DatabaseLocation", Any(m_sCurrentURL)} })); SolarMutexGuard aGuard; - Reference< XJobExecutor > xTableWizard( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.wizards.table.CallTableWizard", aWizArgs, m_aContext), UNO_QUERY); + Reference< XJobExecutor > xTableWizard( m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext(u"com.sun.star.wizards.table.CallTableWizard"_ustr, aWizArgs, m_aContext), UNO_QUERY); if ( xTableWizard.is() ) - xTableWizard->trigger("start"); + xTableWizard->trigger(u"start"_ustr); } catch(const Exception&) { diff --git a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx index eefc08e4191a..c1400970181a 100644 --- a/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx +++ b/dbaccess/source/filter/xml/xmlDataSourceInfo.cxx @@ -91,20 +91,20 @@ OXMLDataSourceInfo::OXMLDataSourceInfo( ODBFilter& rImport if ( !bFoundField ) { aProperty.Name = INFO_FIELDDELIMITER; - aProperty.Value <<= OUString(";"); + aProperty.Value <<= u";"_ustr; rImport.addInfo(aProperty); } if ( !bFoundThousand ) { aProperty.Name = INFO_THOUSANDSDELIMITER; - aProperty.Value <<= OUString(","); + aProperty.Value <<= u","_ustr; rImport.addInfo(aProperty); } } if ( (nElement & TOKEN_MASK) == XML_FONT_CHARSET && !bFoundCharset ) { aProperty.Name = INFO_CHARSET; - aProperty.Value <<= OUString("utf8"); + aProperty.Value <<= u"utf8"_ustr; rImport.addInfo(aProperty); } } diff --git a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx index 9402bb399dca..57318d84e964 100644 --- a/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx +++ b/dbaccess/source/filter/xml/xmlDataSourceSetting.cxx @@ -169,20 +169,28 @@ Any OXMLDataSourceSetting::convertString(const css::uno::Type& _rExpectedType, c } break; case TypeClass_SHORT: // sal_Int16 + { // it's a real int16 property + sal_Int32 nValue(0); + bool const bSuccess = + ::sax::Converter::convertNumber(nValue, _rReadCharacters, + SAL_MIN_INT16, SAL_MAX_INT16); + SAL_WARN_IF(!bSuccess, "dbaccess", + "OXMLDataSourceSetting::convertString: could not convert \"" + << _rReadCharacters << "\" into a sal_Int16!"); + aReturn <<= static_cast<sal_Int16>(nValue); + break; + } case TypeClass_LONG: // sal_Int32 - { // it's a real int32/16 property - sal_Int32 nValue(0); - bool const bSuccess = - ::sax::Converter::convertNumber(nValue, _rReadCharacters); - SAL_WARN_IF(!bSuccess, "dbaccess", - "OXMLDataSourceSetting::convertString: could not convert \"" - << _rReadCharacters << "\" into an integer!"); - if (TypeClass_SHORT == _rExpectedType.getTypeClass()) - aReturn <<= static_cast<sal_Int16>(nValue); - else - aReturn <<= nValue; - break; - } + { // it's a real int32 property + sal_Int32 nValue(0); + bool const bSuccess = + ::sax::Converter::convertNumber(nValue, _rReadCharacters); + SAL_WARN_IF(!bSuccess, "dbaccess", + "OXMLDataSourceSetting::convertString: could not convert \"" + << _rReadCharacters << "\" into a sal_Int32!"); + aReturn <<= nValue; + break; + } case TypeClass_HYPER: { OSL_FAIL("OXMLDataSourceSetting::convertString: 64-bit integers not implemented yet!"); diff --git a/dbaccess/source/filter/xml/xmlDocuments.cxx b/dbaccess/source/filter/xml/xmlDocuments.cxx index fa763614c31e..80834d353735 100644 --- a/dbaccess/source/filter/xml/xmlDocuments.cxx +++ b/dbaccess/source/filter/xml/xmlDocuments.cxx @@ -71,7 +71,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLDocuments::createF case XML_TABLE: case XML_TABLE_REPRESENTATION: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); - pContext = new OXMLTable( GetOwnImport(), xAttrList, m_xContainer, "com.sun.star.sdb.TableDefinition"); + pContext = new OXMLTable( GetOwnImport(), xAttrList, m_xContainer, u"com.sun.star.sdb.TableDefinition"_ustr); break; case XML_QUERY: GetOwnImport().GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP ); diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index 8b96604e85d2..d0a464a4d2c1 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -63,7 +63,7 @@ com_sun_star_comp_sdb_DBExportFilter_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { return cppu::acquire(new ::dbaxml::ODBExport(context, - "com.sun.star.comp.sdb.DBExportFilter")); + u"com.sun.star.comp.sdb.DBExportFilter"_ustr)); } extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* @@ -71,7 +71,7 @@ com_sun_star_comp_sdb_XMLSettingsExporter_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { return cppu::acquire(new ::dbaxml::ODBExport(context, - "com.sun.star.comp.sdb.XMLSettingsExporter", + u"com.sun.star.comp.sdb.XMLSettingsExporter"_ustr, SvXMLExportFlags::SETTINGS | SvXMLExportFlags::PRETTY )); } @@ -80,7 +80,7 @@ com_sun_star_comp_sdb_XMLFullExporter_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { return cppu::acquire(new ::dbaxml::ODBExport(context, - "com.sun.star.comp.sdb.XMLFullExporter", + u"com.sun.star.comp.sdb.XMLFullExporter"_ustr, SvXMLExportFlags::ALL)); } @@ -95,24 +95,24 @@ namespace dbaxml switch (_rType.getTypeClass()) { case TypeClass_STRING: - return "string"; + return u"string"_ustr; case TypeClass_DOUBLE: - return "double"; + return u"double"_ustr; case TypeClass_BOOLEAN: - return "boolean"; + return u"boolean"_ustr; case TypeClass_BYTE: case TypeClass_SHORT: - return "short"; + return u"short"_ustr; case TypeClass_LONG: - return "int"; + return u"int"_ustr; case TypeClass_HYPER: - return "long"; + return u"long"_ustr; case TypeClass_ENUM: - return "int"; + return u"int"_ustr; default: OSL_FAIL( "lcl_implGetPropertyXMLType: unsupported value type!" ); - return "double"; + return u"double"_ustr; } } @@ -415,7 +415,7 @@ void ODBExport::exportDataSource() if ( bAutoIncrementEnabled && !(aAutoIncrement.first.isEmpty() && aAutoIncrement.second.isEmpty()) ) m_oAutoIncrement = aAutoIncrement; if ( aDelimiter.bUsed ) - m_aDelimiter.reset( new TDelimiter( aDelimiter ) ); + m_aDelimiter.reset(new TDelimiter(std::move(aDelimiter))); SvXMLElementExport aElem(*this, XML_NAMESPACE_DB, XML_DATA_SOURCE, true, true); @@ -770,7 +770,7 @@ void ODBExport::exportComponent(XPropertySet* _xProp) OUString sValue; _xProp->getPropertyValue(PROPERTY_PERSISTENT_NAME) >>= sValue; bool bIsForm = true; - _xProp->getPropertyValue("IsForm") >>= bIsForm; + _xProp->getPropertyValue(u"IsForm"_ustr) >>= bIsForm; if ( bIsForm ) sValue = "forms/" + sValue; else diff --git a/dbaccess/source/filter/xml/xmlQuery.cxx b/dbaccess/source/filter/xml/xmlQuery.cxx index a707e8734533..b1cdd90bf1b7 100644 --- a/dbaccess/source/filter/xml/xmlQuery.cxx +++ b/dbaccess/source/filter/xml/xmlQuery.cxx @@ -37,7 +37,7 @@ OXMLQuery::OXMLQuery( ODBFilter& rImport ,const Reference< XFastAttributeList > & _xAttrList ,const css::uno::Reference< css::container::XNameAccess >& _xParentContainer ) : - OXMLTable( rImport, _xAttrList,_xParentContainer, "com.sun.star.sdb.CommandDefinition" ) + OXMLTable( rImport, _xAttrList,_xParentContainer, u"com.sun.star.sdb.CommandDefinition"_ustr ) ,m_bEscapeProcessing(true) { for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList )) diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index a41e7b43022b..18a1d223df86 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -125,12 +125,11 @@ static ErrCode ReadThroughComponent( static ErrCode ReadThroughComponent( const uno::Reference< embed::XStorage >& xStorage, const uno::Reference<XComponent>& xModelComponent, - const char* pStreamName, + const OUString& sStreamName, const uno::Reference<XComponentContext> & rxContext, ODBFilter& _rFilter) { OSL_ENSURE( xStorage.is(), "Need storage!"); - OSL_ENSURE(nullptr != pStreamName, "Please, please, give me a name!"); if ( !xStorage ) // TODO/LATER: better error handling @@ -141,7 +140,6 @@ static ErrCode ReadThroughComponent( try { // open stream (and set parser input) - OUString sStreamName = OUString::createFromAscii(pStreamName); if ( !xStorage->hasByName( sStreamName ) || !xStorage->isStreamElement( sStreamName ) ) { // stream name not found! return immediately with OK signal @@ -176,11 +174,11 @@ ODBFilter::ODBFilter( const uno::Reference< XComponentContext >& _rxContext ) GetMM100UnitConverter().SetCoreMeasureUnit(util::MeasureUnit::MM_10TH); GetMM100UnitConverter().SetXMLMeasureUnit(util::MeasureUnit::CM); - GetNamespaceMap().Add( "_db", + GetNamespaceMap().Add( u"_db"_ustr, GetXMLToken(XML_N_DB), XML_NAMESPACE_DB ); - GetNamespaceMap().Add( "__db", + GetNamespaceMap().Add( u"__db"_ustr, GetXMLToken(XML_N_DB_OASIS), XML_NAMESPACE_DB ); } @@ -194,7 +192,7 @@ ODBFilter::~ODBFilter() noexcept OUString ODBFilter::getImplementationName_Static() { - return "com.sun.star.comp.sdb.DBFilter"; + return u"com.sun.star.comp.sdb.DBFilter"_ustr; } @@ -244,10 +242,10 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) bool bRet = true; if (!xStorage.is()) { - if (aMediaDescriptor.has("URL")) - sFileName = aMediaDescriptor.getOrDefault("URL", OUString()); - if (sFileName.isEmpty() && aMediaDescriptor.has("FileName")) - sFileName = aMediaDescriptor.getOrDefault("FileName", sFileName); + if (aMediaDescriptor.has(u"URL"_ustr)) + sFileName = aMediaDescriptor.getOrDefault(u"URL"_ustr, OUString()); + if (sFileName.isEmpty() && aMediaDescriptor.has(u"FileName"_ustr)) + sFileName = aMediaDescriptor.getOrDefault(u"FileName"_ustr, sFileName); OSL_ENSURE(!sFileName.isEmpty(), "ODBFilter::implImport: no URL given!"); bRet = !sFileName.isEmpty(); @@ -323,7 +321,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) uno::Reference<XComponent> xModel(GetModel()); ErrCode nRet = ReadThroughComponent( xStorage ,xModel - ,"settings.xml" + ,u"settings.xml"_ustr ,GetComponentContext() ,*this ); @@ -331,7 +329,7 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) if ( nRet == ERRCODE_NONE ) nRet = ReadThroughComponent( xStorage ,xModel - ,"content.xml" + ,u"content.xml"_ustr ,GetComponentContext() ,*this ); |